| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 | 
							- using System.Collections.Generic;
 
- using ET;
 
- using FairyGUI;
 
- using UI.CommonGame;
 
- using UI.Studio;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public class StudioFilingView : BaseWindow
 
-     {
 
-         private UI_StudioFilingUI _ui;
 
-         private ValueBarController _valueBarController;
 
-         private StudioCfg _studioCfg;
 
-         private List<StoryLevelCfg> _storyLevelCfgs;
 
-         private int _viewData = 0;
 
-         private int itemIndex = 0;
 
-         private List<string> nameString = new List<string> { "壹", "贰", "叁", "肆", "伍" };
 
-         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_StudioFilingUI.PACKAGE_NAME;
 
-             _ui = UI_StudioFilingUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             _valueBarController = new ValueBarController(_ui.m_comValueBar);
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_fb_bg");
 
-             _ui.m_btnChageLine.url = ResPathUtil.GetCommonGameResPath("zsx_fl");
 
-             _ui.m_list.itemRenderer = RenderListItem;
 
-             _ui.m_btnBack.onClick.Add(GoBackFrom);
 
-             _ui.m_btnChange.onClick.Add(OnBtnChangeClick);
 
-             _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
 
-             _ui.m_btnAdd.onClick.Add(OnBtnAddClick);
 
-             _ui.m_btnSuit.onClick.Add(OnBtnSuitClick);
 
-         }
 
-         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 OnShown()
 
-         {
 
-             base.OnShown();
 
-             _valueBarController.OnShown();
 
-             _viewData = this.viewData != null ? (int)this.viewData : 0;
 
-             StudioDataManager.Instance.filingChapterId = _viewData > 0 ? _viewData : StudioDataManager.Instance.npcFilingChapterId;
 
-             UpdateView();
 
-             Timers.inst.AddUpdate(CheckGuide);
 
-             UpdateItem();
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             _valueBarController.OnHide();
 
-             Timers.inst.Remove(CheckGuide);
 
-             Timers.inst.Remove(AddItemUpdate);
 
-         }
 
-         protected void GoBackFrom()
 
-         {
 
-             ViewManager.GoBackFrom(typeof(StudioFilingView).FullName);
 
-         }
 
-         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);
 
-         }
 
-         private void OnLimitChanged(EventContext context)
 
-         {
 
-             int limitId = (int)context.data;
 
-             if (this._studioCfg.limit != limitId)
 
-             {
 
-                 return;
 
-             }
 
-             UpdateView();
 
-         }
 
-         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_btnAdd.visible = limitCfg.itemID > 0;
 
-             _ui.m_role.url = ResPathUtil.GetStudioFilingPicPath(_studioCfg.res); //ResPathUtil.GetBgImgPath(_studioCfg.res);
 
-             _ui.m_btnChange.icon = "ui://Studio/gzs_" + _studioCfg.res;
 
-             _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", limitData.TotalPlayMax - limitData.PlayTimes, limitData.MaxStorageCount);
 
-             _ui.m_type.SetSelectedIndex(0);
 
-             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_studioCfg.suitId);
 
-             _ui.m_txtSuitName.text = suitCfg.name;
 
-             DressUpMenuSuitDataManager.GetSuitProgressBySuitId(_studioCfg.suitId, out int count, out int totalCount);
 
-             _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", count, totalCount);
 
-             _ui.m_suitIcon.url = ResPathUtil.GetIconPath(suitCfg.res, "png");
 
-             _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_studioCfg.type, _studioCfg.subType, StudioDataManager.Instance.filingChapterId);
 
-             _ui.m_list.numItems = _storyLevelCfgs.Count;
 
-             UpdateRedDot();
 
-         }
 
-         private void RenderListItem(int index, GObject obj)
 
