Ejemplo n.º 1
0
    public override void SetDataJoinLobby(EsObject obj)
    {
        SetDataChannelLobby(obj);
        if (obj.variableExists("gameDetails"))
        {
            EsObject gameDetails = obj.getEsObject("gameDetails");

            if (gameDetails.variableExists("config"))
            {
                EsObject esConfig = gameDetails.getEsObject("config");
                SetingConfig(esConfig);
            }

            if (gameDetails.variableExists("parent"))
            {
                parent = new RoomInfo(gameDetails.getEsObject("parent"));
            }
            if (gameDetails.variableExists(DEFINE_INVITED_USERS))
            {
                invitedUsers = gameDetails.getStringArray(DEFINE_INVITED_USERS);
            }
            if (gameDetails.variableExists("roomMasterUsername"))
            {
                roomMasterUsername = gameDetails.getString("roomMasterUsername");
            }
            if (gameDetails.variableExists("gameIndex"))
            {
                gameIndex = gameDetails.getInteger("gameIndex");
            }

            if (gameDetails.variableExists("defaultInfo"))
            {
                EsObject defaultInfo = gameDetails.getEsObject("defaultInfo");
                numberRobotAllowed = defaultInfo.getInteger("numRobotAllowed");
            }
        }
    }
Ejemplo n.º 2
0
    public void SetDataChannelLobby(EsObject obj)
    {
        base.SetDataRoom(obj);

        if (obj.variableExists("gameId"))
        {
            gameId = obj.getInteger("gameId");
        }
        if (obj.variableExists("description"))
        {
            nameLobby = obj.getString("description");
        }
        if (obj.variableExists("maximumPlayers"))
        {
            maxNumberPlayer = obj.getInteger("maximumPlayers");
        }
        if (obj.variableExists("numberUsers"))
        {
            numberUserInRoom = obj.getInteger("numberUsers");
        }
        if (obj.variableExists("betting"))
        {
            betting = obj.getInteger("betting");
        }
        if (obj.variableExists("gameIndex"))
        {
            gameIndex = obj.getInteger("gameIndex");
        }

        isPassword = false;
        if (obj.variableExists("password"))
        {
            isPassword = obj.getBoolean("password");
        }

        if (obj.variableExists("config"))
        {
            SetingConfig(obj.getEsObject("config"));
        }

        if (obj.variableExists("gamePlaying"))
        {
            gamePlaying = obj.getBoolean("gamePlaying");
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Xủ lý khi có sự thay đổi về danh sách người online, thêm người mới vào lobby, có người thoát ra khỏi lobby
    /// </summary>
    public void OnPluginUpdateUserOnline(string command, string action, EsObject eso)
    {
        if (command == Fields.RESPONSE.USER_ONLINE_UPDATE)
        {
            #region Khi có người mới tham gia hoặc thoát ra khởi room
            EsObject es   = eso.getEsObject(Fields.PLAYER.USERNAME);
            User     user = new User(es);
            if (action == "addUserOnline")
            {
                if (es.getString(Fields.PLAYER.USERNAME) != GameManager.Instance.mInfo.username)
                {
                    lstUser.Add(user);
                    DrawListUserOnline(user, ++i);
                    tableInvite.Reposition();
                }
            }
            else if (action == "removeUserOnline")
            {
                User us = lstUser.Find(u => u.username == user.username);
                if (lstUser.Contains(us))
                {
                    lstUser.Remove(us);
                }

                GPUserOnlineRow rowUser = listUserOnline.Find(o => o.mUser.username == es.getString(Fields.PLAYER.USERNAME));

                if (rowUser != null)
                {
                    listUserOnline.Remove(rowUser);
                    GameObject.Destroy(rowUser.gameObject);
                    tableInvite.repositionNow = true;
                }
            }
            #endregion
        }
    }
Ejemplo n.º 4
0
 public TournamentInfo(EsObject es)
 {
     zoneId = roomId = -1;
     if (es.variableExists("id"))
     {
         this.tournamentId = es.getInteger("id");
     }
     if (es.variableExists("roomId"))
     {
         this.roomId = es.getInteger("roomId");
     }
     if (es.variableExists("zoneId"))
     {
         this.zoneId = es.getInteger("zoneId");
     }
     if (es.variableExists("displayName"))
     {
         this.tournamentName = es.getString("displayName");
     }
     if (es.variableExists("description"))
     {
         this.decription = es.getString("description");
     }
     if (es.variableExists("startTimeRegistration"))
     {
         startDate = es.getString("startTimeRegistration");
     }
     if (es.variableExists("endTimeRegistration"))
     {
         endDate = es.getString("endTimeRegistration");
     }
     if (es.variableExists("startTime"))
     {
         startDate = es.getString("startTime");
     }
     if (es.variableExists("config"))
     {
         SetConfig((IDictionary)JSON.JsonDecode(es.getString("config")));
     }
     if (es.variableExists("maxPlayers"))
     {
         this.maxPlayers = es.getInteger("maxPlayers");
     }
     if (es.variableExists("remainStartTime"))
     {
         this.remainStartTime = es.getLong("remainStartTime");
     }
     if (es.variableExists("isRegister"))
     {
         this.isRegister = es.getBoolean("isRegister");
     }
     if (es.variableExists("numPlayersRegister"))
     {
         this.numPlayersRegister = es.getInteger("numPlayersRegister");
     }
     if (es.variableExists("winner"))
     {
         EsObject obj = es.getEsObject("winner");
         if (obj.variableExists("userName"))
         {
             this.userNameWin = obj.getString("userName");
         }
         if (obj.variableExists("avatar"))
         {
             this.avatarWinner = obj.getString("avatar");
         }
     }
 }
Ejemplo n.º 5
0
    void OnProcessPluginMessage(string command, string action, EsObject paremeters)
    {
        if (command == Fields.RESPONSE.FULL_UPDATE)
        {
            #region Lấy danh sách các lobby sau khi vào room
            LobbyRowTLMN.List.Clear();
            EsObject[] children = paremeters.getEsObjectArray("children");

            UIScrollView panel = parentListLobby.transform.parent.gameObject.GetComponent <UIScrollView>();

            foreach (EsObject obj in children)
            {
                LobbyTLMN lobby = new LobbyTLMN(obj);
                LobbyRowTLMN.Create(panelLobbyRow, parentListLobby.transform, lobby);
            }
            if (children.Length > 0)
            {
                parentListLobby.repositionNow = true;
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.LOBBY_ADD)
        {
            #region Có một lobby mới được tạo.
            EsObject     es    = paremeters.getEsObject("child");
            UIScrollView panel = parentListLobby.transform.parent.gameObject.GetComponent <UIScrollView>();
            LobbyRowTLMN.Create(panelLobbyRow, parentListLobby.transform, new LobbyTLMN(es));
            parentListLobby.repositionNow = true;
            #endregion
        }
        else if (command == Fields.RESPONSE.LOBBY_UPDATE)
        {
            #region Có một lobby nào đó có thay đổi.
            EsObject     es  = paremeters.getEsObject("child");
            LobbyRowTLMN row = LobbyRowTLMN.List.Find(o => o.lobby.gameId == es.getInteger("gameId"));
            if (row != null)
            {
                row.UpdateData(es);
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.LOBBY_REMOVE)
        {
            #region Có một lobby nào đó thoát
            EsObject     es  = paremeters.getEsObject("child");
            LobbyRowTLMN row = LobbyRowTLMN.List.Find(o => o.lobby.gameId == es.getInteger("gameId"));
            LobbyRowTLMN.Remove(row);
            parentListLobby.repositionNow     = true;
            parentListUseOnline.repositionNow = true;
            #endregion
        }
        else if (command == Fields.REQUEST.GET_USER_ONLINE)
        {
            #region Lấy danh sách những người chơi đang online khi vào room
            UserOnlineRowTLMN.List.Clear();

            EsObject[] children = paremeters.getEsObjectArray("users");
            foreach (EsObject obj in children)
            {
                if (obj.getString(Fields.PLAYER.USERNAME) == GameManager.Instance.mInfo.username)
                {
                    continue;
                }
                UserOnlineRowTLMN.Create(parentListUseOnline.transform, new User(obj));
            }
            #endregion
        }
        else if (command == Fields.RESPONSE.USER_ONLINE_UPDATE)
        {
            #region Khi có người mới tham gia hoặc thoát ra khởi room
            if (action == "addUserOnline")
            {
                EsObject es = paremeters.getEsObject(Fields.PLAYER.USERNAME);
                if (es.getString(Fields.PLAYER.USERNAME) != GameManager.Instance.mInfo.username)
                {
                    UserOnlineRowTLMN.Create(parentListUseOnline.transform, new User(es));
                    parentListLobby.repositionNow     = true;
                    parentListUseOnline.repositionNow = true;
                }
            }
            else if (action == "removeUserOnline")
            {
                EsObject       es  = paremeters.getEsObject(Fields.PLAYER.USERNAME);
                EUserOnlineRow row = UserOnlineRowTLMN.List.Find(o => o.user.username == es.getString(Fields.PLAYER.USERNAME));
                if (row != null)
                {
                    UserOnlineRowTLMN.Remove(row);
                    parentListLobby.repositionNow     = true;
                    parentListUseOnline.repositionNow = true;
                }
            }
            #endregion
        }
        else if (command == "quickJoinGame")
        {
            #region Chơi nhanh
            int gameId = paremeters.getInteger("gameId");
            if (gameId == -1)
            {
                NotificationView.ShowMessage("Hiện không có bàn chơi nào sẵn sàng.", 3f);
            }
            else
            {
                LobbyTLMN lobby = LobbyRowTLMN.List.Find(lb => lb.lobby.gameId == gameId).lobby;
                GameManager.Instance.selectedLobby = new LobbyTLMN(lobby.zoneId, lobby.roomId, lobby.gameId);
                if (PlaySameDevice.IsCanJoinGameplay)
                {
                    GameManager.Server.DoJoinGame("");
                }
            }
            #endregion
        }
        else if (command == "error")
        {
            int id = paremeters.getInteger("error");
            if (id == 0)
            {
                Common.MessageRecharge("Bạn không đủ tiền để tham gia bàn chơi.");
            }
            else if (id == 1)
            {
                NotificationView.ShowMessage("Bàn chơi đã đủ người hoặc đã được thêm máy.");
            }
            else if (id == 2)
            {
                NotificationView.ShowMessage("Bạn đã bị đuổi khỏi bài chơi trước đó.");
            }
            else if (id == 4)
            {
                NotificationView.ShowMessage("Mật khẩu không chính xác.\n\nĐề nghị nhập lại.");
            }
            else if (id == 5)
            {
                string contentMsg = paremeters.getString("textNotification");
                int    gameId     = paremeters.getInteger("gameId");
                string password   = paremeters.variableExists("password") ? paremeters.getString("password") : "";
                NotificationView.ShowConfirm("Xác nhận",
                                             contentMsg,
                                             delegate()
                {
                    GameManager.Instance.selectedLobby = new LobbyTLMN(gameId);
                    GameManager.Server.DoJoinGame(password);
                }, null);
            }
        }
        else if (command == "tryCreateGame")
        {
            bool allowCreateRoom = paremeters.getBoolean("allowCreateGame");
            if (allowCreateRoom)
            {
                if (CommonTLMN.ValidateChipToBetting(((ChannelTLMN)GameManager.Instance.selectedChannel).bettingValues[0]))
                {
                    GameManager.LoadScene(ESceneName.CreateRoomTLMN);
                }
                else
                {
                    Common.MessageRecharge("Bạn không đủ tiền để tạo bàn chơi.");
                }
            }
            else
            {
                string contentMsg = paremeters.getString("textNotification");
                int    gameId     = paremeters.getInteger("gameId");
                string password   = paremeters.variableExists("password") ? paremeters.getString("password") : "";
                NotificationView.ShowConfirm("Xác nhận",
                                             contentMsg,
                                             delegate()
                {
                    GameManager.Instance.selectedLobby = new LobbyTLMN(gameId);
                    GameManager.Server.DoJoinGame(password);
                }, null);
            }
        }
    }
Ejemplo n.º 6
0
    public void SetDataChannelLobby(EsObject obj)
    {
        base.SetDataRoom(obj);
        if (obj.variableExists("gameId"))
        {
            gameId = obj.getInteger("gameId");
        }
        if (obj.variableExists("description"))
        {
            nameLobby = obj.getString("description");
        }
        if (obj.variableExists("maximumPlayers"))
        {
            maxNumberPlayer = obj.getInteger("maximumPlayers");
        }
        if (obj.variableExists("numberUsers"))
        {
            numberUserInRoom = obj.getInteger("numberUsers");
        }
        if (obj.variableExists("betting"))
        {
            betting = obj.getInteger("betting");
        }
        if (obj.variableExists("playActionTime"))
        {
            timePlay = obj.getInteger("playActionTime");
        }
        if (obj.variableExists("gameIndex"))
        {
            gameIndex = obj.getInteger("gameIndex");
        }
        if (obj.variableExists("hasRobot"))
        {
            hasRobot = obj.getBoolean("hasRobot");
        }
        isPassword = false;
        if (obj.variableExists("password"))
        {
            isPassword = obj.getBoolean("password");
        }

        if (obj.variableExists("config"))
        {
            SetingConfig(obj.getEsObject("config"));
        }

        if (obj.variableExists("gamePlaying"))
        {
            gamePlaying = obj.getBoolean("gamePlaying");
        }

        autoBatBao = false;
        if (obj.variableExists("usingAutoBatBaoRule"))
        {
            gamePlaying = obj.getBoolean("usingAutoBatBaoRule");
        }

        autoU = false;
        if (obj.variableExists("usingAutoURule"))
        {
            gamePlaying = obj.getBoolean("usingAutoURule");
        }

        if (obj.variableExists("usingNuoiGaRule"))
        {
            ruleGa = (EGaRule)obj.getInteger("usingNuoiGaRule");
        }
    }
Ejemplo n.º 7
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();
    }
Ejemplo n.º 8
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");
            }
        }
    }