下载界面增加开始按钮,登陆注册bug修改

This commit is contained in:
Caiyanpeng committed 2021-05-20 14:12:43 +08:00
1 parent 470d52b1bc
commit 09514e2a8a
5 files changed
+1645 -1337

No files matched your search

+3 -1
View File
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -11,6 +12,7 @@ namespace Assets.Scripts.Apis
public bool result { get; set; }
//public dynamic data { get; set; }
public string errMsg { get; set; }
public JArray errFieldMsg { get; set; }
}
public class JsonResult<T> : JsonResult
+45 -11
View File
@@ -309,14 +309,7 @@ public class LoginController : MonoBehaviour
{
UIManager.AddEvent(wxLogin1.Find("Image").gameObject, EventTriggerType.PointerClick, (b) =>
{
wxLock = true;
wxBrowser.LoadHTML("<div/>");
//wxBrowser.Url = "chrome://version/";
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
{
wxLock = false;
wxLogin1.gameObject.SetActive(false);
};
wxReturnLogin();
});
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
if (wxBrowser != null)
@@ -619,6 +612,8 @@ public class LoginController : MonoBehaviour
async void GetCaptcha()
{
var btn = signPage1.Find("Captcha").Find("BtnGet");
btn.GetComponent<Button>().enabled = false;
btn.GetComponent<Button>().interactable = false;
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
var Email = signForm.email;
var r = await ConfigHelper.userApi.GetCaptcha(Email.text);
@@ -643,7 +638,10 @@ public class LoginController : MonoBehaviour
}
else
{
btn.GetComponent<Button>().enabled = true;
btn.GetComponent<Button>().interactable = true;
Utils.showToast(gameObject, r.errMsg);
Utils.SetValidate(signFormDict, r.errFieldMsg);
}
}
#endregion
@@ -886,10 +884,24 @@ public class LoginController : MonoBehaviour
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
//if (wxLogin3.gameObject.activeSelf) wxLogin3.gameObject.SetActive(false);
pageNums = 4;
if (wxLogin1.transform.localPosition.y == 0)
{
wxReturnLogin();
}
Canvas.ForceUpdateCanvases();
this.StartScrollPanel(1);
}
void wxReturnLogin()
{
wxLock = true;
wxBrowser.LoadHTML("<div/>");
//wxBrowser.Url = "chrome://version/";
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
{
wxLock = false;
wxLogin1.gameObject.SetActive(false);
};
}
/// <summary>
/// 立刻跳到登录页并且返回按钮强行失效
/// </summary>
@@ -1124,9 +1136,31 @@ public class LoginController : MonoBehaviour
void Update()
{
//Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
if (Input.GetKeyDown(KeyCode.Tab) && loginForm !=null && loginForm.email.isFocused && loginForm.password != null)
if (Input.GetKeyDown(KeyCode.Tab))
{
loginForm.password.ActivateInputField();
if (loginForm != null && loginForm.email.isFocused && loginForm.password != null)
{
loginForm.password.ActivateInputField();
}
if (signForm != null)
{
if (signForm.email.isFocused)
{
signForm.captcha.ActivateInputField();
}
if (signForm.captcha.isFocused)
{
signForm.password.ActivateInputField();
}
if (signForm.password.isFocused)
{
signForm.cpassword.ActivateInputField();
}
if (signForm.cpassword.isFocused)
{
signForm.email.ActivateInputField();
}
}
}
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
{
@@ -11,13 +11,14 @@ using UnityEngine.UI;
public class DownloadController : PFUIPanel
{
// Start is called before the first frame update
Transform Button,Loading,Exit;
Transform Btn, Loading,Exit,BtnStart;
ScrollRect scroll;
string path;
[SerializeField] Transform log;
void Start()
{
Button = transform.Find("Panel/BtnConfirm");
Btn = transform.Find("Panel/BtnConfirm");
BtnStart = transform.Find("Panel/BtnStart");
Loading = transform.Find("Panel/LoadingContainer");
scroll = transform.Find("Panel/Scroll View").GetComponent<ScrollRect>();
Exit = transform.Find("Panel/Exit");
@@ -25,29 +26,39 @@ public class DownloadController : PFUIPanel
{
Utils.showToast(gameObject, "Please update to the latest version.");
});
SetType(false);
SetType(1);
//Button.GetComponent<Button>().enabled = false;
//Button.GetComponent<Button>().interactable = false;
path = Application.persistentDataPath + "/PowerFun.exe";
UIManager.AddEvent(Button.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
UIManager.AddEvent(Btn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
Application.Quit();
Utils.ExecFile(path);
});
UIManager.AddEvent(BtnStart.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (_base) =>
{
if (App.UpdateObject != null)
{
BtnStart.GetComponent<Button>().enabled = false;
BtnStart.GetComponent<Button>().interactable = false;
StartCoroutine(DownLoadExe(App.UpdateObject.Url, path, (a, b, isComplete) =>
{
transform.Find("Panel/LoadingContainer/Text").GetComponent<Text>().text = $"Downloaded {a.ToString("#0")}M / {b.ToString("#0")}M";// string.Format(, a, b);
transform.Find("Panel/LoadingContainer/Loading").GetComponent<Image>().fillAmount = (float)(a / b);
if (isComplete)
{
SetType(3);
PlayerPrefs.SetString("exeVersion", App.UpdateObject.Code);
new FileInfo(path + ".pfdownload").MoveTo(path);
}
}));
}
});
//transform
if (App.UpdateObject != null)
{
StartCoroutine(DownLoadExe(App.UpdateObject.Url, path, (a, b, isComplete) =>
{
transform.Find("Panel/LoadingContainer/Text").GetComponent<Text>().text = $"Downloaded {a.ToString("#0")}M / {b.ToString("#0")}M";// string.Format(, a, b);
transform.Find("Panel/LoadingContainer/Loading").GetComponent<Image>().fillAmount = (float)(a / b);
if (isComplete)
{
SetType(true);
PlayerPrefs.SetString("exeVersion", App.UpdateObject.Code);
new FileInfo(path + ".pfdownload").MoveTo(path);
}
}));
for (var i = 0; i < App.UpdateObject.UpdateLog.Count; i++)
{
var newLog = Instantiate<Transform>(log);
@@ -96,6 +107,7 @@ public class DownloadController : PFUIPanel
{
File.Delete(desFileName + ".pfdownload");
}
SetType(2);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Timeout = 5000;
WebResponse response = request.GetResponse();
@@ -124,11 +136,29 @@ public class DownloadController : PFUIPanel
}
OnDownloadProgressEvent.Invoke(dDownloadedLength, dTotalLength, true);
}
void SetType(bool f)
void SetType(int a)
{
// true 显示 button false 显示loading
Button.gameObject.SetActive(f);
Loading.gameObject.SetActive(!f);
switch (a)
{
case 1:
// true 显示 button false 显示loading
Btn.gameObject.SetActive(false);
Loading.gameObject.SetActive(false);
BtnStart.gameObject.SetActive(true);
break;
case 2:
Btn.gameObject.SetActive(false);
Loading.gameObject.SetActive(true);
BtnStart.gameObject.SetActive(false);
break;
case 3:
Btn.gameObject.SetActive(true);
Loading.gameObject.SetActive(false);
BtnStart.gameObject.SetActive(false);
break;
default:break;
}
}
// Update is called once per frame
void Update()