Merge branch 'dev_cyp' into dev
# Conflicts: # Assets/Resources/Loading.meta # Assets/Scripts/Apis/MapApi.cs # Assets/Scripts/UI/Prefab/Panel/MapListController.cs
This commit is contained in:
commit
19766db051
65 files changed
+12634
-12942
No files matched your search
@@ -103,7 +103,23 @@ namespace Assets.Scripts.Apis
|
||||
|
||||
return Encoding.UTF8.GetString(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加收藏
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<JsonResult<object>> AddFav(string routeId)
|
||||
{
|
||||
return await PostAsync<JsonResult<object>>("/MemberFavoriteMap/Add",new { routeId });
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消收藏
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<JsonResult<object>> CancelFav(string routeId)
|
||||
{
|
||||
return await PostAsync<JsonResult<object>>("/MemberFavoriteMap/Cancel", new { routeId });
|
||||
}
|
||||
|
||||
public JsonResult<MapRouteRankingList> GetRouteRanking(int id,string type, int pageIndex,int pageSize,string name)
|
||||
{
|
||||
var url = $"Map/v1/GetRouteRanking?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&id={ id }&type={ type }&filterSelf={ true }";
|
||||
|
||||
@@ -104,5 +104,6 @@ namespace Assets.Scripts.Apis.Models
|
||||
public string Hard { get; set; }
|
||||
public string CountryCode { get; set; }
|
||||
public bool IsFire { get; set; }
|
||||
public string AltitudeGraph { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
//cookie
|
||||
public string cookie { get; set; }
|
||||
|
||||
|
||||
|
||||
public string Unionid { get; set; }
|
||||
public int Height { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,9 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
public async Task<JsonResult<UserResultModel>> QuickLogin()
|
||||
{
|
||||
return await PostAsync<JsonResult<UserResultModel>>("NoAuth/QuickLogin",null);
|
||||
var r = await PostAsync<JsonResult<UserResultModel>>("NoAuth/QuickLogin", null);
|
||||
r.data.cookie = cookies[0].Value;
|
||||
return r;
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionId(string unionId, string openId)
|
||||
@@ -153,7 +155,7 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
|
||||
|
||||
public async Task<JsonResult<dynamic>> Update(UserResultModel currUser, string filePath = "")
|
||||
public async Task<JsonResult<JObject>> Update(UserResultModel currUser, string filePath = "")
|
||||
{
|
||||
//return await PostAsync<JsonResult<dynamic>>("User/UpdateUserSetting", new {
|
||||
// UID = currUser.Id,
|
||||
@@ -186,6 +188,7 @@ namespace Assets.Scripts.Apis
|
||||
UID = currUser.Id,
|
||||
Sex = currUser.Sex,
|
||||
currUser.Unit,
|
||||
currUser.Height,
|
||||
currUser.Weight,
|
||||
currUser.FTP,
|
||||
currUser.WheelDiameter,
|
||||
@@ -205,7 +208,11 @@ namespace Assets.Scripts.Apis
|
||||
//imgData = imgData
|
||||
}, files);
|
||||
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<dynamic>>(res);
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<JObject>>(res);
|
||||
}
|
||||
public async Task<JsonResult<JObject>> GetNotify()
|
||||
{
|
||||
return await GetAsync<JsonResult<JObject>>("/Home/GetNotify");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,9 @@ public static class App
|
||||
public static string WxAppSecret = "906abafb2a18bc7a66ccfa5550f859b6";
|
||||
|
||||
public static string MapBoxAccessToken => "pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA";
|
||||
|
||||
public static bool FromLogin = false;
|
||||
|
||||
/// <summary>
|
||||
/// 场景跳转传值
|
||||
/// Name,MapListPanel
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using DG.Tweening;
|
||||
using Newtonsoft.Json;
|
||||
@@ -11,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@@ -75,7 +77,7 @@ public class LoginController : MonoBehaviour
|
||||
private ScrollRect scrollPanel;
|
||||
private ScrollRect scrollSign;
|
||||
private ScrollRect scrollAvatar;
|
||||
private Transform imagexf;
|
||||
private Transform imagexf,imagedf;
|
||||
//注册主页面
|
||||
private UserResultModel userResult;
|
||||
/*微信相关*/
|
||||
@@ -99,14 +101,13 @@ public class LoginController : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
App.FromLogin = true;
|
||||
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>();
|
||||
userInfos = UIManager.Instance.userInfos;
|
||||
//userInfos.RemoveAt(0);
|
||||
//PlayerPrefs.SetString("UserInfos", "");
|
||||
//transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||||
|
||||
|
||||
//if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||||
//{
|
||||
// foreach (var ipt in loginForm)
|
||||
@@ -120,17 +121,17 @@ public class LoginController : MonoBehaviour
|
||||
// }
|
||||
// //loginForm[0].
|
||||
//}
|
||||
|
||||
|
||||
if (loading != null)
|
||||
{
|
||||
loading.texture.wrapMode = TextureWrapMode.Repeat;
|
||||
//loading.texture.wrapMode = TextureWrapMode.Mirror;
|
||||
}
|
||||
if (loginScrollView != null)
|
||||
{
|
||||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||||
mainContent = loginScrollView.transform.Find("Viewport").Find("Content");
|
||||
quickContainer = mainContent.Find("FormContainer-Quick");
|
||||
loginContainer = mainContent.Find("FormContainer-Login").Find("FormContainer");
|
||||
quickContainer = mainContent.Find("Empty").Find("FormContainer-Quick");
|
||||
loginContainer = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer");
|
||||
signContainer = mainContent.Find("FormContainer-Sign");
|
||||
}
|
||||
if (signScrollView != null)
|
||||
@@ -214,7 +215,7 @@ public class LoginController : MonoBehaviour
|
||||
foreach (var user in userInfos)
|
||||
{
|
||||
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/QuickUserInfo")).transform;
|
||||
info.GetComponent<QuickLoginUser>().Initial(user);
|
||||
info.GetComponent<QuickLoginUser>().Initial(user,transform);
|
||||
info.parent = content;
|
||||
info.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
@@ -255,9 +256,10 @@ public class LoginController : MonoBehaviour
|
||||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
|
||||
wxBrowser.Url = $"https://open.weixin.qq.com/connect/qrconnect?appid={App.WxAppId}&redirect_uri=https%3A%2F%2Fwx.powerfun.com.cn%2FNoAuth%2Fv1%2FWxWebLogin&response_type=code&scope=snsapi_login&state={wxState}#wechat_redirect";
|
||||
//AdjustWxQrCode();
|
||||
var wx1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
var wx1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||||
wx1.gameObject.SetActive(true);
|
||||
Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
|
||||
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||||
});
|
||||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||||
@@ -282,14 +284,14 @@ public class LoginController : MonoBehaviour
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||||
if (wxLogin1 != null)
|
||||
{
|
||||
wxLogin1.Find("Image").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
wxLock = true;
|
||||
wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOMoveY(-573, 0.8f).onComplete = () =>
|
||||
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
@@ -361,6 +363,7 @@ public class LoginController : MonoBehaviour
|
||||
});
|
||||
}
|
||||
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
|
||||
imagedf = transform.Find("Panel").Find("LoginContainer").Find("Imagedf");
|
||||
toolContainer = transform.Find("Panel").Find("ToolContainer");
|
||||
if (toolContainer != null)
|
||||
{
|
||||
@@ -368,6 +371,10 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
toolContainer.Find("Msg").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowNewsModal();
|
||||
});
|
||||
}
|
||||
}
|
||||
private void AdjustWxQrCode()
|
||||
@@ -581,7 +588,15 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
if (r!=null && r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
if (signType == 1)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
userResult = r.data;
|
||||
}
|
||||
LoadInfo();
|
||||
StartScrollSign(1);
|
||||
}
|
||||
else
|
||||
@@ -619,15 +634,68 @@ public class LoginController : MonoBehaviour
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = data.Nickname;
|
||||
userResult = data;
|
||||
}
|
||||
private void goRegEnd()
|
||||
async void goRegEnd()
|
||||
{
|
||||
if(!await UpdateInfo()) return;
|
||||
if (pageNums == 5)
|
||||
{
|
||||
this.StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.CurrentUser = userResult;
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
void LoadInfo()
|
||||
{
|
||||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||||
var _months = signForm.months.GetComponent<PFUIDropdown>();
|
||||
var _years = signForm.years.GetComponent<PFUIDropdown>();
|
||||
|
||||
var _genders = signForm.genders.GetComponent<PFUIDropdown>();
|
||||
var _countrys = signForm.countrys.GetComponent<PFUIDropdown>();
|
||||
var _units = signForm.units.GetComponent<PFUIDropdown>();
|
||||
var _weight = signForm.weight.GetComponent<PFUIInputField>();
|
||||
var _height = signForm.height.GetComponent<PFUIInputField>();
|
||||
if (userResult.Birthday.HasValue)
|
||||
{
|
||||
_days.SelectValue(userResult.Birthday.Value.Day.ToString());
|
||||
_months.SelectValue(userResult.Birthday.Value.Month.ToString());
|
||||
_years.SelectValue(userResult.Birthday.Value.Year.ToString());
|
||||
}
|
||||
_genders.SelectIndex(userResult.Sex-1);
|
||||
_countrys.SelectIndex(UIManager.Instance.loginRegOptions.GetCountryIndexByName(userResult.Country));
|
||||
_units.SelectIndex(userResult.Unit);
|
||||
_weight.Text = userResult.Weight.ToString();
|
||||
_height.Text = userResult.Height.ToString();
|
||||
}
|
||||
async Task<bool> UpdateInfo()
|
||||
{
|
||||
if (userResult == null) return false;
|
||||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||||
var _months = signForm.months.GetComponent<PFUIDropdown>();
|
||||
var _years = signForm.years.GetComponent<PFUIDropdown>();
|
||||
var _genders = signForm.genders.GetComponent<PFUIDropdown>();
|
||||
var _countrys = signForm.countrys.GetComponent<PFUIDropdown>();
|
||||
var _units = signForm.units.GetComponent<PFUIDropdown>();
|
||||
var _weight = signForm.weight.GetComponent<PFUIInputField>();
|
||||
var _height = signForm.height.GetComponent<PFUIInputField>();
|
||||
if (signForm.years.value != -1 && signForm.months.value != -1 && signForm.days.value != -1)
|
||||
{
|
||||
userResult.Birthday = new DateTime(int.Parse(_years.SelectedItem), int.Parse(_months.SelectedItem), int.Parse(_days.SelectedItem));
|
||||
}
|
||||
userResult.Sex = _genders.SelectedIndex + 1;
|
||||
userResult.Country = UIManager.Instance.loginRegOptions.GetCountryName(_countrys.SelectedIndex);
|
||||
userResult.Unit = _units.SelectedIndex;
|
||||
userResult.Weight = int.Parse(_weight.Text);
|
||||
userResult.Height = int.Parse(_height.Text);
|
||||
userResult.Nickname = userResult.Phone;
|
||||
var r = await ConfigHelper.userApi.Update(userResult);
|
||||
return r.result;
|
||||
//userResult.Birthday.v
|
||||
}
|
||||
private void goLoginReturn2()
|
||||
{
|
||||
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
|
||||
@@ -641,7 +709,11 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMove(new Vector3(0, -447, 0), 0.3f);
|
||||
imagexf.DOLocalMoveY(-575, 0.3f);
|
||||
}
|
||||
if (imagedf != null)
|
||||
{
|
||||
imagedf.DOLocalMoveY(-128, 0.3f);
|
||||
}
|
||||
this.StartScrollPanel(0);
|
||||
}
|
||||
@@ -649,7 +721,11 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMove(new Vector3(0, -635, 0), 0.3f);
|
||||
imagexf.DOLocalMoveY(-669, 0.3f);
|
||||
}
|
||||
if (imagedf != null)
|
||||
{
|
||||
imagedf.DOLocalMoveY(-34, 0.3f);
|
||||
}
|
||||
this.StartScrollPanel(1);
|
||||
}
|
||||
@@ -678,7 +754,6 @@ public class LoginController : MonoBehaviour
|
||||
this.StartScrollPanel(2);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
|
||||
}
|
||||
void goMain(Transform gou)
|
||||
{
|
||||
@@ -686,26 +761,18 @@ public class LoginController : MonoBehaviour
|
||||
if (data == null) return;
|
||||
//ConfigHelper.CurrentUser = res.data;
|
||||
if (gou != null && gou.gameObject.activeSelf)
|
||||
{
|
||||
SaveInfo(data);
|
||||
//PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||||
}
|
||||
else
|
||||
{
|
||||
var u = userInfos.Find(x => x.Id == data.Id);
|
||||
if (u == null)
|
||||
if (u != null)
|
||||
{
|
||||
userInfos.Add(new QUserInfo
|
||||
{
|
||||
Id = data.Id,
|
||||
NickName = data.Nickname,
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
});
|
||||
userInfos.Remove(u);
|
||||
}
|
||||
else
|
||||
{
|
||||
u.Id = data.Id;
|
||||
u.NickName = data.Nickname;
|
||||
u.Avatar = data.WxHeadImg;
|
||||
u.Cookie = data.cookie;
|
||||
}
|
||||
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
}
|
||||
App.CurrentUser = data;
|
||||
//App.CurrentUser = new UserModel
|
||||
@@ -721,6 +788,32 @@ public class LoginController : MonoBehaviour
|
||||
//};
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
public void SaveInfo(UserResultModel data)
|
||||
{
|
||||
var u = userInfos.Find(x => x.Id == data.Id);
|
||||
if (u == null)
|
||||
{
|
||||
userInfos.Add(new QUserInfo
|
||||
{
|
||||
Id = data.Id,
|
||||
NickName = data.Nickname,
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfos.Insert(0, new QUserInfo
|
||||
{
|
||||
Id = data.Id,
|
||||
NickName = data.Nickname,
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
});
|
||||
userInfos.Remove(u);
|
||||
}
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
}
|
||||
async void Submit()
|
||||
{
|
||||
if (loginForm.email == null || loginForm.password == null)
|
||||
@@ -744,7 +837,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Utils.showToast(gameObject, res.errMsg);
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
@@ -855,8 +948,14 @@ public class LoginController : MonoBehaviour
|
||||
var country = wxInfoJson.Value<string>("country");
|
||||
signForm.countrys.value = regOptions.GetCountryIndexByCode(country);
|
||||
}
|
||||
signForm.weight.text = "";
|
||||
signForm.height.text = "";
|
||||
//if (string.IsNullOrEmpty(signForm.weight.text))
|
||||
//{
|
||||
// signForm.weight.text = "";
|
||||
//}
|
||||
//if (!string.IsNullOrEmpty(signForm.height.text))
|
||||
//{
|
||||
// signForm.height.text = "";
|
||||
//}
|
||||
}
|
||||
signScrollBar.DOLocalMoveX((index-1) *160, 0.2f);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,13 @@ namespace Assets.Scripts.UI.Control
|
||||
//var image = this.transform.GetComponent<Image>();
|
||||
// var png = Resources.Load<Sprite>("Images/ipt-1");
|
||||
//image.sprite = png;
|
||||
var _text = mInnerInputField.transform.Find("Text").GetComponent<Text>();
|
||||
if (_text.color!=Color.white)
|
||||
{
|
||||
Text = "";
|
||||
}
|
||||
_text.color = Color.white;
|
||||
|
||||
outline.enabled = true;
|
||||
ColorUtility.TryParseHtmlString("#F93086", out Color color);
|
||||
|
||||
@@ -112,13 +119,23 @@ namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.mInnerInputField.GetComponent<Text>().color = Color.white;
|
||||
outline.enabled = true;
|
||||
outline.effectColor = Utils.HexToColorHtml("#F93086");
|
||||
ColorUtility.TryParseHtmlString("#F93086", out Color color);
|
||||
this.mInnerInputField.transform.Find("Text").GetComponent<Text>().color = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#F93086", out Color color);
|
||||
this.mInnerInputField.GetComponent<Text>().color = color;
|
||||
this.mInnerInputField.transform.Find("Text").GetComponent<Text>().color = Color.white;
|
||||
outline.enabled = false;
|
||||
}
|
||||
}
|
||||
public void SetValidate(string msg)
|
||||
{
|
||||
this.mInnerInputField.transform.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#F93086");
|
||||
Text = msg;
|
||||
outline.enabled = true;
|
||||
outline.effectColor = Utils.HexToColorHtml("#F93086");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,23 +65,44 @@ namespace Assets.Scripts.UI.Prefab.Login
|
||||
public Texture GetCountryImage(int index)
|
||||
{
|
||||
var c = countryList[index];
|
||||
if (c == null) return null;
|
||||
if (c == null) return Resources.Load<Texture>(countryList[countryDefaultValue].source);
|
||||
return Resources.Load<Texture>(c.source);
|
||||
}
|
||||
public Texture GetCountryImage(string code)
|
||||
{
|
||||
return GetCountryImage(GetCountryIndexByCode(code));
|
||||
}
|
||||
public Texture GetCountryImageByName(string name)
|
||||
{
|
||||
var c = countryList.Find(x=>x.country == name);
|
||||
if (c == null) return Resources.Load<Texture>(countryList[countryDefaultValue].source);
|
||||
return Resources.Load<Texture>(c.source);
|
||||
}
|
||||
public int GetCountryIndexByCode(string code)
|
||||
{
|
||||
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
|
||||
if (c == -1) return countryDefaultValue;
|
||||
return c;
|
||||
}
|
||||
public int GetCountryIndexByName(string country)
|
||||
{
|
||||
var c = countryList.FindIndex(x => x.country == country);
|
||||
if (c == -1) return countryDefaultValue;
|
||||
return c;
|
||||
}
|
||||
public List<Dropdown.OptionData> GetDayOptions(int year,int month)
|
||||
{
|
||||
int day = DateTime.DaysInMonth(year, month);
|
||||
return DayOptions.dayOption[day];
|
||||
}
|
||||
|
||||
public string GetCountryName(int index)
|
||||
{
|
||||
var c = countryList[index];
|
||||
if (c == null) return countryList[countryDefaultValue].country;
|
||||
return c.country;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,23 @@ using UnityEngine.UI;
|
||||
public class QuickLoginUser : MonoBehaviour
|
||||
{
|
||||
QUserInfo user;
|
||||
Transform top;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
public void Initial(QUserInfo user)
|
||||
public void Initial(QUserInfo user,Transform top)
|
||||
{
|
||||
if (user == null) return;
|
||||
this.top = top;
|
||||
transform.GetComponent<Button>().onClick.AddListener(async () =>
|
||||
{
|
||||
ApiBase.SetCookie(user.Cookie);
|
||||
var r = await ConfigHelper.userApi.QuickLogin();
|
||||
if (r.result)
|
||||
{
|
||||
//
|
||||
top.GetComponent<LoginController>().SaveInfo(r.data);
|
||||
App.CurrentUser = r.data;
|
||||
//ConfigHelper.CurrentUser = r.data.Value<UserResultModel>("user");
|
||||
//ConfigHelper.CurrentUser = re;
|
||||
@@ -83,10 +87,9 @@ public class QuickLoginUser : MonoBehaviour
|
||||
|
||||
private void DeleteList(int index)
|
||||
{
|
||||
var userInfosJson = PlayerPrefs.GetString("UserInfos");
|
||||
var userInfos = JsonConvert.DeserializeObject<List<QUserInfo>>(userInfosJson);
|
||||
var userInfos = UIManager.Instance.userInfos;
|
||||
userInfos.RemoveAt(index);
|
||||
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
}
|
||||
|
||||
public void setActive()
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MapItem : MonoBehaviour
|
||||
public class PropNames
|
||||
{
|
||||
public static List<string> icons = new List<string> { "icon1", "icon2", "icon3" };
|
||||
public static List<string> texts = new List<string> { "DistanceText", "EleText", "SlopeText" };
|
||||
public static Dictionary<bool, string> colorDict = new Dictionary<bool, string>
|
||||
{
|
||||
{ true,"#ffffff"},{false,"#5c5c6e" }
|
||||
};
|
||||
}
|
||||
public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
//[SerializeField] Text text;
|
||||
@@ -19,20 +31,44 @@ public class MapItem : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
float? localY = null;
|
||||
MapRoute map;
|
||||
public void Initial(MapRoute myMap)
|
||||
{
|
||||
gameObject.GetComponent<Button>().onClick.AddListener(()=>
|
||||
map = myMap;
|
||||
//localY = transform.GetComponent<RectTransform>().rect.height;
|
||||
//Debug.Log(localY);
|
||||
//UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (Base) =>
|
||||
//{
|
||||
// UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
//});
|
||||
//UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerEnter, (Base) =>
|
||||
//{
|
||||
// if (localY == null)
|
||||
// {
|
||||
// localY = transform.localPosition.y;
|
||||
// }
|
||||
// //transform.localPosition.Set(transform.localPosition.x,localY.Value+8, transform.localPosition.z);
|
||||
// //transform.DOLocalMoveY(localY.Value + 8, 0.5f);
|
||||
// //transform.domov(localY+8, 0.5f);
|
||||
//});
|
||||
//UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, (Base) =>
|
||||
//{
|
||||
// //transform.localPosition.Set(transform.localPosition.x, localY.Value, transform.localPosition.z);
|
||||
// //transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||
//});
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
Debug.Log(123);
|
||||
UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
//SceneManager.LoadScene("4-Demo", LoadSceneMode.Additive);
|
||||
});
|
||||
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");
|
||||
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";
|
||||
props.Find("SlopeText").GetComponent<Text>().text = $"{myMap.AverageGrade.ToString("#0.00")}%";
|
||||
@@ -42,5 +78,85 @@ public class MapItem : MonoBehaviour
|
||||
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);
|
||||
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
|
||||
transform.Find("CollectImg").gameObject.SetActive(false);
|
||||
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
|
||||
UIManager.Instance.collectDict[myMap.IsFavorite];
|
||||
transform.Find("BtnInfo").GetComponent<Button>().onClick.AddListener(Info);
|
||||
transform.Find("BtnRide").GetComponent<Button>().onClick.AddListener(Ride);
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapHBImg").GetComponent<RawImage>(), myMap.AltitudeGraph);
|
||||
SetActive4Button(false);
|
||||
}
|
||||
|
||||
private void Ride()
|
||||
{
|
||||
App.RouteIdParam = map.Id;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
|
||||
private void Info()
|
||||
{
|
||||
UIManager.ShowMapDetailPanel(map.Id);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (localY == null)
|
||||
{
|
||||
localY = transform.localPosition.y;
|
||||
}
|
||||
transform.Find("CollectImg").gameObject.SetActive(true);
|
||||
transform.DOLocalMoveY(localY.Value + 5, 0.5f);
|
||||
SetActive4Button(true);
|
||||
SetColor(map.IsFavorite);
|
||||
}
|
||||
void SetActive4Button(bool b)
|
||||
{
|
||||
transform.Find("MapHBImg").gameObject.SetActive(!b);
|
||||
transform.Find("BtnInfo").gameObject.SetActive(b);
|
||||
transform.Find("BtnRide").gameObject.SetActive(b);
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||
transform.Find("CollectImg").gameObject.SetActive(false);
|
||||
SetActive4Button(false);
|
||||
SetColor(false);
|
||||
}
|
||||
private void SetColor(bool isFav)
|
||||
{
|
||||
PropNames.icons.ForEach((v) =>
|
||||
{
|
||||
transform.Find("Props").Find(v).GetComponent<Image>().color = Utils.HexToColorHtml(
|
||||
PropNames.colorDict[isFav]);
|
||||
});
|
||||
PropNames.texts.ForEach((v) =>
|
||||
{
|
||||
transform.Find("Props").Find(v).GetComponent<Text>().color = Utils.HexToColorHtml(
|
||||
PropNames.colorDict[isFav]);
|
||||
});
|
||||
}
|
||||
async void Collect()
|
||||
{
|
||||
JsonResult<object> r;
|
||||
if (map.IsFavorite)
|
||||
{
|
||||
r = await ConfigHelper.mapApi.CancelFav(map.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.mapApi.AddFav(map.Id.ToString());
|
||||
}
|
||||
if (r.result)
|
||||
{
|
||||
map.IsFavorite = !map.IsFavorite;
|
||||
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
|
||||
UIManager.Instance.collectDict[map.IsFavorite];
|
||||
SetColor(map.IsFavorite);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowAlert(r.errMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Assets.Scripts;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NewsController : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
content = transform.Find("Main").Find("Inner").Find("Content");
|
||||
exit = transform.Find("Main").Find("Exit");
|
||||
if (exit != null)
|
||||
{
|
||||
exit.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
}
|
||||
Get();
|
||||
}
|
||||
Transform content,exit;
|
||||
async void Get()
|
||||
{
|
||||
var r = await ConfigHelper.userApi.GetNotify();
|
||||
if (r.result)
|
||||
{
|
||||
content.GetComponent<Text>().text = r.data.Value<string>("Content");
|
||||
//content.GetComponent<Text>().text
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71855add6efca96458ac893b08f2dd4a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,8 +7,10 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EditUserController : PFUIPanel
|
||||
@@ -18,38 +20,63 @@ public class EditUserController : PFUIPanel
|
||||
private PFUIDropdown mDayDropdown;
|
||||
private PFUIDropdown mMonthDropdown;
|
||||
private PFUIDropdown mYearDropdown;
|
||||
private Text mIdText;
|
||||
private Text mNameText;
|
||||
private PFUIDropdown mConutryDropdown;
|
||||
private PFUIDropdown mUnitDropdown;
|
||||
private Text mID;
|
||||
private PFUIInputField mNickName;
|
||||
private PFUIInputField mFTP;
|
||||
private PFUIInputField mWeight;
|
||||
private PFUIInputField mHeight;
|
||||
private PFUIInputField mMHR;
|
||||
private PFUIInputField mBW;
|
||||
private PFUIInputField mWD;
|
||||
private PFUIInputField mName;
|
||||
private PFUIInputField mPhone;
|
||||
private PFUIInputField mAddr;
|
||||
private RawImage mHeadImage;
|
||||
private UserApi userApi;
|
||||
private Button mCancelButton;
|
||||
private Button mBackButton;
|
||||
private Button mSwitchButton;
|
||||
PfUIButton mChangeAvatar;
|
||||
protected override void Awake()
|
||||
{
|
||||
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
|
||||
userApi = new UserApi();
|
||||
|
||||
mIdText = this.transform.Find("IdText").GetComponent<Text>();
|
||||
mNameText = this.transform.Find("NameText").GetComponent<Text>();
|
||||
|
||||
var panel = this.transform.Find("Panel");
|
||||
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
|
||||
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
|
||||
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
|
||||
mYearDropdown = panel.Find("YearDropdown").GetComponent<PFUIDropdown>();
|
||||
mMonthDropdown = panel.Find("MonthDropdown").GetComponent<PFUIDropdown>();
|
||||
mDayDropdown = panel.Find("DayDropdown").GetComponent<PFUIDropdown>();
|
||||
mUnitDropdown = panel.Find("UnitDropdown").GetComponent<PFUIDropdown>();
|
||||
mSaveButton = this.transform.Find("SaveButton").GetComponent<Button>();
|
||||
mCancelButton = this.transform.Find("CancelButton").GetComponent<Button>();
|
||||
mHeadImage = this.transform.Find("HeadImage").GetComponent<RawImage>();
|
||||
mBackButton = this.transform.Find("BackButton").GetComponent<Button>();
|
||||
UIManager.AddEvent(mBackButton.gameObject, EventTriggerType.PointerClick, Cancel);
|
||||
|
||||
mSwitchButton = this.transform.Find("SwitchAccountButton").GetComponent<Button>();
|
||||
mChangeAvatar = this.transform.Find("ChangeAvatar").GetComponent<PfUIButton>();
|
||||
mConutryDropdown = panel.Find("CountryDropdown").GetComponent<PFUIDropdown>();
|
||||
mNickName = panel.Find("NickName").Find("input").GetComponent<PFUIInputField>();
|
||||
mFTP = panel.Find("Ftp").Find("input").GetComponent<PFUIInputField>();
|
||||
mWeight = panel.Find("Weight").Find("input").GetComponent<PFUIInputField>();
|
||||
mHeight = panel.Find("Height").Find("input").GetComponent<PFUIInputField>();
|
||||
mMHR = panel.Find("MHR").Find("input").GetComponent<PFUIInputField>();
|
||||
mBW = panel.Find("BW").Find("input").GetComponent<PFUIInputField>();
|
||||
mWD = panel.Find("WD").Find("input").GetComponent<PFUIInputField>();
|
||||
mName = panel.Find("Name").Find("input").GetComponent<PFUIInputField>();
|
||||
mPhone = panel.Find("PN").Find("input").GetComponent<PFUIInputField>();
|
||||
mAddr = panel.Find("Addr").Find("input").GetComponent<PFUIInputField>();
|
||||
UIManager.AddEvent(mBackButton.gameObject, EventTriggerType.PointerClick, Cancel);
|
||||
UIManager.AddEvent(mChangeAvatar.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
OpenFileName ofn = new OpenFileName();
|
||||
|
||||
ofn.structSize = Marshal.SizeOf(ofn);
|
||||
|
||||
ofn.filter = "All Files\0*.*\0\0";
|
||||
ofn.filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)\0*.jpg;*.png;*.jpeg;*.bmp\0";
|
||||
|
||||
ofn.file = new string(new char[256]);
|
||||
|
||||
@@ -70,18 +97,19 @@ public class EditUserController : PFUIPanel
|
||||
|
||||
if (Win32.GetOpenFileName(ofn))
|
||||
{
|
||||
Debug.Log(ofn.file);
|
||||
ChangeAvatar(ofn.file);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
mSexDropdown.ClearOptions();
|
||||
mSexDropdown.AddOptions(new List<string>
|
||||
{
|
||||
"男","女"
|
||||
});
|
||||
|
||||
|
||||
mUnitDropdown.ClearOptions();
|
||||
mUnitDropdown.AddOptions(UIManager.Instance.loginRegOptions.units);
|
||||
mYearDropdown.ClearOptions();
|
||||
var years = new List<string>();
|
||||
for (int i = 1960; i < 2099; i++)
|
||||
@@ -120,49 +148,84 @@ public class EditUserController : PFUIPanel
|
||||
//});
|
||||
|
||||
LoadDataSync();
|
||||
|
||||
}
|
||||
|
||||
void LoadDataSync()
|
||||
async Task Login()
|
||||
{
|
||||
var rect = ((RectTransform)mHeadImage.transform).rect;
|
||||
SetRounded(mHeadImage.transform, rect.height);
|
||||
var result = await new UserApi().Login("13115011550", "laozhong", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
async Task LoadDataSync()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
|
||||
|
||||
var currentUser = App.CurrentUser;
|
||||
if (currentUser == null) return;
|
||||
//mIdText.text = currentUser.Id.ToString();
|
||||
//mNameText.text = currentUser.Nickname;
|
||||
|
||||
mIdText.text = currentUser.Id.ToString();
|
||||
mNameText.text = currentUser.Nickname;
|
||||
//Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
|
||||
//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(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
|
||||
UIManager.AddEvent(mCancelButton.gameObject, EventTriggerType.PointerClick, Cancel);
|
||||
if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
}
|
||||
if (currentUser.Sex == 1)
|
||||
{
|
||||
mSexDropdown.SelectValue("男");
|
||||
}
|
||||
else
|
||||
{
|
||||
mSexDropdown.SelectValue("女");
|
||||
}
|
||||
mUnitDropdown.SelectIndex(currentUser.Unit);
|
||||
if (currentUser.Birthday.HasValue)
|
||||
{
|
||||
var birthday = currentUser.Birthday.Value;
|
||||
mYearDropdown.SelectValue(birthday.Year.ToString());
|
||||
mMonthDropdown.SelectValue(birthday.Month.ToString());
|
||||
mDayDropdown.SelectValue(birthday.Day.ToString());
|
||||
}
|
||||
mID.text = currentUser.Id.ToString();
|
||||
mNickName.Text = currentUser.Nickname;
|
||||
mFTP.Text = currentUser.FTP.ToString();
|
||||
mWeight.Text = currentUser.Weight.ToString();
|
||||
mHeight.Text = currentUser.Height.ToString();
|
||||
mMHR.Text = currentUser.MaxHeartRate.ToString();
|
||||
mBW.Text = currentUser.BicycleWeight.ToString();
|
||||
mWD.Text = currentUser.WheelDiameter.ToString();
|
||||
mName.Text = currentUser.Contact;
|
||||
mPhone.Text = currentUser.ContactPhone;
|
||||
mAddr.Text = currentUser.ContactAddress;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
mConutryDropdown.ClearOptions();
|
||||
mConutryDropdown.AddOptions(UIManager.Instance.loginRegOptions.countrys);
|
||||
mConutryDropdown.SelectIndex(UIManager.Instance.loginRegOptions.countryDefaultValue);
|
||||
mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
|
||||
UIManager.Instance.loginRegOptions.GetCountryImage(UIManager.Instance.loginRegOptions.countryDefaultValue);
|
||||
mConutryDropdown.OnValueChange = (int index) =>
|
||||
{
|
||||
mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
|
||||
UIManager.Instance.loginRegOptions.GetCountryImage(index);
|
||||
};
|
||||
var rect = ((RectTransform)mHeadImage.transform).rect;
|
||||
SetRounded(mHeadImage.transform, rect.height);
|
||||
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
|
||||
UIManager.AddEvent(mCancelButton.gameObject, EventTriggerType.PointerClick, Cancel);
|
||||
UIManager.AddEvent(mSwitchButton.gameObject, EventTriggerType.PointerClick, Switch);
|
||||
}
|
||||
|
||||
private void Switch(BaseEventData arg0)
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -191,22 +254,65 @@ public class EditUserController : PFUIPanel
|
||||
|
||||
async void Save(BaseEventData e)
|
||||
{
|
||||
//var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
|
||||
//user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
|
||||
//user.Sex = mSexDropdown.SelectedItem == "男" ? 1 : 2;
|
||||
|
||||
//var result = await userApi.Update(user);
|
||||
//if (result.result == false)
|
||||
//{
|
||||
// UIManager.ShowAlert(result.errMsg);
|
||||
// return;
|
||||
//}
|
||||
|
||||
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
|
||||
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
|
||||
user.Sex = mSexDropdown.SelectedItem == "男" ? 1 : 2;
|
||||
user.Nickname = mNickName.Text;
|
||||
user.Country = UIManager.Instance.loginRegOptions.GetCountryName(mConutryDropdown.SelectedIndex);
|
||||
user.FTP = int.Parse(mFTP.Text);
|
||||
user.Height = int.Parse(mHeight.Text);
|
||||
user.Weight = int.Parse(mWeight.Text);
|
||||
user.MaxHeartRate = int.Parse(mMHR.Text);
|
||||
user.BicycleWeight = int.Parse(mBW.Text);
|
||||
user.WheelDiameter = int.Parse(mWD.Text);
|
||||
user.Unit = mUnitDropdown.SelectedIndex;
|
||||
user.Contact = mName.Text;
|
||||
user.ContactPhone = mPhone.Text;
|
||||
user.ContactAddress = mAddr.Text;
|
||||
var result = await userApi.Update(user);
|
||||
if (result.result == false)
|
||||
{
|
||||
UIManager.ShowAlert(result.errMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.CurrentUser = user;
|
||||
var userinfos = UIManager.Instance.userInfos;
|
||||
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
|
||||
if (i != -1)
|
||||
{
|
||||
userinfos[i].NickName = user.Nickname;
|
||||
UIManager.Instance.userInfos = userinfos;
|
||||
}
|
||||
UIManager.ShowAlert("Success");
|
||||
}
|
||||
LoadDataSync();
|
||||
//App.CurrentUser = user;
|
||||
|
||||
UIManager.ShowAlert("result.errMsg");
|
||||
//UIManager.ShowAlert("result.errMsg");
|
||||
}
|
||||
async void ChangeAvatar(string path)
|
||||
{
|
||||
var r = await userApi.Update(App.CurrentUser, path);
|
||||
if (r.result)
|
||||
{
|
||||
var img = r.data.Value<string>("WxHeadImg");
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, img);
|
||||
var userinfos = UIManager.Instance.userInfos;
|
||||
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
|
||||
if (i != -1)
|
||||
{
|
||||
userinfos[i].Avatar = img;
|
||||
UIManager.Instance.userInfos = userinfos;
|
||||
}
|
||||
App.CurrentUser.WxHeadImg = img;
|
||||
UIManager.ShowAlert("Success");
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowAlert(r.errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel(BaseEventData e)
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
|
||||
@@ -45,6 +45,7 @@ public class MapListController : PFUIPanel
|
||||
//{
|
||||
// hardSelector.onValueChanged.AddListener(ChangeHard);
|
||||
//}
|
||||
ApiBase.SetCookie("15A37DF28842CBA8E4E550BFA24186C8222D392F3EE18D9E95A49CC32796D2E3F6E40385C6A114942546EE1DD793DF34880DE48090B91AD2460EB887B59664BB3965F3371DDA1F1401EC7F27C5A1084566E47069F12CB6BBC0BC7A84ADC5582B");
|
||||
btnMapMode = this.transform.Find("SwitchMode").gameObject;
|
||||
SetRounded(btnMapMode.transform, 64);
|
||||
UIManager.AddEvent(btnMapMode, EventTriggerType.PointerClick, (e) =>
|
||||
@@ -196,8 +197,11 @@ public class MapListController : PFUIPanel
|
||||
var rect = ((RectTransform)headImage.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
headImage.material = material;
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
if (App.FromLogin)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using System.Collections;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UserInfoController : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
UserApi userApi;
|
||||
Transform infoPanel,summaryPanel;
|
||||
protected override void Start()
|
||||
{
|
||||
userApi = ConfigHelper.userApi;
|
||||
this.transform.localPosition = new Vector3(0, 0, 0);
|
||||
|
||||
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
|
||||
@@ -16,14 +22,55 @@ public class UserInfoController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
|
||||
Button editBtn = this.transform.Find("InfoPanel").Find("EditButton").GetComponent<Button>();
|
||||
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
|
||||
UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
});
|
||||
infoPanel = transform.Find("InfoPanel").Find("P");
|
||||
Button editBtn = infoPanel.Find("EditButton").GetComponent<Button>();
|
||||
editBtn.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
});
|
||||
summaryPanel = transform.Find("SummaryPanel");
|
||||
Load();
|
||||
}
|
||||
async void Load()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
var result = await userApi.Login("15651831367", "123456", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
var r = userApi.GetSummary();
|
||||
if (r.result)
|
||||
{
|
||||
var summary = r.data;
|
||||
var user = App.CurrentUser;
|
||||
Utils.DisplayImage(StartCoroutine, infoPanel.Find("Avatar").GetComponent<RawImage>(), user.WxHeadImg);
|
||||
infoPanel.Find("Status").Find("Country").GetComponent<RawImage>().texture
|
||||
= UIManager.Instance.loginRegOptions.GetCountryImageByName(user.Country);
|
||||
infoPanel.Find("Status").Find("Wx").gameObject.SetActive(
|
||||
!string.IsNullOrEmpty(user.Unionid));
|
||||
infoPanel.Find("IdText").GetComponent<Text>().text = $"ID:{user.Id}";
|
||||
infoPanel.Find("NameText").GetComponent<Text>().text = $"{user.Nickname}";
|
||||
infoPanel.Find("EmailText").GetComponent<Text>().text = $"{user.Phone}";
|
||||
|
||||
infoPanel.Find("Ftp").Find("Value").GetComponent<Text>().text = user.FTP.ToString();
|
||||
infoPanel.Find("MHR").Find("Value").GetComponent<Text>().text = user.MaxHeartRate.ToString();
|
||||
infoPanel.Find("Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
|
||||
infoPanel.Find("BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
|
||||
infoPanel.Find("WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
|
||||
|
||||
summaryPanel.Find("Number").Find("Value").GetComponent<Text>().text = summary.Count.ToString();
|
||||
summaryPanel.Find("Time").Find("Value").GetComponent<Text>().text = summary.TotalTicks.ToString();
|
||||
summaryPanel.Find("KM").Find("Value").GetComponent<Text>().text = summary.TotalDistance.ToString();
|
||||
summaryPanel.Find("Climb").Find("Value").GetComponent<Text>().text = summary.TotalClimb.ToString();
|
||||
summaryPanel.Find("Calories").Find("Value").GetComponent<Text>().text = summary.TotalKj.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
@@ -58,6 +59,14 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("SettingModal", ref this.mSettingContoller);
|
||||
}
|
||||
}
|
||||
private NewsController mNewsContoller;
|
||||
public NewsController NewsModal
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("NewsModal", ref this.mNewsContoller);
|
||||
}
|
||||
}
|
||||
private MapListController mMapListController;
|
||||
public MapListController MapListPanel
|
||||
{
|
||||
@@ -114,6 +123,13 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
UIManager.Instance = this;
|
||||
loginRegOptions = new LoginRegOptions();
|
||||
var userInfosJson = PlayerPrefs.GetString("UserInfos");
|
||||
userInfos = JsonConvert.DeserializeObject<List<QUserInfo>>(userInfosJson);
|
||||
if (userInfos == null) userInfos = new List<QUserInfo>();
|
||||
collectDict = new Dictionary<bool, Sprite> {
|
||||
{ false,Resources.Load<Sprite>("Images/p-4灰")},
|
||||
{ true,Resources.Load<Sprite>("Images/p-4")},
|
||||
};
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -294,6 +310,10 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.SettingModal, null, true);
|
||||
}
|
||||
public static void ShowNewsModal()
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.NewsModal, null, true);
|
||||
}
|
||||
public static void ShowEditUserPanel()
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.EditUserPanel, UIManager.Instance.MainPanel);
|
||||
@@ -380,8 +400,20 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public LoginRegOptions loginRegOptions { get; private set; }
|
||||
|
||||
|
||||
private List<QUserInfo> _userInfos;
|
||||
public List<QUserInfo> userInfos
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userInfos;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userInfos = value;
|
||||
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(value));
|
||||
}
|
||||
}
|
||||
public Dictionary<bool, Sprite> collectDict { get; private set; }
|
||||
private void OnDestroy()
|
||||
{
|
||||
UIManager.Instance = null;
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -13,8 +15,64 @@ using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
/*获取ip*/
|
||||
public enum ADDRESSFAM
|
||||
{
|
||||
IPv4, IPv6
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本机IP
|
||||
/// </summary>
|
||||
/// <param name="Addfam">要获取的IP类型</param>
|
||||
/// <returns></returns>
|
||||
public static string GetIP(ADDRESSFAM Addfam)
|
||||
{
|
||||
if (Addfam == ADDRESSFAM.IPv6 && !Socket.OSSupportsIPv6)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string output = "";
|
||||
|
||||
foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||
NetworkInterfaceType _type1 = NetworkInterfaceType.Wireless80211;
|
||||
NetworkInterfaceType _type2 = NetworkInterfaceType.Ethernet;
|
||||
|
||||
if ((item.NetworkInterfaceType == _type1 || item.NetworkInterfaceType == _type2) && item.OperationalStatus == OperationalStatus.Up)
|
||||
#endif
|
||||
{
|
||||
foreach (UnicastIPAddressInformation ip in item.GetIPProperties().UnicastAddresses)
|
||||
{
|
||||
//IPv4
|
||||
if (Addfam == ADDRESSFAM.IPv4)
|
||||
{
|
||||
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
output = ip.Address.ToString();
|
||||
//Debug.Log("IP:" + output);
|
||||
}
|
||||
}
|
||||
|
||||
//IPv6
|
||||
else if (Addfam == ADDRESSFAM.IPv6)
|
||||
{
|
||||
if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
{
|
||||
output = ip.Address.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
/*获取ip*/
|
||||
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/
|
||||
public static void showToast(GameObject game,string text,int duration = 1)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user