1159 lines
44 KiB
C#
1159 lines
44 KiB
C#
using Assets.Scripts;
|
||
using Assets.Scripts.Apis;
|
||
using Assets.Scripts.Apis.Models;
|
||
using Assets.Scripts.UI.Control;
|
||
using Assets.Scripts.UI.Prefab.Login;
|
||
using DG.Tweening;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Reflection;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading.Tasks;
|
||
using System.Timers;
|
||
using UnityEngine;
|
||
using UnityEngine.Events;
|
||
using UnityEngine.EventSystems;
|
||
using UnityEngine.SceneManagement;
|
||
using UnityEngine.UI;
|
||
using ZenFulcrum.EmbeddedBrowser;
|
||
//记录:小f 是-457和-681
|
||
|
||
public class QUserInfo
|
||
{
|
||
public long Id { get; set; }
|
||
public string Phone { get; set; }
|
||
public string NickName { get; set; }
|
||
public string Avatar { get; set; }
|
||
public string Cookie { get; set; }
|
||
}
|
||
public class LoginForm
|
||
{
|
||
public InputField email { get; set; }
|
||
public InputField password { get; set; }
|
||
}
|
||
public class SignForm
|
||
{
|
||
//页面1
|
||
public InputField email { get; set; }
|
||
public InputField captcha { get; set; }
|
||
public InputField password { get; set; }
|
||
public InputField cpassword { get; set; }
|
||
//页面2
|
||
public Dropdown years { get; set; }
|
||
public Dropdown months { get; set; }
|
||
public Dropdown days { get; set; }
|
||
public Dropdown genders { get; set; }
|
||
public InputField weight { get; set; }
|
||
public InputField height { get; set; }
|
||
public Dropdown countrys { get; set; }
|
||
public Dropdown units { get; set; }
|
||
}
|
||
public class LoginController : MonoBehaviour
|
||
{
|
||
private Transform mainContent;
|
||
/*初始页面*/
|
||
private Transform quickContainer;
|
||
private Transform loginContainer;
|
||
private Transform signContainer;
|
||
//修改高度
|
||
Transform LoginBg;
|
||
/*初始页面*/
|
||
LoginForm loginForm;
|
||
[SerializeField] Button loginReturn2;
|
||
private Button remember;
|
||
/*滑动相关*/
|
||
[SerializeField] GameObject loginScrollView;
|
||
[SerializeField] GameObject signScrollView;
|
||
[SerializeField] GameObject avatarScrollView;
|
||
/*滑动相关*/
|
||
//注册
|
||
private Transform signPage1;
|
||
private Transform signPage2;
|
||
private Transform signScrollBar;
|
||
private SignForm signForm;
|
||
private LoginRegOptions regOptions;
|
||
|
||
private ScrollRect scrollPanel;
|
||
private ScrollRect scrollSign;
|
||
private ScrollRect scrollAvatar;
|
||
private Transform imagexf, imagedf;
|
||
//注册主页面
|
||
private UserResultModel userResult;
|
||
/*微信相关*/
|
||
private Browser wxBrowser;
|
||
private string wxState;
|
||
private Transform wxLogin1;
|
||
private Transform wxLogin2;
|
||
private Transform wxLogin3;
|
||
private JObject wxInfoJson;
|
||
private bool wxLock;
|
||
/*微信相关*/
|
||
private List<QUserInfo> userInfos;
|
||
|
||
/*退出按钮*/
|
||
[SerializeField] Button exit;
|
||
/*退出按钮*/
|
||
//其他
|
||
[SerializeField] RawImage loading;
|
||
Transform toolContainer;
|
||
Dictionary<string, Selectable> formDict,signFormDict;
|
||
|
||
public string avatarName { get; private set; }
|
||
public Texture avatar;
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
App.FromLogin = true;
|
||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||
userInfos = UIManager.Instance.userInfos;
|
||
//userInfos.RemoveAt(0);
|
||
//PlayerPrefs.SetString("UserInfos", "");
|
||
//transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||
|
||
//if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||
//{
|
||
// foreach (var ipt in loginForm)
|
||
// {
|
||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>
|
||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>
|
||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>
|
||
// ((BaseEventData arg0) => { OnLoginInputDeSelect(arg0, ipt.gameObject); }));
|
||
// }
|
||
// //loginForm[0].
|
||
//}
|
||
|
||
if (loading != null)
|
||
{
|
||
//loading.texture.wrapMode = TextureWrapMode.Mirror;
|
||
}
|
||
if (loginScrollView != null)
|
||
{
|
||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||
LoginBg = loginScrollView.transform.Find("Viewport").Find("LoginBg");
|
||
mainContent = loginScrollView.transform.Find("Viewport").Find("Content");
|
||
quickContainer = mainContent.Find("Empty").Find("FormContainer-Quick");
|
||
loginContainer = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer");
|
||
signContainer = mainContent.Find("FormContainer-Sign");
|
||
}
|
||
if (signScrollView != null)
|
||
{
|
||
scrollSign = signScrollView.GetComponent<ScrollRect>();
|
||
var content = signScrollView.transform.Find("Viewport").Find("Content");
|
||
signPage1 = content.Find("FirstPage");
|
||
UIManager.AddEvent(signPage1.Find("next").GetComponent<Button>().gameObject,
|
||
EventTriggerType.PointerClick, (b) => goRegNext());
|
||
//signPage1.Find("next").GetComponent<Button>().onClick.AddListener(() => { goRegNext(); });
|
||
UIManager.AddEvent(signPage1.Find("Captcha").Find("BtnGet").gameObject,
|
||
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>();
|
||
var password = signPage1.Find("Password").GetComponent<InputField>();
|
||
var cpassword = signPage1.Find("CPassword").GetComponent<InputField>();
|
||
//第三方登录要用的按钮
|
||
UIManager.AddEvent(signPage1.Find("previousThird").GetComponent<Button>().gameObject,
|
||
EventTriggerType.PointerClick, (b) => goThirdPrev());
|
||
//signPage1.Find("previousThird").GetComponent<Button>().onClick.AddListener(goThirdPrev);
|
||
UIManager.AddEvent(signPage1.Find("signThird").GetComponent<Button>().gameObject,
|
||
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>().onClick.AddListener(goRegPrev);
|
||
UIManager.AddEvent(signPage2.Find("sign").GetComponent<Button>().gameObject,
|
||
EventTriggerType.PointerClick, (b) => goRegEnd());
|
||
//signPage2.Find("sign").GetComponent<Button>().onClick.AddListener(goRegEnd);
|
||
//注册2 字段
|
||
var years = signPage2.Find("Year").GetComponent<Dropdown>();
|
||
var months = signPage2.Find("Month").GetComponent<Dropdown>();
|
||
var days = signPage2.Find("Day").GetComponent<Dropdown>();
|
||
var genders = signPage2.Find("Gender").GetComponent<Dropdown>();
|
||
var countrys = signPage2.Find("Country").GetComponent<Dropdown>();
|
||
var units = signPage2.Find("Unit").GetComponent<Dropdown>();
|
||
regOptions = new LoginRegOptions();
|
||
years.options = regOptions.years;
|
||
months.options = regOptions.months;
|
||
days.options = regOptions.days;
|
||
years.captionText.text = "Year";
|
||
months.captionText.text = "Month";
|
||
days.captionText.text = "Day";
|
||
years.onValueChanged.AddListener((int index) =>
|
||
{
|
||
if (index != -1 && months.value != -1)
|
||
{
|
||
days.options = regOptions.GetDayOptions(int.Parse(years.captionText.text), int.Parse(months.captionText.text));
|
||
days.value = 0;
|
||
}
|
||
});
|
||
months.onValueChanged.AddListener((int index) =>
|
||
{
|
||
if (index != -1 && years.value != -1)
|
||
{
|
||
days.options = regOptions.GetDayOptions(int.Parse(years.captionText.text), int.Parse(months.captionText.text));
|
||
days.value = 0;
|
||
}
|
||
});
|
||
genders.options = regOptions.genders;
|
||
genders.captionText.text = "Gender";
|
||
countrys.options = regOptions.countrys;
|
||
countrys.value = regOptions.countryDefaultValue;
|
||
countrys.onValueChanged.AddListener((int index) =>
|
||
{
|
||
countrys.transform.Find("RawImage").GetComponent<RawImage>().texture = regOptions.GetCountryImage(index);
|
||
});
|
||
units.options = regOptions.units;
|
||
units.captionText.text = "Display Units";
|
||
signForm = new SignForm()
|
||
{
|
||
email = email,
|
||
captcha = captcha,
|
||
password = password,
|
||
cpassword = cpassword,
|
||
weight = signPage2.Find("Weight").GetComponent<InputField>(),
|
||
height = signPage2.Find("Height").GetComponent<InputField>(),
|
||
years = years,
|
||
months = months,
|
||
days = days,
|
||
genders = genders,
|
||
countrys = countrys,
|
||
units = units,
|
||
};
|
||
signScrollBar = signScrollView.transform.Find("Image").Find("Image");
|
||
}
|
||
if (avatarScrollView != null)
|
||
{
|
||
scrollAvatar = avatarScrollView.GetComponent<ScrollRect>();
|
||
var content = scrollAvatar.transform.Find("Viewport").Find("Content");
|
||
foreach (var user in userInfos)
|
||
{
|
||
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/QuickUserInfo")).transform;
|
||
info.GetComponent<QuickLoginUser>().Initial(user, transform);
|
||
info.parent = content;
|
||
info.localScale = new Vector3(1, 1, 1);
|
||
}
|
||
content.Find("empty1").transform.SetSiblingIndex(0);
|
||
content.Find("empty2").transform.SetSiblingIndex(content.childCount - 1);
|
||
scrollAvatar.GetComponent<QuickLoginScroll>().Initial();
|
||
}
|
||
if (quickContainer != null)
|
||
{
|
||
var loginNewAccount = quickContainer.Find("loginNewAccount").GetComponent<Button>();
|
||
UIManager.AddEvent(loginNewAccount.gameObject, EventTriggerType.PointerClick, (b) => goLogin());
|
||
}
|
||
if (loginContainer != null)
|
||
{
|
||
var returnQuick = loginContainer.Find("returnQuick").GetComponent<Button>();
|
||
UIManager.AddEvent(returnQuick.gameObject, EventTriggerType.PointerClick, (b) => ReturnQuick());
|
||
var sign = loginContainer.Find("reg").GetComponent<Button>();
|
||
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);
|
||
}
|
||
});
|
||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
if (wxLock) return;
|
||
wxLock = true;
|
||
|
||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
|
||
wxBrowser.Url = $"https://open.weixin.qq.com/connect/qrconnect?appid={App.WxAppId}&redirect_uri=https%3A%2F%2Fwx.powerfun.com.cn%2FNoAuth%2Fv1%2FWxWebLogin&response_type=code&scope=snsapi_login&state={wxState}#wechat_redirect";
|
||
//AdjustWxQrCode();
|
||
var wx1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||
wx1.gameObject.SetActive(true);
|
||
Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
|
||
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
|
||
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||
});
|
||
//wechatLogin.onClick.AddListener(() =>
|
||
//{
|
||
|
||
//});
|
||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||
UIManager.AddEvent(login.gameObject, EventTriggerType.PointerClick, (b) => Submit());
|
||
//login.onClick.AddListener(Submit);
|
||
loginForm = new LoginForm()
|
||
{
|
||
email = loginContainer.Find("phone").GetComponent<InputField>(),
|
||
password = loginContainer.Find("pwd").GetComponent<InputField>()
|
||
};
|
||
}
|
||
//if (loginReturn2 != null)
|
||
//{
|
||
// loginReturn2.onClick.AddListener(goLoginReturn2);
|
||
//}
|
||
if (signContainer != null)
|
||
{
|
||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||
UIManager.AddEvent(loginr2.gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
goLoginReturn2();
|
||
});
|
||
}
|
||
if (exit != null)
|
||
{
|
||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
Application.Quit();
|
||
});
|
||
}
|
||
|
||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||
if (wxLogin1 != null)
|
||
{
|
||
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);
|
||
};
|
||
});
|
||
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
|
||
if (wxBrowser != null)
|
||
{
|
||
// wxBrowser.EvalJS(@"Object.defineProperties(Navigator.prototype, {
|
||
// language: {
|
||
// value: 'zh-CN',
|
||
// configurable: false,
|
||
// enumerable: true,
|
||
// writable: false
|
||
// },
|
||
// languages: {
|
||
// value: ['zh-CN','en','zh'],
|
||
// configurable: false,
|
||
// enumerable: true,
|
||
// writable: false
|
||
// }
|
||
//});");
|
||
wxBrowser.onTextureUpdated += OnUserScan;
|
||
//browser.Zoom = 0.5f;
|
||
//browser.
|
||
}
|
||
}
|
||
|
||
wxLogin2 = mainContent.Find("FormContainer-wx2");
|
||
if (wxLogin2 != null)
|
||
{
|
||
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
wxLogin2.gameObject.SetActive(false);
|
||
//wxLogin3.gameObject.SetActive(false);
|
||
pageNums = 4;
|
||
Canvas.ForceUpdateCanvases();
|
||
StartScrollPanel(1);
|
||
});
|
||
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
|
||
{
|
||
this.goSign(false);
|
||
});
|
||
}
|
||
wxLogin3 = mainContent.Find("FormContainer-wx3");
|
||
if (wxLogin3 != null)
|
||
{
|
||
UIManager.AddEvent(wxLogin3.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
if (signContainer.gameObject.activeSelf)
|
||
{
|
||
StartScrollPanel(3);
|
||
}
|
||
else
|
||
{
|
||
signContainer.gameObject.SetActive(true);
|
||
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) =>
|
||
{
|
||
goMain(wxLogin3.Find("rememberButton").Find("Gou"));
|
||
});
|
||
}
|
||
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
|
||
imagedf = transform.Find("Panel").Find("LoginContainer").Find("Imagedf");
|
||
toolContainer = transform.Find("Panel").Find("ToolContainer");
|
||
if (toolContainer != null)
|
||
{
|
||
UIManager.AddEvent(toolContainer.Find("Setting").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
UIManager.ShowSettingModal();
|
||
});
|
||
//toolContainer.Find("Setting").GetComponent<Button>().onClick.AddListener(() =>
|
||
//{
|
||
// UIManager.ShowSettingModal();
|
||
//});
|
||
UIManager.AddEvent(toolContainer.Find("Msg").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
UIManager.ShowNewsModal();
|
||
});
|
||
//toolContainer.Find("Msg").GetComponent<Button>().onClick.AddListener(() =>
|
||
//{
|
||
// UIManager.ShowNewsModal();
|
||
//});
|
||
}
|
||
if (userInfos.Count == 0) goLoginImmediately();
|
||
formDict = new Dictionary<string, Selectable>()
|
||
{
|
||
{"Phone",loginForm.email },
|
||
{"Pwd",loginForm.password },
|
||
};
|
||
loginForm.email.onEndEdit.AddListener(async (s) =>
|
||
{
|
||
if (!string.IsNullOrEmpty(s) && avatarName!=s)
|
||
{
|
||
var r = await ConfigHelper.userApi.GetHeadImg(s);
|
||
if (!string.IsNullOrEmpty(r))
|
||
{
|
||
Utils.DisplayImage(StartCoroutine, loginContainer.Find("Avatar").GetComponent<RawImage>(), r);
|
||
avatarName = s;
|
||
}
|
||
else
|
||
{
|
||
loginContainer.Find("Avatar").GetComponent<RawImage>().texture = avatar;
|
||
}
|
||
}
|
||
});
|
||
signFormDict = new Dictionary<string, Selectable>
|
||
{
|
||
{ "Phone",signForm.email},
|
||
{ "Captcha",signForm.captcha},
|
||
{ "Pwd",signForm.password},
|
||
{ "Years",signForm.years},
|
||
{ "Months",signForm.months},
|
||
{ "Days",signForm.days},
|
||
};
|
||
avatar = Resources.Load<Texture>("Images/New Account");
|
||
}
|
||
private void AdjustWxQrCode()
|
||
{
|
||
wxBrowser.EvalJS(@"
|
||
console.log(439,document.body.style.padding);
|
||
let time = null;
|
||
let f = ()=>{
|
||
console.log(442);
|
||
|
||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||
document.body.style.background = '#272732';
|
||
document.body.style.overflow = 'hidden';
|
||
document.body.style.transformOrigin = 'top left';
|
||
document.body.style.transform = 'scale(0.85106382978)';
|
||
document.body.style.padding = '0';
|
||
if(document.body.style.padding === '0px' && time!=null){
|
||
clearInterval(time);
|
||
}
|
||
}
|
||
f();
|
||
if(document.body.style.padding !== '0px'){
|
||
time = setInterval(f,500);
|
||
}");
|
||
}
|
||
//浏览器加载回调
|
||
private async void OnUserScan()
|
||
{
|
||
if (wxBrowser.Url.Contains("qrconnect"))
|
||
{
|
||
AdjustWxQrCode();
|
||
}
|
||
Debug.Log(wxBrowser.Url);
|
||
var rgx = Regex.Match(wxBrowser.Url, @"https\:\/\/wx.powerfun.com.cn/NoAuth/v1/WxWebLogin\?code=(.*?)&state=(.*?)$");
|
||
var groups = rgx.Groups;
|
||
if (groups.Count == 3)
|
||
{
|
||
wxLogin1.gameObject.SetActive(false);
|
||
var state = groups[2].Value;
|
||
if (state == wxState)
|
||
{
|
||
var acjson = await ConfigHelper.thirdPartApi.GetWxAccessToken(groups[1].Value);
|
||
var infojson = await ConfigHelper.thirdPartApi.GetWxUserInfo(
|
||
acjson.Value<string>("access_token"), acjson.Value<string>("openid"));
|
||
wxInfoJson = infojson;
|
||
string unionId = wxInfoJson.Value<string>("unionid"),
|
||
openId = wxInfoJson.Value<string>("openid");
|
||
var r = await ConfigHelper.userApi.OnWebWxLoginCheckUnionId(unionId, openId);
|
||
if (r.result)
|
||
{
|
||
JObject data = JObject.FromObject(r.data);
|
||
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
||
{
|
||
wxLogin2.gameObject.SetActive(true);
|
||
Utils.DisplayImage(StartCoroutine,
|
||
wxLogin2.Find("Avatar").GetComponent<RawImage>(),
|
||
wxInfoJson.Value<string>("headimgurl"));
|
||
wxLogin2.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||
wxLogin3.gameObject.SetActive(true);
|
||
Utils.DisplayImage(StartCoroutine,
|
||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||
wxInfoJson.Value<string>("headimgurl"));
|
||
wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||
pageNums = 5;
|
||
//this.goSign();
|
||
StartScrollPanel(2);
|
||
}
|
||
else
|
||
{
|
||
RefreshWx3(data.ToObject<UserResultModel>());
|
||
wxLogin3.gameObject.SetActive(true);
|
||
//Utils.DisplayImage(StartCoroutine,
|
||
//wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||
//wxInfoJson.Value<string>("headimgurl"));
|
||
//wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||
signContainer.gameObject.SetActive(false);
|
||
pageNums = 3;
|
||
//this.goSign();
|
||
StartScrollPanel(2);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Utils.showToast(gameObject, r.errMsg);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
private void goThirdNext()
|
||
{
|
||
this.StartScrollPanel(4);
|
||
}
|
||
|
||
private void goThirdPrev()
|
||
{
|
||
this.StartScrollPanel(2);
|
||
}
|
||
|
||
private void OnDestroy()
|
||
{
|
||
|
||
}
|
||
|
||
//用于倒计时获取验证码
|
||
int time = 0;
|
||
float timer = 0f;
|
||
bool startCaptcha = false;
|
||
async void GetCaptcha()
|
||
{
|
||
var btn = signPage1.Find("Captcha").Find("BtnGet");
|
||
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
|
||
var Email = signForm.email;
|
||
var r = await ConfigHelper.userApi.GetCaptcha(Email.text);
|
||
//Timer t = new Ti
|
||
if (r.result)
|
||
{
|
||
if (r.data.Value<bool>("isExist") && pageNums == 5)
|
||
{
|
||
HidePassword();
|
||
}
|
||
time = 60;
|
||
btnText.text = $"Again({time})";
|
||
System.Timers.Timer timer = new System.Timers.Timer();
|
||
btn.GetComponent<Button>().enabled = false;
|
||
btn.GetComponent<Button>().interactable = false;
|
||
startCaptcha = true;
|
||
//timer.Interval = 1000;
|
||
//timer.AutoReset = true;
|
||
//timer.Elapsed += new ElapsedEventHandler(CaptchaTimerTick);
|
||
//timer.Enabled = true;
|
||
//btnGet.
|
||
}
|
||
else
|
||
{
|
||
Utils.showToast(gameObject, r.errMsg);
|
||
}
|
||
}
|
||
|
||
void HidePassword()
|
||
{
|
||
signPage1.Find("Password").gameObject.SetActive(false);
|
||
signPage1.Find("CPassword").gameObject.SetActive(false);
|
||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
goRegNextWithoutPass();
|
||
});
|
||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(goRegNextWithoutPass);
|
||
}
|
||
|
||
|
||
void ShowPassword()
|
||
{
|
||
signForm.email.text = "";
|
||
signForm.password.text = "";
|
||
signForm.captcha.text = "";
|
||
signForm.cpassword.text = "";
|
||
signPage1.Find("Password").gameObject.SetActive(true);
|
||
signPage1.Find("CPassword").gameObject.SetActive(true);
|
||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||
{
|
||
goRegNext(1);
|
||
});
|
||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; });
|
||
}
|
||
void CaptchaTimerTick()
|
||
{
|
||
timer -= Time.deltaTime;
|
||
if (timer <= 0)
|
||
{
|
||
var btn = signPage1.Find("Captcha").Find("BtnGet");
|
||
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
|
||
btnText.text = $"Again({time--})";
|
||
if (time < 0)
|
||
{
|
||
btnText.text = "Get";
|
||
btn.GetComponent<Button>().enabled = true;
|
||
btn.GetComponent<Button>().interactable = true;
|
||
startCaptcha = false;
|
||
//timer.Stop();
|
||
}
|
||
timer = 1.0f;
|
||
}
|
||
}
|
||
|
||
private void OnLoginInputDeSelect(BaseEventData arg0, GameObject game)
|
||
{
|
||
var image = game.transform.GetComponent<Image>();
|
||
image.sprite = Resources.Load<Sprite>("Images/gl-no");
|
||
//var rect = game.transform.GetComponent<RectTransform>();
|
||
//rect.SetSiblingIndex(rect.childCount-1);
|
||
}
|
||
|
||
private void OnLoginInputSelect(BaseEventData arg0, GameObject game)
|
||
{
|
||
var image = game.transform.GetComponent<Image>();
|
||
image.sprite = Resources.Load<Sprite>("Images/gl");
|
||
//var rect = game.transform.GetComponent<RectTransform>();
|
||
//rect.SetSiblingIndex(0);
|
||
}
|
||
|
||
private void goRegPrev()
|
||
{
|
||
signForm.email.text = "";
|
||
signForm.password.text = "";
|
||
signForm.captcha.text = "";
|
||
signForm.cpassword.text = "";
|
||
StartScrollSign(0);
|
||
}
|
||
//0-普通 1-微信
|
||
private async void goRegNext(int signType = 0)
|
||
{
|
||
var Email = signForm.email;
|
||
var Captcha = signForm.captcha;
|
||
var Password = signForm.password;
|
||
var CPassword = signForm.cpassword;
|
||
if (Password.text != CPassword.text)
|
||
{
|
||
Utils.showToast(gameObject, "两次密码输入不一致");
|
||
return;
|
||
}
|
||
//JsonConvert
|
||
JsonResult<object> r = null;
|
||
if (signType == 0)
|
||
{
|
||
r = await ConfigHelper.userApi.Register(Email.text, Password.text, Captcha.text);
|
||
}
|
||
else if (signType == 1)
|
||
{
|
||
r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||
Captcha.text,
|
||
wxInfoJson.Value<string>("unionid"),
|
||
wxInfoJson.Value<string>("openid"),
|
||
wxInfoJson.Value<string>("headimgurl"),
|
||
wxInfoJson.Value<string>("nickname"),
|
||
wxInfoJson.Value<int>("sex"),
|
||
Password.text);
|
||
}
|
||
if (r != null && r.result)
|
||
{
|
||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||
RefreshWx3(u);
|
||
LoadInfo();
|
||
StartScrollSign(1);
|
||
}
|
||
else
|
||
{
|
||
var errorList = JArray.FromObject(r.data);
|
||
Utils.SetValidate(signFormDict, errorList);
|
||
Utils.showToast(gameObject, r.errMsg, 1);
|
||
}
|
||
}
|
||
|
||
async void goRegNextWithoutPass()
|
||
{
|
||
var Email = signForm.email;
|
||
var Captcha = signForm.captcha;
|
||
var r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||
Captcha.text,
|
||
wxInfoJson.Value<string>("unionid"),
|
||
wxInfoJson.Value<string>("openid"),
|
||
wxInfoJson.Value<string>("headimgurl"),
|
||
wxInfoJson.Value<string>("nickname"),
|
||
wxInfoJson.Value<int>("sex"),
|
||
"");
|
||
if (r.result)
|
||
{
|
||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||
RefreshWx3(u);
|
||
StartScrollPanel(4);
|
||
}
|
||
else
|
||
{
|
||
Utils.showToast(gameObject, r.errMsg);
|
||
}
|
||
}
|
||
void RefreshWx3(UserResultModel data)
|
||
{
|
||
Utils.DisplayImage(StartCoroutine,
|
||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||
data.WxHeadImg);
|
||
wxLogin3.Find("NickName").GetComponent<Text>().text = data.Nickname;
|
||
userResult = data;
|
||
}
|
||
async void goRegEnd()
|
||
{
|
||
if (!await UpdateInfo()) return;
|
||
if (pageNums == 5)
|
||
{
|
||
this.StartScrollPanel(4);
|
||
}
|
||
else
|
||
{
|
||
this.StartScrollPanel(3);
|
||
}
|
||
//throw new NotImplementedException();
|
||
}
|
||
void LoadInfo()
|
||
{
|
||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||
var _months = signForm.months.GetComponent<PFUIDropdown>();
|
||
var _years = signForm.years.GetComponent<PFUIDropdown>();
|
||
|
||
var _genders = signForm.genders.GetComponent<PFUIDropdown>();
|
||
var _countrys = signForm.countrys.GetComponent<PFUIDropdown>();
|
||
var _units = signForm.units.GetComponent<PFUIDropdown>();
|
||
var _weight = signForm.weight.GetComponent<PFUIInputField>();
|
||
var _height = signForm.height.GetComponent<PFUIInputField>();
|
||
if (userResult.Birthday.HasValue)
|
||
{
|
||
_days.SelectValue(userResult.Birthday.Value.Day.ToString());
|
||
_months.SelectValue(userResult.Birthday.Value.Month.ToString());
|
||
_years.SelectValue(userResult.Birthday.Value.Year.ToString());
|
||
}
|
||
_genders.SelectIndex(userResult.Sex - 1);
|
||
_countrys.SelectIndex(UIManager.Instance.loginRegOptions.GetCountryIndexByName(userResult.Country));
|
||
_units.SelectIndex(userResult.Unit);
|
||
_weight.Text = userResult.Weight.ToString();
|
||
_height.Text = userResult.Height.ToString();
|
||
}
|
||
async Task<bool> UpdateInfo()
|
||
{
|
||
if (userResult == null) return false;
|
||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||
var _months = signForm.months.GetComponent<PFUIDropdown>();
|
||
var _years = signForm.years.GetComponent<PFUIDropdown>();
|
||
var _genders = signForm.genders.GetComponent<PFUIDropdown>();
|
||
var _countrys = signForm.countrys.GetComponent<PFUIDropdown>();
|
||
var _units = signForm.units.GetComponent<PFUIDropdown>();
|
||
var _weight = signForm.weight.GetComponent<PFUIInputField>();
|
||
var _height = signForm.height.GetComponent<PFUIInputField>();
|
||
if (signForm.years.value != -1 && signForm.months.value != -1 && signForm.days.value != -1)
|
||
{
|
||
userResult.Birthday = new DateTime(int.Parse(_years.SelectedItem), int.Parse(_months.SelectedItem), int.Parse(_days.SelectedItem));
|
||
}
|
||
else
|
||
{
|
||
var errorList = new List<object>();
|
||
errorList.Add(new { Field="Years", ErrMsg="" });
|
||
errorList.Add(new { Field = "Months", ErrMsg = "" });
|
||
errorList.Add(new { Field = "Days", ErrMsg = "" });
|
||
Utils.SetValidate(signFormDict, JArray.FromObject(errorList));
|
||
Utils.showToast(gameObject, "请选择生日");
|
||
return false;
|
||
}
|
||
userResult.Sex = _genders.SelectedIndex + 1;
|
||
userResult.Country = UIManager.Instance.loginRegOptions.GetCountryName(_countrys.SelectedIndex);
|
||
userResult.Unit = _units.SelectedIndex;
|
||
userResult.Weight = int.Parse(_weight.Text);
|
||
userResult.Height = int.Parse(_height.Text);
|
||
if (string.IsNullOrEmpty(userResult.Nickname))
|
||
{
|
||
userResult.Nickname = userResult.Phone;
|
||
}
|
||
var r = await ConfigHelper.userApi.Update(userResult);
|
||
return r.result;
|
||
//userResult.Birthday.v
|
||
}
|
||
private void goLoginReturn2()
|
||
{
|
||
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
|
||
//if (wxLogin3.gameObject.activeSelf) wxLogin3.gameObject.SetActive(false);
|
||
pageNums = 4;
|
||
Canvas.ForceUpdateCanvases();
|
||
this.StartScrollPanel(1);
|
||
}
|
||
|
||
void ReturnQuick()
|
||
{
|
||
if (imagexf != null)
|
||
{
|
||
imagexf.DOLocalMoveY(-575, 0.3f);
|
||
}
|
||
if (imagedf != null)
|
||
{
|
||
imagedf.DOLocalMoveY(-128, 0.3f);
|
||
}
|
||
if (LoginBg != null)
|
||
{
|
||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(360, 385), 0.3f);
|
||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-94, 0.3f);
|
||
}
|
||
this.StartScrollPanel(0);
|
||
}
|
||
public void goLogin(bool noReturn = false)
|
||
{
|
||
if (imagexf != null)
|
||
{
|
||
imagexf.DOLocalMoveY(-669, 0.3f);
|
||
}
|
||
if (imagedf != null)
|
||
{
|
||
imagedf.DOLocalMoveY(-34, 0.3f);
|
||
}
|
||
if (LoginBg != null)
|
||
{
|
||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(360, 573), 0.3f);
|
||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(0, 0.3f);
|
||
}
|
||
//DOTween.To(() => o, x => o = x, t, 0.3f);
|
||
this.StartScrollPanel(1);
|
||
if (noReturn)
|
||
{
|
||
loginContainer.Find("returnQuick").GetComponent<Button>().gameObject.SetActive(false);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 立刻跳到登录页并且返回按钮强行失效
|
||
/// </summary>
|
||
private void goLoginImmediately()
|
||
{
|
||
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);
|
||
var scrollValue = 1f / (pageNums - 1);
|
||
var value = 1 * scrollValue;
|
||
scrollPanel.horizontalNormalizedPosition = value;
|
||
loginContainer.Find("returnQuick").GetComponent<Button>().gameObject.SetActive(false);
|
||
}
|
||
void goSign(bool isAccount = true)
|
||
{
|
||
if (!isAccount)
|
||
{
|
||
pageNums = 5;
|
||
//wxLogin2.gameObject.SetActive(false);
|
||
signPage1.Find("next").gameObject.SetActive(false);
|
||
signPage1.Find("previousThird").gameObject.SetActive(true);
|
||
signPage1.Find("signThird").gameObject.SetActive(true);
|
||
ShowPassword();
|
||
this.StartScrollPanel(3);
|
||
this.StartScrollSign(0);
|
||
}
|
||
else
|
||
{
|
||
pageNums = 4;
|
||
wxLogin2.gameObject.SetActive(false);
|
||
|
||
signPage1.Find("next").gameObject.SetActive(true);
|
||
signPage1.Find("previousThird").gameObject.SetActive(false);
|
||
signPage1.Find("signThird").gameObject.SetActive(false);
|
||
ShowPassword();
|
||
this.StartScrollPanel(2);
|
||
this.StartScrollSign(0);
|
||
}
|
||
}
|
||
void goMain(Transform gou)
|
||
{
|
||
var data = userResult;
|
||
if (data == null) return;
|
||
//ConfigHelper.CurrentUser = res.data;
|
||
if (gou != null && gou.gameObject.activeSelf)
|
||
{
|
||
SaveInfo(data);
|
||
//PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||
}
|
||
else
|
||
{
|
||
var u = userInfos.Find(x => x.Id == data.Id);
|
||
if (u != null)
|
||
{
|
||
userInfos.Remove(u);
|
||
}
|
||
UIManager.Instance.userInfos = userInfos;
|
||
UIManager.Instance.userInfoIndex = 0;
|
||
}
|
||
App.CurrentUser = data;
|
||
//App.CurrentUser = new UserModel
|
||
//{
|
||
// NickName = data.Nickname,
|
||
// Ftp = data.FTP,
|
||
// Weight = data.Weight,
|
||
// BicycleWeight = data.BicycleWeight,
|
||
// Carlories = "",
|
||
// Avatar = data.WxHeadImg,
|
||
// Distance = 0,
|
||
// Climb = "",
|
||
//};
|
||
SceneManager.LoadScene("MainScene");
|
||
}
|
||
public void SaveInfo(UserResultModel data)
|
||
{
|
||
var index = userInfos.FindIndex(x => x.Id == data.Id);
|
||
if (index == -1)
|
||
{
|
||
userInfos.Add(new QUserInfo
|
||
{
|
||
Id = data.Id,
|
||
NickName = data.Nickname,
|
||
Avatar = data.WxHeadImg,
|
||
Cookie = data.cookie,
|
||
Phone = data.Phone
|
||
});
|
||
index = userInfos.Count - 1;
|
||
}
|
||
else
|
||
{
|
||
var u = userInfos[index];
|
||
u.Id = data.Id;
|
||
u.NickName = data.Nickname;
|
||
u.Avatar = data.WxHeadImg;
|
||
u.Cookie = data.cookie;
|
||
u.Phone = data.Phone;
|
||
//userInfos.Insert(0, new QUserInfo
|
||
//{
|
||
// Id = data.Id,
|
||
// NickName = data.Nickname,
|
||
// Avatar = data.WxHeadImg,
|
||
// Cookie = data.cookie
|
||
//});
|
||
//userInfos.Remove(u);
|
||
}
|
||
UIManager.Instance.userInfos = userInfos;
|
||
UIManager.Instance.userInfoIndex = index;
|
||
//PlayerPrefs.SetInt("UserInfoIndex", index);
|
||
}
|
||
async void Submit()
|
||
{
|
||
//if (loginForm.email == null || loginForm.password == null)
|
||
//{
|
||
// Utils.showToast(gameObject, "未绑定", 1);
|
||
// return;
|
||
//}
|
||
//if (string.IsNullOrEmpty(loginForm.email.text) || string.IsNullOrEmpty(loginForm.password.text))
|
||
//{
|
||
// Utils.showToast(gameObject, "请输入信息", 1);
|
||
// return;
|
||
//}
|
||
//var res = await Global.userApi.Login(phone.text, pwd.text, "");
|
||
//测试用
|
||
|
||
var res = await ConfigHelper.userApi.LoginV1(loginForm.email.text, loginForm.password.text, "");
|
||
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
||
if (res.result)
|
||
{
|
||
userResult = JObject.FromObject(res.data).ToObject<UserResultModel>();
|
||
goMain(remember.transform.Find("Gou"));
|
||
}
|
||
else
|
||
{
|
||
if (res.data != null)
|
||
{
|
||
var errorList = JArray.FromObject(res.data);
|
||
Utils.SetValidate(formDict, errorList);
|
||
}
|
||
Utils.showToast(gameObject, res.errMsg);
|
||
}
|
||
}
|
||
// Update is called once per frame
|
||
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)
|
||
{
|
||
loginForm.password.ActivateInputField();
|
||
}
|
||
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
|
||
{
|
||
if (loginForm != null && !string.IsNullOrEmpty(loginForm.email.text) && !string.IsNullOrEmpty(loginForm.password.text))
|
||
{
|
||
Submit();
|
||
}
|
||
}
|
||
if (startCaptcha)
|
||
{
|
||
CaptchaTimerTick();
|
||
}
|
||
goScrollPanel();
|
||
goScrollSign();
|
||
//if (Input.GetKeyDown(KeyCode.Return) && )
|
||
//{
|
||
//}
|
||
//if (Input.GetKeyDown(KeyCode.Return)) {
|
||
// Debug.Log("回车键");
|
||
// if (pwd.isFocused)
|
||
// {
|
||
// this.Submit();
|
||
// }
|
||
//}
|
||
}
|
||
|
||
#region 主页面滑动逻辑
|
||
private int tmpImdex = 0;
|
||
private int scrollPanelIndex = 2;
|
||
//private float scrollValue = 0.5f;
|
||
private bool startScrollPanel = false;
|
||
private void StartScrollPanel(int index)
|
||
{
|
||
if (startScrollPanel) return;
|
||
scrollPanelIndex = index;
|
||
startScrollPanel = true;
|
||
}
|
||
private int pageNums = 4;
|
||
private void goScrollPanel()
|
||
{
|
||
var index = scrollPanelIndex;
|
||
var scrollValue = 1f/(pageNums - 1);
|
||
var value = index * scrollValue;
|
||
if (scrollPanel != null && startScrollPanel)
|
||
{
|
||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||
{
|
||
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 20);
|
||
if (scrollPanel.horizontalNormalizedPosition <= value)
|
||
{
|
||
scrollPanel.horizontalNormalizedPosition = value;
|
||
startScrollPanel = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
scrollPanel.horizontalNormalizedPosition += (scrollValue / 20);
|
||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||
{
|
||
scrollPanel.horizontalNormalizedPosition = value;
|
||
startScrollPanel = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
private void Test()
|
||
{
|
||
//if (startScrollPanel) return;
|
||
//scrollPanelIndex = ((int)System.Math.Pow(tmpImdex, 3)
|
||
// + 2*(int)System.Math.Pow(tmpImdex, 2)
|
||
// + 1) % 4;
|
||
//tmpImdex++;
|
||
//Debug.Log(scrollPanelIndex);
|
||
//startScrollPanel = true;
|
||
if (startScrollSign) return;
|
||
scrollSignIndex = (scrollSignIndex + 1) % 2;
|
||
Debug.Log(scrollSignIndex);
|
||
startScrollSign = true;
|
||
}
|
||
#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 (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)
|
||
{
|
||
var sex = wxInfoJson.Value<int>("sex");
|
||
if (sex > 0)
|
||
{
|
||
signForm.genders.value = sex - 1;
|
||
}
|
||
var country = wxInfoJson.Value<string>("country");
|
||
signForm.countrys.value = regOptions.GetCountryIndexByCode(country);
|
||
}
|
||
//if (string.IsNullOrEmpty(signForm.weight.text))
|
||
//{
|
||
// signForm.weight.text = "";
|
||
//}
|
||
//if (!string.IsNullOrEmpty(signForm.height.text))
|
||
//{
|
||
// signForm.height.text = "";
|
||
//}
|
||
}
|
||
signScrollBar.DOLocalMoveX((index-1) *160, 0.2f);
|
||
}
|
||
private void goScrollSign()
|
||
{
|
||
float value = scrollSignIndex;
|
||
if (scrollSign != null && startScrollSign)
|
||
{
|
||
if (scrollSignIndex == 0)
|
||
{
|
||
scrollSign.horizontalNormalizedPosition -= (1f / 20);
|
||
if (scrollSign.horizontalNormalizedPosition <= 0)
|
||
{
|
||
scrollSign.horizontalNormalizedPosition = 0;
|
||
startScrollSign = false;
|
||
|
||
}
|
||
}
|
||
else if (scrollSignIndex == 1)
|
||
{
|
||
scrollSign.horizontalNormalizedPosition += (1f / 20);
|
||
if (scrollSign.horizontalNormalizedPosition >= 1)
|
||
{
|
||
scrollSign.horizontalNormalizedPosition = 1;
|
||
startScrollSign = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
}
|