예제 #1
0
    void OnDestroy()
    {
                #if UNITY_IPHONE
        EtceteraManager.remoteNotificationReceivedAtLaunchEvent -= remoteNotificationAtLauch;
        EtceteraManager.remoteNotificationReceivedEvent         -= remoteNotification;
        EtceteraManager.remoteRegistrationSucceededEvent        -= remoteRegistrationSucceeded;
        EtceteraManager.remoteRegistrationFailedEvent           -= remoteRegistrationFailed;
                #elif UNITY_ANDROID
        GCMReceiver._onRegistered   -= remoteRegistrationSucceeded;
        GCMReceiver._onUnregistered -= remoteRegistrationFailed;
        GCMReceiver._onMessage      -= gcmReceiverMessage;
        if (GameObject.Find("GCMReceiver") != null)
        {
            GameObject.Destroy(GameObject.Find("GCMReceiver"));
        }
                #endif

        Debug.LogWarning(this.GetType().Name + ": OnDestroy");
        if (_mServer != null)
        {
            _mServer.OnDestroy();
        }
        //_mServer.DoLogOut();
        _instance = null;
        StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
    }
예제 #2
0
 void OnClickProfile(GameObject go)
 {
     //GameManager.Server.DoRequestPlugin(Utility.SetEsObject("getLevel", new object[]{
     //        "appId", GameManager.Instance.hallRoom.gameId
     //    }));
     StoreGame.Remove(StoreGame.EType.SEND_FRIEND_MESSAGE);
     ProfileView.Instance.CheckWhenStart();
     HideMenu();
 }
예제 #3
0
    IEnumerator onProcessGetInfoRule(string textJson, bool isCache)
    {
        string reRequest = null;

        ArrayList list = (ArrayList)JSON.JsonDecode(textJson);

        foreach (Hashtable obj in list)
        {
            GameManager.Instance.ListHelp.Add(obj);
        }

        if (list.Count > 0)
        {
            //GameManager.Instance.ListHelp.Sort((x, y) => DateTime.Parse(x["time"].ToString()).CompareTo(DateTime.Parse(y["time"].ToString())));
            GameManager.Instance.ListHelp.Sort((x, y) => int.Parse(x["id"].ToString()).CompareTo(int.Parse(y["id"].ToString())));

            if (isCache)
            {
                WWWForm form = new WWWForm();
                string  time = string.Format("{0:yyyy-MM-dd HH:mm:ss}", GameManager.Instance.ListHelp[list.Count - 1]["time"].ToString());
                form.AddField("time", time);
                form.AddField("game_id", (int)GameManager.GAME);
                form.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier);
                ServerWeb.StartThreadHttp(ServerWeb.URL_GETINFO_HELP, form, delegate(bool isDone, WWW response, IDictionary json)
                {
                    if (isDone)
                    {
                        if (string.IsNullOrEmpty(response.error))
                        {
                            reRequest = "0";
                            if (json["code"].ToString() == "1")
                            {
                                StoreGame.Remove(StoreGame.EType.CACHE_HELP);
                                GameManager.Instance.ListHelp.Clear();
                                GameManager.Instance.StartCoroutine(DoRequest_AllHelp());
                            }
                        }
                        else
                        {
                            reRequest = "1";
                        }
                    }
                });
                while (string.IsNullOrEmpty(reRequest))
                {
                    yield return(new WaitForEndOfFrame());
                }
                if (reRequest == "1")
                {
                    yield return(new WaitForSeconds(2f));

                    GameManager.Instance.StartCoroutine(DoRequest_AllHelp());
                }
            }
        }
    }
예제 #4
0
    System.Collections.IEnumerator _CheckWhenStart()
    {
        if (StoreGame.Contains(StoreGame.EType.SEND_FRIEND_MESSAGE))
        {
            yield return(new WaitForEndOfFrame());

            controller.OnSelectTabbar(1);
        }
        else if (StoreGame.Contains(StoreGame.EType.CHANGE_INFORMATION))
        {
            controller.OnSelectTabbar(5);
            panelSettings.ShowEditGeneral();
            StoreGame.Remove(StoreGame.EType.CHANGE_INFORMATION);
        }
    }
