private void Init() { if (this.newHeroData == null) { this.newHeroData = NGUITools.AddChild(this.HeroItem.gameObject, NewHeroItem.GetHeroItemPrefab()).GetComponent <NewHeroItem>(); } if (!base.gameObject.GetComponent <UIEventListener>()) { UIEventListener.Get(base.gameObject).onClick = new UIEventListener.VoidDelegate(this.click); UIEventListener.Get(base.gameObject).LongPress = new UIEventListener.VoidDelegate(this.click); base.gameObject.GetComponent <UIEventListener>().isCanLongPress = true; } }
public void Init(HeroData data, VictPlayerType type, VictPlayerData playerData, bool isSelf = false, bool isFriend = false) { this.mPlayerData = playerData; this._IsAlly = Singleton <PvpManager> .Instance.IsOurPlayer(int.Parse(playerData.UserID)); this.playerType = type; NGUITools.SetActiveChildren(this.P_HeroItem, false); GameObject gameObject = NGUITools.AddChild(this.P_HeroItem, Resources.Load <GameObject>("Prefab/NewUI/SelectHero/SelectHeroItem")); NewHeroItem component = gameObject.GetComponent <NewHeroItem>(); component.Init(data, NewHeroItem.CardType.HeroAvator, true, true); gameObject.name = data.HeroID; if (isSelf) { this.P_SummonerName.color = new Color32(253, 173, 41, 255); } this.P_SummonerName.text = playerData.SummonerName; if (playerData.LastChamRank <= 50) { this.P_SummonerName.gameObject.GetComponent <AllochroicLabelChecker>().RenderLabel(playerData.LastChamRank); } this.P_KillHero.text = playerData.KillHero.ToString(); this.P_KillMonster.text = this.ThousandFormat(playerData.Gold); this.P_Kill.text = playerData.Death.ToString(); this.P_KillAssist.text = playerData.KillAssist.ToString(); if (Singleton <PvpManager> .Instance.IsObserver || ((LevelManager.m_CurLevel.IsFightWithRobot() || LevelManager.m_CurLevel.IsBattleNewbieGuide()) && type == VictPlayerType.BL)) { this.P_AddFriend.gameObject.SetActive(false); this.P_AddGood.gameObject.SetActive(false); } else { this.P_AddFriend.gameObject.SetActive(!isSelf && !isFriend); this.P_AddFriend.name = playerData.SummonerId; this.P_AddGood.gameObject.SetActive(!isSelf); this.P_AddGood.name = playerData.UserID; } this.RegisteListener(); this.SetEquipment(playerData); if (playerData.FirstKill) { this.Sign.gameObject.SetActive(true); } this.P_MvpIcon.SetActive(ModelManager.Instance.Get_Settle_MvpUserId() == playerData.UserID); }