diff --git a/Assets/BingoBrain/BingoScene.cs b/Assets/BingoBrain/BingoScene.cs index c60872f..0f89eaa 100644 --- a/Assets/BingoBrain/BingoScene.cs +++ b/Assets/BingoBrain/BingoScene.cs @@ -60,8 +60,8 @@ namespace BingoBrain AppDispatcher.Instance.Dispatch(CsjInfoC.InitUIMgr); AppDispatcher.Instance.AddListener(CsjInfoC.LoginInit, OnLoadingComplete); PreferencesMgr.Instance.InitPreferences(); - NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);//quxiaozhushi - NetworkDispatcher.Instance.AddListener(NetworkMsg.Start, ShowScene);//quxiaozhushi + NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);//quxiaozhushi + NetworkDispatcher.Instance.AddListener(NetworkMsg.Start, ShowScene);//quxiaozhushi } private void OnLoadingComplete(object param = null) diff --git a/Assets/BingoBrain/Manager/Network.cs b/Assets/BingoBrain/Manager/Network.cs index 61abf7c..7dca79a 100644 --- a/Assets/BingoBrain/Manager/Network.cs +++ b/Assets/BingoBrain/Manager/Network.cs @@ -20,7 +20,7 @@ namespace BingoBrain 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 const string DomainRelease = "bingoglassland.top"; diff --git a/Assets/BingoSun/Scripts/LoginSystem.cs b/Assets/BingoSun/Scripts/LoginSystem.cs index 2343621..bb02285 100644 --- a/Assets/BingoSun/Scripts/LoginSystem.cs +++ b/Assets/BingoSun/Scripts/LoginSystem.cs @@ -38,108 +38,115 @@ public class LoginSystem : BaseSystem private void AddListener() { - // NetworkDispatcher.Instance.AddListener(NetworkMsg.Login, OnRequestLogin); - // NetworkDispatcher.Instance.AddListener(NetworkMsg.Reconnect, OnResponseReconnect); + NetworkDispatcher.Instance.AddListener(NetworkMsg.Login, OnRequestLogin); + // NetworkDispatcher.Instance.AddListener(NetworkMsg.Reconnect, OnResponseReconnect); } 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); } private void RequestLogin() { + var requestLoginData = new RequestLoginData { device_id = SystemInfo.deviceUniqueIdentifier, - // device_id ="E742FE8B-C32E-56A7-8F8A-6B3BC0F3169", + // device_id ="E742FE8B-C32E-56A7-8F8A-6B3BC0F3169", pack_name = NetworkMsg.Identifier, app_version = Application.version, channel = BingoBea.Instance.attribution, sim = WebviewManager.haveSimCard }; - + Debug.Log(JsonConvert.SerializeObject(requestLoginData)); Debug.Log(SystemInfo.deviceUniqueIdentifier); GameHelper.PostFunnelLogin("loginSend"); Debug.Log(JsonConvert.SerializeObject(requestLoginData)); - //zhushi // NetworkKit.Post("login", requestLoginData, (isSuccess, loginData) => - // { + NetworkKit.Post("login", requestLoginData, (isSuccess, loginData) => + { - // if (isSuccess) - // { - // var loginModel = GameHelper.GetLoginModel(); - // loginModel.cdn_url = loginData.cdn_url; - // loginModel.setting = loginData.setting; - // loginModel.play_data = loginData.play_data; - // loginModel.token = loginData.token; - // loginModel.uid = loginData.uid; - // loginModel.country = loginData.country; - // loginModel.expires_at = loginData.expires_at; - // loginModel.is_magic = loginData.is_magic; - // loginModel.invite_code = loginData.invite_code; - // loginModel.invite_url = loginData.invite_url; - // loginModel.last_login_time = loginData.last_login_time; - // loginModel.login_time = loginData.login_time; - // loginModel.reg_time = loginData.reg_time; - // loginModel.new_player = loginData.new_player; - // loginModel.debug_log = loginData.debug_log; - // loginModel.enwp = loginData.enwp; + if (isSuccess) + { + var loginModel = GameHelper.GetLoginModel(); + loginModel.cdn_url = loginData.cdn_url; + loginModel.setting = loginData.setting; + loginModel.play_data = loginData.play_data; + loginModel.token = loginData.token; + loginModel.uid = loginData.uid; + loginModel.country = loginData.country; + loginModel.expires_at = loginData.expires_at; + loginModel.is_magic = loginData.is_magic; + loginModel.invite_code = loginData.invite_code; + loginModel.invite_url = loginData.invite_url; + loginModel.last_login_time = loginData.last_login_time; + loginModel.login_time = loginData.login_time; + loginModel.reg_time = loginData.reg_time; + loginModel.new_player = loginData.new_player; + loginModel.debug_log = loginData.debug_log; + loginModel.enwp = loginData.enwp; - // loginModel.preferences = new Preferences(); - // NetworkKit.CDNUrl = $"{loginData.cdn_url}/"; - // NetworkKit.SetCacheToken(loginData.token); - // //RequestHeart(); - // DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time); - // Sequence mLoopSequence = DOTween.Sequence(); - // mLoopSequence.AppendCallback(() => - // { - // RequestHeart(); + loginModel.preferences = new Preferences(); + NetworkKit.CDNUrl = $"{loginData.cdn_url}/"; + NetworkKit.SetCacheToken(loginData.token); + //RequestHeart(); + DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time); + Sequence mLoopSequence = DOTween.Sequence(); + mLoopSequence.AppendCallback(() => + { + RequestHeart(); - // }).AppendInterval(60).SetLoops(-1); - // //TimerHelper.UnscaleGeneral.AddLoopTimer(60, (timer) => { RequestHeart(); }); - // //NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData); - // //UICtrlDispatcher.Instance.Dispatch(SkinInfo.EnterBingoUI_Open); - // PreferencesMgr.Instance.PlayerName = loginData.invite_code; - // NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig); - // MaxADKit.Init(); - // GameHelper.PostFunnelLogin("loginRecv", true); - // if (GameHelper.IsGiftSwitch()) - // { - // GameObject.Find("MainCameraRoot").SetActive(false); - // } - // else{ - // GameObject.Find("sheep_parent").SetActive(false); - // } - // } - // else - // { - // //UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close); - // Debug.Log("登陆请求失败"); - // GameHelper.PostFunnelLogin("loginRecv", false); + }).AppendInterval(60).SetLoops(-1); + //TimerHelper.UnscaleGeneral.AddLoopTimer(60, (timer) => { RequestHeart(); }); + //NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData); + //UICtrlDispatcher.Instance.Dispatch(SkinInfo.EnterBingoUI_Open); + PreferencesMgr.Instance.PlayerName = loginData.invite_code; + NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig); + MaxADKit.Init(); + GameHelper.PostFunnelLogin("loginRecv", true); + if (GameHelper.IsGiftSwitch()) + { + GameObject.Find("MainCameraRoot").SetActive(false); + } + else + { + GameObject.Find("sheep_parent").SetActive(false); + } + } + else + { + Debug.Log(JsonConvert.SerializeObject(loginData)); + //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,()=>{ - // if (loginCount < LoginCountLimit) { - // loginCount++; - // RequestLogin(); - - // } else { - // loginCount = 0; - // Action _OnFail = () => - // { - // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login); - // }; - // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail); - // } - // }); - // } - // }); + DOVirtual.DelayedCall(times, () => + { + if (loginCount < LoginCountLimit) + { + loginCount++; + RequestLogin(); + + } + else + { + loginCount = 0; + Action _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 string Identifier = "com.interactivegames123.bingograssland"; + public static string Identifier = "com.interactivegames.bingotornado"; public static uint Start = ++MsgRootLogic; public static uint NotNetwork = ++MsgRootLogic; } diff --git a/Assets/BingoSun/Scripts/NetworkKit.cs b/Assets/BingoSun/Scripts/NetworkKit.cs index 91b9220..a58a892 100644 --- a/Assets/BingoSun/Scripts/NetworkKit.cs +++ b/Assets/BingoSun/Scripts/NetworkKit.cs @@ -39,10 +39,10 @@ public class NetworkKit var requestJson = SerializeUtil.ToJsonIndented(requestData); var url2 = url; -// #if BingoBrainRelease +#if BingoBrainRelease url2 = Base64Kit.Encode(url); requestJson = Base64Kit.Encode(requestJson); -// #endif +#endif var bytes = Encoding.UTF8.GetBytes(requestJson); var url1 = BingoBrain.Network.domainUrl + url2; //Debug.Log($"Url: {url1}"); @@ -59,7 +59,7 @@ public class NetworkKit loginRequest.SetRequestHeader(keyValuePair.Key, keyValuePair.Value); } } - + Debug.Log(JsonConvert.SerializeObject(loginRequest)); SetRequestContentType(loginRequest); yield return loginRequest.SendWebRequest(); if (loginRequest.result is not UnityWebRequest.Result.Success) @@ -69,17 +69,17 @@ public class NetworkKit else { var receiveContent = loginRequest.downloadHandler.text; -// #if BingoBrainRelease +#if BingoBrainRelease if (!receiveContent.IsNullOrWhiteSpace()) { receiveContent = receiveContent.Substring(0, receiveContent.Length - 1); receiveContent = receiveContent.Substring(1); receiveContent = Base64Kit.Decode(receiveContent); } -// #endif +#endif - //Debug.Log(url + "--------" + loginRequest.downloadHandler.text); - //Debug.Log(url + "--------" + receiveContent); + Debug.Log(url + "--------" + loginRequest.downloadHandler.text); + Debug.Log(url + "--------" + receiveContent); var response = SerializeUtil.ToObject(receiveContent); if (response?.code == 0) @@ -234,9 +234,9 @@ public class NetworkKit public static void BuriedPoint(string eventname, string eventproperty, int integer) { - if(eventname == BuriedPointEvent.Apple_AD_event || eventname == BuriedPointEvent.Apple_pay_event) - { - eventname = GameHelper.IsAdModelOfPay()?BuriedPointEvent.Apple_AD_event: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; } buriedPointObject.@event = eventname; @@ -251,7 +251,7 @@ public class NetworkKit } public static BuriedPointObject buriedPointObject = new BuriedPointObject(); - public static string GetNetworkType() + public static string GetNetworkType() { switch (Application.internetReachability) { @@ -261,7 +261,7 @@ public class NetworkKit return NetworkType.wifi; case NetworkReachability.NotReachable: return NetworkType.notConnected; - default: + default: return NetworkType.notConnected; } } @@ -280,25 +280,25 @@ public class NetworkKit var headers = new Dictionary { { "x-token", GetCacheToken() } }; - IsfvKit.StartCoroutine(PostInternal("tokenRefresh", null, (isSuccess, tokenData) => + IsfvKit.StartCoroutine(PostInternal("tokenRefresh", null, (isSuccess, tokenData) => { if (isSuccess) { LoginModel loginModel = GameHelper.GetLoginModel(); loginModel.token = tokenData.token; loginModel.expires_at = tokenData.expires_at; - + SetCacheToken(tokenData.token); } isReqToken = false; - + }, headers)); } private static bool isReqToken1 = false; - public static void ReLoginGetToken() + public static void ReLoginGetToken() { if (isReqToken1) return; @@ -314,13 +314,14 @@ public class NetworkKit isReqToken1 = true; - Post("login", requestLoginData, (isSuccess, loginData) =>{ + Post("login", requestLoginData, (isSuccess, loginData) => + { if (isSuccess) { LoginModel loginModel = GameHelper.GetLoginModel(); loginModel.token = loginData.token; loginModel.expires_at = loginData.expires_at; - + SetCacheToken(loginData.token); } @@ -473,101 +474,101 @@ public class BuriedPointObject } public class BuriedPointEvent { - public static string play_event = "Number_of_people_play"; - public static string play_property = "Number_of_people_playing"; + public static string play_event = "Number_of_people_play"; + public static string play_property = "Number_of_people_playing"; - public static string playing_event = "Playing_time"; - public static string playing_property = "Room_type"; + public static string playing_event = "Playing_time"; + public static string playing_property = "Room_type"; - public static string ad_task = "ad_task"; - public static string watch_ad_number = "watch_ad_number"; - public static string finish_ad_number = "finish_ad_number"; + public static string ad_task = "ad_task"; + public static string watch_ad_number = "watch_ad_number"; + public static string finish_ad_number = "finish_ad_number"; - public static string h5_event = "H5_task"; - public static string h5_event_time = "H5_time"; - public static string h5_event_numbers = "finish_H5_number"; + public static string h5_event = "H5_task"; + public static string h5_event_time = "H5_time"; + public static string h5_event_numbers = "finish_H5_number"; - public static string withdraw_behavior = "withdraw_behavior"; - public static string withdraw_message = "withdraw_message"; - public static string withdraw_cash1 = "withdraw_cash1"; - public static string withdraw_cash2 = "withdraw_cash2"; - public static string withdraw_cash3 = "withdraw_cash3"; + public static string withdraw_behavior = "withdraw_behavior"; + public static string withdraw_message = "withdraw_message"; + public static string withdraw_cash1 = "withdraw_cash1"; + public static string withdraw_cash2 = "withdraw_cash2"; + public static string withdraw_cash3 = "withdraw_cash3"; - public static string Hall_behavior = "Hall_behavior"; - public static string open_hall_number = "open_hall_number"; - //public static string open_hall_people = "open_hall_people"; - public static string collect_fly_number = "collect_fly_number"; - //public static string collect_fly_people = "collect_fly_people"; - public static string fly_ct_number = "fly_ct_number"; - //public static string fly_ct_people = "fly_ct_people"; - public static string annular_finish_number = "annular_finish_number"; - public static string annular_get_number = "annular_get_number"; - public static string annular_ct_number = "annular_ct_number"; - //public static string annular_ct_people = "annular_ct_people"; + public static string Hall_behavior = "Hall_behavior"; + public static string open_hall_number = "open_hall_number"; + //public static string open_hall_people = "open_hall_people"; + public static string collect_fly_number = "collect_fly_number"; + //public static string collect_fly_people = "collect_fly_people"; + public static string fly_ct_number = "fly_ct_number"; + //public static string fly_ct_people = "fly_ct_people"; + public static string annular_finish_number = "annular_finish_number"; + public static string annular_get_number = "annular_get_number"; + public static string annular_ct_number = "annular_ct_number"; + //public static string annular_ct_people = "annular_ct_people"; - public static string video_behavior = "video_behavior"; - public static string watch_ad_people = "watch_ad_people"; - public static string watch_success_ad_people = "watch_success_ad_people"; + public static string video_behavior = "video_behavior"; + public static string watch_ad_people = "watch_ad_people"; + public static string watch_success_ad_people = "watch_success_ad_people"; - public static string video_type = "video_type"; - public static string Rewarded_videos_trigger_number = "Rewarded_videos_trigger_number"; - public static string Rewarded_videos_fill_number = "Rewarded_videos_fill_number"; - public static string Rewarded_videos_dinish_number = "Rewarded_videos_dinish_number"; - public static string Interstitial_videos_trigger_number = "Interstitial_videos_trigger_number"; - public static string Interstitial_videos_fill_number = "Interstitial_videos_fill_number"; - public static string Interstitial_videos_dinish_number = "Interstitial_videos_dinish_number"; - public static string Apple_pay_event = "Pay_Event"; - public static string Apple_AD_event = "AD_Event"; + public static string video_type = "video_type"; + public static string Rewarded_videos_trigger_number = "Rewarded_videos_trigger_number"; + public static string Rewarded_videos_fill_number = "Rewarded_videos_fill_number"; + public static string Rewarded_videos_dinish_number = "Rewarded_videos_dinish_number"; + public static string Interstitial_videos_trigger_number = "Interstitial_videos_trigger_number"; + public static string Interstitial_videos_fill_number = "Interstitial_videos_fill_number"; + public static string Interstitial_videos_dinish_number = "Interstitial_videos_dinish_number"; + public static string Apple_pay_event = "Pay_Event"; + public static string Apple_AD_event = "AD_Event"; - public static string pack_show = "pack_show"; - public static string pack_click = "pack_click"; - public static string pack_open = "pack_open"; - public static string pack_success = "pack_success"; + public static string pack_show = "pack_show"; + public static string pack_click = "pack_click"; + public static string pack_open = "pack_open"; + public static string pack_success = "pack_success"; - public static string remove_ad_show = "remove_ad_show"; - public static string remove_ad_click = "remove_ad_click"; - public static string remove_ad_open = "remove_ad_open"; - public static string remove_ad_success = "remove_ad_success"; + public static string remove_ad_show = "remove_ad_show"; + public static string remove_ad_click = "remove_ad_click"; + public static string remove_ad_open = "remove_ad_open"; + public static string remove_ad_success = "remove_ad_success"; - public static string pass_show = "master_pass_show"; - public static string pass_click = "master_pass_click"; - public static string pass_open = "pass_open"; - public static string pass_success = "master_pass_receive"; + public static string pass_show = "master_pass_show"; + public static string pass_click = "master_pass_click"; + public static string pass_open = "pass_open"; + public static string pass_success = "master_pass_receive"; - public static string buy_one_show = "buy_one_show"; - public static string buy_one_click = "buy_one_click"; - public static string buy_one_open = "buy_one_open"; - public static string buy_one_success = "buy_one_success"; + public static string buy_one_show = "buy_one_show"; + public static string buy_one_click = "buy_one_click"; + public static string buy_one_open = "buy_one_open"; + public static string buy_one_success = "buy_one_success"; - public static string gold_show = "shop_show"; - public static string gold_click_1 = "shop_click"; + public static string gold_show = "shop_show"; + public static string gold_click_1 = "shop_click"; - public static string gold_click_ad = "gold_click_ad"; + public static string gold_click_ad = "gold_click_ad"; - // public static string gold_click_2 = "gold_click_2"; - // public static string gold_click_3 = "gold_click_3"; - // public static string gold_click_4 = "gold_click_4"; - // public static string gold_open_1 = "gold_open_1"; - // public static string gold_open_2 = "gold_open_2"; - // public static string gold_open_3 = "gold_open_3"; - // public static string gold_open_4 = "gold_open_4"; - public static string gold_success_1 = "shop_receive"; - // public static string gold_success_2 = "gold_success_2"; - // public static string gold_success_3 = "gold_success_3"; - // public static string gold_success_4 = "gold_success_4"; - public static string afterRewardAdShow = "afterRewardAdShow"; - public static string afterRewardAdEnd = "afterRewardAdEnd"; - public static string fail_show = "fail_show"; - public static string fail_click = "fail_click"; - public static string fail_buy_success = "fail_buy_success"; - public static string three_days_gift_show = "three_days_gift_show"; - public static string three_days_gift_click = "three_days_gift_click"; - public static string three_days_gift_buy_success = "three_days_gift_buy_success"; - public static string three_days_gift_open = "three_days_gift_open"; - public static string three_day1_success = "three_day1_success"; - public static string three_day2_success = "three_day2_success"; - public static string three_day3_success = "three_day3_success"; - public static string Three_days_gift_event = "Three_days_gift_event"; + // public static string gold_click_2 = "gold_click_2"; + // public static string gold_click_3 = "gold_click_3"; + // public static string gold_click_4 = "gold_click_4"; + // public static string gold_open_1 = "gold_open_1"; + // public static string gold_open_2 = "gold_open_2"; + // public static string gold_open_3 = "gold_open_3"; + // public static string gold_open_4 = "gold_open_4"; + public static string gold_success_1 = "shop_receive"; + // public static string gold_success_2 = "gold_success_2"; + // public static string gold_success_3 = "gold_success_3"; + // public static string gold_success_4 = "gold_success_4"; + public static string afterRewardAdShow = "afterRewardAdShow"; + public static string afterRewardAdEnd = "afterRewardAdEnd"; + public static string fail_show = "fail_show"; + public static string fail_click = "fail_click"; + public static string fail_buy_success = "fail_buy_success"; + public static string three_days_gift_show = "three_days_gift_show"; + public static string three_days_gift_click = "three_days_gift_click"; + public static string three_days_gift_buy_success = "three_days_gift_buy_success"; + public static string three_days_gift_open = "three_days_gift_open"; + public static string three_day1_success = "three_day1_success"; + public static string three_day2_success = "three_day2_success"; + public static string three_day3_success = "three_day3_success"; + public static string Three_days_gift_event = "Three_days_gift_event"; }