예제 #5
0
    public static void ClearCache()
    {
        if (!Application.isWebPlayer)
        {
            return;
        }

        if (GameManager.CurrentScene == ESceneName.GameplayChan)
        {
            return;
        }

        if (StoreGame.Contains(StoreGame.EType.PLAY_THE_SAME_DEVICE))
        {
            string   newValue = "";
            string[] arrays   = StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE).Split(DATA_ROW.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            Debug.LogWarning(StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE) + "\n" + arrays.Length);

            foreach (string str in arrays)
            {
                string[] arr = str.Split(DATA_SAPCE.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arr[0] == GameManager.Instance.mInfo.username)
                {
                    Debug.LogWarning("IsCanJoinGameplay Remove: " + str);
                    continue;
                }
                newValue += str + DATA_ROW;
            }

            if (newValue != StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE))
            {
                if (string.IsNullOrEmpty(newValue))
                {
                    StoreGame.Remove(StoreGame.EType.PLAY_THE_SAME_DEVICE);
                }
                else
                {
                    StoreGame.SaveString(StoreGame.EType.PLAY_THE_SAME_DEVICE, newValue);
                }
                StoreGame.Save();
            }
        }
    }
예제 #6
0
    protected virtual void OnLoginResponse(LoginResponse e)
    {
        isLogged = true;
        if (e.Successful)
        {
            EsObject param = new EsObject();

            if (!string.IsNullOrEmpty(GameManager.Instance.userNameLogin) && !string.IsNullOrEmpty(GameManager.Instance.passwordLogin))
            {
                param.setString("userName", GameManager.Instance.userNameLogin);
                param.setString("password", GameManager.Instance.passwordLogin);
                param.setInteger(Fields.REQUEST.APP_ID, (int)GameManager.GAME);
                param.setString("environment", Common.GetDevice);
                param.setString("version", GameSettings.CurrentVersion);
                param.setString("platform", PlatformSetting.GetSamplePlatform.ToString());
                param.setString("deviceToken", GameManager.Instance.deviceToken);
            }
            else if (!string.IsNullOrEmpty(GameManager.Instance.accessToken))
            {
                param.setString("accessToken", GameManager.Instance.accessToken);
                param.setInteger(Fields.REQUEST.APP_ID, (int)GameManager.GAME);
                param.setString("environment", Common.GetDevice);
                param.setString("version", GameSettings.CurrentVersion);
                param.setString("platform", PlatformSetting.GetSamplePlatform.ToString());
                param.setString("deviceToken", GameManager.Instance.deviceToken);
            }

            GameManager.Server.DoRequestPluginLogin(Utility.SetEsObject(Fields.REQUEST.COMMAND_LOGIN, new object[] { "loginInfo", param }));
        }
        else
        {
            WaitingView.Instance.Close();
            StoreGame.Remove(StoreGame.EType.SAVE_USERNAME);
            StoreGame.Remove(StoreGame.EType.SAVE_PASSWORD);
            StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
            string message = "Thông tin đăng nhập không hợp lệ. Yêu cầu nhập lại thông tin truy cập.";
            if (e.EsObject.variableExists("reason"))
            {
                message = e.EsObject.getString("reason");
            }
            NotificationView.ShowMessage(message);
        }
    }
예제 #7
0
    /// <summary>
    /// Sự kiện xảy ra khi bạn logout ứng dụng
    /// </summary>
    public void DoLogOut()
    {
        StoreGame.Remove(StoreGame.EType.DEBUG_LOG);                            //REMOVE DEBUG_LOG
        StoreGame.SaveString(StoreGame.EType.BOOL_SEND_LOG_TO_SERVER, "false"); //REMOVE DEBUG_LOG
        WaitingView.Hide();
        if (Application.loadedLevelName == ESceneName.LoginScreen.ToString())
        {
            Disconnect(); return;
        }
        //DoLeaveCurrentRoom();
        LogOutRequest logOutRequest = new LogOutRequest();

        DoRequest(logOutRequest);
        #region BUILD WEB ESIMO COMMENT VAO KHI BUILD CHO FACEBOOK
#if UNITY_WEBPLAYER
        switch (GameSettings.Instance.TypeBuildFor)
        {
        case GameSettings.EBuildType.esimo:
        case GameSettings.EBuildType.web_esimo:
            Application.ExternalEval("window.location = \"/site/logout\"");
            break;
        }
#endif
        #endregion
        StoreGame.Remove(StoreGame.EType.SAVE_USERNAME);
        StoreGame.Remove(StoreGame.EType.SAVE_PASSWORD);
        StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
        if (es.Engine.Connected)
        {
            es.Engine.Close();
        }
        if ((FB.IsLoggedIn || !string.IsNullOrEmpty(FB.AccessToken)) && !Application.isWebPlayer)
        {
            FB.Logout();
        }
        Disconnect();
        GameManager.LoadScene(ESceneName.LoginScreen);
    }
