// 게스트 자동 로그인 가능 여부 채크한다 void GuestLoinCheck() { USER.I._TempGuestID = PlayerPrefHelper.GetUserID(); if (!string.IsNullOrEmpty(USER.I._TempGuestID)) { USER.I.IsGuestLogin = true; _objLoginButtonGroup.gameObject.SetActive(false); AssetBundleVersionCheck(); } else { // 로그인 기록이 없다.. 로그인 버튼 활성 _objLoginButtonGroup.gameObject.SetActive(true); _clickLock = false; } }
private void ParserCommand(Hashtable has) { _currentId = has["id"].ToString(); #if UNITY_EDITOR //Debug.Log(Time.frameCount + " <Color=#fff000> NET::ParserCommand - " + _currentId.ToString() + " </Color>"); #endif switch (_currentId) { // 로비씬 로딩 ( 팝업로딩화면이 유지된상태에서 로비씬 로딩 ) case PKID.SCENE_LOAD_LOBBY: UI.loginLoadingPage.SceneLoadLobby(); break; case PKID.LobbyConnect: _NetSocket.Connect(CONFIG.GetCurrentConfigServerIP(), CONFIG.GetCurrentConfigServerPORT()); return; case PKID.LobbyDisconnect: _bSelfDisconnect = true; _BCNetSocket.Disconnect(); _NetSocket.Disconnect(); return; // 게스트 유저 아이디 정보가 레지스트리에 없다면 신규 가입 처리 case PKID.GuestUserJoin: USER.I._TempGuestID = PlayerPrefHelper.GetUserID(); if (string.IsNullOrEmpty(USER.I._TempGuestID)) { I.SendReqGuestUserJoin((id, msg) => { if (!string.IsNullOrEmpty(msg)) { PKGuestUserJoin pk = JsonConvert.DeserializeObject <PKGuestUserJoin>(msg); if (pk.data.pid > 0) { USER.I._TempGuestID = pk.data.pid.ToString(); } } remove(PKID.GuestUserJoin); }, I.OnSendReqTimerout); } else { remove(PKID.GuestUserJoin); } return; case PKID.LobbyLogin: I.SendRQLobbyLogin((id, msg) => { Main.I.AppsFlyerEvent(AFInAppEvents.PLAY, AFInAppEvents.ACCOUNT_LOGIN, "true"); USER.I._PKLogin = JsonConvert.DeserializeObject <PK.Login.RECEIVE>(msg); remove(PKID.LobbyLogin); }, OnSendReqTimerout); return; case PKID.GuestUserUpdate: I.SendGuestUserUpdate(); break; case PKID.UserInfo: I.SendReqLobbyUserInfo((id, msg) => { Main.I.AppsFlyerEvent(AFInAppEvents.PLAY, AFInAppEvents.USER_DATA_LOADING, "true"); USER.I.SetPKUserInfo(msg); Main.I.AppsFlyerEvent(AFInAppEvents.USER, AFInAppEvents.USER_LEVEL, USER.I._PKUserInfo.data.user_level.ToString(), AFInAppEvents.LEVEL_UP, "false", AFInAppEvents.COINS_BALANCE, USER.I._PKUserInfo.data.balance.ToString()); remove(PKID.UserInfo); }, OnSendReqTimerout); return; case PKID.ServerInfo: I.SendReqServerInfo((id, msg) => { PK.ServerInfo.RECEIVE info = JsonConvert.DeserializeObject <PK.ServerInfo.RECEIVE>(msg); if (info != null) { for (int i = 0; i < info.data.Length; i++) { if (info.data[i].server_name == "broadcast") { _BCNetSocket.Connect(info.data[i].server_address); I.AddMessage(PKID.BroadCastConnect); break; } } } remove(PKID.ServerInfo); }, OnSendReqTimerout); return; case PKID.News: I.SendReqNews((id, msg) => { if (!string.IsNullOrEmpty(msg)) { USER.I._PKNews = JsonConvert.DeserializeObject <PK.News.RECEIVE>(msg); } remove(PKID.News); }, I.OnSendReqTimerout); return; case PKID.CheckDeal: I.SendReqCheckDeal((id, msg) => { USER.I.SetPKCheckDeal(msg); remove(PKID.CheckDeal); }, OnSendReqTimerout, "init", 0); return; case PKID.GetPurchaseItems: I.SendReqGetPurchaseItems((id, msg) => { USER.I._PKGetPurchaseItems = JsonConvert.DeserializeObject <PK.GetPurchaseItems.RECEIVE>(msg); remove(PKID.GetPurchaseItems); }, OnSendReqTimerout, USER.I.GetDealKind().ToString(), ""); return; //case PKID.GetVaultShop: // I.SendReqGetVaultShop((id, msg) => // { // USER.I._PKGetVaultShop = JsonConvert.DeserializeObject<PK.GetVaultShop.RECEIVE>(msg); // remove(PKID.GetVaultShop); // }, OnSendReqTimerout); // return; case PKID.GamesInfo: I.SendReqGamesInfo((id, msg) => { USER.I._PKGamesInfo = JsonConvert.DeserializeObject <PK.GamesInfo.RECEIVE>(msg); remove(PKID.GamesInfo); }, OnSendReqTimerout, USER.I._PKUserInfo.GetId()); return; case PKID.GiftsCount: I.SendReqGiftsCount((id, msg) => { USER.I._PKGiftsCount = JsonConvert.DeserializeObject <PK.GiftsCount.RECEIVE>(msg); remove(PKID.GiftsCount); }, OnSendReqTimerout); return; case PKID.ListGifts: I.SendReqListGifts((id, msg) => { USER.I.SetPKListGifts(msg); remove(PKID.ListGifts); }, OnSendReqTimerout); return; case PKID.AppFriends: I.SendReqAppFriends((id, msg) => { if (!string.IsNullOrEmpty(msg)) { USER.I.PKReciveSetAppFriends(msg); } remove(PKID.AppFriends); }, OnSendReqTimerout); return; case PKID.SendGiftChallengeItems: I.SendReqSendGiftChallengeItems((id, msg) => { USER.I._PKSendGiftChallengeItems = JsonConvert.DeserializeObject <PK.SendGiftChallengeItems.RECEIVE>(msg); remove(PKID.SendGiftChallengeItems); }, OnSendReqTimerout); return; case PKID.InvitationChallengeCheck: I.SendReqInvitationChallengeCheck((id, msg) => { USER.I._PKInvitChallengeCheck = JsonConvert.DeserializeObject <PK.InviteChallengeCheck.RECEIVE>(msg); remove(PKID.InvitationChallengeCheck); }, OnSendReqTimerout); return; case PKID.BroadCastConnect: SendBroadCastConnect(); break; // 토너먼트 패킷 case PKID.TournamentNowConfig: I.SendReqTmtNowConfig((id, msg) => { if (!string.IsNullOrEmpty(msg)) { UI.Tournaments.PKNowConfig(JsonConvert.DeserializeObject <PK.TmtNowConfig.RECEIVE>(msg)); } remove(PKID.TournamentNowConfig); }, OnSendReqTimerout, HasToInt("tmtid"), HasToInt("gameid")); return; case PKID.TournamentNowRank: I.SendReqTmtNowRank((id, msg) => { if (!string.IsNullOrEmpty(msg)) { UI.Tournaments.PKNowRank(JsonConvert.DeserializeObject <PK.TmtNowRank.RECEIVE>(msg)); } remove(PKID.TournamentNowRank); }, OnSendReqTimerout, HasToInt("tmtid"), HasToInt("gameid")); return; case PKID.TournamentUserRank: I.SendReqTmtUserRank((id, msg) => { if (!string.IsNullOrEmpty(msg)) { UI.Tournaments.PKUserRank(JsonConvert.DeserializeObject <PK.TmtUserRank.RECEIVE>(msg)); } remove(PKID.TournamentUserRank); }, OnSendReqTimerout, HasToInt("tmtid"), HasToInt("gameid")); return; // collect bonus case PKID.BonusInfo: I.SendReqBonusInfo((id, msg) => { if (!string.IsNullOrEmpty(msg)) { USER.I._PKBonusInfo = JsonConvert.DeserializeObject <PK.BonusInfo.RECEIVE>(msg); } remove(PKID.BonusInfo); }, OnSendReqTimerout); return; } remove(_currentId); }
void ParserCommand(Hashtable has) { SCENEIDs _IDs = (SCENEIDs)has["id"].GetHashCode(); #if UNITY_EDITOR Debug.Log(Time.frameCount + " <Color=#fff000> SCENE::ParserCommand - " + _IDs.ToString() + " </Color>"); #endif switch (_IDs) { case SCENEIDs.Company: Main.I.ShowCompany(true); Main.I._logo.color = Color.white; Main.I._logo.DOFade(0, 1f).SetDelay(2f).OnComplete(() => { remove(SCENEIDs.Company); }); return; case SCENEIDs.MsgBoxNetReConnect: MsgBoxNetworkReConnect(); break; case SCENEIDs.NetReConnect: NetworkReConnect(); break; case SCENEIDs.FirstLoginToLobby: Main.I.ShowCompany(false); UI.ShowLoginLoadingPage((id, args) => { remove(SCENEIDs.FirstLoginToLobby); }, SCENEIDs.FirstLoginToLobby, has["name"].ToString()); return; case SCENEIDs.FirstActiveLobby: //UI.I.FirstActiveLobby(); break; case SCENEIDs.FBSignOut: { SOUND.I.PlayStop(DEF.SND.lobby_bgm); USER.I.ResetReConnect(); UI.SetWaitLoading(false); UI.ShowLoginLoadingPage((id, args) => { remove(SCENEIDs.FBSignOut); }, SCENEIDs.FBSignOut); } return; case SCENEIDs.FacebookShare: break; case SCENEIDs.InitLobby: UI.I.FirstActiveLobby(); break; case SCENEIDs.InviteFriends: Main.I.GetFBController().InviteFriends(); break; case SCENEIDs.ReConnectServer: UI.SetWaitLoading(false); USER.I.ResetReConnect(); UI.ShowLoginLoadingPage((id, args) => { remove(SCENEIDs.ReConnectServer); }, SCENEIDs.ReConnectServer); return; case SCENEIDs.GuestToFacebook: { if (USER.I.IsGuestLogin) { UI.I.ShowGuestGuide((_id, args) => { if (args[0].ToString() == "ok") { AddMessage(SCENEIDs.LoginGuestToFacebook); remove(SCENEIDs.GuestToFacebook); } else // cancel { remove(SCENEIDs.GuestToFacebook); } }); } else { remove(SCENEIDs.GuestToFacebook); } } return; case SCENEIDs.LoginGuestToFacebook: { UI.SetWaitLoading(true); Main.FB.FBLogin((x) => { if (x == true) { SOUND.I.PlayStop(DEF.SND.lobby_bgm); long guestId = System.Convert.ToInt64(PlayerPrefHelper.GetUserID()); long fbid = System.Convert.ToInt64(Main.FB.GetFbLoginInfo().id); NET.I.SendReqGuestToFacebook((id, msg) => { // reset data USER.I.ResetReConnect(); I.AddMessage(SCENEIDs.ReLoginFacebook); }, NET.I.OnSendReqTimerout, guestId, fbid); } else { UI.SetWaitLoading(false); } }); } break; case SCENEIDs.ReLoginFacebook: UI.SetWaitLoading(false); UI.ShowLoginLoadingPage((id, args) => { remove(SCENEIDs.ReLoginFacebook); }, SCENEIDs.ReLoginFacebook); return; case SCENEIDs.GuestToFBActiveLobby: UI.I.GuestToFBActiveLobby(); break; case SCENEIDs.LobbyToGame: int gameID = System.Convert.ToInt32(has["game"].ToString()); if (DEF.IsUseGameID((eGameList)gameID)) { if (Lobby.I != null) { Lobby.I.gameObject.SetActive(false); } UI.ShowGameLoadingPage((id, args) => { if (args[0].ToString() == "ok") { //UI.I.LobbyToGame((eGameList)args[1]); remove(SCENEIDs.LobbyToGame); } }, SCENEIDs.LobbyToGame, gameID); return; } break; case SCENEIDs.GameToLobby: UI.I.GameToLobby(); break; case SCENEIDs.Quit: UI.I.ShowMsgBox("Are you sure you want to quit the game?", (id, args) => { if (args[0].ToString() == "ok") { Main.I.OnQuit(); } }); break; case SCENEIDs.DEBUG_LOADING_COMPLETED: { UI.GameMain = GameObject.FindObjectOfType <InGame>(); if (UI.GameMain.gameId == DEF.FIRST_INSTALL_GAME) { BUNDLE.I.UnLoadBundle(DEF.GetGameBundleName(DEF.FIRST_INSTALL_GAME)); // 로비에서 다운받기 때문에 삭제 } UI.I.LobbyToGame(UI.GameMain.gameId); UI.GameMain.Init(); } break; // first news popups case SCENEIDs.NewsDailySpin: UI.Popup.ShowPopup <UIPopDailySpin>("DailySpin", (int)_IDs, (id, args) => { if (args[0].ToString() == "x") { base.removeAt(SCENEIDs.NewsGoldenSpin); // 취소면 NewsGoldenSpin 메세지 강제 제거 } remove(SCENEIDs.NewsDailySpin); }, true); return; case SCENEIDs.NewsGoldenSpin: UI.Popup.ShowPopup <UIPopDailySpinShop>("DailySpinShop", (int)_IDs, (id, args) => { remove(SCENEIDs.NewsGoldenSpin); }, null); return; case SCENEIDs.NewsFirstPurchase: UI.Popup.ShowPopup <UIPopFirstPurchaseOffer>("FirstPurchaseOffer", (int)_IDs, (id, args) => { remove(SCENEIDs.NewsFirstPurchase); }, true); return; case SCENEIDs.NewsSweetOffer: UI.Popup.ShowPopup <UIPopSweetOffer>("SweetOffer", (int)_IDs, (id, args) => { if (args[0].ToString() == "buy") { UI.Popup.ShowPopup <UIPopPurchaseSuccessful>("PurchaseSuccessful", 0, (id2, args2) => { remove(SCENEIDs.NewsSweetOffer); }, args[1]); } else { remove(SCENEIDs.NewsSweetOffer); } }, true); return; case SCENEIDs.NewsNormal: UI.Popup.ShowPopup <UIPopNewsNormal>("NewsNormal", (int)_IDs, (id, args) => { remove(SCENEIDs.NewsNormal); }, has["url"], has["value"]); return; case SCENEIDs.NewsGame: UI.Popup.ShowPopup <UIPopNewsGame>("NewsGame", (int)_IDs, (id, args) => { remove(SCENEIDs.NewsGame); if (args[0].ToString() == "ok") { AddMessage(SCENEIDs.NewsGameRun, "gameid", args[1]); } else { AddMessage(SCENEIDs.NewsInbox); } }, has["url"], has["value"]); return; case SCENEIDs.NewsGameRun: Lobby.I.RunNewsGame((eGameList)HasToInt("gameid")); break; case SCENEIDs.NewsInbox: //UI.Popup.ShowPopup<UIPopGift>("Gift", (int)_IDs, null, "InBox"); UI.I.AddMessage(UI.IDs.PopGift, "tab", "InBox"); break; } I.remove(_IDs); }
/// <summary> /// 서버 연결끊김으로 재접속 처리 루틴 처리한다 /// 로비네트워크에서만 채크한다. /// </summary> public void NetworkReConnect() { // 재접속 팝업창 업데이트 종료 SYSTIMER.I.ReConnectAlram.Stop(); if (Main.I.CurrentView == eView.Lobby) { UI.SetWaitLoading(false); NET.I.removeAll(); // 스케줄 아이디 삭제 USER.I.ResetReConnect(); UI.I.ResetReConnect(); UI.Coins.GameToLobby(); if (USER.I.IsGuestLogin) { USER.I._TempGuestID = PlayerPrefHelper.GetUserID(); } NET.I.AddMessage(PKID.LobbyLogin); NET.I.AddMessage(PKID.UserInfo); NET.I.AddMessage(PKID.ServerInfo); NET.I.AddMessage(PKID.CheckDeal); NET.I.AddMessage(PKID.GetPurchaseItems); //NET.I.AddMessage(PKID.GetVaultShop); NET.I.AddMessage(PKID.BonusInfo); NET.I.AddMessage(PKID.GamesInfo); NET.I.AddMessage(PKID.GiftsCount); NET.I.AddMessage(PKID.ListGifts); NET.I.AddMessage(PKID.AppFriends); NET.I.AddMessage(PKID.SendGiftChallengeItems); NET.I.AddMessage(PKID.InvitationChallengeCheck); } else if (Main.I.CurrentView == eView.Game) { UI.SetWaitLoading(false); // 인게임 로그인에서 해제 NET.I.removeAll(); // 스케줄 아이디 삭제 USER.I.ResetReConnect(); UI.I.ResetReConnect(); if (USER.I.IsGuestLogin) { USER.I._TempGuestID = PlayerPrefHelper.GetUserID(); } NET.I.AddMessage(PKID.LobbyLogin); NET.I.AddMessage(PKID.UserInfo); NET.I.AddMessage(PKID.ServerInfo); NET.I.AddMessage(PKID.CheckDeal); NET.I.AddMessage(PKID.GetPurchaseItems); //NET.I.AddMessage(PKID.GetVaultShop); NET.I.AddMessage(PKID.BonusInfo); NET.I.AddMessage(PKID.GamesInfo); NET.I.AddMessage(PKID.GiftsCount); NET.I.AddMessage(PKID.ListGifts); NET.I.AddMessage(PKID.AppFriends); NET.I.AddMessage(PKID.SendGiftChallengeItems); NET.I.AddMessage(PKID.InvitationChallengeCheck); StartCoroutine(coGameReConnect()); } }