Esempio n. 1
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 }));
    }
    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 }));
    }
Esempio n. 3
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);
    }
Esempio n. 4
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 }));
    }
    private QuickJoinGameRequest getBasicQuickJoinRequest()
    {
        QuickJoinGameRequest qjr = new QuickJoinGameRequest();
        qjr.GameType = GameConstants.PLUGIN_NAME;
        qjr.ZoneName = GameConstants.ZONE_NAME;
        qjr.Hidden = false;
        qjr.Locked = false;
        qjr.CreateOnly = false;

        EsObject initOb = new EsObject();
        initOb.setString(GameConstants.PLAYER_NAME, me);
        initOb.setBoolean(GameConstants.AI_OPPONENT, true);

        qjr.GameDetails = initOb;

        return qjr;
    }
Esempio n. 6
0
 public EsObject toEsObject()
 {
     EsObject obj = new EsObject();
     obj.setInteger(GameConstants.ID, key);
     obj.setBoolean(GameConstants.COLOR_IS_BLACK, isColorBlack());
     return obj;
 }
 /**
  *  Sends a position update message to the plugin.
  */
 public void sendPositionUpdate(EsObject esob)
 {
     esob.setBoolean(PluginTags.USE_UDP, useUDP);
     sendToPlugin(esob);
 }