Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo

This commit is contained in:
lishuo committed 2021-07-29 16:13:39 +08:00
commit 50fd9c3af6
20 files changed
+2136 -1568

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ using Assets.Scripts.Devices;
public static class App
{
public static string Host = "http://192.168.0.102:5082/";
public static string Host = "http://192.168.0.101:5085/";
public static string AppVersion = Application.version;
@@ -62,7 +62,7 @@ public class HomeController : PFUIPanel
//Application.OpenURL("https://powerfun.oss-cn-shanghai.aliyuncs.com/Releases/PowerFunWorkouts.exe");
return;
}
UIManager.ShowConfirm("Confirm", "Switch to PowerFun Workouts?\nWe will close the Powerfun and start PowerFun Workouts.", () =>
UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(path);
Application.Quit();
+19 -11
View File
@@ -23,6 +23,10 @@ public class RaceHomeScript : RaceScript
base.Show();
handleAvatar();
GetData();
if (btnGoList != null)
{
btnGoList.Find("Panel").GetComponent<CanvasGroup>().alpha = 0;
}
}
void Start()
{
@@ -68,26 +72,30 @@ public class RaceHomeScript : RaceScript
rightContainer = transform.Find("RightContainer");
leftContainer = transform.Find("LeftContainer");
btnGoList = rightContainer.Find("Container-2/BtnGoList");
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
if (btnGoList != null)
{
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
UIManager.ShowRaceListPanel();
};
});
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowRaceListPanel();
});
}
}
bool isEnter = false;
async void GetData()
{
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0);
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 1);
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 2);
DisplayMaps(r.data, activityList.data);
Initial();
Utils.StartTimeUnLimit(10, () =>
if (!isEnter)
{
goRight();
});
Utils.StartTimeUnLimit(10, () =>
{
goRight();
});
isEnter = true;
}
}
private void DisplayMaps(List<MapCompetition> list, List<MapCompetition> activityList)
{
@@ -30,7 +30,7 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
Utils.DisplayImage(transform.Find("AltitudeCurve").GetComponent<RawImage>(), mapCompetition.AltitudeGraph, true);
transform.Find("InfoContainer/Text").GetComponent<Text>().SetTextWithEllipsis(mapCompetition.Title);
transform.Find("GetReadyContainer").gameObject.SetActive(true);
transform.Find("GetReadyContainer").gameObject.SetActive(mapCompetition.Status != 4);
transform.Find("GetReadyContainer-2").gameObject.SetActive(mapCompetition.Status == 1);
//transform.Find("Text").GetComponent<Text>().text = mapCompetition.Title;
//props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString(myMap.Distance > 1000 ? "#0" : "#0.00")}KM";
@@ -42,7 +42,7 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
= $"{(mapCompetition.TotalClimb ?? 0.0).ToString(mapCompetition.TotalClimb > 1000 ? "#0" : "#0.00")}M";
transform.Find("DataContainer/Slope/Text").GetComponent<Text>().text
= $"{mapCompetition.AverageGrade.ToString("#0.00")}%";
transform.Find("InfoContainer/StartTime/Text").GetComponent<Text>().text = mapCompetition.StartTime.ToString();
transform.Find("InfoContainer/StartTime/Text").GetComponent<Text>().text = mapCompetition.StartTime.ToLocalTime().ToString();
transform.Find("CountContainer/Text").GetComponent<Text>().text = mapCompetition.ApplyCount.ToString();
SetStatus(mapCompetition);
SetButtonGroup(mapCompetition);
@@ -26,10 +26,10 @@ public class RaceListScript : RaceScript
{
base.Show();
handleAvatar();
//Refresh();
Refresh();
}
//筛选条件
void Start()
void Awake()
{
scroll = transform.Find("ListContainer/List").gameObject;
if (scroll != null)
@@ -155,13 +155,10 @@ public class RaceListScript : RaceScript
{
UIManager.AddEvent(btnReturn.gameObject, EventTriggerType.PointerClick, (b) =>
{
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
{
UIManager.ShowRaceHomePanel(true);
};
UIManager.ShowRaceHomePanel(true);
});
}
Refresh();
//Refresh();
}
private async Task Login()
+15 -15
View File
@@ -78,15 +78,15 @@ public class RaceScript : PFUIPanel
var map = currentItem.GetComponent<RaceItemScript>().mapCompetition;
if (map.Status == 1)
{
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Deadline for Registration";
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Start for Registration";
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
map.EndApplyTime.ToString("yyyy-MM-dd HH:mm");
currentItem.Find("GetReadyContainer-2/Title").GetComponent<Text>().text = "Start Time";
map.StartApplyTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
currentItem.Find("GetReadyContainer-2/Title").GetComponent<Text>().text = "Deadline for Registration";
currentItem.Find("GetReadyContainer-2/Value").GetComponent<Text>().text =
map.StartTime.ToString("yyyy-MM-dd HH:mm");
map.EndApplyTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
if ((map.StartApplyTime - UIManager.Now.GetDateTime()).TotalSeconds < 0 ||
(map.StartTime - UIManager.Now.GetDateTime()).TotalSeconds < 0)
if ((map.StartApplyTime.ToLocalTime() - UIManager.Now.GetDateTime()).TotalSeconds < 0 ||
(map.StartTime.ToLocalTime() - UIManager.Now.GetDateTime()).TotalSeconds < 0)
{
var res = ConfigHelper.mapCompetitionApi.GetById(map.Id);
if (res.result)
@@ -99,15 +99,15 @@ public class RaceScript : PFUIPanel
{
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Start Time";
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
map.StartTime.ToString("yyyy-MM-dd HH:mm");
}
else if (map.Status == 4)
{
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "End Time";
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
map.FirstEndTime.HasValue ?
map.FirstEndTime.Value.ToString("yyyy-MM-dd HH:mm") : map.EndTime.ToString("yyyy-MM-dd HH:mm");
map.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
}
//else if (map.Status == 4)
//{
// currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "End Time";
// currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text =
// map.FirstEndTime.HasValue ?
// map.FirstEndTime.Value.ToString("yyyy-MM-dd HH:mm") : map.EndTime.ToString("yyyy-MM-dd HH:mm");
//}
else
{
//Dictionary<int,>
@@ -127,7 +127,7 @@ public class RaceScript : PFUIPanel
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text
= map.HasJoin ? "Get Ready" : "Start Time";
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text
= map.HasJoin ? Utils.GetCountDown(time): map.StartTime.ToString("yyyy-MM-dd HH:mm");
= map.HasJoin ? Utils.GetCountDown(time): map.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm");
}
}
}
@@ -26,7 +26,7 @@ public class ResultListController : MonoBehaviour
{
{0,"routes" },{1,"competition" }
};
void Start()
void Awake()
{
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
InitialColor();
@@ -82,7 +82,7 @@ public class ResultListController : MonoBehaviour
UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
scrolls = new Transform[] { routeScroll, matchScroll };
GetList(0);
//GetList(0);
GetList(1);
}
@@ -88,7 +88,9 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
{
right = transform.Find("RightMatch");
transform.Find("Right").gameObject.SetActive(false);
right.Find("Value").GetComponent<Text>().text = result.Ranking.ToString();
UIManager.AddEvent(right.Find("BtnDetail").gameObject, EventTriggerType.PointerClick, (b) => Detail());
UIManager.AddEvent(right.Find("BtnRide").gameObject, EventTriggerType.PointerClick, (b) => Ride());
//right.Find("Value").GetComponent<Text>().text = result.Ranking.ToString();
}
right.gameObject.SetActive(true);
gameObject.GetComponent<Button>().onClick.AddListener(() =>
@@ -103,7 +105,14 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
this.index = index;
}
void Detail()
{
Debug.Log("Detail");
}
void Ride()
{
Debug.Log("Ride");
}
private void Delete()
{
UIManager.ShowConfirm("Delete", "Delete this record?", async () =>
@@ -186,11 +195,11 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
public void OnPointerExit(PointerEventData eventData)
{
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
if (index == 1)
{
right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
}
//if (index == 1)
//{
// right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
// right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
//}
if (left != null)
{
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
@@ -213,11 +222,11 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
public void OnPointerEnter(PointerEventData eventData)
{
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
if (index == 1)
{
right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
}
//if (index == 1)
//{
// right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
// right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
//}
if (left != null)
{
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
@@ -21,6 +21,7 @@ public class DownloadWorkoutsController : PFUIPanel
public override void Show()
{
base.Show();
Initial();
Btn = transform.Find("Panel/BtnConfirm");
BtnStart = transform.Find("Panel/BtnStart");
Loading = transform.Find("Panel/LoadingContainer");
@@ -29,6 +30,23 @@ public class DownloadWorkoutsController : PFUIPanel
BtnStart.GetComponent<Button>().enabled = true;
BtnStart.GetComponent<Button>().interactable = true;
SetType(1);
}
private async void Initial()
{
var res = await ConfigHelper.userApi.GetAppVersion();
if (res.result)
{
wpf = res.data.WPF;
}
//if (File.Exists(path) && wpf.Version == PlayerPrefs.GetString("exeVersion_w"))
//{
// BtnStart.Find("Text").GetComponent<Text>().text = "Install";
//}
//else
//{
// BtnStart.Find("Text").GetComponent<Text>().text = "Start";
//}
}
void Start()
{
@@ -64,36 +82,28 @@ public class DownloadWorkoutsController : PFUIPanel
UIManager.AddEvent(Btn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
//Application.Quit();
UIManager.ShowConfirm("Confirm", "Switch to PowerFun Workouts?\nWe will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(path);
Application.Quit();
});
OpenFile(path);
});
UIManager.AddEvent(BtnStart.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick,async (_base) =>
{
var res = await ConfigHelper.userApi.GetAppVersion();
if (res.result)
if (wpf != null)
{
wpf = res.data.WPF;
if (wpf != null)
BtnStart.GetComponent<Button>().enabled = false;
BtnStart.GetComponent<Button>().interactable = false;
Debug.Log(path);
StartCoroutine(DownLoadExe(wpf.Url, path, (p, isComplete) =>
{
BtnStart.GetComponent<Button>().enabled = false;
BtnStart.GetComponent<Button>().interactable = false;
Debug.Log(path);
StartCoroutine(DownLoadExe(wpf.Url, path, (p, isComplete) =>
//Debug.Log($"{a} {b} {isComplete}");
transform.Find("Panel/LoadingContainer/Text").GetComponent<Text>().text = $"Downloaded {Math.Round(p * 100, 0)}%";// string.Format(, a, b);
transform.Find("Panel/LoadingContainer/Loading").GetComponent<Image>().fillAmount = (float)p;
if (isComplete)
{
//Debug.Log($"{a} {b} {isComplete}");
transform.Find("Panel/LoadingContainer/Text").GetComponent<Text>().text = $"Downloaded {Math.Round(p * 100,0)}%";// string.Format(, a, b);
transform.Find("Panel/LoadingContainer/Loading").GetComponent<Image>().fillAmount = (float)p;
if (isComplete)
{
SetType(3);
PlayerPrefs.SetString("exeVersion_w", wpf.Version);
new FileInfo(path + ".pfdownload").MoveTo(path);
}
}));
}
SetType(3);
PlayerPrefs.SetString("exeVersion_w", wpf.Version);
new FileInfo(path + ".pfdownload").MoveTo(path);
}
}));
}
//if (App.UpdateObject != null)
//{
@@ -152,12 +162,7 @@ public class DownloadWorkoutsController : PFUIPanel
if (version == PlayerPrefs.GetString("exeVersion_w"))
{
//Application.Quit();
UIManager.ShowConfirm("Confirm", "Switch to PowerFun Workouts?\nWe will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(desFileName);
Application.Quit();
});
OpenFile(desFileName);
yield break;
}
else
@@ -249,6 +254,15 @@ public class DownloadWorkoutsController : PFUIPanel
return false;
}
}
void OpenFile(string p)
{
Utils.ExecFile(p);
Application.Quit();
//UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
//{
//});
}
void SetType(int a)
{
switch (a)
+1 -1
View File
@@ -457,7 +457,7 @@ public class UIManager : MonoBehaviour
public static void ShowUserInfoPanel()
{
UIManager.Instance.UserInfoPanel.Reset();
//UIManager.Instance.UserInfoPanel.Reset();
UIManager.Show(UIManager.Instance.UserInfoPanel, UIManager.Instance.MainPanel);
}