Browse Source

feat 任务修改

Jae 2 years ago
parent
commit
bb88d5ce26

+ 5 - 5
FGUIProject/assets/Task/CombTaskUI.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="1080,1920" opaque="false">
-  <controller name="c1" pages="0,,1," selected="0">
+  <controller name="c1" pages="0,,1," selected="1">
     <remark page="0" value="每日任务"/>
     <remark page="1" value="织造任务"/>
   </controller>
@@ -8,7 +8,7 @@
     <component id="n15_ids4" name="LivenessProcess" src="ids449" fileName="components/LivenessRewardProcess.xml" xy="70,717" size="949,53">
       <ProgressBar value="50" max="100"/>
     </component>
-    <list id="n0_lh8v" name="TaskList" xy="0,937" size="1080,778" overflow="scroll" defaultItem="ui://5mpsibzzlh8v5" align="center" autoClearItems="true">
+    <list id="n0_lh8v" name="TaskList" xy="0,937" size="1080,778" overflow="scroll" defaultItem="ui://eg2y0ldplh8v5" align="center" autoClearItems="true">
       <relation target="" sidePair="center-center,top-top,bottomext-bottom"/>
       <item/>
       <item/>
@@ -18,13 +18,13 @@
       <item/>
     </list>
     <image id="n21_ids4" name="n21" src="9jv66j" fileName="imagesNew/lm_zsx0.png" pkg="eg2y0ldp" xy="176,883"/>
-    <text id="n22_ids4" name="n22" xy="428,880" size="236,44" font="ui://eg2y0ldpa0cftks" fontSize="32" color="#915e15" align="center" vAlign="middle" letterSpacing="4" autoSize="none" text="每日5:00刷新"/>
+    <text id="n22_ids4" name="n22" xy="428,880" size="236,44" font="ui://eg2y0ldpa0cftks" fontSize="32" color="#915e15" align="center" vAlign="middle" letterSpacing="4" autoSize="none" text="周一5:00刷新"/>
     <image id="n17_ids4" name="n17" src="uxxstm8" fileName="images/yeqian_db.png" xy="302,804" size="491,72"/>
     <component id="n25_ids4" name="n25" src="ids44e" fileName="components/TabButton.xml" xy="294,805" group="n27_ids4">
-      <Button checked="true" controller="c1" page="0"/>
+      <Button controller="c1" page="0"/>
     </component>
     <component id="n26_ids4" name="n26" src="ids44e" fileName="components/TabButton.xml" xy="555,805" group="n27_ids4">
-      <Button title="织造任务" controller="c1" page="1"/>
+      <Button checked="true" title="织造任务" controller="c1" page="1"/>
     </component>
     <group id="n27_ids4" name="n27" xy="294,805" size="522,72" advanced="true" layout="hz" excludeInvisibles="true"/>
     <component id="n18_ids4" name="GetAll" src="rv091o" fileName="components/Button11.xml" pkg="eg2y0ldp" xy="405,1779" size="273,59">

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -239,6 +239,7 @@ namespace GFGGame
             MainStorySProxy.GetStoryInfos().Coroutine();
             CardSProxy.GetCardInfos().Coroutine();
             TaskSProxy.GetTaskInfos();
+            BattlePassTaskSProxy.GetBattlePassInfo().Coroutine();
             // RechargeSProxy.ReqRechargeInfo().Coroutine();
             // RechargeSProxy.ReqExchangeInfo().Coroutine();
             DailyTaskSProxy.ReqDailyTaskInfos().Coroutine();

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Data/ActivityDay7DataManager.cs

@@ -0,0 +1,12 @@
+using ET;
+
+namespace GFGGame
+{
+    public class ActivityDay7DataManager : SingletonBase<ActivityDay7DataManager>
+    {
+        public int GetActivityDay7Day()
+        {
+            return GameGlobal.myNumericComponent.GetAsInt(NumericType.Day7Activity);
+        }
+    }
+}

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Data/ActivityDay7DataManager.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 25cb38549cc4495eb8a8992d9d955477
+timeCreated: 1685517339

+ 0 - 77
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_RewardIconYellow.cs

