|
|
@@ -34,7 +34,7 @@ public class LoginView : MonoBehaviour |
|
|
|
string cachedPhoneNumber = PlayerPrefs.GetString("CachedPhoneNumber", "");
|
|
|
|
string cachedWxUnionId = PlayerPrefs.GetString("CachedWxUnionId", "");
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cachedPhoneNumber) || !string.IsNullOrEmpty(cachedWxUnionId))
|
|
|
|
if (!string.IsNullOrEmpty(cachedPhoneNumber) && !string.IsNullOrEmpty(cachedWxUnionId))
|
|
|
|
{
|
|
|
|
HttpManager.Instance.phoneNum = cachedPhoneNumber;
|
|
|
|
HttpManager.Instance.wxUnionID = cachedWxUnionId;
|
|
|
@@ -128,22 +128,45 @@ public class LoginView : MonoBehaviour |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async UniTask WxAndPhoneLoginTask()
|
|
|
|
{
|
|
|
|
string phonenum = PhoneNumberInputField.text;
|
|
|
|
WxAndPhoneLoginResponse wxAndPhoneLoginResponse = await HttpManager.Instance.RequestPost<WxAndPhoneLoginRequest, WxAndPhoneLoginResponse>("wx-login", new WxAndPhoneLoginRequest() { uinid = HttpManager.Instance.wxUnionID, iphone_num = HttpManager.Instance.phoneNum });
|
|
|
|
if (wxAndPhoneLoginResponse.code == 0)
|
|
|
|
{
|
|
|
|
SceneManager.LoadScene("LoadingScreen");
|
|
|
|
} |
|
|
|
else |
|
|
|
{
|
|
|
|
PlayerPrefs.DeleteKey("CachedPhoneNumber");
|
|
|
|
PlayerPrefs.DeleteKey("CachedWxUnionId");
|
|
|
|
PlayerPrefs.Save();
|
|
|
|
|
|
|
|
HttpManager.Instance.wxUnionID = "";
|
|
|
|
HttpManager.Instance.phoneNum = "";
|
|
|
|
isWeChatAuthorized = false;
|
|
|
|
isPhoneAuthorized = false;
|
|
|
|
CheckAuthorized(); |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CheckAuthorized()
|
|
|
|
{
|
|
|
|
if (isWeChatAuthorized && isPhoneAuthorized)
|
|
|
|
{
|
|
|
|
SceneManager.LoadScene("LoadingScreen");
|
|
|
|
//SceneManager.LoadScene("LoadingScreen");
|
|
|
|
WxAndPhoneLoginTask().Forget();
|
|
|
|
}
|
|
|
|
else if (isWeChatAuthorized && !isPhoneAuthorized)
|
|
|
|
{
|
|
|
|
WxBindButton.gameObject.SetActive(true);
|
|
|
|
PhoneTrans.SetActive(false);
|
|
|
|
WxBindButton.gameObject.SetActive(false);
|
|
|
|
PhoneTrans.SetActive(true);
|
|
|
|
loginBthTrans.SetActive(false);
|
|
|
|
}
|
|
|
|
else if (isPhoneAuthorized && !isWeChatAuthorized)
|
|
|
|
{
|
|
|
|
WxBindButton.gameObject.SetActive(false);
|
|
|
|
PhoneTrans.SetActive(true);
|
|
|
|
WxBindButton.gameObject.SetActive(true);
|
|
|
|
PhoneTrans.SetActive(false);
|
|
|
|
loginBthTrans.SetActive(false);
|
|
|
|
}
|
|
|
|
if (!isPhoneAuthorized && !isWeChatAuthorized)
|
|
|
@@ -172,9 +195,9 @@ public class LoginView : MonoBehaviour |
|
|
|
NativeBridgeUtil.Instance.WeChatLogin(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClickWxBindButton() |
|
|
|
{ |
|
|
|
NativeBridgeUtil.Instance.WeChatLogin(1); |
|
|
|
void ClickWxBindButton()
|
|
|
|
{
|
|
|
|
NativeBridgeUtil.Instance.WeChatLogin(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|