增加登录请求
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BingoBrain
|
|||||||
|
|
||||||
public static string domainUrl => IsReleaseMode ? DomainReleaseUrl : DomainDebugUrl;
|
public static string domainUrl => IsReleaseMode ? DomainReleaseUrl : DomainDebugUrl;
|
||||||
|
|
||||||
public const string DomainDebugUrl = @"http://swhitegames.top/api/";
|
public const string DomainDebugUrl = @"http://api.jsoncompare.online/";
|
||||||
public static readonly string DomainReleaseUrl = $"https://{DomainRelease}/api/";
|
public static readonly string DomainReleaseUrl = $"https://{DomainRelease}/api/";
|
||||||
public const string DomainRelease = "bingoglassland.top";
|
public const string DomainRelease = "bingoglassland.top";
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ public class LoginSystem : BaseSystem
|
|||||||
|
|
||||||
private void AddListener()
|
private void AddListener()
|
||||||
{
|
{
|
||||||
// NetworkDispatcher.Instance.AddListener(NetworkMsg.Login, OnRequestLogin);
|
NetworkDispatcher.Instance.AddListener(NetworkMsg.Login, OnRequestLogin);
|
||||||
// NetworkDispatcher.Instance.AddListener(NetworkMsg.Reconnect, OnResponseReconnect);
|
// NetworkDispatcher.Instance.AddListener(NetworkMsg.Reconnect, OnResponseReconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveListener()
|
private void RemoveListener()
|
||||||
{
|
{
|
||||||
// NetworkDispatcher.Instance.RemoveListener(NetworkMsg.Login, OnRequestLogin);
|
NetworkDispatcher.Instance.RemoveListener(NetworkMsg.Login, OnRequestLogin);
|
||||||
|
|
||||||
// NetworkDispatcher.Instance.RemoveListener(NetworkMsg.Reconnect, OnResponseReconnect);
|
// NetworkDispatcher.Instance.RemoveListener(NetworkMsg.Reconnect, OnResponseReconnect);
|
||||||
}
|
}
|
||||||
@@ -52,6 +52,7 @@ public class LoginSystem : BaseSystem
|
|||||||
|
|
||||||
private void RequestLogin()
|
private void RequestLogin()
|
||||||
{
|
{
|
||||||
|
|
||||||
var requestLoginData = new RequestLoginData
|
var requestLoginData = new RequestLoginData
|
||||||
{
|
{
|
||||||
device_id = SystemInfo.deviceUniqueIdentifier,
|
device_id = SystemInfo.deviceUniqueIdentifier,
|
||||||
@@ -61,85 +62,91 @@ public class LoginSystem : BaseSystem
|
|||||||
channel = BingoBea.Instance.attribution,
|
channel = BingoBea.Instance.attribution,
|
||||||
sim = WebviewManager.haveSimCard
|
sim = WebviewManager.haveSimCard
|
||||||
};
|
};
|
||||||
|
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
|
||||||
Debug.Log(SystemInfo.deviceUniqueIdentifier);
|
Debug.Log(SystemInfo.deviceUniqueIdentifier);
|
||||||
GameHelper.PostFunnelLogin("loginSend");
|
GameHelper.PostFunnelLogin("loginSend");
|
||||||
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
|
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
|
||||||
//zhushi // NetworkKit.Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>
|
NetworkKit.Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>
|
||||||
// {
|
{
|
||||||
|
|
||||||
|
|
||||||
// if (isSuccess)
|
if (isSuccess)
|
||||||
// {
|
{
|
||||||
// var loginModel = GameHelper.GetLoginModel();
|
var loginModel = GameHelper.GetLoginModel();
|
||||||
// loginModel.cdn_url = loginData.cdn_url;
|
loginModel.cdn_url = loginData.cdn_url;
|
||||||
// loginModel.setting = loginData.setting;
|
loginModel.setting = loginData.setting;
|
||||||
// loginModel.play_data = loginData.play_data;
|
loginModel.play_data = loginData.play_data;
|
||||||
// loginModel.token = loginData.token;
|
loginModel.token = loginData.token;
|
||||||
// loginModel.uid = loginData.uid;
|
loginModel.uid = loginData.uid;
|
||||||
// loginModel.country = loginData.country;
|
loginModel.country = loginData.country;
|
||||||
// loginModel.expires_at = loginData.expires_at;
|
loginModel.expires_at = loginData.expires_at;
|
||||||
// loginModel.is_magic = loginData.is_magic;
|
loginModel.is_magic = loginData.is_magic;
|
||||||
// loginModel.invite_code = loginData.invite_code;
|
loginModel.invite_code = loginData.invite_code;
|
||||||
// loginModel.invite_url = loginData.invite_url;
|
loginModel.invite_url = loginData.invite_url;
|
||||||
// loginModel.last_login_time = loginData.last_login_time;
|
loginModel.last_login_time = loginData.last_login_time;
|
||||||
// loginModel.login_time = loginData.login_time;
|
loginModel.login_time = loginData.login_time;
|
||||||
// loginModel.reg_time = loginData.reg_time;
|
loginModel.reg_time = loginData.reg_time;
|
||||||
// loginModel.new_player = loginData.new_player;
|
loginModel.new_player = loginData.new_player;
|
||||||
// loginModel.debug_log = loginData.debug_log;
|
loginModel.debug_log = loginData.debug_log;
|
||||||
// loginModel.enwp = loginData.enwp;
|
loginModel.enwp = loginData.enwp;
|
||||||
|
|
||||||
|
|
||||||
// loginModel.preferences = new Preferences();
|
loginModel.preferences = new Preferences();
|
||||||
// NetworkKit.CDNUrl = $"{loginData.cdn_url}/";
|
NetworkKit.CDNUrl = $"{loginData.cdn_url}/";
|
||||||
// NetworkKit.SetCacheToken(loginData.token);
|
NetworkKit.SetCacheToken(loginData.token);
|
||||||
// //RequestHeart();
|
//RequestHeart();
|
||||||
// DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time);
|
DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time);
|
||||||
// Sequence mLoopSequence = DOTween.Sequence();
|
Sequence mLoopSequence = DOTween.Sequence();
|
||||||
// mLoopSequence.AppendCallback(() =>
|
mLoopSequence.AppendCallback(() =>
|
||||||
// {
|
{
|
||||||
// RequestHeart();
|
RequestHeart();
|
||||||
|
|
||||||
// }).AppendInterval(60).SetLoops(-1);
|
}).AppendInterval(60).SetLoops(-1);
|
||||||
// //TimerHelper.UnscaleGeneral.AddLoopTimer(60, (timer) => { RequestHeart(); });
|
//TimerHelper.UnscaleGeneral.AddLoopTimer(60, (timer) => { RequestHeart(); });
|
||||||
// //NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
//NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||||
// //UICtrlDispatcher.Instance.Dispatch(SkinInfo.EnterBingoUI_Open);
|
//UICtrlDispatcher.Instance.Dispatch(SkinInfo.EnterBingoUI_Open);
|
||||||
// PreferencesMgr.Instance.PlayerName = loginData.invite_code;
|
PreferencesMgr.Instance.PlayerName = loginData.invite_code;
|
||||||
// NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);
|
NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);
|
||||||
// MaxADKit.Init();
|
MaxADKit.Init();
|
||||||
// GameHelper.PostFunnelLogin("loginRecv", true);
|
GameHelper.PostFunnelLogin("loginRecv", true);
|
||||||
// if (GameHelper.IsGiftSwitch())
|
if (GameHelper.IsGiftSwitch())
|
||||||
// {
|
{
|
||||||
// GameObject.Find("MainCameraRoot").SetActive(false);
|
GameObject.Find("MainCameraRoot").SetActive(false);
|
||||||
// }
|
}
|
||||||
// else{
|
else
|
||||||
// GameObject.Find("sheep_parent").SetActive(false);
|
{
|
||||||
// }
|
GameObject.Find("sheep_parent").SetActive(false);
|
||||||
// }
|
}
|
||||||
// else
|
}
|
||||||
// {
|
else
|
||||||
// //UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
{
|
||||||
// Debug.Log("登陆请求失败");
|
Debug.Log(JsonConvert.SerializeObject(loginData));
|
||||||
// GameHelper.PostFunnelLogin("loginRecv", false);
|
//UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||||
|
Debug.Log("登陆请求失败");
|
||||||
|
GameHelper.PostFunnelLogin("loginRecv", false);
|
||||||
|
|
||||||
// float times = loginCount == 0 ? 0 : 5f;
|
float times = loginCount == 0 ? 0 : 5f;
|
||||||
|
|
||||||
// DOVirtual.DelayedCall(times,()=>{
|
DOVirtual.DelayedCall(times, () =>
|
||||||
// if (loginCount < LoginCountLimit) {
|
{
|
||||||
// loginCount++;
|
if (loginCount < LoginCountLimit)
|
||||||
// RequestLogin();
|
{
|
||||||
|
loginCount++;
|
||||||
|
RequestLogin();
|
||||||
|
|
||||||
// } else {
|
}
|
||||||
// loginCount = 0;
|
else
|
||||||
// Action _OnFail = () =>
|
{
|
||||||
// {
|
loginCount = 0;
|
||||||
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
Action _OnFail = () =>
|
||||||
// };
|
{
|
||||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
|
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||||
// }
|
};
|
||||||
// });
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -186,7 +193,7 @@ public partial class NetworkMsg
|
|||||||
|
|
||||||
public static uint UpdateCheckInviteData = ++MsgRootLogic;
|
public static uint UpdateCheckInviteData = ++MsgRootLogic;
|
||||||
|
|
||||||
public static string Identifier = "com.interactivegames123.bingograssland";
|
public static string Identifier = "com.interactivegames.bingotornado";
|
||||||
public static uint Start = ++MsgRootLogic;
|
public static uint Start = ++MsgRootLogic;
|
||||||
public static uint NotNetwork = ++MsgRootLogic;
|
public static uint NotNetwork = ++MsgRootLogic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public class NetworkKit
|
|||||||
var requestJson = SerializeUtil.ToJsonIndented(requestData);
|
var requestJson = SerializeUtil.ToJsonIndented(requestData);
|
||||||
|
|
||||||
var url2 = url;
|
var url2 = url;
|
||||||
// #if BingoBrainRelease
|
#if BingoBrainRelease
|
||||||
url2 = Base64Kit.Encode(url);
|
url2 = Base64Kit.Encode(url);
|
||||||
requestJson = Base64Kit.Encode(requestJson);
|
requestJson = Base64Kit.Encode(requestJson);
|
||||||
// #endif
|
#endif
|
||||||
var bytes = Encoding.UTF8.GetBytes(requestJson);
|
var bytes = Encoding.UTF8.GetBytes(requestJson);
|
||||||
var url1 = BingoBrain.Network.domainUrl + url2;
|
var url1 = BingoBrain.Network.domainUrl + url2;
|
||||||
//Debug.Log($"Url: {url1}");
|
//Debug.Log($"Url: {url1}");
|
||||||
@@ -59,7 +59,7 @@ public class NetworkKit
|
|||||||
loginRequest.SetRequestHeader(keyValuePair.Key, keyValuePair.Value);
|
loginRequest.SetRequestHeader(keyValuePair.Key, keyValuePair.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Debug.Log(JsonConvert.SerializeObject(loginRequest));
|
||||||
SetRequestContentType(loginRequest);
|
SetRequestContentType(loginRequest);
|
||||||
yield return loginRequest.SendWebRequest();
|
yield return loginRequest.SendWebRequest();
|
||||||
if (loginRequest.result is not UnityWebRequest.Result.Success)
|
if (loginRequest.result is not UnityWebRequest.Result.Success)
|
||||||
@@ -69,17 +69,17 @@ public class NetworkKit
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var receiveContent = loginRequest.downloadHandler.text;
|
var receiveContent = loginRequest.downloadHandler.text;
|
||||||
// #if BingoBrainRelease
|
#if BingoBrainRelease
|
||||||
if (!receiveContent.IsNullOrWhiteSpace())
|
if (!receiveContent.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
receiveContent = receiveContent.Substring(0, receiveContent.Length - 1);
|
receiveContent = receiveContent.Substring(0, receiveContent.Length - 1);
|
||||||
receiveContent = receiveContent.Substring(1);
|
receiveContent = receiveContent.Substring(1);
|
||||||
receiveContent = Base64Kit.Decode(receiveContent);
|
receiveContent = Base64Kit.Decode(receiveContent);
|
||||||
}
|
}
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
//Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
|
Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
|
||||||
//Debug.Log(url + "--------" + receiveContent);
|
Debug.Log(url + "--------" + receiveContent);
|
||||||
var response = SerializeUtil.ToObject<ResponseData>(receiveContent);
|
var response = SerializeUtil.ToObject<ResponseData>(receiveContent);
|
||||||
|
|
||||||
if (response?.code == 0)
|
if (response?.code == 0)
|
||||||
@@ -234,9 +234,9 @@ public class NetworkKit
|
|||||||
public static void BuriedPoint(string eventname, string eventproperty, int integer)
|
public static void BuriedPoint(string eventname, string eventproperty, int integer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(eventname == BuriedPointEvent.Apple_AD_event || eventname == BuriedPointEvent.Apple_pay_event)
|
if (eventname == BuriedPointEvent.Apple_AD_event || eventname == BuriedPointEvent.Apple_pay_event)
|
||||||
{
|
{
|
||||||
eventname = GameHelper.IsAdModelOfPay()?BuriedPointEvent.Apple_AD_event:BuriedPointEvent.Apple_pay_event;
|
eventname = GameHelper.IsAdModelOfPay() ? BuriedPointEvent.Apple_AD_event : BuriedPointEvent.Apple_pay_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
buriedPointObject.@event = eventname;
|
buriedPointObject.@event = eventname;
|
||||||
@@ -314,7 +314,8 @@ public class NetworkKit
|
|||||||
isReqToken1 = true;
|
isReqToken1 = true;
|
||||||
|
|
||||||
|
|
||||||
Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>{
|
Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>
|
||||||
|
{
|
||||||
if (isSuccess)
|
if (isSuccess)
|
||||||
{
|
{
|
||||||
LoginModel loginModel = GameHelper.GetLoginModel();
|
LoginModel loginModel = GameHelper.GetLoginModel();
|
||||||
|
|||||||
Reference in New Issue
Block a user