예제 #8
0
 public static void Clear()
 {
     StoreGame.Remove(StoreGame.EType.PLAY_THE_SAME_DEVICE);
     StoreGame.Save();
 }
예제 #9
0
    void PluginMessageOnProcess(string command, string action, EsObject PluginMessageParameters)
    {
        if (command == Fields.RESPONSE.LOGIN_RESPONSE)
        {
            Debug.Log("OnLoginResponse " + PluginMessageParameters);
            Debug.Log("Đã nhận được thông tin server");
            EsObject esoResponce = PluginMessageParameters;

            if (esoResponce.getBoolean("loginResult"))
            {
                if (esoResponce.variableExists("gifts"))
                {
                    EsObject[] esoGifts = esoResponce.getEsObjectArray("gifts");
                    int        index    = Array.FindIndex(esoGifts, eI => eI.getBoolean("currentDate") == true);
                    if (esoGifts.Length > 0)
                    {
                        for (int i = 0; i < esoGifts.Length; i++)
                        {
                            Announcement ann = new Announcement(esoGifts[i]);
                            ann.index       = i;
                            ann.description = "Ngày " + (i + 1);
                            if (i < index)
                            {
                                ann.receivered = true;
                            }
                            GameManager.Instance.ListAnnouncement.Add(ann);
                        }
                    }
                }
                if (esoResponce.variableExists("countUnReadMessage"))
                {
                    GameManager.Server.totalMesseageCount = esoResponce.getInteger("countUnReadMessage");
                }

                GameManager.Setting.BroadcastMessage = esoResponce.getString("broadCastMessage");
                //GameManager.Instance.channelRoom = new RoomInfo(esoResponce.getEsObject("firstRoomToJoin"));
                GameManager.Instance.hallRoom = new RoomInfo(esoResponce.getEsObject("firstRoomToJoin"));
                GameManager.Instance.mInfo    = new User(esoResponce.getEsObject("userInfo"));

                if (esoResponce.variableExists("ceo_chan"))
                {
                    Common.RULE_CHIP_COMPARE_BETTING = esoResponce.getInteger("ceo_chan");
                }
                if (esoResponce.variableExists("pingRequire"))
                {
                    GameManager.Setting.IsPingRequire = esoResponce.getBoolean("pingRequire");
                }



                if (esoResponce.variableExists("gameRoom"))
                {
                    ((LobbyChan)GameManager.Instance.selectedLobby).SetDataJoinLobby(esoResponce.getEsObject("gameRoom"));
                    GameManager.Instance.selectedChannel.SetDataRoom(esoResponce.getEsObject("gameRoom").getEsObject("gameDetails").getEsObject("parent"));
                    GameManager.Instance.currentRoom = new RoomInfo(GameManager.Instance.hallRoom.zoneId, GameManager.Instance.hallRoom.roomId);
                    GameManager.Server.DoJoinGame(((LobbyChan)GameManager.Instance.selectedLobby).config.password);
                    GameManager.LoadScene(ESceneName.GameplayChan);
                    return;
                }

                ServerWeb.StartThread(ServerWeb.URL_REQUEST_USER, new object[] { "username", GameManager.Instance.mInfo.username }, delegate(bool isDone, WWW res, IDictionary json)
                {
                });
                GameManager.Instance.mInfo.password = lablePassword.value;
                GameManager.Server.DoJoinRoom(GameManager.Instance.hallRoom.zoneId, GameManager.Instance.hallRoom.roomId);
#if UNITY_WEBPLAYER
                if (!hasAccessToken)
                {
                    Application.ExternalEval("ajaxLoginUnity(\"" + GameManager.Instance.userNameLogin + "\", \"" + GameManager.Instance.passwordLogin + "\");");
                }
#endif
                if (!cbSavePass.value)
                {
                    StoreGame.Remove(StoreGame.EType.SAVE_USERNAME);
                    StoreGame.Remove(StoreGame.EType.SAVE_PASSWORD);
                    StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
                    GameManager.Instance.userNameLogin = GameManager.Instance.passwordLogin = GameManager.Instance.accessToken = "";
                }
                else
                {
                    StoreGame.SaveString(StoreGame.EType.SAVE_USERNAME, GameManager.Instance.userNameLogin);
                    StoreGame.SaveString(StoreGame.EType.SAVE_PASSWORD, GameManager.Instance.passwordLogin);
                    StoreGame.SaveString(StoreGame.EType.SAVE_ACCESSTOKEN, GameManager.Instance.accessToken);
                }
            }
            else
            {
                Debug.Log("Login false");
                IsClickButtonLogin = false;
                StoreGame.Remove(StoreGame.EType.SAVE_USERNAME);
                StoreGame.Remove(StoreGame.EType.SAVE_PASSWORD);
                StoreGame.Remove(StoreGame.EType.SAVE_ACCESSTOKEN);
                GameManager.Instance.userNameLogin = GameManager.Instance.passwordLogin = GameManager.Instance.accessToken = "";

                string message = "Thông tin đăng nhập không hợp lệ. Yêu cầu nhập lại thông tin truy cập.";
                if (!string.IsNullOrEmpty(esoResponce.getString("reason")))
                {
                    message = esoResponce.getString("reason");
                }
                NotificationView.ShowMessage(message);
            }
        }

        WaitingView.Instance.Close();
    }
