using System.Text.RegularExpressions; using ET; using FairyGUI; using UI.League; using UnityEngine; namespace GFGGame { //联盟答题奖励展示 public class LeagueAnswerRewardView : BaseWindow { private UI_LeagueAnswerRewardUI _ui; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_LeagueAnswerRewardUI.PACKAGE_NAME; _ui = UI_LeagueAnswerRewardUI.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; _ui.m_btnClose.onClick.Add(Hide); _ui.m_list.itemRenderer = RenderListItem; } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); _ui.m_txtRule.text = TextDescArray.Instance.GetCfg(300008).text; _ui.m_list.numItems = LeagueQuestionBonusCfgArray.Instance.dataArray.Length; } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void RenderListItem(int index, GObject obj) { UI_ListAnswerRewardItem item = UI_ListAnswerRewardItem.Proxy(obj); item.m_txtDesc.text = string.Format("答对{0}题", index + 1); if (item.m_listReward.data == null) { item.m_listReward.itemRenderer = RenderListIrem; } item.m_listReward.numItems = LeagueQuestionBonusCfgArray.Instance.dataArray[index].bonusArr.Length; UI_ListAnswerRewardItem.ProxyEnd(); } private void RenderListIrem(int index, GObject obj) { int[][] rewards = (int[][])obj.parent.data; ItemUtil.UpdateItemNeedNum(obj, rewards[index]); } } }