| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 | 
							- using FairyGUI;
 
- using UI.Main;
 
- using System.Collections.Generic;
 
- using UI.CommonGame;
 
- using UI.TimeTracing;
 
- using System;
 
- using ET;
 
- using UnityEngine;
 
- using UI_ListRewardItem = UI.Main.UI_ListRewardItem;
 
- namespace GFGGame
 
- {
 
-     public class TimeTracingLevelInfoView : BaseWindow
 
-     {
 
-         private const int _quicklyStarCount = 2;//达到2星可快速挑战
 
-         private UI_TimeTracingLevelInfoUI _ui;
 
-         private int _levelID;
 
-         private int _needItemId;
 
-         private int _needItemCount;
 
-         private int _type;
 
-         private int _storyType;
 
-         private int _index;
 
-         private List<ItemData> _bonusList = new List<ItemData>();
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             _ui = UI_TimeTracingLevelInfoUI.Create();
 
-             this.viewCom = _ui.target;
 
-             this.viewCom.Center();
 
-             this.modal = true;
 
-             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
-             _ui.m_listBonus.itemRenderer = UpdateBonusItem;
 
-             // _ui.m_listBonus.onClickItem.Add(OnClickListBonusItem);
 
-             _ui.m_btnStart.onClick.Add(OnClickBtnStart);
 
-             _ui.m_btnFightOnce.onClick.Add(OnClickBtnFightOnce);
 
-             _ui.m_btnFightTimes.onClick.Add(OnClickBtnFightTimes);
 
-             _ui.m_suitAddBtn.target.onClick.Add(OnClickSuitAddBtn);
 
-             _ui.m_scoreRewardBtn.target.onClick.Add(OnClickScoreRewardBtn);
 
-             _ui.m_levelRankBtn.target.onClick.Add(OnClickRankBtn);
 
-             _ui.m_backBtn.onClick.Add(OnClickBackBtn);
 
-             _ui.m_btnAdditionDesc.onClick.Add(OnBtnAdditionDescClick);
 
-             _ui.m_addBtn.onClick.Add(OnClickAddBtn);
 
-             _ui.m_ruleBtn.onClick.Add(RuleController.ShowRuleView);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, UpdateVisitNum);
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, UpdateBtnFightTimes);
 
-             EventAgent.AddEventListener(ConstMessage.TIMETRACINGREDUPDATE, UpdateRed);
 
-         }
 
-         protected async override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             ViewManager.SetMaskAlpha(0.8f);
 
-             _levelID = (int)(viewData as object[])[0];
 
-             _needItemId = (int)(viewData as object[])[1];
 
-             _needItemCount = (int)(viewData as object[])[2];
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
 
-             _type = levelCfg.type;
 
-             _storyType = levelCfg.subType;
 
-             _ui.m_btnStart.touchable = true;
 
-             _ui.m_ruleBtn.data = 300030;
 
-             await ReqGetLevelRank();
 
-             RedDotController.Instance.SetComRedDot(_ui.m_scoreRewardBtn.target, TimeTracingDataManager.Instance.GetLevelRewardStatus(_levelID));
 
-             UpdateView(); 
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             ViewManager.SetMaskAlpha(0.6f);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, UpdateVisitNum);
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, UpdateBtnFightTimes);
 
-             EventAgent.RemoveEventListener(ConstMessage.TIMETRACINGREDUPDATE, UpdateRed);
 
-         }
 
-         private void OnClickBtnStart()
 
