public void ClearBet() { if (Enable) { clearTable(); RouletteDelegate.removeAllBet(); } }
public void clearTable() { BetListHistory.Clear(); foreach (Bet b in BetList) { BetListHistory.Add(b); } this.BetList.Clear(); RouletteDelegate.removeAllBet(); }
void clearTableAfterWin() { BetListHistory.Clear(); foreach (Bet b in BetList) { BetListHistory.Add(b); // // Debug.Log ("Add coin to hstory " + b.coin); } this.BetList.Clear(); RouletteDelegate.removeAllBet(); }
void onWarpChatRecived(string sender, string message) { JSONNode s = JSON.Parse(message); switch (s[RouletteTag.TAG]) { case RouletteTag.MOVE_TO_TABLE: { onMoveToTable(); Numbers = JSON.Parse(s["PREVIOUS_NUMBER"]); GameID = s["GAME_ID"]; ManageHistoryPanels(Numbers); } break; case RouletteTag.START_WHEEL: { this.winingNumber = int.Parse(s[RouletteTag.VALUE]); GameID = s["GAME_ID"]; } break; case RouletteTag.NOT_ENOUGH_COIN: { string playerName = s[RouletteTag.PLAYER]; if (playerName.Equals(GameUser.CurrentUser.ID)) { GameController.showToast("Alert! you don't have sufficient coins"); } } break; case RouletteTag.START_DEAL: { this.winingNumber = -1; } break; case RouletteTag.BET_ADDED: { string betID = s["BET_ID"]; addBetOnTable(betID); } break; case RouletteTag.REMOVE_DONE: { string playerName = s[RouletteTag.PLAYER]; if (playerName.Equals(GameUser.CurrentUser.ID)) { // Debug.Log ("Clear Table "); BetListHistory.Clear(); foreach (Bet b in BetList) { // Debug.Log ("user coins" + b.coin); GameUser.CurrentUser.Coin = "" + (float.Parse(GameUser.CurrentUser.Coin) + b.coin); PlayerPrefs.SetFloat(RouletteTag.TOTAL_BET, PlayerPrefs.GetInt(RouletteTag.TOTAL_BET) - b.coin); Player_coin.text = "Coin:" + GameUser.CurrentUser.Coin; BetListHistory.Add(b); } this.BetList.Clear(); RouletteDelegate.removeAllBet(); refreshTable(); } } break; case RouletteTag.UNDO_DONE: { string playerName = s[RouletteTag.PLAYER]; if (playerName.Equals(GameUser.CurrentUser.ID)) { string betID = s["BET_ID"]; Bet b = getBetbyID(betID); if (b != null) { Destroy(b.coinSample); GameUser.CurrentUser.Coin = "" + (float.Parse(GameUser.CurrentUser.Coin) + b.coin); PlayerPrefs.SetFloat(RouletteTag.TOTAL_BET, PlayerPrefs.GetFloat(RouletteTag.TOTAL_BET) - b.coin); Player_coin.text = "Coin:" + GameUser.CurrentUser.Coin; foreach (int n in b.number) { if (n > 0) { GameObject btn = GameObject.Find("" + n); Color c = btn.transform.GetChild(0).GetComponent <Image> ().color; c.a = 0.0f; btn.transform.GetChild(0).GetComponent <Image> ().color = c; } } BetList.Remove(b); } refreshTable(); } } break; case RouletteTag.MOVE_TO_WHEEL: { moveToWheel(); try { HistoryPanel.transform.SetSiblingIndex(0); GameID = s["GAME_ID"]; } catch (System.Exception ex) { } isTable = false; } break; case RouletteTag.BETTING_STOP: { // sendBetttingToServer (); GameID = s["GAME_ID"]; } break; case RouletteTag.WIN_COIN: { // Debug.Log (message); string playerName = s[RouletteTag.PLAYER]; if (playerName.Equals(GameUser.CurrentUser.ID)) { if (PlayerPrefs.GetInt("Sound") == 1) { Player.PlayOneShot(WinSound); } winAmount.text = "Win: " + s[RouletteTag.VALUE]; RouletteDelegate.winnerFound(); } ServerRequest(); // Debug.Log ("win found"); } break; case RouletteTag.LOSS_COIN: { ServerRequest(); // Debug.Log ("loss found"); } break; case RouletteTag.BETTING_START: { GameID = s["GAME_ID"]; winAmount.text = "Win: 0"; clearTableAfterWin(); } break; case RouletteTag.TIME: { try { Timer.text = int.Parse(s[RouletteTag.VALUE]) + ":00"; if (PlayerPrefs.GetInt("Sound") == 1) { Player.PlayOneShot(ClockSound); } } catch (System.Exception ex) { // Debug.Log (ex.Message); } } break; } }