@@ -1,77 +0,0 @@
-/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
-
-using FairyGUI;
-
-namespace UI.Task
-{
-    public partial class UI_RewardIconYellow
-    {
-        public GComponent target;
-        public Controller m_c1;
-        public GLoader m_loaIcon;
-        public GTextField m_num;
-        public const string URL = "ui://5mpsibzznd1743";
-        public const string PACKAGE_NAME = "Task";
-        public const string RES_NAME = "RewardIconYellow";
-        private static UI_RewardIconYellow _proxy;
-
-        public static UI_RewardIconYellow Create(GObject gObject = null)
-        {
-            var ui = new UI_RewardIconYellow();
-            if(gObject == null)
-            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GComponent)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static UI_RewardIconYellow Proxy(GObject gObject = null)
-        {
-            if(_proxy == null)
-            {
-                _proxy = new UI_RewardIconYellow();
-            }
-            var ui = _proxy;
-            if(gObject == null)
-            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GComponent)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static void ProxyEnd()
-        {
-            if (_proxy != null)
-            {
-                _proxy.Dispose();
-            }
-        }
-
-        public static void ClearProxy()
-        {
-            ProxyEnd();
-            _proxy = null;
-        }
-
-        private void Init(GComponent comp)
-        {
-            m_c1 = comp.GetController("c1");
-            m_loaIcon = (GLoader)comp.GetChild("loaIcon");
-            m_num = (GTextField)comp.GetChild("num");
-        }
-        public void Dispose(bool disposeTarget = false)
-        {
-            m_c1 = null;
-            m_loaIcon = null;
-            m_num = null;
-            if(disposeTarget && target != null)
-            {
-                target.RemoveFromParent();
-                target.Dispose();
-            }
-            target = null;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_RewardIconYellow.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 72132a2f53f5a427d9997b4e92566a14
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 92
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_TaskListItem.cs

@@ -1,92 +0,0 @@
-/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
-
-using FairyGUI;
-
-namespace UI.Task
-{
-    public partial class UI_TaskListItem
-    {
-        public GComponent target;
-        public Controller m_c1;
-        public Controller m_c2;
-        public GTextField m_txtDesc;
-        public GTextField m_txtCount;
-        public GList m_listTaskReward;
-        public GButton m_GetRewardBt;
-        public GButton m_ComeBt;
-        public GButton m_HadGet;
-        public const string URL = "ui://5mpsibzzlh8v5";
-        public const string PACKAGE_NAME = "Task";
-        public const string RES_NAME = "TaskListItem";
-        private static UI_TaskListItem _proxy;
-
-        public static UI_TaskListItem Create(GObject gObject = null)
-        {
-            var ui = new UI_TaskListItem();
-            if(gObject == null)
-            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GComponent)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static UI_TaskListItem Proxy(GObject gObject = null)
-        {
-            if(_proxy == null)
-            {
-                _proxy = new UI_TaskListItem();
-            }
-            var ui = _proxy;
-            if(gObject == null)
-            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
-            else
-            	ui.target =  (GComponent)gObject;
-            ui.Init(ui.target);
-            return ui;
-        }
-
-        public static void ProxyEnd()
-        {
-            if (_proxy != null)
-            {
-                _proxy.Dispose();
-            }
-        }
-
-        public static void ClearProxy()
-        {
-            ProxyEnd();
-            _proxy = null;
-        }
-
-        private void Init(GComponent comp)
-        {
-            m_c1 = comp.GetController("c1");
-            m_c2 = comp.GetController("c2");
-            m_txtDesc = (GTextField)comp.GetChild("txtDesc");
-            m_txtCount = (GTextField)comp.GetChild("txtCount");
-            m_listTaskReward = (GList)comp.GetChild("listTaskReward");
-            m_GetRewardBt = (GButton)comp.GetChild("GetRewardBt");
-            m_ComeBt = (GButton)comp.GetChild("ComeBt");
-            m_HadGet = (GButton)comp.GetChild("HadGet");
-        }
-        public void Dispose(bool disposeTarget = false)
-        {
-            m_c1 = null;
-            m_c2 = null;
-            m_txtDesc = null;
-            m_txtCount = null;
-            m_listTaskReward = null;
-            m_GetRewardBt = null;
-            m_ComeBt = null;
-            m_HadGet = null;
-            if(disposeTarget && target != null)
-            {
-                target.RemoveFromParent();
-                target.Dispose();
-            }
-            target = null;
-        }
-    }
-}

+ 0 - 11
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Task/UI_TaskListItem.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8738dbc55acf3418c8a76d66c77c227f
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 87 - 6
GameClient/Assets/Game/HotUpdate/Views/ActivityDay7/ActivityDay7View.cs

@@ -1,5 +1,7 @@
+using ET;
 using FairyGUI;
 using UI.ActivityDay7;
+using UI.CommonGame;
 using UI.Task;
 
 namespace GFGGame
@@ -15,7 +17,7 @@ namespace GFGGame
         private Activity7DaysCfg[] activity7DaysCfgs;
 
         //选中的天数index 天数=index+1
-        private int onClickIndex = 0;
+        private int onClickDayIndex;
 
         public override void Dispose()
         {
@@ -49,6 +51,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            onClickDayIndex = ActivityDay7DataManager.Instance.GetActivityDay7Day() - 1;
             SetScoreList();
             SetDayList();
         }
@@ -70,26 +73,72 @@ namespace GFGGame
                 item.target.onClick.Add(OnClickDay);
             }
             //设置按钮状态
-            item.target.selected = index == onClickIndex;
+            item.target.selected = index == onClickDayIndex;
             UI_ButtonDay.ProxyEnd();
         }
 
         //选中天数
         private void OnClickDay(EventContext context)
         {
-            onClickIndex = (int)context.data;
-            _ui.m_TaskList.numItems = cfgDataArray.Length;
-            //TODO 刷新天数任务列表
+            if (!(context.sender is GObject typeItem)) return;
+            onClickDayIndex = (int)typeItem.data;
+            var activity7DaysTaskCfg = Activity7DaysTaskCfgArray.Instance.GetCfg(onClickDayIndex + 1);
+            _ui.m_TaskList.data = activity7DaysTaskCfg.taskIdArr;
+            _ui.m_TaskList.numItems = activity7DaysTaskCfg.taskIdArr.Length;
+            //设置其他按钮选中状态
+            SetDayList();
         }
 
         //TaskListRenderer
         private void TaskListRenderer(int index, GObject obj)
         {
             var item = UI_TaskListItem.Proxy(obj);
-
+            var tasks = (int[])obj.parent.data;
+            var taskId = tasks[index];
+            var taskCfg = TaskCfgArray.Instance.GetCfg(taskId);
+            item.m_c1.selectedIndex = TaskDataManager.Instance.GetTaskStateById(taskId);
+            item.m_c2.selectedIndex = taskCfg.jumpId == "" ? 1 : 0;
+            item.m_txtDesc.text = TaskDataManager.Instance.GetTaskDesc(taskCfg.id);
+            item.m_txtCount.text =
+                $"{TaskDataManager.Instance.GetTaskProgressById(taskCfg.id)}/{taskCfg.count}";
+            if (item.m_GetRewardBt.data == null)
+            {
+                item.m_GetRewardBt.onClick.Add(OnBtnGetClick);
+            }
+            item.m_GetRewardBt.data = taskCfg.id;
+            if (item.m_ComeBt.data == null)
+            {
+                item.m_ComeBt.onClick.Add(OnBtnGoClick);
+            }
+            item.m_ComeBt.data = taskCfg.jumpId;
+            if (item.m_listTaskReward.data == null)
+            {
+                item.m_listTaskReward.itemRenderer = ListTaskRewardItemRender;
+            }
+            item.m_listTaskReward.data = taskCfg.rewardsArr;
+            item.m_listTaskReward.numItems = taskCfg.rewardsArr.Length;
             UI_TaskListItem.ProxyEnd();
         }
 
+        private static void ListTaskRewardItemRender(int index, GObject obj)
+        {
+            var item = UI_RewardIconYellow.Proxy(obj);
+            var rewards = (int[][])item.target.parent.data;
+            var itemCfg = ItemCfgArray.Instance.GetCfg(rewards[index][0]);
+            item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
+            item.m_num.text = $"{rewards[index][1]}";
+            UI_RewardIconYellow.ProxyEnd();
+        }
+
+        private void OnBtnGoClick(EventContext context)
+        {
+            Hide();
+            var btnGo = context.sender as GObject;
+            if (btnGo == null) return;
+            ViewManager.Show($"GFGGame.{btnGo.data}", null, new[] { typeof(ActivityDay7View).FullName, viewData },
+                true);
+        }
+
         //设置积分列表
         private void SetScoreList()
         {
@@ -126,5 +175,37 @@ namespace GFGGame
             cfgDataArray = Activity7DaysCfgArray.Instance.dataArray;
             _ui.m_DayList.numItems = cfgDataArray.Length;
         }
+
+        private async void OnBtnGetClick(EventContext context)
+        {
+            if (!(context.sender is GObject btnGet)) return;
+            var result = await TaskSProxy.GetTaskBonus((int)btnGet.data);
+            if (!result) return;
+        }
+
+
+        private async ETTask OnClickReward(int id)
+        {
+            var cfg = DailyActiveRewardCfgArray.Instance.GetCfg(id);
+            var state = DailyTaskDataManager.Instance.GetBoxStateById(cfg.id);
+            switch (state)
+            {
+                case ConstBonusStatus.CAN_NOT_GET:
+                {
+                    var rewards = ItemUtil.CreateItemDataList(cfg.rewardsArr);
+                    ViewManager.Show<RewardPreView>(new object[] { rewards, "活跃度奖励", $"满足{cfg.count}活跃度可领取" });
+                    break;
+                }
+                case ConstBonusStatus.CAN_GET:
+                {
+                    var result = await DailyTaskSProxy.ReqLivenessBox(cfg.id);
+                    // if (result) UpdateLivenessProcess();
+                    break;
+                }
+                case ConstBonusStatus.GOT:
+                    //领取完毕
+                    break;
+            }
+        }
     }
 }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -572,8 +572,8 @@ namespace GFGGame
         }
         private void OnClickBtnRenWu()
         {
-            // ViewManager.Show<TaskView>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
-            ViewManager.Show<ActivityDay7View>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
+            ViewManager.Show<TaskView>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
+            // ViewManager.Show<ActivityDay7View>(null, new[] { ViewName.MAINUI_VIEW, this.viewData });
             // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 1);
             // ViewManager.Show<DailyTaskView>();
         }

