Ver a proveniência

bug修复

master
LuanShi há 2 meses
ascendente
cometimento
952315fdf0
4 ficheiros alterados com 48 adições e 15 eliminações
  1. +0
    -4
      Assets/Plugins/SDK/NativeBridgeUtil.cs
  2. +32
    -9
      Assets/Scripts/LoginAndPay/LoginView.cs
  3. +14
    -0
      Assets/Scripts/LoginAndPay/http/LoginRequest.cs
  4. +2
    -2
      ProjectSettings/ProjectSettings.asset

+ 0
- 4
Assets/Plugins/SDK/NativeBridgeUtil.cs Ver ficheiro

@@ -1,11 +1,7 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using ETHotfix.com.commsdk.unity3d; using ETHotfix.com.commsdk.unity3d;
using System.Text.RegularExpressions;
using System; using System;
using System.Collections.Generic;
using ETModel;
using ETModel.com.commsdk.unity3d;


+ 32
- 9
Assets/Scripts/LoginAndPay/LoginView.cs Ver ficheiro

@@ -34,7 +34,7 @@ public class LoginView : MonoBehaviour
string cachedPhoneNumber = PlayerPrefs.GetString("CachedPhoneNumber", ""); string cachedPhoneNumber = PlayerPrefs.GetString("CachedPhoneNumber", "");
string cachedWxUnionId = PlayerPrefs.GetString("CachedWxUnionId", ""); 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.phoneNum = cachedPhoneNumber;
HttpManager.Instance.wxUnionID = cachedWxUnionId; 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() private void CheckAuthorized()
{ {
if (isWeChatAuthorized && isPhoneAuthorized) if (isWeChatAuthorized && isPhoneAuthorized)
{ {
SceneManager.LoadScene("LoadingScreen");
//SceneManager.LoadScene("LoadingScreen");
WxAndPhoneLoginTask().Forget();
} }
else if (isWeChatAuthorized && !isPhoneAuthorized) else if (isWeChatAuthorized && !isPhoneAuthorized)
{ {
WxBindButton.gameObject.SetActive(true);
PhoneTrans.SetActive(false);
WxBindButton.gameObject.SetActive(false);
PhoneTrans.SetActive(true);
loginBthTrans.SetActive(false); loginBthTrans.SetActive(false);
} }
else if (isPhoneAuthorized && !isWeChatAuthorized) else if (isPhoneAuthorized && !isWeChatAuthorized)
{ {
WxBindButton.gameObject.SetActive(false);
PhoneTrans.SetActive(true);
WxBindButton.gameObject.SetActive(true);
PhoneTrans.SetActive(false);
loginBthTrans.SetActive(false); loginBthTrans.SetActive(false);
} }
if (!isPhoneAuthorized && !isWeChatAuthorized) if (!isPhoneAuthorized && !isWeChatAuthorized)
@@ -172,9 +195,9 @@ public class LoginView : MonoBehaviour
NativeBridgeUtil.Instance.WeChatLogin(1); NativeBridgeUtil.Instance.WeChatLogin(1);
} }
void ClickWxBindButton()
{
NativeBridgeUtil.Instance.WeChatLogin(1);
void ClickWxBindButton()
{
NativeBridgeUtil.Instance.WeChatLogin(1);
} }
} }

+ 14
- 0
Assets/Scripts/LoginAndPay/http/LoginRequest.cs Ver ficheiro

@@ -65,3 +65,17 @@ public class PaymentStatusResponse : WWWResponse
public string data; public string data;
public string message; public string message;
} }

[Serializable]
public class WxAndPhoneLoginRequest : WWWRequest
{
public string uinid;
public string iphone_num;
}
[Serializable]
public class WxAndPhoneLoginResponse : WWWResponse
{
public int code;
public string message;
}

+ 2
- 2
ProjectSettings/ProjectSettings.asset Ver ficheiro

@@ -157,7 +157,7 @@ PlayerSettings:
buildNumber: {} buildNumber: {}
AndroidBundleVersionCode: 1 AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16 AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0
AndroidTargetSdkVersion: 28
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
aotOptions: aotOptions:
stripEngineCode: 1 stripEngineCode: 1
@@ -244,7 +244,7 @@ PlayerSettings:
AndroidTargetArchitectures: 1 AndroidTargetArchitectures: 1
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
AndroidKeystoreName: G:/work/unity/unity2018/ZhenShiXunYouJi3/zsmxj.keystore
AndroidKeystoreName: H:/Work/unityWork/unity2018workGit/ZhenShiXunYouJi2/zsmxj.keystore
AndroidKeyaliasName: zsmxj AndroidKeyaliasName: zsmxj
AndroidBuildApkPerCpuArchitecture: 0 AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0 AndroidTVCompatibility: 0


Carregando…
Cancelar
Guardar