修改细节

This commit is contained in:
Caiyanpeng committed 2021-07-29 15:45:44 +08:00
1 parent 6ab3ee19f2
commit edce9c676d
18 files changed
+1735 -1368

No files matched your search

@@ -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()
{
@@ -66,30 +84,26 @@ public class DownloadWorkoutsController : PFUIPanel
//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)
//{
@@ -242,11 +256,12 @@ public class DownloadWorkoutsController : PFUIPanel
}
void OpenFile(string p)
{
UIManager.ShowConfirm("Confirm", "Switch to PowerFun Workouts?\nWe will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(p);
Application.Quit();
});
Utils.ExecFile(p);
Application.Quit();
//UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
//{
//});
}
void SetType(int a)
{