public static FACardBettingView Create(int cardId, Transform parent, PanelBetting grandParent) { GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/GaNgoai/CardFA")); obj.name = "card " + cardId; obj.transform.parent = parent; obj.transform.localPosition = new Vector3(0f, 0f, -1f); obj.transform.localScale = Vector3.one; FACardBettingView card = obj.GetComponent <FACardBettingView>(); card.SetData(cardId, grandParent); return(card); }
internal void ShowIndividualCard(Electrotank.Electroserver5.Api.EsObject eso) { esObj = eso; DestroyCard(); if (eso.variableExists("cards")) { int[] cardIds = eso.getIntegerArray("cards"); for (int i = 0; i < cardIds.Length; i++) { if (parent.model != null) { if (parent.model.CardId == cardIds[i]) { FACardBettingView.Create(cardIds[i], tableCardFA.transform, gameObject.GetComponent <PanelBetting>()).gameObject.SetActive(false); continue; } } FACardBettingView cars = FACardBettingView.Create(cardIds[i], tableCardFA.transform, gameObject.GetComponent <PanelBetting>()); } tableCardFA.Reposition(); GameManager.Instance.FunctionDelay(delegate() { tableCardFA.transform.parent.localPosition = Vector3.zero; }, 0.01f); } GameManager.Instance.FunctionDelay(delegate() { if (parent.model != null) { if (parent.model.CardId != -1) { ChanCard card = new ChanCard(); card.CardId = parent.model.CardId; card.parent = cardParent; card.Instantiate(); card.cardTexture.texture.width = CARD_WIDTH; card.cardTexture.texture.height = CARD_HIGHT; GameObject.Destroy(card.gameObject.GetComponent <BoxCollider>()); lbCardBet.text = card.ToString(); cardId = parent.model.CardId; } if (parent.model.ChipBetting == 0) { lbChipBet.text = ((LobbyChan)GameManager.Instance.selectedLobby).betting.ToString(); } else { lbChipBet.text = parent.model.ChipBetting.ToString(); } HideAllButton(); } }, 0.15f); }