Merge remote-tracking branch 'origin/dev' into dev_lishuo
This commit is contained in:
commit
a96d538dc1
86 files changed
+8879
-1515
No files matched your search
@@ -26,6 +26,7 @@ using ZenFulcrum.EmbeddedBrowser;
|
||||
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; }
|
||||
@@ -59,6 +60,8 @@ public class LoginController : MonoBehaviour
|
||||
private Transform quickContainer;
|
||||
private Transform loginContainer;
|
||||
private Transform signContainer;
|
||||
//修改高度
|
||||
Transform LoginBg;
|
||||
/*初始页面*/
|
||||
LoginForm loginForm;
|
||||
[SerializeField] Button loginReturn2;
|
||||
@@ -74,11 +77,11 @@ public class LoginController : MonoBehaviour
|
||||
private Transform signScrollBar;
|
||||
private SignForm signForm;
|
||||
private LoginRegOptions regOptions;
|
||||
|
||||
|
||||
private ScrollRect scrollPanel;
|
||||
private ScrollRect scrollSign;
|
||||
private ScrollRect scrollAvatar;
|
||||
private Transform imagexf,imagedf;
|
||||
private Transform imagexf, imagedf;
|
||||
//注册主页面
|
||||
private UserResultModel userResult;
|
||||
/*微信相关*/
|
||||
@@ -98,7 +101,10 @@ public class LoginController : MonoBehaviour
|
||||
//其他
|
||||
[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()
|
||||
{
|
||||
@@ -130,6 +136,7 @@ public class LoginController : MonoBehaviour
|
||||
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");
|
||||
@@ -140,18 +147,30 @@ public class LoginController : MonoBehaviour
|
||||
scrollSign = signScrollView.GetComponent<ScrollRect>();
|
||||
var content = signScrollView.transform.Find("Viewport").Find("Content");
|
||||
signPage1 = content.Find("FirstPage");
|
||||
signPage1.Find("next").GetComponent<Button>().onClick.AddListener(()=> { goRegNext(); });
|
||||
signPage1.Find("Captcha").Find("BtnGet").GetComponent<Button>().onClick.AddListener(GetCaptcha);
|
||||
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>();
|
||||
//第三方登录要用的按钮
|
||||
signPage1.Find("previousThird").GetComponent<Button>().onClick.AddListener(goThirdPrev);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
|
||||
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");
|
||||
signPage2.Find("previous").GetComponent<Button>().onClick.AddListener(goRegPrev);
|
||||
signPage2.Find("sign").GetComponent<Button>().onClick.AddListener(goRegEnd);
|
||||
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>();
|
||||
@@ -168,7 +187,7 @@ public class LoginController : MonoBehaviour
|
||||
days.captionText.text = "Day";
|
||||
years.onValueChanged.AddListener((int index) =>
|
||||
{
|
||||
if (index != -1 && months.value!=-1)
|
||||
if (index != -1 && months.value != -1)
|
||||
{
|
||||
days.options = regOptions.GetDayOptions(int.Parse(years.captionText.text), int.Parse(months.captionText.text));
|
||||
days.value = 0;
|
||||
@@ -213,31 +232,28 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
scrollAvatar = avatarScrollView.GetComponent<ScrollRect>();
|
||||
var content = scrollAvatar.transform.Find("Viewport").Find("Content");
|
||||
foreach (var user in userInfos)
|
||||
foreach (var user in userInfos)
|
||||
{
|
||||
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/QuickUserInfo")).transform;
|
||||
info.GetComponent<QuickLoginUser>().Initial(user,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);
|
||||
content.Find("empty2").transform.SetSiblingIndex(content.childCount - 1);
|
||||
scrollAvatar.GetComponent<QuickLoginScroll>().Initial();
|
||||
}
|
||||
if (quickContainer != null)
|
||||
if (quickContainer != null)
|
||||
{
|
||||
var loginNewAccount = quickContainer.Find("loginNewAccount").GetComponent<Button>();
|
||||
loginNewAccount.onClick.AddListener(goLogin);
|
||||
UIManager.AddEvent(loginNewAccount.gameObject, EventTriggerType.PointerClick, (b) => goLogin());
|
||||
}
|
||||
if (loginContainer != null)
|
||||
if (loginContainer != null)
|
||||
{
|
||||
var returnQuick = loginContainer.Find("returnQuick").GetComponent<Button>();
|
||||
UIManager.AddEvent(returnQuick.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
ReturnQuick();
|
||||
});
|
||||
UIManager.AddEvent(returnQuick.gameObject, EventTriggerType.PointerClick, (b) => ReturnQuick());
|
||||
var sign = loginContainer.Find("reg").GetComponent<Button>();
|
||||
sign.onClick.AddListener(() => goSign());
|
||||
UIManager.AddEvent(sign.gameObject, EventTriggerType.PointerClick, (b) => goSign());
|
||||
remember = loginContainer.Find("rememberButton").GetComponent<Button>();
|
||||
UIManager.AddEvent(remember.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
@@ -252,7 +268,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
});
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
wechatLogin.onClick.AddListener(() =>
|
||||
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
if (wxLock) return;
|
||||
wxLock = true;
|
||||
@@ -266,8 +282,13 @@ public class LoginController : MonoBehaviour
|
||||
//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>();
|
||||
login.onClick.AddListener(Submit);
|
||||
UIManager.AddEvent(login.gameObject, EventTriggerType.PointerClick, (b) => Submit());
|
||||
//login.onClick.AddListener(Submit);
|
||||
loginForm = new LoginForm()
|
||||
{
|
||||
email = loginContainer.Find("phone").GetComponent<InputField>(),
|
||||
@@ -278,7 +299,7 @@ public class LoginController : MonoBehaviour
|
||||
//{
|
||||
// loginReturn2.onClick.AddListener(goLoginReturn2);
|
||||
//}
|
||||
if (signContainer != null)
|
||||
if (signContainer != null)
|
||||
{
|
||||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||||
UIManager.AddEvent(loginr2.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
@@ -293,14 +314,15 @@ public class LoginController : MonoBehaviour
|
||||
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.Url = "chrome://version/";
|
||||
wxBrowser.LoadHTML("<div/>");
|
||||
//wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
@@ -329,9 +351,9 @@ public class LoginController : MonoBehaviour
|
||||
//browser.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxLogin2 = mainContent.Find("FormContainer-wx2");
|
||||
if (wxLogin2!=null)
|
||||
if (wxLogin2 != null)
|
||||
{
|
||||
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
@@ -341,7 +363,7 @@ public class LoginController : MonoBehaviour
|
||||
Canvas.ForceUpdateCanvases();
|
||||
StartScrollPanel(1);
|
||||
});
|
||||
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(()=>
|
||||
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
this.goSign(false);
|
||||
});
|
||||
@@ -368,20 +390,15 @@ public class LoginController : MonoBehaviour
|
||||
var gou = wxLogin3.Find("rememberButton").Find("Gou").gameObject;
|
||||
gou.SetActive(!gou.activeSelf);
|
||||
});
|
||||
//wxLogin3.Find("rememberButton").GetComponent<Button>().onClick.AddListener(()=>
|
||||
//{
|
||||
|
||||
//});
|
||||
wxLogin3.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
|
||||
UIManager.AddEvent(wxLogin3.Find("Next").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goMain(wxLogin3.Find("rememberButton").Find("Gou"));
|
||||
//goMain
|
||||
});
|
||||
}
|
||||
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)
|
||||
if (toolContainer != null)
|
||||
{
|
||||
UIManager.AddEvent(toolContainer.Find("Setting").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
@@ -400,19 +417,62 @@ public class LoginController : MonoBehaviour
|
||||
// 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()
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
wxBrowser.EvalJS(@"
|
||||
console.log(document.getElementsByClassName('qrcode')[0]);
|
||||
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';
|
||||
");
|
||||
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()
|
||||
@@ -440,7 +500,7 @@ public class LoginController : MonoBehaviour
|
||||
if (r.result)
|
||||
{
|
||||
JObject data = JObject.FromObject(r.data);
|
||||
if (data.Value<string>("success")!=null && data.Value<string>("success") == "False")
|
||||
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
||||
{
|
||||
wxLogin2.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
@@ -500,12 +560,12 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
var btn = signPage1.Find("Captcha").Find("BtnGet");
|
||||
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
|
||||
var Email = signForm.email;
|
||||
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)
|
||||
if (r.data.Value<bool>("isExist") && pageNums == 5)
|
||||
{
|
||||
HidePassword();
|
||||
}
|
||||
@@ -513,6 +573,7 @@ public class LoginController : MonoBehaviour
|
||||
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;
|
||||
@@ -520,7 +581,7 @@ public class LoginController : MonoBehaviour
|
||||
//timer.Enabled = true;
|
||||
//btnGet.
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
@@ -537,12 +598,16 @@ public class LoginController : MonoBehaviour
|
||||
|
||||
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);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
|
||||
}
|
||||
void CaptchaTimerTick()
|
||||
void CaptchaTimerTick()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
@@ -554,13 +619,14 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
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>();
|
||||
@@ -569,7 +635,7 @@ public class LoginController : MonoBehaviour
|
||||
//rect.SetSiblingIndex(rect.childCount-1);
|
||||
}
|
||||
|
||||
private void OnLoginInputSelect(BaseEventData arg0,GameObject game)
|
||||
private void OnLoginInputSelect(BaseEventData arg0, GameObject game)
|
||||
{
|
||||
var image = game.transform.GetComponent<Image>();
|
||||
image.sprite = Resources.Load<Sprite>("Images/gl");
|
||||
@@ -588,13 +654,13 @@ public class LoginController : MonoBehaviour
|
||||
var Captcha = signForm.captcha;
|
||||
var Password = signForm.password;
|
||||
var CPassword = signForm.cpassword;
|
||||
if (Password.text != CPassword.text)
|
||||
if (Password.text != CPassword.text)
|
||||
{
|
||||
Utils.showToast(gameObject,"两次密码输入不一致");
|
||||
Utils.showToast(gameObject, "两次密码输入不一致");
|
||||
return;
|
||||
}
|
||||
//JsonConvert
|
||||
JsonResult<UserResultModel> r = null;
|
||||
JsonResult<object> r = null;
|
||||
if (signType == 0)
|
||||
{
|
||||
r = await ConfigHelper.userApi.Register(Email.text, Password.text, Captcha.text);
|
||||
@@ -610,17 +676,38 @@ public class LoginController : MonoBehaviour
|
||||
wxInfoJson.Value<int>("sex"),
|
||||
Password.text);
|
||||
}
|
||||
if (r!=null && r.result)
|
||||
if (r != null && r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||||
RefreshWx3(u);
|
||||
LoadInfo();
|
||||
StartScrollSign(1);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
var errorList = JArray.FromObject(r.data);
|
||||
SetValidate(signFormDict, errorList);
|
||||
Utils.showToast(gameObject, r.errMsg, 1);
|
||||
}
|
||||
}
|
||||
void SetValidate(Dictionary<string,Selectable> dict,JArray errorList)
|
||||
{
|
||||
foreach (var error in errorList)
|
||||
{
|
||||
var className = dict[error.Value<string>("Field")].GetType().Name;
|
||||
if (className == "InputField")
|
||||
{
|
||||
dict[error.Value<string>("Field")].GetComponent<PFUIInputField>()
|
||||
.SetValidate(true);
|
||||
}
|
||||
else if (className == "Dropdown")
|
||||
{
|
||||
dict[error.Value<string>("Field")].GetComponent<PFUIDropdown>()
|
||||
.SetValidate();
|
||||
}
|
||||
//formDict[error.Value<string>("Filed")].error.Value<string>("ErrMsg");
|
||||
}
|
||||
}
|
||||
async void goRegNextWithoutPass()
|
||||
{
|
||||
var Email = signForm.email;
|
||||
@@ -635,7 +722,8 @@ public class LoginController : MonoBehaviour
|
||||
"");
|
||||
if (r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
var u = JObject.FromObject(r.data).ToObject<UserResultModel>();
|
||||
RefreshWx3(u);
|
||||
StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
@@ -643,7 +731,7 @@ public class LoginController : MonoBehaviour
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void RefreshWx3(UserResultModel data)
|
||||
void RefreshWx3(UserResultModel data)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
@@ -653,8 +741,8 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
async void goRegEnd()
|
||||
{
|
||||
if(!await UpdateInfo()) return;
|
||||
if (pageNums == 5)
|
||||
if (!await UpdateInfo()) return;
|
||||
if (pageNums == 5)
|
||||
{
|
||||
this.StartScrollPanel(4);
|
||||
}
|
||||
@@ -664,7 +752,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
void LoadInfo()
|
||||
void LoadInfo()
|
||||
{
|
||||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||||
var _months = signForm.months.GetComponent<PFUIDropdown>();
|
||||
@@ -681,13 +769,13 @@ public class LoginController : MonoBehaviour
|
||||
_months.SelectValue(userResult.Birthday.Value.Month.ToString());
|
||||
_years.SelectValue(userResult.Birthday.Value.Year.ToString());
|
||||
}
|
||||
_genders.SelectIndex(userResult.Sex-1);
|
||||
_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()
|
||||
async Task<bool> UpdateInfo()
|
||||
{
|
||||
if (userResult == null) return false;
|
||||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||||
@@ -698,16 +786,26 @@ public class LoginController : MonoBehaviour
|
||||
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)
|
||||
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 = "" });
|
||||
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))
|
||||
if (string.IsNullOrEmpty(userResult.Nickname))
|
||||
{
|
||||
userResult.Nickname = userResult.Phone;
|
||||
}
|
||||
@@ -724,7 +822,7 @@ public class LoginController : MonoBehaviour
|
||||
this.StartScrollPanel(1);
|
||||
}
|
||||
|
||||
void ReturnQuick()
|
||||
void ReturnQuick()
|
||||
{
|
||||
if (imagexf != null)
|
||||
{
|
||||
@@ -734,11 +832,16 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
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);
|
||||
}
|
||||
void goLogin()
|
||||
public void goLogin(bool noReturn = false)
|
||||
{
|
||||
if (imagexf != null)
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMoveY(-669, 0.3f);
|
||||
}
|
||||
@@ -746,7 +849,32 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -818,7 +946,8 @@ public class LoginController : MonoBehaviour
|
||||
Id = data.Id,
|
||||
NickName = data.Nickname,
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
Cookie = data.cookie,
|
||||
Phone = data.Phone
|
||||
});
|
||||
index = userInfos.Count - 1;
|
||||
}
|
||||
@@ -829,6 +958,7 @@ public class LoginController : MonoBehaviour
|
||||
u.NickName = data.Nickname;
|
||||
u.Avatar = data.WxHeadImg;
|
||||
u.Cookie = data.cookie;
|
||||
u.Phone = data.Phone;
|
||||
//userInfos.Insert(0, new QUserInfo
|
||||
//{
|
||||
// Id = data.Id,
|
||||
@@ -844,27 +974,30 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
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;
|
||||
}
|
||||
//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.Login(loginForm.email.text, loginForm.password.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 = res.data;
|
||||
userResult = JObject.FromObject(res.data).ToObject<UserResultModel>();
|
||||
goMain(remember.transform.Find("Gou"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorList = JArray.FromObject(res.data);
|
||||
SetValidate(formDict, errorList);
|
||||
Utils.showToast(gameObject, res.errMsg);
|
||||
}
|
||||
}
|
||||
@@ -959,6 +1092,7 @@ public class LoginController : MonoBehaviour
|
||||
private bool startScrollSign = false;
|
||||
private int scrollSignIndex = 0;
|
||||
|
||||
|
||||
private void StartScrollSign(int index)
|
||||
{
|
||||
if (startScrollSign) return;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Mapbox.Examples;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using Mapbox.Examples;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -11,17 +14,23 @@ public class MainController : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
Version = this.transform.Find("GameObject").Find("Version").GetComponent<Text>();
|
||||
Version.text = "Version:"+App.AppVersion;
|
||||
Version.text = "V"+App.AppVersion;
|
||||
|
||||
AntConnector.Instance();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
async void Start()
|
||||
{
|
||||
UIManager.Instance.Root = root;
|
||||
UIManager.Instance.MainPanel = this.transform.Find("Panel").GetComponent<PFUIPanel>();
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
|
||||
if (App.CurrentUser == null)
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
|
||||
//MainMenu.transform.Find("Home").GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// UIManager.ShowHomePanel();
|
||||
@@ -52,4 +61,15 @@ public class MainController : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async Task Login()
|
||||
{
|
||||
var result = await ConfigHelper.userApi.Login("13115011550", "laozhong", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
AntConnector.Instance().Dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user