| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 | 
							- using System;
 
- using System.Collections.Generic;
 
- using ET;
 
- using FairyGUI;
 
- using UI.CommonGame;
 
- using UI.TimeTracing;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public class TimeTracingLevelView : BaseWindow
 
-     {
 
-         private UI_TimeTracingLevelUI _ui;
 
-         private ValueBarController _valueBarController;
 
-         private int SuitID;
 
-         private int levelId;
 
-         private int _chapterID;
 
-         long num = 0;
 
-         List<CompositebonusCfg> datas;
 
-         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_TimeTracingLevelUI.PACKAGE_NAME;
 
-             _ui = UI_TimeTracingLevelUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
-             _ui.m_rankBtn.onClick.Add(OnClickRankBtn);
 
-             _ui.m_suitBg.onClick.Add(OnClickMakeSuitBtn);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             
 
-             if ((this.viewData as object[]) != null)
 
-             {
 
-                 _chapterID = (int)(this.viewData as object[])[0];
 
-                 SuitID = (int)(this.viewData as object[])[1];
 
-             }
 
-             else
 
-             {
 
-                 _chapterID = (int)this.viewData;
 
-             }
 
-             _ui.m_bg.url = ResPathUtil.GetBgImgPath("chahuibg");
 
-             UpdateView();
 
-             UpdateSuitNum();
 
-             UpdateFirst();
 
-             UpdateproBar();  
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             _valueBarController.OnHide();
 
-             base.OnHide();
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.TIMETRACINGREDUPDATE, UpdateView);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.TIMETRACINGREDUPDATE, UpdateView);
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             MainStoryDataManager.currentChapterCfgId = _chapterID;
 
-             _valueBarController = new ValueBarController(_ui.m_moneyList);
 
-             _valueBarController.OnShown();
 
-             ActivityFightCfg chapterCfg = ActivityFightCfgArray.Instance.GetCfg(_chapterID);
 
-             var list = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
 
-             for (int i = 0; i < 5; i++)
 
-             {
 
-                 int j = i + 1;
 
-                 GObject obj = _ui.target.GetChild("level" + j.ToString()); 
 
-                 StoryLevelCfg levelCfg = i < list.Count ? list[i] : null;
 
-                 UI_TimeTracingLevelItem levelItem = UI_TimeTracingLevelItem.Proxy(obj);
 
-                 if (i == 0 || InstanceZonesDataManager.CheckLevelPass(levelCfg.id - 1))
 
-                 {
 
-                     levelItem.target.data = levelCfg;
 
-                     levelItem.target.visible = true;
 
-                     levelItem.m_levelName.text = levelCfg.name;
 
-                     Dictionary<int, LevelRoleInfoProto> itemInfo;
 
-                     if (TimeTracingDataManager._LevelMaxInfoDic.TryGetValue(_chapterID,out itemInfo))
 
-                     {
 
-                         if(itemInfo.Count <= i)
 
-                         {
 
-                             levelItem.m_player.target.visible = false;
 
-                         }
 
-                         else
 
-                         {
 
-                             levelItem.m_player.target.visible = true;
 
-                             levelItem.m_player.m_name.text = itemInfo[levelCfg.id].RoleName;
 
-                             ItemCfg headCfg = ItemCfgArray.Instance.GetCfg(itemInfo[levelCfg.id].HeadItemId);
 
-                             ItemCfg headBorderCfg = ItemCfgArray.Instance.GetCfg(itemInfo[levelCfg.id].HeadBorderItemId);
 
-                             levelItem.m_player.m_headFrame.url = ResPathUtil.GetHeadBorderPath(headBorderCfg.res);
 
-                             levelItem.m_player.m_head.url = ResPathUtil.GetHeadPath(headCfg.res);
 
-                             RedDotController.Instance.SetComRedDot(levelItem.target, TimeTracingDataManager.Instance.GetLevelRewardStatus(levelCfg.id), "", -30,10);
 
-                         }
 
-                     }
 
-                     else
 
-                     {
 
-                         levelItem.m_player.target.visible = false;
 
-                     }
 
-                     levelItem.target.onClick.Clear();
 
-                     levelItem.target.onClick.Add(OnClickLevelItem);
 
-                 }
 
-                 else
 
-                 {
 
-                     levelItem.target.visible = false;
 
-                 }
 
-                 if (!InstanceZonesDataManager.CheckLevelPass(levelCfg.id))
 
-                 {
 
-                     //设置为解锁关卡
 
-                     RedDotController.Instance.SetComRedDot(levelItem.target, TimeTracingDataManager.Instance.GetLevelRewardStatus(levelCfg.id),"",-30,10);
 
-                     MainStoryDataManager.currentLevelCfgId = levelCfg.id;
 
-                     levelItem.m_player.target.visible = false;
 
-                 }
 
-                 UI_TimeTracingLevelItem.ProxyEnd();
 
-             }
 
-             _valueBarController.UpdateList(new List<int>() { ConstItemID.DIAMOND_PURPLE, ConstItemID.DIAMOND_RED });
 
-         }
 
-         private void UpdateSuitNum()
 
