This commit is contained in:
Caiyanpeng committed 2021-08-25 15:35:41 +08:00
1 parent 88beff5b89
commit 89e3a04fe9
12 files changed
+4974 -1577

No files matched your search

@@ -93,7 +93,11 @@ public class HomeController : PFUIPanel
}
private void GoRide(BaseEventData e)
{
Debug.Log(App.firstEnter.ToString());
//UIManager.ShowEarthPanel(App.latitude, App.longitude);
#if UNITY_ANDROID || UNITY_IOS
UIManager.ShowMapListPanel();
#else
if (App.firstEnter == 0)
{
App.firstEnter = 1;
@@ -103,6 +107,8 @@ public class HomeController : PFUIPanel
{
UIManager.ShowMapListPanel();
}
#endif
OnExit(e);
}
void goTraining(BaseEventData e)
@@ -12,10 +12,9 @@ public class UserInfoController : PFUIPanel
// Start is called before the first frame update
UserApi userApi;
Transform infoPanel,summaryPanel;
protected override void Awake()
protected override void Start()
{
this.transform.localPosition = new Vector3(0, 0, 0);
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
UIManager.AddEvent(exitBtn.gameObject, EventTriggerType.PointerClick, (b) =>
@@ -55,6 +54,14 @@ public class UserInfoController : PFUIPanel
//{
// UIManager.ShowEditUserPanel();
//});
#if UNITY_ANDROID || UNITY_IOS
editBtn.gameObject.SetActive(true);
var recordBtn = infoPanel.Find("RecordButton");
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerEnter, (b) =>
{
Debug.Log("去看記錄");
});
#else
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerEnter, (b) =>
{
editBtn.gameObject.SetActive(true);
@@ -63,23 +70,28 @@ public class UserInfoController : PFUIPanel
{
editBtn.gameObject.SetActive(false);
});
#endif
summaryPanel = transform.Find("SummaryPanel");
//创建比赛
#if !(UNITY_ANDROID || UNITY_IOS)
var createBtn = summaryPanel.Find("CreateBtn").gameObject;
UIManager.AddEvent(createBtn, EventTriggerType.PointerClick, (b) =>
{
Application.OpenURL(App.CurrentUser.WebHost + "Mine/EditMatch?Token=" + App.CurrentUser.cookie);
});
#endif
}
public override void Show()
{
base.Show();
Load();
#if !(UNITY_ANDROID || UNITY_IOS)
if (summaryPanel != null)
{
summaryPanel.Find("Panel").Find("RideResultList").GetComponent<ResultListController>().Load();
}
#endif
}
async void Load()
{
@@ -104,6 +116,18 @@ public class UserInfoController : PFUIPanel
infoPanel.Find("NameText").GetComponent<Text>().text = $"{user.Nickname}";
infoPanel.Find("EmailText").GetComponent<Text>().text = $"{user.Phone}";
infoPanel.Find("DescText").GetComponent<Text>().text = $"{summary.Tips}";
#if UNITY_IOS || UNITY_ANDROID
infoPanel.Find("Container/Ftp").Find("Value").GetComponent<Text>().text = user.FTP.ToString();
infoPanel.Find("Container/MHR").Find("Value").GetComponent<Text>().text = user.MaxHeartRate.ToString();
infoPanel.Find("Container/Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
infoPanel.Find("Container/BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
infoPanel.Find("Container/WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
infoPanel.Find("Container/Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("Container/WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToString("dd-MM-yyyy");
infoPanel.Find("Container/MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToString("dd-MM-yyyy");
#else
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";
@@ -114,6 +138,7 @@ public class UserInfoController : PFUIPanel
infoPanel.Find("BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("dd-MM-yyyy");
infoPanel.Find("WD").Find("Time").GetComponent<Text>().text = user.LastUpdateWheelStraight.ToString("dd-MM-yyyy");
infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToString("dd-MM-yyyy");
#endif
if (user.Sex == 2)
{
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
@@ -127,7 +152,9 @@ public class UserInfoController : PFUIPanel
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();
#if !(UNITY_ANDROID || UNITY_IOS)
summaryPanel.Find("CreateBtn").gameObject.SetActive(user.CanCreateRace);
#endif
}
}