This commit is contained in:
Caiyanpeng committed 2021-04-15 15:58:37 +08:00
1 parent 038720e7bd
commit c97bd50f3f
32 files changed
+9899 -3719

No files matched your search

+2
View File
@@ -102,5 +102,7 @@ namespace Assets.Scripts.Apis.Models
public bool Enable3D { get; set; }
public int TheHeat { get; set; }
public string Hard { get; set; }
public string CountryCode { get; set; }
public bool IsFire { get; set; }
}
}
+11 -2
View File
@@ -134,13 +134,22 @@ namespace Assets.Scripts.Apis
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionId(string unionId, string openId)
{
return await PostAsync<JsonResult<object>>("NoAuth/OnWebWxLoginCheckUnionId", new {unionId,openId});
var r = await PostAsync<JsonResult<object>>("NoAuth/OnWebWxLoginCheckUnionId", new { unionId, openId });
if (r.result)
{
var data = JObject.FromObject(r.data).ToObject<UserResultModel>();
data.cookie = cookies[0].Value;
r.data = data;
}
return r;
}
public async Task<JsonResult<UserResultModel>> OnWebWxLogin(string Phone, string Captcha
, string UnionId, string WxWebOpenId, string WxHeadImg, string NickName, int? Sex, string Password)
{
return await PostAsync<JsonResult<UserResultModel>>("NoAuth/OnWebWxLogin",
var r = await PostAsync<JsonResult<UserResultModel>>("NoAuth/OnWebWxLogin",
new { Phone, Captcha, UnionId, WxWebOpenId, WxHeadImg, NickName, Sex, Password });
r.data.cookie = cookies[0].Value;
return r;
}
+2 -2
View File
@@ -1,11 +1,12 @@
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Prefab.Login;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class App
{
public static string Host = "http://192.168.0.97:5082/";
public static string Host = "http://192.168.0.101:5082/";
public static string AppVersion = "1.0.0";
@@ -15,7 +16,6 @@ public static class App
public static string WxAppSecret = "906abafb2a18bc7a66ccfa5550f859b6";
public static string MapBoxAccessToken => "pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA";
/// <summary>
/// 场景跳转传值
/// Name,MapListPanel
+30 -8
View File
@@ -94,9 +94,12 @@ public class LoginController : MonoBehaviour
/*退出按钮*/
//其他
[SerializeField] RawImage loading;
Transform toolContainer;
// Start is called before the first frame update
void Start()
{
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
var userInfosJson = PlayerPrefs.GetString("UserInfos");
userInfos = JsonConvert.DeserializeObject<List<QUserInfo>>(userInfosJson);
if (userInfos == null) userInfos = new List<QUserInfo>();
@@ -148,13 +151,13 @@ public class LoginController : MonoBehaviour
signPage2.Find("previous").GetComponent<Button>().onClick.AddListener(goRegPrev);
signPage2.Find("sign").GetComponent<Button>().onClick.AddListener(goRegEnd);
//注册2 字段
regOptions = new LoginRegOptions();
var years = signPage2.Find("Year").GetComponent<Dropdown>();
var months = signPage2.Find("Month").GetComponent<Dropdown>();
var days = signPage2.Find("Day").GetComponent<Dropdown>();
var genders = signPage2.Find("Gender").GetComponent<Dropdown>();
var countrys = signPage2.Find("Country").GetComponent<Dropdown>();
var units = signPage2.Find("Unit").GetComponent<Dropdown>();
regOptions = new LoginRegOptions();
years.options = regOptions.years;
months.options = regOptions.months;
days.options = regOptions.days;
@@ -358,6 +361,14 @@ public class LoginController : MonoBehaviour
});
}
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
toolContainer = transform.Find("Panel").Find("ToolContainer");
if (toolContainer != null)
{
toolContainer.Find("Setting").GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowSettingModal();
});
}
}
private void AdjustWxQrCode()
{
@@ -674,15 +685,26 @@ public class LoginController : MonoBehaviour
var data = userResult;
if (data == null) return;
//ConfigHelper.CurrentUser = res.data;
if (gou != null && gou.gameObject.activeSelf && !userInfos.Exists(x => x.Id == data.Id))
if (gou != null && gou.gameObject.activeSelf)
{
userInfos.Add(new QUserInfo
var u = userInfos.Find(x => x.Id == data.Id);
if (u == null)
{
Id = data.Id,
NickName = data.Nickname,
Avatar = data.WxHeadImg,
Cookie = data.cookie
});
userInfos.Add(new QUserInfo
{
Id = data.Id,
NickName = data.Nickname,
Avatar = data.WxHeadImg,
Cookie = data.cookie
});
}
else
{
u.Id = data.Id;
u.NickName = data.Nickname;
u.Avatar = data.WxHeadImg;
u.Cookie = data.cookie;
}
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
}
App.CurrentUser = data;
@@ -68,6 +68,10 @@ namespace Assets.Scripts.UI.Prefab.Login
if (c == null) return null;
return Resources.Load<Texture>(c.source);
}
public Texture GetCountryImage(string code)
{
return GetCountryImage(GetCountryIndexByCode(code));
}
public int GetCountryIndexByCode(string code)
{
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
@@ -31,6 +31,7 @@ public class MapItem : MonoBehaviour
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
transform.Find("CollectImg").gameObject.SetActive(myMap.IsFavorite);
transform.Find("Hot").gameObject.SetActive(myMap.IsFire);
var props = transform.Find("Props");
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString("#0.00")}KM";
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString("#0.00")}M";
@@ -40,5 +41,6 @@ public class MapItem : MonoBehaviour
var diff = tabContainer.Find("Diff");
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
}
}
@@ -13,6 +13,7 @@ using UnityEngine.UI;
public class EditUserController : PFUIPanel
{
private Button mSaveButton;
private Button mReturnButton;
private PFUIDropdown mSexDropdown;
private PFUIDropdown mDayDropdown;
private PFUIDropdown mMonthDropdown;
@@ -33,6 +34,7 @@ public class EditUserController : PFUIPanel
mMonthDropdown = panel.Find("MonthDropdown").GetComponent<PFUIDropdown>();
mDayDropdown = panel.Find("DayDropdown").GetComponent<PFUIDropdown>();
mSaveButton = this.transform.Find("SaveButton").GetComponent<Button>();
mReturnButton = transform.Find("CancelButton").GetComponent<Button>();
mHeadImage = this.transform.Find("HeadImage").GetComponent<RawImage>();
mSexDropdown.ClearOptions();
@@ -80,12 +82,17 @@ public class EditUserController : PFUIPanel
// new Dropdown.OptionData()
//});
LoadDataSync();
LoadDataSyncAsync();
}
async void LoadDataSync()
async System.Threading.Tasks.Task Login()
{
var result = await new UserApi().Login("13115011550", "laozhong", "");
App.CurrentUser = result.data;
}
async System.Threading.Tasks.Task LoadDataSyncAsync()
{
await Login();
Material material = null;
if (material == null)
{
@@ -95,33 +102,38 @@ public class EditUserController : PFUIPanel
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
mHeadImage.material = material;
//var currentUser = App.CurrentUser;
//mIdText.text = "ID:" + currentUser.Id.ToString();
//mNameText.text = currentUser.Nickname;
//if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
//{
// Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
//}
//if (currentUser.Sex == 1)
//{
// mSexDropdown.SelectValue("男");
//}
//else
//{
// mSexDropdown.SelectValue("女");
//}
//if (currentUser.Birthday.HasValue)
//{
// var birthday = currentUser.Birthday.Value;
// mYearDropdown.SelectValue(birthday.Year.ToString());
// mMonthDropdown.SelectValue(birthday.Month.ToString());
// mDayDropdown.SelectValue(birthday.Day.ToString());
//}
var currentUser = App.CurrentUser;
mIdText.text = "ID:" + currentUser.Id.ToString();
mNameText.text = currentUser.Nickname;
if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
{
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
}
if (currentUser.Sex == 1)
{
mSexDropdown.SelectValue("男");
}
else
{
mSexDropdown.SelectValue("女");
}
if (currentUser.Birthday.HasValue)
{
var birthday = currentUser.Birthday.Value;
mYearDropdown.SelectValue(birthday.Year.ToString());
mMonthDropdown.SelectValue(birthday.Month.ToString());
mDayDropdown.SelectValue(birthday.Day.ToString());
}
UIManager.AddEvent(mReturnButton.gameObject, EventTriggerType.PointerClick, Return);
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
}
private void Return(BaseEventData arg0)
{
UIManager.ShowUserInfoPanel();
}
// Start is called before the first frame update
protected override void Start()
{
@@ -59,7 +59,10 @@ public class HomeController : PFUIPanel
{
UIManager.ShowAlert("test");
});
UIManager.AddEvent(transform.Find("MainNav").Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowSettingModal();
});
GetSummary();
}
@@ -39,7 +39,7 @@ public class MapListController : PFUIPanel
}
}
private bool isEnd = false;
protected override void Start()
protected override void Start()
{
//if (hardSelector != null)
//{
@@ -19,9 +19,10 @@ public class ResultListController : MonoBehaviour
// Start is called before the first frame update
int pageIndex = 0, pageSize = 20;
string name = "";
Transform[] contents;
void Start()
{
ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
InitialColor();
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
@@ -32,6 +33,7 @@ public class ResultListController : MonoBehaviour
routeContent = routeScroll.Find("Viewport").Find("Content");
matchScroll = scrollContent.Find("MatchList");
matchContent = matchScroll.Find("Viewport").Find("Content");
contents = new Transform[] { routeContent, matchContent};
if (btnMatch != null)
{
btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
@@ -45,7 +47,7 @@ public class ResultListController : MonoBehaviour
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
{
name = searchInput.GetComponent<InputField>().text;
Refresh();
Refresh(contents[scrollIndex]);
});
}
if (routeScroll != null)
@@ -71,13 +73,13 @@ public class ResultListController : MonoBehaviour
}
if (scrollrect.verticalNormalizedPosition >= 1)
{
Refresh();
Refresh(contents[scrollIndex]);
}
}
private void Refresh()
private void Refresh(Transform content)
{
routeContent.transform.DestroyChildren();
content.transform.DestroyChildren();
pageIndex = 0;
GetList();
}
@@ -94,8 +96,8 @@ public class ResultListController : MonoBehaviour
else
{
isEnd = false;
DisplayRouteResult(r.data,routeContent);
DisplayRouteResult(r.data, matchContent);
DisplayRouteResult(r.data,contents[scrollIndex]);
//DisplayRouteResult(r.data, matchContent);
}
}
else
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SettingContoller : PFUIPanel
{
// Start is called before the first frame update
Transform exit;
protected override void Awake()
{
exit = transform.Find("Main").Find("Exit");
if (exit != null)
{
exit.GetComponent<Button>().onClick.AddListener(()=>
{
Close();
});
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1304d873aa16cd641a83b889e9a1f3af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18 -3
View File
@@ -4,10 +4,12 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using DG.Tweening;
using Assets.Scripts.UI.Prefab.Login;
public class UIManager : MonoBehaviour
{
private PFUIPanel mMainPanel;
public PFUIPanel MainPanel
{
get
@@ -48,7 +50,14 @@ public class UIManager : MonoBehaviour
return this.GetPanelInstance("DevicePanel", ref this.mDeviceController);
}
}
private SettingContoller mSettingContoller;
public SettingContoller SettingModal
{
get
{
return this.GetPanelInstance("SettingModal", ref this.mSettingContoller);
}
}
private MapListController mMapListController;
public MapListController MapListPanel
{
@@ -95,12 +104,13 @@ public class UIManager : MonoBehaviour
private void Awake()
{
UIManager.Instance = this;
loginRegOptions = new LoginRegOptions();
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
@@ -226,7 +236,10 @@ public class UIManager : MonoBehaviour
{
UIManager.Show(UIManager.Instance.DevicePanel, null, true);
}
public static void ShowSettingModal()
{
UIManager.Show(UIManager.Instance.SettingModal, null, true);
}
public static void ShowEditUserPanel()
{
UIManager.Show(UIManager.Instance.EditUserPanel, UIManager.Instance.MainPanel);
@@ -312,6 +325,8 @@ public class UIManager : MonoBehaviour
}
}
public LoginRegOptions loginRegOptions { get; private set; }
private void OnDestroy()
{