public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (front == null) { front = Array.Find(CardManager.instance.cardImages, x => x.name == "card_" + value + "_" + cardType.ToString()); } if (showFront && sr.sprite != front) { sr.sprite = front; } else if (!showFront && sr.sprite != back) { sr.sprite = back; } if (stream.IsWriting) { stream.SendNext(cardType); stream.SendNext(cardColor); stream.SendNext(value); stream.SendNext(showFront); stream.SendNext(isDouble); } else if (stream.IsReading) { cardType = (Enums.CardType)stream.ReceiveNext(); cardColor = (Enums.CardColor)stream.ReceiveNext(); value = (int)stream.ReceiveNext(); showFront = (bool)stream.ReceiveNext(); isDouble = (bool)stream.ReceiveNext(); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Enums.CardColor color = (Enums.CardColor)value; switch (color) { case Enums.CardColor.Black: return(new SolidColorBrush(Color.FromArgb(255, 52, 52, 52))); case Enums.CardColor.Blue: return(new SolidColorBrush(Color.FromArgb(255, 26, 68, 93))); case Enums.CardColor.Green: return(new SolidColorBrush(Color.FromArgb(255, 37, 87, 49))); case Enums.CardColor.Red: return(new SolidColorBrush(Color.FromArgb(255, 81, 15, 29))); case Enums.CardColor.None: return(new SolidColorBrush(Color.FromArgb(255, 82, 65, 39))); //Is an item default: throw new NotImplementedException(); } }