public void InitAsIncognito(UserDataInGame _data, string _txtNameShow = "") // Init dưới dạng ẩn danh { myType = MyType.Incognito; if (data != null) { if (!data.IsEqual(_data)) { if (actionLoadAvatar != null) { StopCoroutine(actionLoadAvatar); actionLoadAvatar = null; } } } data = _data; imgAvatar.texture = CoreGameManager.instance.gameInfomation.otherInfo.avatarIncognito; txtGold.text = string.Empty; imgIconAcc.gameObject.SetActive(false); if (string.IsNullOrEmpty(_txtNameShow)) { txtNameShow.text = MyLocalize.GetString("Global/Wating"); } else { txtNameShow.text = _txtNameShow; } if (data != null) { actionLoadAvatar = data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => { actionLoadAvatar = null; }); } }
public void InitData(UserDataInGame _userData, bool _isWin, long _goldBonus, int _point) { data = _userData; if (_isWin) { imgStar.gameObject.SetActive(true); panelShadow.gameObject.SetActive(false); txtGoldBonus.text = "+" + MyConstant.GetMoneyString(_goldBonus, 9999); txtName.color = Color.yellow; txtPoint.color = Color.yellow; } else { imgStar.gameObject.SetActive(false); panelShadow.gameObject.SetActive(true); txtGoldBonus.text = string.Empty; txtName.color = Color.white; txtPoint.color = Color.white; } txtName.text = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName); txtPoint.text = "" + MyConstant.GetMoneyString(_point); imgAvatar.texture = CoreGameManager.instance.gameInfomation.otherInfo.avatarDefault; data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => { try{ if (_avatar != null) { imgAvatar.texture = _avatar; } }catch {} }); }
public void InitData(UserDataInGame _userData, string _chatConntent, System.Action <MySimplePoolObjectController> _onSelfDestruction) { txtUserName.text = MyConstant.ConvertString(_userData.nameShowInGame, maxLengthOfUserName); _userData.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => { try{ if (_avatar != null) { imgAvatar.texture = _avatar; } }catch {} }); txtContent.text = _chatConntent; tmpTxtContent.text = _chatConntent; onSelfDestruction = _onSelfDestruction; }
public void Init(UserDataInGame _data, System.Action _onClose = null) { data = _data; Sprite _iconDatabaseID = data.GetIconDatabaseID(); if (_iconDatabaseID != null) { imgIconAcc.gameObject.SetActive(true); imgIconAcc.sprite = _iconDatabaseID; } else { imgIconAcc.gameObject.SetActive(false); } txtNameShow.text = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName); txtGold.text = MyConstant.GetMoneyString(data.gold, 999999999); txtAchievement_Win.text = MyConstant.GetMoneyString(data.win); txtAchievement_Tie.text = MyConstant.GetMoneyString(data.tie); txtAchievement_Lose.text = MyConstant.GetMoneyString(data.lose); data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => { try{ if (_avatar != null) { imgAvatar.texture = _avatar; } }catch {} }); onClose = _onClose; CoreGameManager.instance.RegisterNewCallbackPressBackKey(Close); Show(); }
IEnumerator DoActionInitData(UserDataInGame _userData, bool _isWin, long _goldBonus, int _point, List <sbyte> _cardValue) { data = _userData; if (cardPoolManager == null) { cardPoolManager = new MySimplePoolManager(); } if (_isWin) { imgStar.color = Color.white; panelShadow.gameObject.SetActive(false); txtGoldBonus.text = "+" + MyConstant.GetMoneyString(_goldBonus, 9999); txtGoldBonus.color = Color.yellow; txtName.color = Color.yellow; txtPoint.color = Color.yellow; } else { imgStar.color = Color.gray; panelShadow.gameObject.SetActive(true); txtGoldBonus.text = "-" + MyConstant.GetMoneyString(_goldBonus, 9999); txtGoldBonus.color = Color.red; txtName.color = Color.white; txtPoint.color = Color.white; } txtName.text = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName); txtPoint.text = "" + MyConstant.GetMoneyString(_point); imgAvatar.texture = CoreGameManager.instance.gameInfomation.otherInfo.avatarDefault; data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => { try{ if (_avatar != null) { imgAvatar.texture = _avatar; } }catch {} }); int _totalCards = _cardValue.Count; if (_totalCards > 20) { _totalCards = 20; } List <CardHolderController> _tmpListCardHolder = new List <CardHolderController>(); for (int i = 0; i < _totalCards; i++) { CardHolderController _cardHolder = LeanPool.Spawn(cardHolderPrefab, Vector3.zero, Quaternion.identity, panelCardHolderContainer).GetComponent <CardHolderController>(); _tmpListCardHolder.Add(_cardHolder); } yield return(Yielders.EndOfFrame); for (int i = 0; i < _totalCards; i++) { CardUnoInfo _cardInfo = null; if (Uno_GamePlay_Manager.instance.unoGamePlayData.IsWildCardColor(_cardValue[i])) { _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(CardUnoInfo.CardType._Special_WildColor); } else if (Uno_GamePlay_Manager.instance.unoGamePlayData.IsWildCardDraw(_cardValue[i])) { _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(CardUnoInfo.CardType._Special_Draw4Cards); } else { _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(_cardValue[i]); } if (_cardInfo == null) { #if TEST Debug.LogError(">>> Không tìm thấy cardInfo (0): " + _cardValue[i]); #endif } PanelCardUnoDetailController _card = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, panelCardContainer).GetComponent <PanelCardUnoDetailController>(); cardPoolManager.AddObject(_card); _card.transform.position = _tmpListCardHolder[i].transform.position; _card.transform.rotation = _tmpListCardHolder[i].transform.rotation; _card.ShowNow(_cardInfo, (int)_cardValue[i]); _card.ResizeAgain(Uno_GamePlay_Manager.instance.UIManager.sizeCardDefault.x, Uno_GamePlay_Manager.instance.UIManager.sizeCardDefault.y); _card.transform.localScale = Vector3.one * _tmpListCardHolder[i].ratioScale; } for (int i = 0; i < _tmpListCardHolder.Count; i++) { _tmpListCardHolder[i].SelfDestruction(); } _tmpListCardHolder.Clear(); }