123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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;
- isReturnView = 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_beijing2");
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- // EventAgent.AddEventListener(ConstMessage.ACTIVE_SKILL,)
- }
- protected override void OnShown()
- {
- base.OnShown();
- _valueBarController.OnShown();
- _valueBarController.Controller(11);
- _ui.m_listScore.numItems = 4;
- _ui.m_list.numItems = LeagueSkillCountCfgArray.Instance.dataArray.Length;
- if (LeagueDataManager.Instance.GetSkillProgressByType(_ui.m_list.numItems) < 100)
- {
- _ui.m_list.ScrollToView(LeagueDataManager.Instance.MaxFinishType);
- }
- }
- 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 UpdateView()
- {
- }
- 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.dataArray[index];
- UI_ListSkillTypeItem item = UI_ListSkillTypeItem.Proxy(obj);
- int maxFinishType = LeagueDataManager.Instance.MaxFinishType;
- item.m_txtTitle.text = string.Format("茶艺·{0}", skillCountCfg.name);
- item.m_loaBg.url = string.Format("ui://League/skill_{0}", index + 1);
- item.m_grpLock.visible = skillCountCfg.type > maxFinishType + 1;
- double progress = LeagueDataManager.Instance.GetSkillProgressByType(skillCountCfg.type);
- // item.m_txtProgress.text = string.Format("进度{0}%", progress);
- item.m_txtProgress.SetVar("value", progress.ToString()).FlushVars();
- // item.m_txtProgress.text = LeagueDataManager.Instance.GetSkillProgressByType(skillCountCfg.type).ToString();
- if (item.target.data == null)
- {
- item.target.onClick.Add(OnUpSkillClick);
- }
- item.target.data = skillCountCfg.type;
- UI_ListSkillTypeItem.ProxyEnd();
- }
- private void OnUpSkillClick(EventContext context)
- {
- GObject obj = context.sender as GObject;
- int type = (int)obj.data;
- if (type > LeagueDataManager.Instance.MaxFinishType + 1)
- {
- PromptController.Instance.ShowFloatTextPrompt("学完前一类所有技能开启");
- return;
- }
- ViewManager.Show<LeagueSkillUpView>(type);
- }
- }
- }
|