예제 #10
0
    void ProcessGeneral(string command, string action, EsObject eso)
    {
        if (command == Fields.RESPONSE.CREATE_GAME)
        {
            #region CREATE_GAME
            if (eso.getBoolean("successful"))
            {
                GameManager.Instance.selectedLobby.SetDataJoinLobby(eso);
            }
            else
            {
                NotificationView.ShowMessage("Lỗi! Tạo bàn chơi không thành công.", 3f);
            }
            #endregion
        }
        else if (command == "joinGame")
        {
            #region JOIN GAME
            if (EventLoadSence != null)
            {
                EventLoadSence();
            }
            GameManager.Instance.selectedLobby.SetDataJoinLobby(eso);
            WaitingView.Hide();
            PlaySameDevice.SaveDeviceWhenJoinGame();
            #endregion
        }
        else if (command == "removeFriend")
        {
            #region REMOVE FRIEND
            EsObject obj = eso.getEsObject("user");

            User pendingUser = GameManager.Instance.mInfo.pendingBuddies.Find(user => user.username == (obj.variableExists("username") ? obj.getString("username") : obj.getString(Fields.PLAYER.USERNAME)));
            if (pendingUser != null)
            {
                GameManager.Instance.mInfo.pendingBuddies.Remove(pendingUser);

                if (EventFriendPendingChanged != null)
                {
                    EventFriendPendingChanged(pendingUser, true);
                }
            }
            else
            {
                pendingUser = GameManager.Instance.mInfo.buddies.Find(user => user.username == (obj.variableExists("username") ? obj.getString("username") : obj.getString(Fields.PLAYER.USERNAME)));
                GameManager.Instance.mInfo.buddies.Remove(pendingUser);

                if (EventFriendChanged != null)
                {
                    EventFriendChanged(pendingUser, true);
                }
            }
            #endregion
        }
        else if (command == "acceptFriendRequest")
        {
            #region ACCEPT FRIEND REQUEST
            EsObject obj  = eso.getEsObject("user");
            User     user = new User(obj);

            if (GameManager.Instance.mInfo.requestBuddies.Find(u => u.username == user.username) != null)
            {
                GameManager.Instance.mInfo.requestBuddies.Remove(GameManager.Instance.mInfo.requestBuddies.Find(u => u.username == user.username));
            }

            if (GameManager.Instance.mInfo.buddies.Find(u => u.username == user.username) == null)
            {
                User pendingUser = GameManager.Instance.mInfo.pendingBuddies.Find(u => u.username == user.username);
                if (pendingUser != null)
                {
                    GameManager.Instance.mInfo.pendingBuddies.Remove(pendingUser);
                }

                GameManager.Instance.mInfo.buddies.Add(user);
                if (EventFriendChanged != null)
                {
                    EventFriendChanged(user, false);
                }
            }
            #endregion
        }
        else if (command == "friendRequest")
        {
            #region FRIEND REQUEST
            EsObject obj  = eso.getEsObject("user");
            User     user = new User(obj);
            GameManager.Instance.mInfo.pendingBuddies.Add(user);

            if (EventFriendPendingChanged != null)
            {
                EventFriendPendingChanged(user, false);
            }
            #endregion
        }
        else if (command == "inComingMessage")
        {
            #region INCOME MESSAGE
            Messages message = new Messages(eso.getEsObject("message"));
            GameManager.Instance.mInfo.messages.Add(message);

            RegisterEventMessageChanged(message, false);
            #endregion
        }
        else if (command == "outGoingMessage")
        {
            #region OUT GOING MESSAGE
            Messages mess = new Messages();
            mess.SetDataOutGoing(eso);
            GameManager.Instance.mInfo.messages.Add(mess);
            RegisterEventMessageChanged(mess, true);
            #endregion
        }
        else if (command == "systemMessage")
        {
            #region SYSTEM MESSAGE
            Messages message = new Messages(eso.getEsObject("message"));

            message.sender        = 0;
            message.read          = false;
            message.receiver      = GameManager.Instance.mInfo.id;
            message.receiver_name = GameManager.Instance.mInfo.username;

            MessageSystemCache.SaveCache(new Hashtable[] { message.ParseToHashtable });

            if (message.type != 0)
            {
                ServerMessagesView.MessageServer(message.content);
            }
            else
            {
                RegisterEventMessageChanged(message, false);
            }
            #endregion
        }
        else if (command == "invitePlayGame")
        {
            #region INVITE PLAY GAME
            string actionInvited = "joinGame";
            if (eso.variableExists("action"))
            {
                actionInvited = eso.getString("action");
            }

            if (actionInvited == "createGame")
            {
                NotificationView.ShowConfirm("Xác nhận", "Bạn có muốn tạo phòng mới hay không?",
                                             delegate()
                {
                    GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                                           new object[] { "config", createRoom() }));
                }, delegate()
                {
                    GameManager.Server.DoRequestCommand("abortInvitation");
                });
            }
            else
            {
                #region INVITE PLAYER
                string userName = eso.getString(Fields.PLAYER.USERNAME);
                int    gameId   = eso.getInteger("gameId");
                string password = eso.variableExists("password") ? eso.getString("password") : "";
                if (password.Length == 0 && eso.variableExists("config"))
                {
                    EsObject esoConfig = eso.getEsObject("config");
                    if (esoConfig.variableExists("password"))
                    {
                        password = esoConfig.getString("password");
                    }
                }
                int roomId    = eso.getInteger("roomId");
                int zoneId    = eso.getInteger("zoneId");
                int gameIndex = eso.getInteger("gameIndex");

                if (GameManager.CurrentScene == ESceneName.LobbyChan || GameManager.CurrentScene == ESceneName.LobbyPhom || GameManager.CurrentScene == ESceneName.LobbyTLMN)
                {
                    string contentMsg = "Bạn nhận được một lời mời chơi!";
                    if (userName.Length > 0)
                    {
                        contentMsg = "\"" + Utility.Convert.ToTitleCase(userName) +
                                     "\" gửi bạn một lời mời tham gia vào bàn chơi số " + gameIndex + ".\n\n";
                    }
                    NotificationView.ShowConfirm("Mời chơi",
                                                 contentMsg,
                                                 delegate()
                    {
                        //GameManager.Instance.selectedLobby = GameManager.CurrentScene == ESceneName.LobbyChan ? new LobbyChan(zoneId, roomId, gameId) : GameManager.CurrentScene == ESceneName.LobbyPhom ? new LobbyPhom(zoneId, roomId, gameId) : new LobbyTLMN(zoneId, roomId, gameId);
                        if (GameManager.CurrentScene == ESceneName.LobbyPhom)
                        {
                            GameManager.Instance.selectedLobby = new LobbyPhom(zoneId, roomId, gameId);
                        }
                        else if (GameManager.CurrentScene == ESceneName.LobbyChan)
                        {
                            GameManager.Instance.selectedLobby = new LobbyChan(zoneId, roomId, gameId);
                        }
                        else
                        {
                            GameManager.Instance.selectedLobby = new LobbyTLMN(zoneId, roomId, gameId);
                        }
                        GameManager.Server.DoJoinGame(password);
                    }, delegate()
                    {
                        GameManager.Server.DoRequestCommand("abortInvitation");
                    });
                }
                #endregion
            }
            #endregion
        }
        else if (command == "updateUserInfo")
        {
            #region CẬP NHẬT THÔNG TIN USERS
            if (eso.variableExists("userName") && eso.getString("userName") == GameManager.Instance.mInfo.username)
            {
                if (eso.variableExists("field"))
                {
                    string field = eso.getString("field");

                    if (field == "money")
                    {
                        string moneyType = "";
                        if (eso.variableExists("moneyType"))
                        {
                            moneyType = eso.getString("moneyType");
                        }
                        if (moneyType != "" && moneyType == "chip")
                        {
                            long.TryParse(eso.getString("value"), out GameManager.Instance.mInfo.chip);
                        }
                        else if (moneyType != "" && moneyType == "gold")
                        {
                            long.TryParse(eso.getString("value"), out GameManager.Instance.mInfo.gold);
                        }
                    }
                    else if (field == "experience")
                    {
                        GameManager.Instance.mInfo.SetDataUser(eso.getEsObject("userInfo"));
                    }

                    if (EventUpdateUserInfo != null)
                    {
                        EventUpdateUserInfo();
                    }
                }
            }
            else if (eso.variableExists("userName") && eso.getString("userName") != GameManager.Instance.mInfo.username)
            {
                if (GameManager.CurrentScene == ESceneName.GameplayChan && eso.variableExists("field"))
                {
                    string field = eso.getString("field");
                    if (field == "experience")
                    {
                        if (GameModelChan.GetPlayer(eso.getString("userName")) != null)
                        {
                            GameModelChan.GetPlayer(eso.getString("userName")).SetDataUser(eso.getEsObject("userInfo"));
                        }
                    }
                }
            }
            #endregion
        }
        else if (command == "updateConfigClient")
        {
            #region CẬP NHẬT THÔNG TIN CONFIG
            if (eso.variableExists("config"))
            {
                IDictionary obj  = (IDictionary)JSON.JsonDecode(eso.getString("config"));
                string      type = obj[Fields.CONFIGCLIENT.KEY_TYPE_REAL_TIME].ToString();
                switch (type)
                {
                case Fields.CONFIGCLIENT.VALUE_ADS:
                    Announcement announce = new Announcement(
                        Convert.ToInt32(obj["index"]),
                        obj["description"].ToString(),
                        obj["scenes"].ToString() == "lobby"
                                ? Announcement.Scene.lobby
                                : obj["scenes"].ToString() == "login"
                                ? Announcement.Scene.login
                                : Announcement.Scene.announce,
                        obj["url"].ToString(),
                        obj["image"].ToString(),
                        obj["type"].ToString() == "Ads" ? Announcement.Type.Advertisement : Announcement.Type.Event
                        );
                    GameManager.Instance.ListAnnouncement.Remove(GameManager.Instance.ListAnnouncement.Find(ads => ads.show == announce.show && ads.type == Announcement.Type.Advertisement));
                    GameManager.Instance.ListAnnouncement.Add(announce);
                    if (EventAdsChanged != null)
                    {
                        EventAdsChanged(obj);
                    }
                    break;

                case Fields.CONFIGCLIENT.VALUE_HELP:
                    StoreGame.Remove(StoreGame.EType.CACHE_HELP);
                    GameManager.Instance.ListHelp.Clear();
                    StoreGame.SaveString(StoreGame.EType.CACHE_HELP, JSON.JsonEncode(obj[Fields.RESPONSE.PHP_RESPONSE_ITEMS]));
                    ArrayList list = (ArrayList)obj[Fields.RESPONSE.PHP_RESPONSE_ITEMS];
                    foreach (Hashtable item in list)
                    {
                        GameManager.Instance.ListHelp.Add(item);
                    }
                    if (EventHelpChanged != null)
                    {
                        EventHelpChanged(obj);
                    }
                    break;

                case Fields.CONFIGCLIENT.VALUE_CONFIG_CLIENT:
                    ArrayList items = (ArrayList)obj[Fields.RESPONSE.PHP_RESPONSE_ITEMS];
                    foreach (Hashtable item in items)
                    {
                        GameManager.Setting.Platform.AddOrUpdatePlatformConfig(item);
                    }
                    if (GameManager.Setting.Platform.GetConfigByType(PlatformType.url_ping) != null)
                    {
                        ServerWeb.URL_PING = GameManager.Setting.Platform.GetConfigByType(PlatformType.url_ping).Value;
                    }
                    if (EventConfigClientChanged != null)
                    {
                        EventConfigClientChanged(obj);
                    }
                    break;
                }
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.DAYLY_GIFT)
        {
            #region Thông tin trả về khi nhận quà tặng
            //AnnouncementView.Instance.Close();
            if (eso.variableExists("textNotification"))
            {
                if (GameObject.Find("__Announcement") != null)
                {
                    AnnouncementView.Instance.SetCenterOnNextCurrentDay();
                }
                GameManager.Instance.FunctionDelay(delegate()
                {
                    string text = eso.getString("textNotification");
                    NotificationView.ShowMessage(text);
                }, 1f);
                GameManager.Instance.ListAnnouncement.RemoveAll(a => a.show == Announcement.Scene.announce && a.type == Announcement.Type.Gift);
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.GET_MESSAGE)
        {
            #region LẤY THÔNG TIN TIN NHẮN TỪ SERVER
            WaitingView.Hide();
            //disable total count khi chưa load messeage
            this.totalMesseageCount = -1;
            if (eso.variableExists("messages"))
            {
                EsObject[] array = eso.getEsObjectArray("messages");
                System.Array.ForEach <EsObject>(array, o => { GameManager.Instance.mInfo.messages.Add(new Messages(o)); });

                List <Messages> systemMessage = GameManager.Instance.mInfo.messages.FindAll(m => m.sender == 0);
                GameManager.Instance.ListMessageSystem.Clear();
                while (systemMessage.Count > 0)
                {
                    GameManager.Instance.ListMessageSystem.Add(systemMessage[0]);
                    GameManager.Instance.mInfo.messages.Remove(systemMessage[0]);
                    systemMessage.RemoveAt(0);
                }
                if (EventGetMessageCallBack != null)
                {
                    EventGetMessageCallBack();
                }
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.GET_BUDDIES)
        {
            #region LẤY THÔNG TIN DANH SÁCH BẠN BÈ
            WaitingView.Hide();
            GameManager.Instance.mInfo.SetDataUser(eso);
            if (EventGetBuddiesCallBack != null)
            {
                EventGetBuddiesCallBack();
            }
            #endregion
        }
        else if (command == "getLevel")
        {
            if (eso.variableExists("level"))
            {
                GameManager.Instance.mInfo.level = eso.getInteger("level");
            }
            if (eso.variableExists("experience"))
            {
                GameManager.Instance.mInfo.experience = eso.getInteger("experience");
            }
            if (eso.variableExists("expMinCurrentLevel"))
            {
                GameManager.Instance.mInfo.expMinCurrentLevel = eso.getInteger("expMinCurrentLevel");
            }
            if (eso.variableExists("expMinNextLevel"))
            {
                GameManager.Instance.mInfo.expMinNextLevel = eso.getInteger("expMinNextLevel");
            }
        }
    }