internal void InitBetting(Electrotank.Electroserver5.Api.EsObject eso) { if (panelBetting.gameObject.activeSelf) { panelBetting.HideAllButton(); } ShowPanelJoin(); foreach (PlayerBettingView pv in panelJoin.listBettingPlayer) { if (pv.iconChange.gameObject.activeSelf) { pv.iconChange.gameObject.SetActive(false); } } PlayerBettingView view = panelJoin.listBettingPlayer.Find(lbv => lbv.model.Player.username == eso.getString("userName")); ECardTexture texture = view.GetComponentInChildren <ECardTexture>(); view.model.CardId = eso.getInteger("cardId"); view.model.ETypeLaying = (ETypeLayingBetting)eso.getInteger("gaNgoaiType"); view.model.ChipBetting = eso.getLong("value"); view.SetData(view.model); if (GameManager.Instance.mInfo.username == eso.getString("userName")) { panelJoin.ShowButonJoin(model); } if (eso.getString("userName") != GameManager.Instance.mInfo.username) { view.iconChange.gameObject.SetActive(true); } }
public void InitUser(EsObject[] esoArr) { DestroyUser(); for (int i = 0; i < esoArr.Length; i++) { EsObject eso = esoArr[i]; PlayerBettingModel model = new PlayerBettingModel();; model.Player = GameModelChan.GetPlayer(eso.getString("userName")); if (model == null) { model = new PlayerBettingModel(); model.Player.username = eso.getString("userName"); } model.CardId = eso.getInteger("cardId"); if (winner == eso.getString("userName")) { model.IsWinner = true; } else { model.IsWinner = false; } model.ETypeLaying = (ETypeLayingBetting)eso.getInteger("gaNgoaiType"); model.ChipBetting = eso.getLong("value"); PlayerBettingView bettingView = PlayerBettingView.Create(model, tableUser.transform); listBettingPlayer.Add(bettingView); if (eso.getString("userName") == GameManager.Instance.mInfo.username) { bettingView.gameObject.name = "__0"; } } tableUser.repositionNow = true; // tableUser.Reposition(); SetCenterUITable(tableUser); GameManager.Instance.FunctionDelay(delegate() { foreach (PlayerBettingView pv in listBettingPlayer) { if (pv.model.IsWinner != null) { if (pv.model.IsWinner == true) { pv.iconChicken.gameObject.SetActive(true); } else { pv.lbMoney.gameObject.GetComponent <UILabel>().color = new Color(1f, 155f / 255f, 0f); ECardTexture texture1 = pv.gameObject.GetComponentInChildren <ECardTexture>(); texture1.card.SetColor(new Color(1f, 1f, 1f, 90f / 255f)); } } } }, 0.1f); }
public static PlayerBettingView Create(PlayerBettingModel model, Transform parent) { GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/GaNgoai/PlayerBettingView")); obj.transform.parent = parent; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; PlayerBettingView bettings = obj.GetComponent <PlayerBettingView>(); bettings.SetData(model); return(bettings); }
public void InitUser(EsObject[] esoArr) { while (listBettingPlayer.Count > 0) { GameObject.Destroy(listBettingPlayer[0].gameObject); listBettingPlayer.RemoveAt(0); } for (int i = 0; i < esoArr.Length; i++) { EsObject eso = esoArr[i]; PlayerBettingModel model = new PlayerBettingModel(); model.Player = GameModelChan.GetPlayer(eso.getString("userName")); if (model.Player == null) { model.Player = new PlayerControllerChan(); model.Player.username = eso.getString("userName"); } if (!GameModelChan.game.dicUserBetting.ContainsKey(eso.getString("userName"))) { GameModelChan.game.dicUserBetting.Add(eso.getString("userName"), false); } model.CardId = eso.getInteger("cardId"); model.ETypeLaying = (ETypeLayingBetting)eso.getInteger("gaNgoaiType"); model.ChipBetting = eso.getLong("value"); PlayerBettingView bettingView = PlayerBettingView.Create(model, tableUser.transform); listBettingPlayer.Add(bettingView); if (eso.getString("userName") == GameManager.Instance.mInfo.username) { parent.model = model; ShowButonJoin(model); bettingView.gameObject.name = "__0"; } } tableUser.repositionNow = true; SetCenterUITable(tableUser); if (Array.Find <EsObject>(esoArr, eso => eso.getString("userName") == GameManager.Instance.mInfo.username) == null) { HideBothButton(); } GameManager.Instance.FunctionDelay(delegate() { foreach (PlayerBettingView view in listBettingPlayer) { if (GameModelChan.game.dicUserBetting.ContainsKey(view.model.Player.username) && GameModelChan.game.dicUserBetting[view.model.Player.username]) { view.iconChange.gameObject.SetActive(true); GameModelChan.game.dicUserBetting[view.model.Player.username] = false; } } }, 0.01f); }