|
@@ -0,0 +1,98 @@
|
|
|
+using System.Collections.Generic;
|
|
|
+using ET;
|
|
|
+using FairyGUI;
|
|
|
+using UI.Main;
|
|
|
+using UnityEngine;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class StoryFightFailView : BaseWindow
|
|
|
+ {
|
|
|
+ private UI_StoryFightFailUI _ui;
|
|
|
+ private List<LevelTipsCfg> _cfgs = new List<LevelTipsCfg>();
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+ packageName = UI_StoryFightFailUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_StoryFightFailUI.Create();
|
|
|
+ this.viewCom = _ui.target;
|
|
|
+ this.viewCom.Center();
|
|
|
+ this.modal = true;
|
|
|
+ viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
+
|
|
|
+ _ui.m_list.itemRenderer = RenderListItem;
|
|
|
+ }
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ for (int i = 0; i < LevelTipsCfgArray.Instance.dataArray.Length; i++)
|
|
|
+ {
|
|
|
+ LevelTipsCfg cfg = LevelTipsCfgArray.Instance.dataArray[i];
|
|
|
+ if (cfg.storyLevel > 0 && InstanceZonesDataManager.currentLevelCfgId != cfg.storyLevel) continue;
|
|
|
+ _cfgs.Add(cfg);
|
|
|
+ }
|
|
|
+ _ui.m_list.numItems = _cfgs.Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+ _cfgs.Clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void RenderListItem(int index, GObject gObject)
|
|
|
+ {
|
|
|
+ UI_ListFailItem item = UI_ListFailItem.Proxy(gObject);
|
|
|
+
|
|
|
+ StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
|
|
|
+ StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
|
|
|
+
|
|
|
+ item.m_txtDesc.text = string.Format(_cfgs[index].desc, ConstDressUpScoreType.scoreTypeList()[fightCfg.scoreType]);
|
|
|
+ if (item.m_btnGo.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnGo.onClick.Add(OnBtnGoClick);
|
|
|
+ }
|
|
|
+ item.m_btnGo.data = _cfgs[index];
|
|
|
+
|
|
|
+ UI_ListFailItem.ProxyEnd();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnGoClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject obj = context.sender as GObject;
|
|
|
+ LevelTipsCfg cfg = obj.data as LevelTipsCfg;
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(cfg.jumpId)) return;
|
|
|
+ object[] param = new object[cfg.jumpParamArr.Length];
|
|
|
+ for (int i = 0; i < cfg.jumpParamArr.Length; i++)
|
|
|
+ {
|
|
|
+ param[i] = cfg.jumpParamArr[i];
|
|
|
+ }
|
|
|
+ Hide();
|
|
|
+ ViewManager.Hide<StroyFightResultView>();
|
|
|
+ ViewManager.JumpToView(cfg.jumpId, param, null, false);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|