-         {
 
-             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(SuitID);
 
-             _ui.m_suitIcon.url = ResPathUtil.GetIconPath(suitCfg.res, "png");
 
-             int count;
 
-             int totalCount;
 
-             DressUpMenuSuitDataManager.GetSuitProgressBySuitId(SuitID, out count, out totalCount);
 
-             _ui.m_suitNum.text = count + "/" + totalCount;
 
-         }
 
-         private void UpdateFirst()
 
-         {
 
-             if(TimeTracingDataManager.Instance.SuitRankDatasDic[0].Count == 0)
 
-             {
 
-                 _ui.m_playerName.text = "";
 
-                 _ui.m_headFrame.url = "";
 
-                 _ui.m_headIcon.url = "";
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_playerName.text = TimeTracingDataManager.Instance.SuitRankDatasDic[0][0].RoleName;
 
-                 ItemCfg headCfg = ItemCfgArray.Instance.GetCfg(TimeTracingDataManager.Instance.SuitRankDatasDic[0][0].HeadItemId);
 
-                 ItemCfg headBorderCfg = ItemCfgArray.Instance.GetCfg(TimeTracingDataManager.Instance.SuitRankDatasDic[0][0].HeadBorderItemId);
 
-                 _ui.m_headFrame.url = ResPathUtil.GetHeadBorderPath(headBorderCfg.res);
 
-                 _ui.m_headIcon.url = ResPathUtil.GetHeadPath(headCfg.res);
 
-             }
 
-         }
 
-         private void UpdateproBar()
 
-         {
 
-             int consumeID = 0; 
 
-             datas = CompositebonusCfgArray.Instance.GetCfgsBychapterId(_chapterID);
 
-             consumeID = datas[0].paramsArr[0];
 
-             ItemData item;
 
-             if (BagDataManager.Instance.GetBagData().TryGetValue(consumeID, out item))
 
-             {
 
-                 _ui.m_countNum.text = item.num.ToString();
 
-                 num = item.num;
 
-             }
 
-             else
 
-             {
 
-                 num = 0;
 
-                 _ui.m_countNum.text = "0";
 
-             }
 
-             _ui.m_proBar.max = datas[datas.Count-1].count;
 
-             _ui.m_proBar.value = num;
 
-             UpdateproBarItem();
 
-         }
 
-         private void UpdateproBarItem()
 
-         {
 
-             for (int i = 0; i < datas.Count; i++)
 
-             {
 
-                 GComponent comProBonus = _ui.target.GetChild("barItem" + i).asCom;
 
-                 if (i == datas.Count - 1)
 
-                 {
 
-                     comProBonus.x = ((float)datas[i].count / (float)datas[datas.Count - 1].count) * _ui.m_proBar.width - 30;
 
-                 }
 
-                 else
 
-                 {
 
-                     comProBonus.x = ((float)datas[i].count / (float)datas[datas.Count - 1].count) * _ui.m_proBar.width - 15;
 
-                 }
 
-                 UI_proBarItem item = UI_proBarItem.Proxy(comProBonus);
 
-                 //if (num >= datas[i].count)
 
-                 //{
 
-                 //    return;
 
-                 //}
 
-                 //else 
 
-                 //{
 
-                 //}
 
-                 item.m_c1.selectedIndex = TimeTracingDataManager.Instance.GetChapterRewardIDStatus(datas[i].id, datas[i].paramsArr[0]);
 
-                 item.m_icon.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(datas[i].bonusArr[0][0]).res, "png");
 
-                 item.m_count.text = datas[i].count.ToString();
 
-                 if (item.target.data == null)
 
-                 {
 
-                     item.target.onClick.Add(OnBtnGetProBonus);
 
-                 }
 
-                 item.target.data = datas[i];
 
-                 UI_proBarItem.ProxyEnd();
 
-             }
 
-         }
 
-         private async void OnBtnGetProBonus(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             CompositebonusCfg compositeCfg = obj.data as CompositebonusCfg;
 
-             if(num < compositeCfg.count || TimeTracingDataManager.Instance.GetChapterRewardIDStatus(compositeCfg.id, compositeCfg.paramsArr[0]) != 1)
 
-             {
 
-                 GoodsItemTipsController.ShowItemTips(compositeCfg.bonusArr[0][0]);
 
-                 return;
 
-             }
 
-             await TimeTracingSProxy.ReqGetSuitReward(compositeCfg.id);
 
-             UpdateproBarItem();
 
-         }
 
-         private async void OnClickRankBtn()
 
-         {
 
-             await TimeTracingSProxy.ReqGetSuitFriendRank(SuitID);
 
-             ViewManager.Show<TimeTracingSuitRankView>(new object[] { SuitID });
 
-         }
 
-         private void OnClickMakeSuitBtn() 
 
-         {
 
-             ViewManager.Show<ClothingSyntheticView>(new object[] { SuitID, 0, _chapterID }, false, false);
 
-         }
 
-         private void OnClickLevelItem(EventContext context)
 
-         {
 
-             GObject obj = context.sender as GObject;
 
-             StoryLevelCfg storyLevelCfg = (StoryLevelCfg)obj.data;
 
-             MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
 
-             InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishTimeTracingLevel);
 
-         }
 
-         private void OnClickBtnBack()
 
-         {
 
-             ViewManager.GoBackFrom(typeof(TimeTracingLevelView).FullName);
 
-         }
 
-     }
 
- }
 
 
  |