-         {
 
-             // int _index = _storyLevelCfgs.Count - index - 1;
 
-             UI_ListLevelItem item = UI_ListLevelItem.Proxy(obj);
 
-             //item.m_c1.selectedIndex = index % 2 == 0 ? 0 : 1;
 
-             item.m_txtName.text = _storyLevelCfgs[index].name + "-" + nameString[index];
 
-             bool isFight = string.IsNullOrEmpty(_storyLevelCfgs[index].storyStartID);
 
-             string resBg = isFight ? "cyjd_di_1" : "cyjd_di_2";
 
-             //item.m_loaBg.url = string.Format("ui://Studio/{0}", resBg);
 
-             if (isFight)
 
-             {
 
-                 //item.m_loaBg.url = "ui://Studio/cyjd_di_1";
 
-                 item.m_flow.visible = true;
 
-                 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_loaBg.url = "ui://Studio/cyjd_di_2";
 
-                 item.m_flow.visible = false;
 
-                 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 = 0;//InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[index].id);
 
-             item.m_c2.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 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, StudioDataManager.Instance.OnFinishFilingStoryLevel);
 
-         }
 
-         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;
 
-             // StoryFightCfg storyFightCfg = StoryFightCfgArray.Instance.GetCfg(_storyLevelCfgs[index].fightID);
 
-             // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(storyFightCfg.bonusBaseArr[0][0]);
 
-             GoodsItemTipsController.ShowItemTips(itemId);
 
-         }
 
-         private void OnBtnChangeClick()
 
-         {
 
-             ViewManager.Show<StudioFilingNpcView>();
 
-         }
 
-         private void OnBtnRewardClick()
 
-         {
 
-             ViewManager.Show<StudioFilingRewardView>();
 
-         }
 
-         private void OnBtnAddClick()
 
-         {
 
-             ViewManager.Show<StudioBuyNumView>(_studioCfg.limit);
 
-         }
 
-         private void OnBtnSuitClick()
 
-         {
 
-             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_studioCfg.suitId);
 
-             if (suitCfg.syntheticStoryLevelId > 0 && !InstanceZonesDataManager.CheckLevelPass(suitCfg.syntheticStoryLevelId))
 
-             {
 
-                 StoryLevelCfg cfg = StoryLevelCfgArray.Instance.GetCfg(suitCfg.syntheticStoryLevelId);
 
-                 PromptController.Instance.ShowFloatTextPrompt(string.Format("需通关{0}关卡解锁", cfg.name));
 
-                 return;
 
-             }
 
-             ViewManager.Show<ClothingSyntheticView>(new object[] { _studioCfg.suitId }, false);
 
-             //if (_viewData == StudioDataManager.Instance.GetLuckyBoxActivityID())
 
-             //{
 
-             //    int _activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitLuckyBox);
 
-             //    ActivityOpenCfg _activityCfg = ActivityOpenCfgArray.Instance.GetCfg(_activityId);
 
-             //    long endTime = TimeUtil.DateTimeToTimestamp(_activityCfg.endTime);
 
-             //    long curTime = TimeHelper.ServerNow();
 
-             //    if (endTime < curTime) return;
 
-             //    ViewManager.Show<LuckyBoxActivityView>(_activityId, new object[] { typeof(StudioFilingView).FullName, this.viewData }, false);
 
-             //}
 
-             //else
 
-             //{
 
-             //    ViewManager.Show<ClothingSyntheticView>(new object[] { _studioCfg.suitId }, new object[] { typeof(StudioFilingView).FullName, this.viewData }, false);
 
-             //}
 
-         }
 
-         private void UpdateRedDot()
 
-         {
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnReward, StudioDataManager.Instance.GetFilingRewardState(StudioDataManager.Instance.filingChapterId));
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnChange, RedDotDataManager.Instance.GetStudioFilingRed(false),"",-27);
 
-         }
 
-         private void CheckGuide(object param)
 
-         {
 
-             if (GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <= 0)
 
-             {
 
-                 UpdateToCheckGuide(null);
 
-             }
 
-             else
 
-             {
 
-                 Timers.inst.Remove(CheckGuide);
 
-             }
 
-         }
 
-         protected override void UpdateToCheckGuide(object param)
 
-         {
 
-             if (!ViewManager.CheckIsTopView(this.viewCom)) return;
 
-             GuideController.TryGuide(_ui.m_list, ConstGuideId.STUDIO_FILING, 5, "从华贵的花想容开始吧~~", 0);
 
-             GuideController.TryCompleteGuide(ConstGuideId.STUDIO_FILING, 5);
 
-         }
 
-         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();
 
-         }
 
-     }
 
- }
 
 
  |