| 
					
				 | 
			
			
				@@ -1,195 +0,0 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using ET; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using FairyGUI; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using UI.DailyTask; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using UnityEngine; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public class DailyTaskView : BaseWindow 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private UI_DailyTaskUI _ui; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private ValueBarController _valueBarController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private List<DailyTaskCfg> _cfgs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private List<DailyActiveRewardCfg> _rewardCfgs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public override void Dispose() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            base.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (_valueBarController != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _valueBarController.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _valueBarController = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (_ui != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        protected override void OnInit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            base.OnInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            packageName = UI_DailyTaskUI.PACKAGE_NAME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui = UI_DailyTaskUI.Create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.viewCom = _ui.target; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            isfullScreen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _valueBarController = new ValueBarController(_ui.m_comValueBar); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnback.onClick.Add(OnBtnBackClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnGetAll.target.onClick.Add(OnBtnGetAllClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_list.itemRenderer = ListItemRender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_listReward.itemRenderer = ListBoxRewardItemRender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_listReward.onClickItem.Add(OnBoxRewardItemClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        protected override void OnShown() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            base.OnShown(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("mrqd_bjbj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _valueBarController.OnShown(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UpdateList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UpdateReward(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_list.ScrollToView(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        protected override void OnHide() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _valueBarController.OnHide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            base.OnHide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void UpdateList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _cfgs = DailyTaskDataManager.Instance.GetDailyTaskCfgs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_list.numItems = _cfgs.Count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void UpdateReward() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_listReward.numItems = _rewardCfgs.Count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_txtDesc0.text = string.Format("今日活跃度{0}", RoleDataManager.Liveness); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_txtDesc1.text = string.Format(",满{0}活跃度可领奖", DailyTaskDataManager.Instance.GetShowLivenessBoxNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(ConstItemID.LIVENESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            bool canGet = DailyTaskDataManager.Instance.GetTaskStateById(_cfgs[0].id) == ConstBonusStatus.CAN_GET; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnGetAll.m_c1.selectedIndex = canGet ? 1 : 0;//第一个不可领说明没有可领奖的任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnGetAll.target.touchable = canGet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void ListItemRender(int index, GObject obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListItem item = UI_ListItem.Proxy(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_c1.selectedIndex = DailyTaskDataManager.Instance.GetTaskStateById(_cfgs[index].id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_c2.selectedIndex = _cfgs[index].jumpId == "" ? 0 : 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_txtDesc.text = DailyTaskDataManager.Instance.GetTaskDesc(_cfgs[index].id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_txtCount.text = string.Format("{0}/{1}", DailyTaskDataManager.Instance.GetTaskProgressById(_cfgs[index].id), _cfgs[index].count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (item.m_btnGet.data == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                item.m_btnGet.onClick.Add(OnBtnGetClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_btnGet.data = _cfgs[index].id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (item.m_btnGo.data == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                item.m_btnGo.onClick.Add(OnBtnGoClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_btnGo.data = _cfgs[index].jumpId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (item.m_listTaskReward.data == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                item.m_listTaskReward.itemRenderer = ListTaskRewardItemRender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_listTaskReward.data = _cfgs[index].rewardsArr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_listTaskReward.numItems = _cfgs[index].rewardsArr.Length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListItem.ClearProxy(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void ListTaskRewardItemRender(int index, GObject obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListTaskRewardItem item = UI_ListTaskRewardItem.Proxy(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int[][] rewards = (int[][])item.target.parent.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(rewards[index][0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_txtNum.text = string.Format("x{0}", rewards[index][1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListTaskRewardItem.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private async void OnBtnGetClick(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GObject btnGet = context.sender as GObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            bool result = await DailyTaskSProxy.ReqDailyTaskBonus((int)btnGet.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                UpdateList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                UpdateReward(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnBtnGoClick(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.Hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GObject btnGo = context.sender as GObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ViewManager.Show(string.Format("GFGGame.{0}", btnGo.data), null, new object[] { typeof(DailyTaskView).FullName, this.viewData }, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void ListBoxRewardItemRender(int index, GObject obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListBoxRewardItem item = UI_ListBoxRewardItem.Proxy(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            DailyActiveRewardCfg cfg = _rewardCfgs[index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int state = DailyTaskDataManager.Instance.GetBoxStateById(cfg.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_c1.selectedIndex = state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_txtNum.text = cfg.count.ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            RedDotController.Instance.SetComRedDot(item.target, state == ConstBonusStatus.CAN_GET, "", 12, 4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.target.data = _rewardCfgs[index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_ListBoxRewardItem.ClearProxy(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private async void OnBoxRewardItemClick(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GObject item = context.data as GObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            DailyActiveRewardCfg cfg = item.data as DailyActiveRewardCfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (DailyTaskDataManager.Instance.GetBoxStateById(cfg.id) == ConstBonusStatus.CAN_GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                bool result = await DailyTaskSProxy.ReqLivenessBox(cfg.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    UpdateReward(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<ItemData> rewards = ItemUtil.CreateItemDataList(cfg.rewardsArr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ViewManager.Show<RewardPreView>(new object[] { rewards, "活跃度奖励", string.Format("满足{0}活跃度可领取", cfg.count) }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnBtnBackClick() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ViewManager.GoBackFrom(typeof(DailyTaskView).FullName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private async void OnBtnGetAllClick() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            bool result = await DailyTaskSProxy.ReqAllDailyTaskBonus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (result) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                UpdateList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                UpdateReward(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 |