Exemplo n.º 1
0
    private void DoCreateGame(int betting)
    {
        WaitingView.Show("Đang tạo bàn");
        Debug.Log("DoCreateGame");
        EsObject gameConfig = new EsObject();

        string roomName = txtRoomName.value;

        if (string.IsNullOrEmpty(roomName))
        {
            roomName = "Bàn chơi của " + GameManager.Instance.mInfo.username;
        }

        gameConfig.setInteger(LobbyTLMN.DEFINE_GAME_TYPE_TLMN,
                              ruleMain[0].value ? (int)LobbyTLMN.GameConfig.GameTypeLTMN.DEM_LA : (int)LobbyTLMN.GameConfig.GameTypeLTMN.XEP_HANG);

        gameConfig.setString(LobbyTLMN.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyTLMN.DEFINE_LOBBY_PASWORD, txtPassword.value.Trim());
        gameConfig.setInteger(LobbyTLMN.DEFINE_BETTING, betting);

        gameConfig.setBoolean(LobbyTLMN.DEFINE_USING_CHATCHONG_RULE, ruleSub[0].value);

        gameConfig.setBoolean(LobbyTLMN.DEFINE_USING_TYPE_RULE, ruleMain[0].value);//True Cơ bản, False Nâng Cao

        gameConfig.setStringArray(LobbyTLMN.DEFINE_INVITED_USERS, new string[0]);

        GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                               new object[] { "config", gameConfig }));
    }
Exemplo n.º 2
0
    private void DoCreateGame(int betting, int timePlay)
    {
        WaitingView.Show("Đang tạo phòng");
        int rulePlaying = 0;

        Debug.Log("DoCreateGame");
        EsObject gameConfig = new EsObject();

        string roomName = txtRoomName.value;

        if (string.IsNullOrEmpty(roomName))
        {
            roomName = "Bàn chơi của " + GameManager.Instance.mInfo.username;
        }

        gameConfig.setString(LobbyChan.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyChan.DEFINE_LOBBY_PASWORD, txtPassword.value.Trim());
        gameConfig.setInteger(LobbyChan.DEFINE_BETTING, betting);

        if (!cbGaNhai.value && !cbNuoiGa.value)
        {
            showGa = (int)LobbyChan.EGaRule.none;
        }

        gameConfig.setInteger(LobbyChan.DEFINE_USING_NUOI_GA, showGa);    //true nuoi ga false ga nhai
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_BAT_BAO, true); //true
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_U, true);       //true
        rulePlaying = ruleMain[0].value ? 1 : ruleMain[1].value ? 2 : ruleMain[2].value ? 3 : 1;
        gameConfig.setInteger(LobbyChan.DEFINE_RULE_FULL_PLAYING, rulePlaying);
        gameConfig.setStringArray(LobbyChan.DEFINE_INVITED_USERS, new string[0]);
        gameConfig.setInteger(LobbyChan.DEFINE_PLAY_ACTION_TIME, timePlay);// defalt 20s

        GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                               new object[] { "config", gameConfig }));
    }
Exemplo n.º 3
0
    private void DoCreateGame(int betting)
    {
        Debug.Log("DoCreateGame");
        EsObject gameConfig = new EsObject();

        string roomName = txtRoomName.value;

        if (string.IsNullOrEmpty(roomName))
        {
            roomName = "Bàn chơi của " + GameManager.Instance.mInfo.username;
        }

        gameConfig.setString(LobbyPhom.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyPhom.DEFINE_LOBBY_PASWORD, txtPassword.value.Trim());
        gameConfig.setInteger(LobbyPhom.DEFINE_BETTING, betting);

        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_U_TRON_RULE, ruleSub[0].value);     //Ù tròn
        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_U_XUONG_RULE, ruleSub[1].value);    //Ù Xuông
        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_XAO_KHAN_RULE, ruleSub[2].value);   // Xào Khan
        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_DEN_CHONG_RULE, ruleSub[3].value);  //Đền Chồng
        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_CHOT_CHONG_RULE, ruleSub[4].value); //Chốt Chồng

        gameConfig.setBoolean(LobbyPhom.DEFINE_USING_TYPE_RULE, ruleMain[0].value);      //True Cơ bản, False Nâng Cao

        gameConfig.setStringArray(LobbyPhom.DEFINE_INVITED_USERS, new string[0]);

        GameManager.Server.DoRequestPlugin(Utility.SetEsObject(Fields.RESPONSE.CREATE_GAME,
                                                               new object[] { "config", gameConfig }));
    }
Exemplo n.º 4
0
    public EsObject createRoom()
    {
        EsObject gameConfig = new EsObject();
        string   roomName   = "Bàn chơi của " + GameManager.Instance.mInfo.username;

        gameConfig.setString(LobbyChan.DEFINE_LOBBY_NAME, roomName);
        gameConfig.setString(LobbyChan.DEFINE_LOBBY_PASWORD, "");
        gameConfig.setInteger(LobbyChan.DEFINE_BETTING, 10);
        gameConfig.setInteger(LobbyChan.DEFINE_USING_NUOI_GA, (int)LobbyChan.EGaRule.none); //true nuoi ga false ga nhai
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_BAT_BAO, true);                   //true
        gameConfig.setBoolean(LobbyChan.DEFINE_USING_AUTO_U, true);                         //true
        gameConfig.setInteger(LobbyChan.DEFINE_RULE_FULL_PLAYING, 1);                       // mặc đinh là ù xuông;
        gameConfig.setStringArray(LobbyChan.DEFINE_INVITED_USERS, new string[0]);
        gameConfig.setInteger(LobbyChan.DEFINE_PLAY_ACTION_TIME, 20);                       // defalt 20s
        return(gameConfig);
    }
Exemplo n.º 5
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);
        }
    }
Exemplo n.º 6
0
 public EsObject toEsObject()
 {
     EsObject obj = new EsObject();
     obj.setInteger(GameConstants.ID, key);
     obj.setBoolean(GameConstants.COLOR_IS_BLACK, isColorBlack());
     return obj;
 }
    private void handleUserEnterEvent(EsObject esob)
    {
        //Debug.Log("handleUserEnterEvent");
        string name = esob.getString(PluginTags.USER_NAME);
        GameObject obj = GameObject.Find("remote_" + name);
        if (obj == null && !name.Equals(_userName))
        {
            // need to spawn player, pick arbitrary spot and move with first position update
            esob.setInteger(PluginTags.TARGET_X, 110);
            esob.setInteger(PluginTags.TARGET_Y, 150);
            getPlayerSpawnController().UserEnterRoom(esob);

            SendMessage("AddChatMessage", name + " entered the room.");
        }
    }