private void OnRemoveCardModel(CardZone cardZone, CardModel cardModel) { countLabel.text = contentCardZone.GetComponentsInChildren <CardModel>().Length.ToString(); if (_cardStack == null) { return; } if (CgsNetManager.Instance.isNetworkActive) { CgsNetManager.Instance.LocalPlayer.RequestRemoveAt(_cardStack.gameObject, cardModel.Index); } else { _cardStack.RemoveAt(cardModel.Index); } }
private void OnAddCardModel(CardZone cardZone, CardModel cardModel) { cardModel.transform.rotation = Quaternion.identity; cardModel.IsFacedown = false; cardModel.DoubleClickAction = CardActions.FlipFace; countLabel.text = contentCardZone.GetComponentsInChildren <CardModel>().Length.ToString(); if (_cardStack == null) { return; } int cardCount = cardZone.GetComponentsInChildren <CardModel>().Length; int index = cardCount - 1 - cardModel.transform.GetSiblingIndex(); if (CgsNetManager.Instance.isNetworkActive) { CgsNetManager.Instance.LocalPlayer.RequestInsert(_cardStack.gameObject, index, cardModel.Id); } else { _cardStack.Insert(index, cardModel.Id); } }