Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble

This commit is contained in:
lishuo committed 2021-08-25 11:22:23 +08:00
commit 92c8f246b8
81 files changed
+74001 -190

No files matched your search

+193 -130
View File
@@ -26,7 +26,7 @@ using ZenFulcrum.EmbeddedBrowser;
#endif
//记录:小f 是-457和-681
public class QUserInfo
public class QUserInfo
{
public long Id { get; set; }
public string Phone { get; set; }
@@ -34,12 +34,12 @@ public class QUserInfo
public string Avatar { get; set; }
public string Cookie { get; set; }
}
public class LoginForm
public class LoginForm
{
public InputField email { get; set; }
public InputField password { get; set; }
}
public class SignForm
public class SignForm
{
//页面1
public InputField email { get; set; }
@@ -106,7 +106,7 @@ public class LoginController : MonoBehaviour
//其他
[SerializeField] RawImage loading;
Transform toolContainer;
Dictionary<string, Selectable> formDict,signFormDict;
Dictionary<string, Selectable> formDict, signFormDict;
public string avatarName { get; private set; }
public Texture avatar;
@@ -134,7 +134,7 @@ public class LoginController : MonoBehaviour
EventTriggerType.PointerClick, (b) => goResetPassword());
//signPage1.Find("next").GetComponent<Button>().onClick.AddListener(() => { goRegNext(); });
UIManager.AddEvent(signPage1.Find("Captcha").Find("BtnGet").gameObject,
EventTriggerType.PointerClick,(b)=> GetCaptcha());
EventTriggerType.PointerClick, (b) => GetCaptcha());
//signPage1.Find("Captcha").Find("BtnGet").GetComponent<Button>().onClick.AddListener(GetCaptcha);
var email = signPage1.Find("Email").GetComponent<InputField>();
var captcha = signPage1.Find("Captcha").GetComponent<InputField>();
@@ -148,10 +148,10 @@ public class LoginController : MonoBehaviour
EventTriggerType.PointerClick, (b) => goRegNext(1));
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
signPage2 = content.Find("NextPage");
UIManager.AddEvent(signPage2.Find("previous").GetComponent<Button>().gameObject,
EventTriggerType.PointerClick, (b) => goRegPrev());
signPage2.Find("previous").GetComponent<Button>().enabled = false;
signPage2.Find("previous").GetComponent<Button>().interactable = false;
//UIManager.AddEvent(signPage2.Find("previous").GetComponent<Button>().gameObject,
// EventTriggerType.PointerClick, (b) => goRegPrev());
//signPage2.Find("previous").GetComponent<Button>().enabled = false;
//signPage2.Find("previous").GetComponent<Button>().interactable = false;
//signPage2.Find("previous").GetComponent<Button>().onClick.AddListener(goRegPrev);
UIManager.AddEvent(signPage2.Find("sign").GetComponent<Button>().gameObject,
EventTriggerType.PointerClick, (b) => goRegEnd());
@@ -211,7 +211,9 @@ public class LoginController : MonoBehaviour
countrys = countrys,
units = units,
};
#if !(UNITY_ANDROID || UNITY_IOS)
signScrollBar = signScrollView.transform.Find("Image").Find("Image");
#endif
}
if (avatarScrollView != null)
{
@@ -219,7 +221,11 @@ public class LoginController : MonoBehaviour
var content = scrollAvatar.transform.Find("Viewport").Find("Content");
foreach (var user in userInfos)
{
#if !(UNITY_ANDROID || UNITY_IOS)
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/QuickUserInfo")).transform;
#else
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/Mobile/QuickUserInfo")).transform;
#endif
info.GetComponent<QuickLoginUser>().Initial(user, transform);
info.SetParent(content);
info.localScale = new Vector3(1, 1, 1);
@@ -241,22 +247,23 @@ public class LoginController : MonoBehaviour
UIManager.AddEvent(sign.gameObject, EventTriggerType.PointerClick, (b) => goSign());
remember = loginContainer.Find("rememberButton").GetComponent<Button>();
UIManager.AddEvent(remember.gameObject, EventTriggerType.PointerClick, (b) =>
{
var gou = remember.transform.Find("Gou");
if (gou.gameObject.activeSelf)
{
gou.gameObject.SetActive(false);
}
else
{
gou.gameObject.SetActive(true);
}
});
UIManager.AddEvent(loginContainer.Find("ForgetPassword").gameObject, EventTriggerType.PointerClick, (e) =>goSign(type:1));
{
var gou = remember.transform.Find("Gou");
if (gou.gameObject.activeSelf)
{
gou.gameObject.SetActive(false);
}
else
{
gou.gameObject.SetActive(true);
}
});
UIManager.AddEvent(loginContainer.Find("ForgetPassword").gameObject, EventTriggerType.PointerClick, (e) => goSign(type: 1));
#if !(UNITY_IOS || UNITY_ANDROID)
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
{
#if !(UNITY_IOS || UNITY_ANDROID)
if (wxLock) return;
wxLock = true;
//wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
@@ -274,9 +281,9 @@ public class LoginController : MonoBehaviour
//Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
wxLogin1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
#endif
});
});
#endif
var login = loginContainer.Find("login").GetComponent<Button>();
UIManager.AddEvent(login.gameObject, EventTriggerType.PointerClick, (b) => Submit());
//login.onClick.AddListener(Submit);
@@ -292,11 +299,18 @@ public class LoginController : MonoBehaviour
//}
if (signContainer != null)
{
#if !(UNITY_ANDROID || UNITY_IOS)
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
UIManager.AddEvent(loginr2.gameObject, EventTriggerType.PointerClick, (b) =>
{
goLoginReturn2();
});
#else
UIManager.AddEvent(signContainer.Find("loginr2").gameObject, EventTriggerType.PointerClick, (b) =>
{
goLoginReturn2();
});
#endif
}
if (exit != null)
{
@@ -305,10 +319,10 @@ public class LoginController : MonoBehaviour
UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", () =>
{
Application.Quit();
},2);
}, 2);
});
}
#if !(UNITY_IOS || UNITY_ANDROID)
wxLogin1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
if (wxLogin1 != null)
{
@@ -316,7 +330,6 @@ public class LoginController : MonoBehaviour
{
wxReturnLogin();
});
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
if (wxBrowser != null)
{
@@ -339,21 +352,24 @@ public class LoginController : MonoBehaviour
//browser.Zoom = 0.5f;
//browser.
}
#endif
}
#endif
wxLogin2 = mainContent.Find("FormContainer-wx2");
if (wxLogin2 != null)
{
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
{
{
#if !(UNITY_IOS || UNITY_ANDROID)
wxLogin1.gameObject.SetActive(false);
wxLogin1.GetComponent<RectTransform>().localPosition = new Vector3(0, -573, 0);
wxLogin2.gameObject.SetActive(false);
//wxLogin3.gameObject.SetActive(false);
pageNums = 4;
//Canvas.ForceUpdateCanvases();
StartScrollPanel(1);
});
#endif
wxLogin2.gameObject.SetActive(false);
//wxLogin3.gameObject.SetActive(false);
pageNums = 4;
//Canvas.ForceUpdateCanvases();
StartScrollPanel(1);
});
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
{
this.goSign(false);
@@ -363,38 +379,40 @@ public class LoginController : MonoBehaviour
if (wxLogin3 != null)
{
UIManager.AddEvent(wxLogin3.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
{
if (signContainer.gameObject.activeSelf)
{
if (pageNums == 5)
{
StartScrollPanel(3);
}
else if (pageNums == 4)
{
StartScrollPanel(2);
}
else
{
StartScrollPanel(1);
}
}
else
{
signContainer.gameObject.SetActive(true);
{
if (signContainer.gameObject.activeSelf)
{
if (pageNums == 5)
{
StartScrollPanel(3);
}
else if (pageNums == 4)
{
StartScrollPanel(2);
}
else
{
StartScrollPanel(1);
}
}
else
{
signContainer.gameObject.SetActive(true);
#if !(UNITY_IOS || UNITY_ANDROID)
wxLogin1.gameObject.SetActive(false);
wxLogin1.GetComponent<RectTransform>().localPosition = new Vector3(0, -573, 0);
pageNums = 4;
//wxLogin3.gameObject.SetActive(false);
StartScrollPanel(1);
}
});
#endif
pageNums = 4;
//wxLogin3.gameObject.SetActive(false);
StartScrollPanel(1);
}
});
UIManager.AddEvent(wxLogin3.Find("rememberButton").gameObject, EventTriggerType.PointerClick, (b) =>
{
var gou = wxLogin3.Find("rememberButton").Find("Gou").gameObject;
gou.SetActive(!gou.activeSelf);
});
UIManager.AddEvent(wxLogin3.Find("Next").gameObject, EventTriggerType.PointerClick, (b) =>
{
var gou = wxLogin3.Find("rememberButton").Find("Gou").gameObject;
gou.SetActive(!gou.activeSelf);
});
UIManager.AddEvent(wxLogin3.Find("Next").gameObject, EventTriggerType.PointerClick, (b) =>
{
goMain(wxLogin3.Find("rememberButton").Find("Gou"));
});
@@ -405,9 +423,9 @@ public class LoginController : MonoBehaviour
if (toolContainer != null)
{
UIManager.AddEvent(toolContainer.Find("Setting").gameObject, EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowSettingModal();
});
{
UIManager.ShowSettingModal();
});
//toolContainer.Find("Setting").GetComponent<Button>().onClick.AddListener(() =>
//{
// UIManager.ShowSettingModal();
@@ -427,6 +445,7 @@ public class LoginController : MonoBehaviour
{"Phone",loginForm.email },
{"Pwd",loginForm.password },
};
#if !(UNITY_ANDROID || UNITY_IOS)
loginForm.email.onEndEdit.AddListener(async (s) =>
{
if (!string.IsNullOrEmpty(s) && avatarName!=s)
@@ -443,7 +462,8 @@ public class LoginController : MonoBehaviour
}
}
});
signFormDict = new Dictionary<string, Selectable>
#endif
signFormDict = new Dictionary<string, Selectable>
{
{ "Phone",signForm.email},
{ "Captcha",signForm.captcha},
@@ -454,11 +474,20 @@ public class LoginController : MonoBehaviour
{ "Days",signForm.days},
};
avatar = Resources.Load<Texture>("Images/New Account");
#if UNITY_ANDROID || UNITY_IOS
transform.Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}";
#else
transform.Find("Panel").Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}";
#endif
}
public void Test(string key)
{
Debug.Log(key);
}
async void Init()
{
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
userInfos = UIManager.Instance.userInfos;
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
@@ -468,18 +497,18 @@ public class LoginController : MonoBehaviour
var r = await ConfigHelper.userApi.GetNotify();
if (r.result)
{
//#if !UNITY_EDITOR
//#if !UNITY_EDITOR
var ver = r.data.Value<JObject>("Version").ToObject<UpdateModel>();
if (ver!=null && ver.HasUpdate)
if (ver != null && ver.HasUpdate)
{
App.UpdateObject = ver;
Debug.Log(Application.persistentDataPath + "/PowerFun.exe");
UIManager.ShowDownloadModal();
}
//#endif
//#endif
App.notifyContent = r.data.Value<string>("Content");
if (r.data.Value<int>("Id") != notifyId)
if (r.data.Value<int>("Id") != notifyId)
{
UIManager.ShowNewsModal();
PlayerPrefs.SetInt("notifyId", r.data.Value<int>("Id"));
@@ -509,7 +538,7 @@ public class LoginController : MonoBehaviour
Debug.Log(JsonConvert.SerializeObject(locationInfo));
var i = await ConfigHelper.thirdPartApi.GetMapImage(locationInfo);
var t = new Texture2D(2, 2);
if (t.LoadImage(Utils.StreamToBytes(i)))
if (t.LoadImage(Utils.StreamToBytes(i)))
{
Debug.Log("成功");
App.TextureCache["rotateImage"] = t;
@@ -526,7 +555,7 @@ public class LoginController : MonoBehaviour
/// </summary>
private void AdjustWxQrCode()
{
#if !(UNITY_IOS || UNITY_ANDROID)
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser.EvalJSCSP(@"
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
document.getElementsByClassName('title')[0].style.display = 'none';
@@ -618,7 +647,7 @@ public class LoginController : MonoBehaviour
{
}
#region 倒计时获取验证码
#region 倒计时获取验证码
int time = 0;
float timer = 0f;
bool startCaptcha = false;
@@ -657,8 +686,8 @@ public class LoginController : MonoBehaviour
Utils.SetValidate(signFormDict, r.errFieldMsg);
}
}
#endregion
#endregion
void CaptchaTimerTick()
{
timer -= Time.deltaTime;
@@ -732,7 +761,7 @@ public class LoginController : MonoBehaviour
Utils.showToast(gameObject, r.errMsg);
}
}
async void goRegNextWithoutPass()
{
var Email = signForm.email;
@@ -745,7 +774,7 @@ public class LoginController : MonoBehaviour
if (r.result)
{
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
RefreshWx3(u,1);
RefreshWx3(u, 1);
StartScrollPanel(4);
}
else
@@ -756,7 +785,7 @@ public class LoginController : MonoBehaviour
/// <summary>
/// 重置密码逻辑
/// </summary>
async void goResetPassword()
async void goResetPassword()
{
var Email = signForm.email;
var Captcha = signForm.captcha;
@@ -775,15 +804,15 @@ public class LoginController : MonoBehaviour
var r = await ConfigHelper.userApi.ResetPassword(Email.text, Captcha.text, Password.text);
if (r.result)
{
Utils.showToast(gameObject, "Success",type:1);
Utils.showToast(gameObject, "Success", type: 1);
goLoginReturn2();
}
else
else
{
Utils.showToast(gameObject, r.errMsg);
}
}
void RefreshWx3(UserResultModel data,int type)
void RefreshWx3(UserResultModel data, int type)
{
Utils.DisplayHead(wxLogin3.Find("Avatar").GetComponent<RawImage>(),
data.WxHeadImg);
@@ -798,6 +827,12 @@ public class LoginController : MonoBehaviour
void goRegEnd()
{
if (!UpdateInfo()) return;
#if UNITY_ANDROID || UNITY_IOS
imagedf.GetComponent<Image>().DOFade(1, 0.3f);
imagexf.GetComponent<Image>().DOFade(1, 0.3f);
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 300), 0.3f);
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-35, 0.3f);
#endif
if (pageNums == 5)
{
this.StartScrollPanel(4);
@@ -838,7 +873,7 @@ public class LoginController : MonoBehaviour
/// 注册页2 修改信息
/// </summary>
/// <returns></returns>
bool UpdateInfo()
bool UpdateInfo()
{
if (userResult == null) return false;
var _days = signForm.days.GetComponent<PFUIDropdown>();
@@ -853,9 +888,9 @@ public class LoginController : MonoBehaviour
{
userResult.Birthday = new DateTime(int.Parse(_years.SelectedItem), int.Parse(_months.SelectedItem), int.Parse(_days.SelectedItem));
}
else
else
{
Utils.SetValidate(signFormDict, JArray.FromObject(new object[]
Utils.SetValidate(signFormDict, JArray.FromObject(new object[]
{
new { Field = "Years", ErrMsg = "" },
new { Field = "Months", ErrMsg = "" },
@@ -873,7 +908,7 @@ public class LoginController : MonoBehaviour
{
userResult.Nickname = userResult.Phone;
}
var r = ConfigHelper.userApi.Update(userResult,out string cookie,"");
var r = ConfigHelper.userApi.Update(userResult, out string cookie, "");
return r.result;
//userResult.Birthday.v
}
@@ -882,22 +917,31 @@ public class LoginController : MonoBehaviour
/// </summary>
private void goLoginReturn2()
{
#if UNITY_ANDROID || UNITY_IOS
imagedf.GetComponent<Image>().DOFade(1, .3f);
imagexf.GetComponent<Image>().DOFade(1, .3f);
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 300), .3f);
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-35, .3f);
#endif
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
//if (wxLogin3.gameObject.activeSelf) wxLogin3.gameObject.SetActive(false);
pageNums = 4;
#if !(UNITY_ANDROID || UNITY_IOS)
if (wxLogin1.transform.localPosition.y == 0)
{
wxReturnLogin();
}
#else
transform.GetComponent<LoginControllerMobile>().HideThirdLoginPage();
#endif
Canvas.ForceUpdateCanvases();
this.StartScrollPanel(1);
}
#if !(UNITY_IOS || UNITY_ANDROID)
void wxReturnLogin()
{
wxLock = true;
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser.LoadHTML("<div/>");
#endif
//wxBrowser.Url = "chrome://version/";
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
{
@@ -905,15 +949,18 @@ public class LoginController : MonoBehaviour
wxLogin1.gameObject.SetActive(false);
};
}
#endif
/// <summary>
/// 立刻跳到登录页并且返回按钮强行失效
/// </summary>
private void goLoginImmediately()
private void goLoginImmediately()
{
#if !(UNITY_IOS || UNITY_ANDROID)
imagedf.localPosition = new Vector3(-580, -34, 0);
imagexf.localPosition = new Vector3(0, -669, 0);
LoginBg.localPosition = Vector3.zero;
LoginBg.GetComponent<RectTransform>().sizeDelta = new Vector2(360, 573);
#endif
var scrollValue = 1f / (pageNums - 1);
var value = 1 * scrollValue;
scrollPanel.horizontalNormalizedPosition = value;
@@ -924,6 +971,7 @@ public class LoginController : MonoBehaviour
/// </summary>
void ReturnQuick()
{
#if !(UNITY_IOS || UNITY_ANDROID)
if (imagexf != null)
{
imagexf.DOLocalMoveY(-575, 0.3f);
@@ -937,6 +985,7 @@ public class LoginController : MonoBehaviour
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(360, 385), 0.3f);
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-94, 0.3f);
}
#endif
this.StartScrollPanel(0);
}
/// <summary>
@@ -945,6 +994,7 @@ public class LoginController : MonoBehaviour
/// <param name="noReturn"></param>
public void goLogin(bool noReturn = false)
{
#if !(UNITY_IOS || UNITY_ANDROID)
if (imagexf != null)
{
imagexf.DOLocalMoveY(-669, 0.3f);
@@ -958,6 +1008,7 @@ public class LoginController : MonoBehaviour
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(360, 573), 0.3f);
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(0, 0.3f);
}
#endif
//DOTween.To(() => o, x => o = x, t, 0.3f);
this.StartScrollPanel(1);
if (noReturn)
@@ -1002,8 +1053,14 @@ public class LoginController : MonoBehaviour
/// </summary>
/// <param name="isAccount"></param>
/// <param name="type">0 注册 1 忘记密码</param>
void goSign(bool isAccount = true,int type = 0)
void goSign(bool isAccount = true, int type = 0)
{
#if UNITY_ANDROID || UNITY_IOS
imagedf.GetComponent<Image>().DOFade(0, .3f);
imagexf.GetComponent<Image>().DOFade(0, .3f);
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 370), .3f);
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(0, .3f);
#endif
if (!isAccount)
{
pageNums = 5;
@@ -1016,7 +1073,7 @@ public class LoginController : MonoBehaviour
this.StartScrollPanel(3);
this.StartScrollSign(0);
}
else
else
{
if (type == 0)
{
@@ -1031,7 +1088,7 @@ public class LoginController : MonoBehaviour
this.StartScrollPanel(2);
this.StartScrollSign(0);
}
else
else
{
pageNums = 4;
signContainer.Find("signText").GetComponent<Text>().text = "RESET PASSWORD";
@@ -1050,7 +1107,7 @@ public class LoginController : MonoBehaviour
/// 登录/注册完成,去首页
/// </summary>
/// <param name="gou"></param>
void goMain(Transform gou)
void goMain(Transform gou)
{
var data = userResult;
if (data == null) return;
@@ -1060,10 +1117,10 @@ public class LoginController : MonoBehaviour
SaveInfo(data);
//PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
}
else
else
{
var u = userInfos.Find(x => x.Id == data.Id);
if (u != null)
if (u != null)
{
userInfos.Remove(u);
}
@@ -1074,13 +1131,13 @@ public class LoginController : MonoBehaviour
App.RideSetting.Sensitivity = data.Sensitivity;
//查询我参加的比赛
UIManager.UpdateJoinCompetition();
SceneManager.LoadScene("MainScene");
SceneManager.LoadSceneAsync("MainScene");
}
/// <summary>
/// 缓存打钩的用户信息
/// </summary>
/// <param name="data"></param>
public void SaveInfo(UserResultModel data)
public void SaveInfo(UserResultModel data)
{
var index = userInfos.FindIndex(x => x.Id == data.Id);
if (index == -1)
@@ -1118,7 +1175,7 @@ public class LoginController : MonoBehaviour
/// <summary>
/// 登录提交
/// </summary>
async void Submit()
async void Submit()
{
var res = await ConfigHelper.userApi.LoginV1(loginForm.email.text, loginForm.password.text, "");
//var res = await NoAuthApi.Login(phone.text, pwd.text);
@@ -1127,9 +1184,9 @@ public class LoginController : MonoBehaviour
userResult = JObject.FromObject(res.data).ToObject<UserResultModel>();
goMain(remember.transform.Find("Gou"));
}
else
else
{
if (res.data != null)
if (res.data != null)
{
var errorList = JArray.FromObject(res.data);
Utils.SetValidate(formDict, errorList);
@@ -1143,13 +1200,13 @@ public class LoginController : MonoBehaviour
//Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
if (Input.GetKeyDown(KeyCode.Tab))
{
if (loginForm != null && loginForm.email.isFocused && loginForm.password != null)
if (loginForm != null && loginForm.email.isFocused && loginForm.password != null)
{
loginForm.password.ActivateInputField();
}
if (signForm != null)
if (signForm != null)
{
if (signForm.email.isFocused)
if (signForm.email.isFocused)
{
signForm.captcha.ActivateInputField();
}
@@ -1167,19 +1224,18 @@ public class LoginController : MonoBehaviour
}
}
}
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
{
if (loginForm != null && !string.IsNullOrEmpty(loginForm.email.text) && !string.IsNullOrEmpty(loginForm.password.text))
{
Submit();
}
}
if (startCaptcha)
if (startCaptcha)
{
CaptchaTimerTick();
}
goScrollPanel();
goScrollSign();
//if (wxLogin1.gameObject.activeInHierarchy)
//{
// adjTime += Time.deltaTime;
@@ -1191,9 +1247,14 @@ public class LoginController : MonoBehaviour
// }
//}
}
private void FixedUpdate()
{
goScrollPanel();
goScrollSign();
}
//float adjTime = 0;
//bool startJs = false;
#region 主页面滑动逻辑
#region 主页面滑动逻辑
private int tmpImdex = 0;
private int scrollPanelIndex = 2;
//private float scrollValue = 0.5f;
@@ -1208,22 +1269,22 @@ public class LoginController : MonoBehaviour
private void goScrollPanel()
{
var index = scrollPanelIndex;
var scrollValue = 1f/(pageNums - 1);
var scrollValue = 1f / (pageNums - 1);
var value = index * scrollValue;
if (scrollPanel != null && startScrollPanel)
if (scrollPanel != null && startScrollPanel)
{
if (scrollPanel.horizontalNormalizedPosition >= value)
{
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 20);
if (scrollPanel.horizontalNormalizedPosition <= value)
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 10);
if (scrollPanel.horizontalNormalizedPosition <= value)
{
scrollPanel.horizontalNormalizedPosition = value;
startScrollPanel = false;
}
}
else
else
{
scrollPanel.horizontalNormalizedPosition += (scrollValue / 20);
scrollPanel.horizontalNormalizedPosition += (scrollValue / 10);
if (scrollPanel.horizontalNormalizedPosition >= value)
{
scrollPanel.horizontalNormalizedPosition = value;
@@ -1232,31 +1293,31 @@ public class LoginController : MonoBehaviour
}
}
}
#endregion
#region 注册页面滑动逻辑
#endregion
#region 注册页面滑动逻辑
private bool startScrollSign = false;
private int scrollSignIndex = 0;
private void StartScrollSign(int index)
{
if (startScrollSign) return;
scrollSignIndex = index;
startScrollSign = true;
Debug.Log($"{index},{index * 160}");
if (index == 1)
if (index == 1)
{
if (signForm.years.value!=-1) signForm.years.value = 0;
if (signForm.years.value != -1) signForm.years.value = 0;
if (signForm.months.value != -1) signForm.months.value = 0;
if (signForm.days.value != -1) signForm.days.value = 0;
if (signForm.countrys.value != -1) signForm.countrys.value = regOptions.countryDefaultValue;
if (signForm.genders.value != -1) signForm.genders.value = 0;
if (signForm.units.value != -1) signForm.units.value = 0;
if (pageNums == 5 && wxInfoJson != null)
if (pageNums == 5 && wxInfoJson != null)
{
var sex = wxInfoJson.Value<int>("sex");
if (sex > 0)
if (sex > 0)
{
signForm.genders.value = sex - 1;
}
@@ -1272,7 +1333,9 @@ public class LoginController : MonoBehaviour
// signForm.height.text = "";
//}
}
#if !(UNITY_ANDROID || UNITY_IOS)
signScrollBar.DOLocalMoveX((index-1) *160, 0.2f);
#endif
}
private void goScrollSign()
{
@@ -1281,17 +1344,17 @@ public class LoginController : MonoBehaviour
{
if (scrollSignIndex == 0)
{
scrollSign.horizontalNormalizedPosition -= (1f / 20);
scrollSign.horizontalNormalizedPosition -= (1f / 10);
if (scrollSign.horizontalNormalizedPosition <= 0)
{
scrollSign.horizontalNormalizedPosition = 0;
startScrollSign = false;
}
}
else if (scrollSignIndex == 1)
{
scrollSign.horizontalNormalizedPosition += (1f / 20);
scrollSign.horizontalNormalizedPosition += (1f / 10);
if (scrollSign.horizontalNormalizedPosition >= 1)
{
scrollSign.horizontalNormalizedPosition = 1;
@@ -1300,5 +1363,5 @@ public class LoginController : MonoBehaviour
}
}
}
#endregion
#endregion
}
+4 -1
View File
@@ -21,7 +21,10 @@ public class MainController : BaseScene
Version.text = "V"+App.AppVersion;
DeviceCache.Init(PFConstants.DeviceCacheFolder);
Loom.Initialize();
#if UNITY_ANDROID || UNITY_IOS
transform.GetComponent<CanvasScaler>().referenceResolution = new Vector2(844,390);
transform.Find("Panel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
#endif
App.MainDeviceAdapter.StartScan();
}