+ 13 - 1
GameClient/Assets/Game/HotUpdate/Views/Task/BattlePassTaskView.cs

@@ -1,6 +1,9 @@
+using System;
 using System.Collections.Generic;
+using System.Linq;
 using ET;
 using FairyGUI;
+using UI.CommonGame;
 using UI.Task;
 
 namespace GFGGame
@@ -52,6 +55,15 @@ namespace GFGGame
             SetBattlePassLevel();
             SetOpenBattlePassBtnStatus();
             FreshSpecialReward(oldLevel);
+            var battlePassCfgs =
+                BattlePassCfgArray.Instance.GetCfgsByid(BattlePassTaskDataManager.Instance.GetSeasonId());
+            var minLevel =
+                (from battlePassCfg in battlePassCfgs
+                    let state = BattlePassTaskDataManager.Instance.GetRewardState(battlePassCfg.level)
+                    where battlePassCfg.level != 0 && state != 2
+                    select battlePassCfg.level).FirstOrDefault();
+            // var index = _ui.m_RewardList.ItemIndexToChildIndex(minLevel - 1);
+            _ui.m_RewardList.ScrollToView(minLevel - 1);
         }
 
         protected override void AddEventListener()
@@ -145,7 +157,7 @@ namespace GFGGame
             //获取玩家当前的通行证等级
             var state = BattlePassTaskDataManager.Instance.GetRewardState(level);
             //设置按钮状态
