public void setMycard(CasinoWarCardImpl newcard)
 {
     MyCard = newcard;
 }
Exemple #2
0
    public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
    {
        base.OnRoomPropertiesUpdate(propertiesThatChanged);
        if (propertiesThatChanged.ContainsKey("timer"))
        {
            this.InfoText.text = PhotonNetwork.CurrentRoom.CustomProperties["timer"].ToString();
        }
        if (propertiesThatChanged.ContainsKey("phase"))
        {
            //leave when didn't bet on times
            if ((int)propertiesThatChanged["phase"] == 2)
            {
                PhaseText.color = Color.yellow;
            }
            else if ((int)propertiesThatChanged["phase"] == 0)
            {
                WarButton.gameObject.SetActive(false);
                PhaseText.color = Color.white;
                ResetAllResults();
                DealerCardText.text = "";
            }
            else if ((int)propertiesThatChanged["phase"] == 1)
            {
                PhaseText.color = Color.red;
            }
            else if ((int)propertiesThatChanged["phase"] == 3)
            {
                PhaseText.color = Color.red;
            }
            else if ((int)propertiesThatChanged["phase"] == 4)
            {
                WarButton.gameObject.SetActive(false);
                PhaseText.color = Color.green;
            }

            if ((int)propertiesThatChanged["phase"] == 2 && (int)PhotonNetwork.LocalPlayer.CustomProperties["bet"] == 0)
            {
                //kicked by server
            }
            this.PhaseText.text = "Phase " + PhotonNetwork.CurrentRoom.CustomProperties["phase"].ToString();
        }
        if (propertiesThatChanged.ContainsKey("resultTable"))
        {
            Hashtable resultTable = (Hashtable)propertiesThatChanged["resultTable"];

            Debug.Log(resultTable.Keys.Count);
            CasinoWarCardImpl card = JsonUtility.FromJson <CasinoWarCardImpl>(resultTable["dealercard"].ToString());
            DealerCardText.text = "Dealer's Card: " + card.ToString();

            foreach (Player player in PhotonNetwork.PlayerList)
            {
                if (resultTable.ContainsKey(player.ActorNumber))
                {
                    CasinoWarPlayer casinoPlayer = JsonUtility.FromJson <CasinoWarPlayer>(resultTable[player.ActorNumber].ToString());
                    UpdateResultGui(casinoPlayer);
                }
            }
        }
        if (propertiesThatChanged.ContainsKey("WarTable"))
        {
            Hashtable WarTable = (Hashtable)propertiesThatChanged["WarTable"];

            CasinoWarCardImpl card = JsonUtility.FromJson <CasinoWarCardImpl>(WarTable["dealercard"].ToString());
            DealerCardText.text = "Dealer's Card: " + card.ToString();

            foreach (Player player in PhotonNetwork.PlayerList)
            {
                if (WarTable.ContainsKey(player.ActorNumber))
                {
                    CasinoWarPlayer casinoPlayer = JsonUtility.FromJson <CasinoWarPlayer>(WarTable[player.ActorNumber].ToString());
                    UpdateResultGui(casinoPlayer);
                }
                else
                {
                    ResetResult(ComputeSlot((int)player.CustomProperties["seat"]));
                }
            }
        }
    }
 public bool Equals(CasinoWarCardImpl card)
 {
     return(card.GetValue().Equals(this.value) && card.GetSuit().Equals(this.suit));
 }