-         {
 
-             // int time = InstanceZonesDataManager.GetCanFightTime(_levelID);
 
-             InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
 
-             if (times > 0)
 
-             {
 
-                 DressUpFightType dressUpFightType = new DressUpFightType();
 
-                 dressUpFightType.levelID = _levelID;
 
-                 dressUpFightType.teaPartID = 0;
 
-                 ViewManager.Show<DressUpFightView>(dressUpFightType, true, false);
 
-                 this.Hide();
 
-             }
 
-             else
 
-             {
 
-                 var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
 
-                 if (RoleDataManager.power < levelCfg.power)
 
-                 {
 
-                     ItemUtil.AddPower(OnClickBtnStart);
 
-                 }
 
-                 else
 
-                 {
 
-                     if (levelCfg.type == ConstInstanceZonesType.Studio && levelCfg.chapterId != StudioDataManager.Instance.GetLuckyBoxActivityID())
 
-                     {
 
-                         var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
 
-                         ViewManager.Show<StudioBuyNumView>(studioCfg.limit);
 
-                     }
 
-                     else
 
-                     {
 
-                         PromptController.Instance.ShowFloatTextPrompt("挑战次数不足");
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         private void OnClickBtnFightOnce()
 
-         {
 
-             // int time = InstanceZonesDataManager.GetCanFightTime(_levelID);
 
-             int starCount = InstanceZonesDataManager.GetStarCountHistory(_levelID);
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
 
-             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-             if (starCount < fightCfg.quickFightStart)
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("挑战星数不足");
 
-                 return;
 
-             }
 
-             InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
 
-             if (times > 0)
 
-             {
 
-                 ViewManager.Show<StoryFightQuicklyView>(new object[] { 1, _needItemId, _needItemCount });
 
-                 this.Hide();
 
-             }
 
-             else
 
-             {
 
-                 if (RoleDataManager.power < levelCfg.power)
 
-                 {
 
-                     ItemUtil.AddPower(OnClickBtnFightOnce);
 
-                 }
 
-                 else
 
-                 {
 
-                     if (levelCfg.type == ConstInstanceZonesType.Studio && levelCfg.chapterId != StudioDataManager.Instance.GetLuckyBoxActivityID())
 
-                     {
 
-                         var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
 
-                         ViewManager.Show<StudioBuyNumView>(studioCfg.limit);
 
-                     }
 
-                     else
 
-                     {
 
-                         PromptController.Instance.ShowFloatTextPrompt("挑战次数不足");
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         private void OnClickBtnFightTimes()
 
-         {
 
-             //只要按钮显示说明一定可以速刷多次
 
-             InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
 
-             ViewManager.Show<StoryFightQuicklyView>(new object[] { times, _needItemId, _needItemCount });
 
-             this.Hide();
 
-         }
 
-         public void UpdateRed()
 
-         {
 
-             RedDotController.Instance.SetComRedDot(_ui.m_scoreRewardBtn.target, TimeTracingDataManager.Instance.GetLevelRewardStatus(_levelID));
 
-         }
 
-         private void UpdateBonusItem(int index, GObject item)
 
-         {
 
-             ItemData itemData = _bonusList[index] as ItemData;
 
-             UI_ListRewardItem listItem = UI_ListRewardItem.Proxy(item);
 
-             ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemData.id);
 
-             listItem.m_txtName.text = cfg.name;
 
-             listItem.m_txtOwner.text = string.Format("已拥有:{0}", ItemDataManager.GetItemNum(itemData.id));
 
-             if (item.data == null)
 
-             {
 
-                 item.data = new ItemView(listItem.m_comItem as GComponent);
 
-             }
 
-             (item.data as ItemView).SetData(itemData);
 
-             //(item.data as ItemView).ShowTxtCount = false;
 
-             List<ItemData> bonusOnceData = StoryBonusDataCache.GetBonusData(_levelID).bonusOnce;
 
-             (item.data as ItemView).ImgShouTongVisable = !InstanceZonesDataManager.CheckLevelPass(_levelID) && index < bonusOnceData.Count;
 
-             UI_ListRewardItem.ProxyEnd();
 
-         }
 
-         private void UpdateBtnFightTimes()
 
-         {
 
-             InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
 
-             _ui.m_btnFightTimes.title = title;
 
-             _ui.m_btnFightTimes.visible = times > 1;
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
 
-             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-             var title = levelCfg.name;
 
-             switch (levelCfg.type)
 
-             {
 
-                 case ConstInstanceZonesType.Story:
 
-                     title = MainStoryDataManager.CurrentChapterOrder + "-" + InstanceZonesDataManager.currentLevelOrder + " " + levelCfg.name;
 
-                     break;
 
-             }
 
-             _ui.m_txtTitle.text = title;
 
-             _ui.m_txtLevelDesc.text = levelCfg.desc;
 
-             ItemUtil.UpdateItemNeedNum(_ui.m_comCostCurrent, ConstItemID.POWER, levelCfg.power);
 
-             _ui.m_comCostCurrent.visible = levelCfg.power > 0;
 
-             _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + fightCfg.scoreType;
 
-             if (fightCfg.targetName != null && fightCfg.targetName.Length > 0)
 
-             {
 
-                 _ui.m_txtTargetName.text = "挑战对手·" + fightCfg.targetName;
 
-                 _ui.m_loaderHead.url = ResPathUtil.GetNpcHeadPath(fightCfg.targetRes);
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_txtTargetName.text = RoleDataManager.roleName;
 
-                 _ui.m_loaderHead.url = ResPathUtil.GetNpcHeadPath("self");
 
-             }
 
-             _bonusList.Clear();
 
-             if (InstanceZonesDataManager.CheckLevelPass(_levelID))
 
-             {
 
-                 _bonusList = StoryBonusDataCache.GetBonusList(_levelID, false, true);
 
-                 _ui.m_groupPass.visible = InstanceZonesDataManager.GetStarCountHistory(_levelID) >= _quicklyStarCount;
 
-                 _ui.m_groupUnpass.visible = InstanceZonesDataManager.GetStarCountHistory(_levelID) < _quicklyStarCount;
 
-                 UpdateBtnFightTimes();
 
-             }
 
-             else
 
-             {
 
-                 _bonusList = StoryBonusDataCache.GetBonusList(_levelID, true);
 
-                 _ui.m_groupPass.visible = false;
 
-                 _ui.m_groupUnpass.visible = true;
 
-                 _ui.m_txtUnpassTips.SetVar("count", NumberUtil.GetChiniseNumberText(fightCfg.quickFightStart)).FlushVars();
 
-             }
 
-             _ui.m_listBonus.numItems = _bonusList.Count;
 
-             // if (_ui.m_listBonus.numItems > 4)
 
-             // {
 
-             //     _ui.m_listBonus.columnGap = 40;
 
-             // }
 
-             // else
 
-             // {
 
-             //     _ui.m_listBonus.columnGap = 60;
 
-             // }
 
-             int score = InstanceZonesDataManager.GetScoreHighest(_levelID);
 
-             if (score > 0)
 
-             {
 
-                 string scoreStr = "" + score;
 
-                 if (score <= fightCfg.score1)
 
-                 {
 
-                     scoreStr = "[color=#A28D77]失败 " + scoreStr + "[/color]";
 
-                 }
 
-                 _ui.m_txtHighestScore.text = scoreStr;
 
-                 _ui.m_flower.target.visible = true;
 
-                 int starCount = InstanceZonesDataManager.GetStarCountHistory(_levelID);
 
-                 StoryUtil.UpdateStar(starCount, _ui.m_flower.target);
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_txtHighestScore.text = "--";
 
-                 _ui.m_flower.target.visible = false;
 
-             }
 
-             _ui.m_grpAdditionDesc.visible = false;
 
-             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(TimeTracingDataManager.SuitID);
 
-             DressUpMenuSuitDataManager.GetSuitProgressBySuitId(TimeTracingDataManager.SuitID, out int count, out int totalCount);
 
-             _ui.m_txtAdditionDesc.text = string.Format("{0}套装收集进度:{1}/{2}", suitCfg.name, count, totalCount);
 
-             float addition = 0;
 
-             StudioDataManager.Instance.filingChapterId = levelCfg.chapterId;
 
-             addition = StudioDataManager.Instance.GetAddition(ConstInstanceZonesType.PureFight);
 
-             addition = addition / 10000 * 100;
 
-             _ui.m_txtAddition.text = string.Format("{0}%加成", addition);
 
-             SuitCfg cfg = SuitCfgArray.Instance.GetCfg(TimeTracingDataManager.SuitID);
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.partsArr[0]);
 
-             if (itemCfg.addition == 0)
 
-             {
 
-                 _ui.m_txtAddition.text = "无加成";
 
-             }
 
-             _ui.m_suitAddBtn.m_c1.selectedIndex = 0;
 
-             _ui.m_scoreRewardBtn.m_c1.selectedIndex = 1;
 
-             UpdateVisitNum();
 
-             UpdateRankBtn();
 
-         }
 
-         private void UpdateRankBtn()
 
-         {
 
-             if (TimeTracingDataManager._LevelMaxInfoDic.ContainsKey(TimeTracingDataManager._currentChapterId)&& TimeTracingDataManager._LevelMaxInfoDic[TimeTracingDataManager._currentChapterId].ContainsKey(_levelID))
 
-             {
 
-                 _ui.m_levelRankBtn.target.visible = true;
 
-                 _ui.m_levelRankBtn.m_name.text = TimeTracingDataManager._LevelMaxInfoDic[TimeTracingDataManager._currentChapterId][_levelID].RoleName;
 
-                 ItemCfg headCfg = ItemCfgArray.Instance.GetCfg(TimeTracingDataManager._LevelMaxInfoDic[TimeTracingDataManager._currentChapterId][_levelID].HeadItemId);
 
-                 ItemCfg headBorderCfg = ItemCfgArray.Instance.GetCfg(TimeTracingDataManager._LevelMaxInfoDic[TimeTracingDataManager._currentChapterId][_levelID].HeadBorderItemId);
 
-                 _ui.m_levelRankBtn.m_headbg.url = ResPathUtil.GetHeadBorderPath(headBorderCfg.res);
 
-                 _ui.m_levelRankBtn.m_head.url = ResPathUtil.GetHeadPath(headCfg.res);
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_levelRankBtn.m_name.text = "";
 
-                _ui.m_levelRankBtn.m_headbg.url = "";
 
-                 _ui.m_levelRankBtn.m_head.url = "";
 
-             }
 
-         }
 
-         private void RenderListTagItem(int index, GObject obj)
 
-         {
 
-             UI_ComTag item = UI_ComTag.Proxy(obj);
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
 
-             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-             string tag = fightCfg.needTagsArr[index];
 
-             int tagType = TagCfgArray.Instance.GetCfg(tag).type;
 
-             item.m_txtTag.text = tag;
 
-             item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
 
-             UI_ComTag.ProxyEnd();
 
-         }
 
-         //时光回溯活动
 
-         private void UpdateVisitNum()
 
-         {
 
-             RoleLimitData limitData = RoleLimitDataManager.GetLimitData(ActivityFightCfgArray.Instance.GetCfg(TimeTracingDataManager._currentChapterId).limit);
 
-             int time = limitData.TotalPlayMax - limitData.PlayTimes;
 
-             _ui.m_limitNum.text = string.Format("今日免费次数:{0}/{1}", limitData.TotalPlayMax - limitData.PlayTimes, limitData.MaxStorageCount);
 
-         }
 
-         private void OnClickAddBtn()
 
-         {
 
-             int limitId = ActivityFightCfgArray.Instance.GetCfg(TimeTracingDataManager._currentChapterId).limit;
 
-             string name = ItemCfgArray.Instance.GetCfg(LimitCfgArray.Instance.GetCfg(limitId).moneyId).name;
 
-             string desc = string.Format("是否花费{0}{1}购买{2}次过关次数?", LimitCfgArray.Instance.GetCfg(limitId).moneyNumArr[0], name, 1);
 
-             ViewManager.Show<ZCJBBuyTipsView>(new object[] { desc,limitId });
 
-         }
 
-         private void OnBtnAdditionDescClick()
 
-         {
 
-             _ui.m_grpAdditionDesc.visible = !_ui.m_grpAdditionDesc.visible;
 
-         }
 
-         private void OnClickSuitAddBtn()
 
-         {
 
-             ViewManager.Show<TimeTracingSuitAddView>();
 
-         }
 
-         private void OnClickScoreRewardBtn()
 
-         {
 
-             ViewManager.Show<TimeTracingLevelRewardView>(_levelID);
 
-         }
 
-         private async void OnClickRankBtn()
 
-         {
 
-             await TimeTracingSProxy.ReqGetLevelRank(_levelID);
 
-             await TimeTracingSProxy.ReqGetLevelFriendRank(_levelID);
 
-             ViewManager.Show<TimeTracingLevelRankView>(_levelID);
 
-         }
 
-         private void OnClickBackBtn()
 
-         {
 
-             this.Hide();
 
-         }
 
-         private async ETTask ReqGetLevelRank()
 
-         {
 
-             await TimeTracingSProxy.ReqGetLevelRank(_levelID);
 
-             await TimeTracingSProxy.ReqGetLevelFriendRank(_levelID);
 
-         }
 
-     }
 
- }
 
 
  |