Beispiel #1
0
 public int StartPoker(string roomSeed, long roomBetCoin, PokerPlayer[] pokerPlayer, int eventId = 0, int playerId = 0, string token = "")
 {
     if (ParseToken(playerId, token))
     {
         PokerParam param = new PokerParam();
         param.player_id     = apiPlayerId;
         param.token         = apiToken;
         param.room_seed     = roomSeed;
         param.room_bet_coin = roomBetCoin;
         param.event_id      = eventId;
         string[] tempString = new string[pokerPlayer.Length];
         var      j          = 0;
         for (var i = 0; i < pokerPlayer.Length; i++)
         {
             if (pokerPlayer[i].seater_id > 0)
             {
                 tempString[j++] = pokerPlayer[i].ToJson();
             }
         }
         param.poker_player = new string[j];
         for (var i = 0; i < j; i++)
         {
             param.poker_player[i] = tempString[i];
         }
         string paramJson = JsonUtility.ToJson(param);
         API    api       = new API("startpoker.php", "RStartPoker", paramJson, 1);
         param = null; paramJson = "";
         StartCoroutine(Congest.SendPOST(this, api));
         return(api.seed);
     }
     return(0);
 }
Beispiel #2
0
 //End Poker
 public int EndPoker(int pokerId, PokerPlayer[] pokerPlayer, int playerId = 0, string token = "", string otp = "")
 {
     if (ParseToken(playerId, token))
     {
         PokerParam param = new PokerParam();
         param.player_id      = apiPlayerId;
         param.token          = apiToken;
         param.poker_round_id = pokerId;
         string[] tempString = new string[pokerPlayer.Length];
         var      j          = 0;
         for (var i = 0; i < pokerPlayer.Length; i++)
         {
             if (pokerPlayer[i].seater_id > 0)
             {
                 tempString[j++] = pokerPlayer[i].ToJson();
             }
         }
         param.poker_player = new string[j];
         for (var i = 0; i < j; i++)
         {
             param.poker_player[i] = tempString[i];
         }
         string paramJson = JsonUtility.ToJson(param);
         if (otp.Length > 0)
         {
             apiOtp = otp;
         }
         API api = new API("endpoker.php", "REndPoker", paramJson, 1, apiOtp);
         param = null; paramJson = "";
         if (apiOtp.Length > 0)
         {
             StartCoroutine(Congest.SendPOST(this, api));
         }
         else
         {
             api.errorCode = 502;
             ParseError(api);
         }
         return(api.seed);
     }
     return(0);
 }