暂存
This commit is contained in:
1 parent
f4cbad819b
commit
0346b650aa
64 files changed
+12634
-12935
No files matched your search
@@ -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) =>
|
||||
{
|
||||
@@ -265,10 +269,14 @@ public class MapListController : PFUIPanel
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(map);
|
||||
obj.transform.SetParent(content.transform);
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
obj.GetComponent<MapItem>().Initial(item);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.parent = content.transform;
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
foreach (Transform t in content.transform)
|
||||
{
|
||||
Debug.Log(t.localPosition.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user