-            SetBtnState(item, battlePassCfg.id, state);
+            SetBtnState(item, battlePassCfg.level, state);
             item.target.data = battlePassCfg;
             UI_BattlePassRewardItem.ProxyEnd();
             FreshSpecialReward(level);

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/Task/BuyBattlePassLevelView.cs

@@ -1,4 +1,5 @@
 using FairyGUI;
+using UI.CommonGame;
 using UI.Task;
 
 namespace GFGGame

+ 3 - 1
GameClient/Assets/Game/HotUpdate/Views/Task/CombTaskView.cs

@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using ET;
 using FairyGUI;
+using UI.CommonGame;
 using UI.Task;
 
 namespace GFGGame
@@ -44,6 +45,7 @@ namespace GFGGame
             base.OnShown();
             UpdateLivenessProcess();
             UpdateTask();
+            _ui.m_TaskList.ScrollToView(0);
         }
 
         protected override void AddEventListener()
@@ -196,7 +198,7 @@ namespace GFGGame
                 case ConstBonusStatus.CAN_GET:
                 {
                     var result = await DailyTaskSProxy.ReqLivenessBox(cfg.id);
-                    if (result) UpdateTask();
+                    if (result) UpdateLivenessProcess();
                     break;
                 }
                 case ConstBonusStatus.GOT:

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/Task/OpenBattlePassView.cs

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using FairyGUI;
+using UI.CommonGame;
 using UI.Task;
 
 namespace GFGGame

+ 0 - 1
GameClient/Assets/Game/HotUpdate/Views/Task/TaskView.cs

@@ -36,7 +36,6 @@ namespace GFGGame
             _valueBarController = new ValueBarController(_ui.m_comValueBar);
             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing2");
             _ui.m_c1.onChanged.Add(OnCtrlChange);
-            BattlePassTaskSProxy.GetBattlePassInfo().Coroutine();
         }
 
         private void OnBtnBackClick()

BIN
GameClient/Assets/ResIn/UI/Task/Task_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/Task/Task_atlas0.png


BIN
GameClient/Assets/ResIn/UI/Task/Task_fui.bytes