| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 | 
							- using System.Collections.Generic;
 
- using ET;
 
- using FairyGUI;
 
- using UI.Studio;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public class StudioActivityView : BaseWindow
 
-     {
 
-         private UI_StudioActivityUI _ui;
 
-         private ValueBarController _valueBarController;
 
-         private StudioCfg _studioCfg;
 
-         private List<StoryLevelCfg> _storyLevelCfgs;
 
-         private int _itemIndex = 0;
 
-         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_StudioActivityUI.PACKAGE_NAME;
 
-             _ui = UI_StudioActivityUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             _valueBarController = new ValueBarController(_ui.m_comValueBar);
 
-             _ui.m_Bg.url = ResPathUtil.GetBgImgPath("bg_fhl");
 
-             _ui.m_btnChageLine.url = ResPathUtil.GetCommonGameResPath("zsx_fl");
 
-             _ui.m_list.itemRenderer = RenderListItem;
 
-             _ui.m_btnBack.onClick.Add(OnBtnBackClick);
 
-             _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
 
-             EventAgent.AddEventListener(ConstMessage.FILLING_CHANGE_CHAPTER, UpdateView);
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
 
-             //EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
 
-             EventAgent.RemoveEventListener(ConstMessage.FILLING_CHANGE_CHAPTER, UpdateView);
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
 
-             //EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-             //EventAgent.RemoveEventListener(ConstMessage.STUDIO_FILING_UPDATE, UpdateView);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _valueBarController.OnShown();
 
-             StudioDataManager.Instance.filingChapterId = StudioDataManager.Instance.GetLuckyBoxActivityID();
 
-             UpdateView();
 
-             UpdateItem();
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             _valueBarController.OnHide();
 
-         }
 
-         private void RenderListItem(int index, GObject obj)
 
-         {
 
-             UI_ListLevelItem item = UI_ListLevelItem.Proxy(obj);
 
-             item.m_txtName.text = _storyLevelCfgs[index].name;
 
-             bool isFight = string.IsNullOrEmpty(_storyLevelCfgs[index].storyStartID);
 
-             string resBg = isFight ? "cyjd_di_1" : "cyjd_di_2";
 
-             if (isFight)
 
-             {
 
-                 item.m_loaIcon.visible = false;
 
-                 item.m_loaItem.visible = true;
 
-                 StoryFightCfg storyFightCfg = StoryFightCfgArray.Instance.GetCfg(_storyLevelCfgs[index].fightID);
 
-                 int itemId = DropOutCfgArray.Instance.GetCfgsByid(storyFightCfg.bonusRandomArr[0])[0].item;
 
-                 ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
 
-                 item.m_loaItem.url = ResPathUtil.GetIconPath(itemCfg);
 
-                 if (item.m_loaItem.data == null)
 
-                 {
 
-                     item.m_loaItem.onClick.Add(OnLoaItemClick);
 
-                 }
 
-                 item.m_loaItem.data = index;
 
-             }
 
-             else
 
-             {
 
-                 item.m_loaItem.visible = false;
 
-                 item.m_loaIcon.visible = true;
 
-                 item.m_loaIcon.url = string.Format("ui://Studio/{0}", _studioCfg.res);
 
-             }
 
-             item.m_grpLock.visible = index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1].id);
 
-             item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[index].id);
 
-             if (item.m_loaBg.data == null)
 
-             {
 
-                 item.m_loaBg.onClick.Add(OnListItemClick);
 
-             }
 
-             item.m_loaBg.data = index;
 
-             UI_ListLevelItem.ProxyEnd();
 
-         }
 
-         private void OnLoaItemClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int index = (int)obj.data;
 
-             StoryFightCfg storyFightCfg = StoryFightCfgArray.Instance.GetCfg(_storyLevelCfgs[index].fightID);
 
-             int itemId = DropOutCfgArray.Instance.GetCfgsByid(storyFightCfg.bonusRandomArr[0])[0].item;
 
-             GoodsItemTipsController.ShowItemTips(itemId);
 
-         }
 
-         private void OnListItemClick(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             int index = (int)obj.data;
 
-             StoryLevelCfg storyLevelCfg = _storyLevelCfgs[index];
 
-             if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1].id))
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("需通关前置关卡");
 
-                 return;
 
-             }
 
-             MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
 
-             InstanceZonesController.ShowLevelView(storyLevelCfg.id, OnFinishFilingStoryLevel);
 
-         }
 
-         private void OnFinishFilingStoryLevel(int levelCfgId, bool firstPass, bool success)
 
-         {
 
-             //StudioDataManager.Instance.SetLuckyBoxActivityID(MainStoryDataManager.currentChapterCfgId);
 
-             ViewManager.Show<StudioActivityView>();
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             _studioCfg = StudioCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId);
 
-             RoleLimitData limitData = RoleLimitDataManager.GetLimitData(this._studioCfg.limit);
 
-             var limitCfg = LimitCfgArray.Instance.GetCfg(this._studioCfg.limit);
 
-             _ui.m_loaBg.url = ResPathUtil.GetStudioFilingPicPath(_studioCfg.res); //ResPathUtil.GetBgImgPath(_studioCfg.res);
 
-             _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", limitData.TotalPlayMax - limitData.PlayTimes, limitData.MaxStorageCount);
 
-             _ui.m_activityTipText.SetVar("name", _studioCfg.name).FlushVars();
 
-             _ui.m_activityTitle.text = _studioCfg.name;
 
-             _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_studioCfg.type, _studioCfg.subType, StudioDataManager.Instance.filingChapterId);
 
-             _ui.m_list.numItems = _storyLevelCfgs.Count;
 
-             //UpdateRedDot();
 
-         }
 
-         private void UpdateItem()
 
-         {
 
-             for (int i = 0; i < _ui.m_list.numChildren; i++)
 
-             {
 
-                 _ui.m_list.GetChildAt(i).visible = false;
 
-             }
 
-             _itemIndex = 0;
 
-             Timers.inst.Add(0.05f, _ui.m_list.numChildren, AddItemUpdate, 1);
 
-         }
 
-         private void AddItemUpdate(object param)
 
-         {
 
-             _ui.m_list.GetChildAt(_itemIndex).visible = true;
 
-             UI_ListLevelItem item = UI_ListLevelItem.Proxy(_ui.m_list.GetChildAt(_itemIndex));
 
-             item.m_Left.Play();
 
-             _itemIndex++;
 
-             UI_ListLevelItem.ProxyEnd();
 
-         }
 
-         protected void OnBtnBackClick()
 
-         {
 
-             Hide();
 
-         }
 
-         private void OnBtnRewardClick()
 
-         {
 
-             ViewManager.Show<StudioFilingRewardView>();
 
-         }
 
-         private void OnLimitChanged(EventContext context)
 
-         {
 
-             int limitId = (int)context.data;
 
-             if (this._studioCfg.limit != limitId)
 
-             {
 
-                 return;
 
-             }
 
-             UpdateView();
 
-         }
 
-     }
 
- }
 
 
  |