using ET; using FairyGUI; using UI.CommonGame; using UI.League; using UnityEngine; namespace GFGGame { //联盟技能 public class LeagueSkillView : BaseWindow { private UI_LeagueSkillUI _ui; private ValueBarController _valueBarController; public override void Dispose() { if (_valueBarController != null) { _valueBarController.Dispose(); _valueBarController = null; } if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_LeagueSkillUI.PACKAGE_NAME; _ui = UI_LeagueSkillUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_btnBack.onClick.Add(OnBtnBackClick); _ui.m_listScore.itemRenderer = RenderListScoreItem; _ui.m_list.itemRenderer = RenderListItem; _valueBarController = new ValueBarController(_ui.m_comValue); _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing"); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); _valueBarController.OnShown(); _valueBarController.Controller(11); _ui.m_listScore.numItems = 4; _ui.m_list.numItems = LeagueSkillCountCfgArray.Instance.dataArray.Length; } protected override void OnHide() { base.OnHide(); if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0); _valueBarController.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void OnBtnBackClick() { ViewManager.GoBackFrom(typeof(LeagueSkillView).FullName); } private void RenderListScoreItem(int index, GObject obj) { UI_ListScoreItem item = UI_ListScoreItem.Proxy(obj); item.m_loaIcon.url = ResPathUtil.GetScorePath(index + 1); item.m_txtProperty.text = LeagueDataManager.Instance.GetAllSkillScore(index + 1).ToString(); UI_ListScoreItem.ProxyEnd(); } private void RenderListItem(int index, GObject obj) { LeagueSkillCountCfg skillCountCfg = LeagueSkillCountCfgArray.Instance.GetCfg(index); UI_ListSkillTypeItem item = UI_ListSkillTypeItem.Proxy(obj); item.m_txtProgress.text = LeagueDataManager.Instance.GetSkillProgressByType(skillCountCfg.type).ToString(); if (item.target.data == null) { item.target.onClick.Add(OnUpSkillClick); } UI_ListSkillTypeItem.ProxyEnd(); } private void OnUpSkillClick(EventContext context) { GObject obj = context.sender as GObject; int type = (int)obj.data; ViewManager.Show(type); } } }