Browse Source

限时累充活动提交,后续修改UI

zhangyuqian 1 year ago
parent
commit
ad6a189bd1

+ 6 - 6
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/DailyWelfare/UI_NewLimitChargeUI.cs

@@ -13,8 +13,8 @@ namespace UI.DailyWelfare
         public GTextField m_txtTime;
         public GGroup m_grpTime;
         public GList m_list;
-        public GButton m_toRightBtn;
-        public GButton m_toLeftBtn;
+        public GButton m_btnRight;
+        public GButton m_btnLeft;
         public GButton m_btnCharge;
         public const string URL = "ui://t8nwuj7idn9y2h";
         public const string PACKAGE_NAME = "DailyWelfare";
@@ -69,8 +69,8 @@ namespace UI.DailyWelfare
             m_txtTime = (GTextField)comp.GetChild("txtTime");
             m_grpTime = (GGroup)comp.GetChild("grpTime");
             m_list = (GList)comp.GetChild("list");
-            m_toRightBtn = (GButton)comp.GetChild("toRightBtn");
-            m_toLeftBtn = (GButton)comp.GetChild("toLeftBtn");
+            m_btnRight = (GButton)comp.GetChild("btnRight");
+            m_btnLeft = (GButton)comp.GetChild("btnLeft");
             m_btnCharge = (GButton)comp.GetChild("btnCharge");
         }
         public void Dispose(bool disposeTarget = false)
@@ -81,8 +81,8 @@ namespace UI.DailyWelfare
             m_txtTime = null;
             m_grpTime = null;
             m_list = null;
-            m_toRightBtn = null;
-            m_toLeftBtn = null;
+            m_btnRight = null;
+            m_btnLeft = null;
             m_btnCharge = null;
             if(disposeTarget && target != null)
             {

+ 79 - 67
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/NewLimitChargeView.cs

@@ -11,7 +11,7 @@ namespace GFGGame
 {
     public class NewLimitChargeView : BaseWindow
     {
-        private UI_StoreChargeAddUpUI _ui;
+        private UI_NewLimitChargeUI _ui;
         private List<ShopCfg> _shopCfgs;
         private DressUpObjUI _dressUpObjUI;
         private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
@@ -49,7 +49,7 @@ namespace GFGGame
         {
             base.OnInit();
             packageName = UI_StoreChargeAddUpUI.PACKAGE_NAME;
-            _ui = UI_StoreChargeAddUpUI.Create();
+            _ui = UI_NewLimitChargeUI.Create();
             this.viewCom = _ui.target;
             isfullScreen = true;
             this.clickBlankToClose = false;
@@ -64,50 +64,60 @@ namespace GFGGame
 
             _ui.m_btnLeft.onClick.Add(OnBtnLeftClick);
             _ui.m_btnRight.onClick.Add(OnBtnRightClick);
+            _ui.m_btnBack.onClick.Add(OnBtnBackClick);
+            _ui.m_btnCharge.onClick.Add(OnBtnChargeClick);
         }
         protected override void AddEventListener()
         {
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
-            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
+            //EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
         protected override void OnShown()
         {
             base.OnShown();
 
-            RefreshList();
-            _curSelectIndex = Math.Max(0, RoleDataManager.vipLv - 1);
-            _ui.m_list.selectedIndex = _curSelectIndex;
-            _ui.m_list.ScrollToView(_curSelectIndex);
-            _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
-            _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 1 ? true : false;
+            //_curSelectIndex = Math.Max(0, RoleDataManager.vipLv - 1);
+            //_ui.m_list.selectedIndex = _curSelectIndex;
+            //_ui.m_list.ScrollToView(_curSelectIndex);
 
+            //_activityId = 501;
             _activityId = (int)(this.viewData as object[])[0];
             _rechargeCfgs = ActivityRechargeCfgArray.Instance.GetCfgsByactivityId(_activityId);
+            _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(_activityId);
+            //UpdateRedDot();
+            
+            RefreshList();
+            _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
+            _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 1 ? true : false;
 
-            UpdateRedDot();
+            Timers.inst.Add(1, 0, UpdateTime);
         }
 
         protected override void OnHide()
         {
             base.OnHide();
+            if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
+            Timers.inst.Remove(UpdateTime);
         }
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
-            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
+            //EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
 
         private void RefreshList()
         {
-            _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length - 1;
+            _ui.m_list.numItems = _rechargeCfgs.Count;
         }
         private void ListItemRenderer(int index, GObject obj)
         {
 
-            VipCfg lastVipCfg = VipCfgArray.Instance.dataArray[index];
-            VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
+            ActivityRechargeCfg lastVipCfg = _rechargeCfgs[index]; 
+            ActivityRechargeCfg vipCfg = _rechargeCfgs[index]; 
+
+
 
             UI_ListShowItem item = UI_ListShowItem.Proxy(obj);
             string name = SuitCfgArray.Instance.GetCfg(vipCfg.suitId).name;
@@ -116,15 +126,14 @@ namespace GFGGame
             item.m_txtName2.text = name.Length > 2 ? name.Substring(2, 1) : "";
             item.m_txtName3.text = name.Length > 3 ? name.Substring(3, 1) : "";
             item.m_txtName4.text = name.Length > 4 ? name.Substring(4) : "";
-
-            item.m_txtGiftBag.SetVar("value", vipCfg.id.ToString()).FlushVars();
+            _ui.m_packageName.text = name;
             if (item.m_listGiftBag.data == null)
             {
                 item.m_listGiftBag.itemRenderer = ListRewardItemRender;
                 item.m_listGiftBag.onClickItem.Add(OnListItemClick);
             }
-            item.m_listGiftBag.data = lastVipCfg.bonusOnceArr;
-            item.m_listGiftBag.numItems = lastVipCfg.bonusOnceArr.Length;
+            item.m_listGiftBag.data = lastVipCfg.bonusArr;
+            item.m_listGiftBag.numItems = lastVipCfg.bonusArr.Length;
 
             if (item.m_holder.data == null)
             {
@@ -148,9 +157,14 @@ namespace GFGGame
             }
             item.m_btnGetGiftBag.data = vipCfg.id;
             bool isGet = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipCfg.id);
-            item.m_btnGetGiftBag.grayed = isGet || vipCfg.id > RoleDataManager.vipLv;
-            RedDotController.Instance.SetComRedDot(item.m_btnGetGiftBag, !isGet && RoleDataManager.vipLv >= vipCfg.id);
-            bool canGet = GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv == vipCfg.id;
+            long limitChargeExp = _activityInfo.CountValue;
+            item.m_btnGetGiftBag.grayed = limitChargeExp < _rechargeCfgs[index].value;
+            //RedDotController.Instance.SetComRedDot(item.m_btnGetGiftBag, !isGet && RoleDataManager.vipLv >= vipCfg.id);
+            //bool canGet = GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv == vipCfg.id;
+
+            //long limitChargeExp = _activityInfo.CountValue;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore);
+            item.m_txtGiftBag.text = string.Format("活动期间累计获得{0}会员积分({1}/{2})", _rechargeCfgs[index].value, limitChargeExp, _rechargeCfgs[index].value);
+
             UI_ListVipItem.ProxyEnd();
         }
 
@@ -184,29 +198,11 @@ namespace GFGGame
             ViewManager.Show<SuitShowView>(new object[] { _suitTypeId, suitId, new List<int>() { suitId }, false });
         }
 
-        private void OnBtnWeekClick(EventContext context)
-        {
-            GObject obj = context.sender as GObject;
-            int vipLv = (int)obj.data;
-            ViewManager.Show<WeekGiftView>(vipLv);
-        }
-
         private void OnBtnGetGiftBagClick(EventContext context)
         {
             GObject obj = context.sender as GObject;
-            int vipLv = (int)obj.data;
-            bool isGet = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipLv);
-            if (isGet)
-            {
-                PromptController.Instance.ShowFloatTextPrompt("会员等级礼包已领取");
-                return;
-            }
-            if (RoleDataManager.vipLv < vipLv)
-            {
-                PromptController.Instance.ShowFloatTextPrompt("会员等级不足");
-                return;
-            }
-            ShopSProxy.ReqGetVipGiftBag(vipLv).Coroutine();
+            int id = (int)obj.data;
+            ActivityGlobalSProxy.ReqGetActivityBonus(_activityId, id).Coroutine();
         }
 
         private void OnBtnLeftClick()
@@ -215,16 +211,20 @@ namespace GFGGame
             if (_curSelectIndex == 0) return;
             _curSelectIndex = _curSelectIndex - 1;
             _ui.m_list.ScrollToView(_curSelectIndex, true);
-            UpdateRedDot();
+            //UpdateRedDot();
         }
         private void OnBtnRightClick()
         {
             if (_curSelectIndex == _ui.m_list.numItems - 1) return;
             _curSelectIndex = _curSelectIndex + 1;
             _ui.m_list.ScrollToView(_curSelectIndex, true);
-            UpdateRedDot();
+            //UpdateRedDot();
 
         }
+        private void OnBtnChargeClick()
+        {
+            ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE });
+        }
         private void UpdateSuitView()
         {
             _curSelectIndex = _ui.m_list.GetFirstChildInView();
@@ -233,35 +233,42 @@ namespace GFGGame
             _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 1 ? true : false;
         }
 
-        private void UpdateRedDot()
+        private void UpdateTime(object param)
         {
+            long curTime = TimeHelper.ServerNow();
+            long endTime = _activityInfo.EndTime;
+            _ui.m_txtTime.text = TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
+        }
 
-            bool leftRed = false;
-            bool rightRed = false;
-            VipCfg[] vipCfgs = VipCfgArray.Instance.dataArray;
-            for (int i = 1; i < vipCfgs.Length; i++)
-            {
-                bool isGet = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipCfgs[i].id);
-                bool red = !isGet && RoleDataManager.vipLv >= vipCfgs[i].id;
+        //private void UpdateRedDot()
+        //{
 
-                if (red && _curSelectIndex > i - 1)
-                {
-                    leftRed = true;
-                    break;
-                }
-                if (red && _curSelectIndex + 1 < i)
-                {
-                    rightRed = true;
-                    break;
-                }
-            }
+        //    bool leftRed = false;
+        //    bool rightRed = false;
+        //    VipCfg[] vipCfgs = VipCfgArray.Instance.dataArray;
+        //    for (int i = 1; i < vipCfgs.Length; i++)
+        //    {
+        //        bool isGet = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.VipGetStatus), vipCfgs[i].id);
+        //        bool red = !isGet && RoleDataManager.vipLv >= vipCfgs[i].id;
 
-            if (GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv > 0 && _curSelectIndex > RoleDataManager.vipLv - 1) { leftRed = true; }
-            if (GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv > 0 && _curSelectIndex + 1 < RoleDataManager.vipLv) { rightRed = true; }
-            RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, leftRed);
-            RedDotController.Instance.SetComRedDot(_ui.m_btnRight, rightRed);
+        //        if (red && _curSelectIndex > i - 1)
+        //        {
+        //            leftRed = true;
+        //            break;
+        //        }
+        //        if (red && _curSelectIndex + 1 < i)
+        //        {
+        //            rightRed = true;
+        //            break;
+        //        }
+        //    }
 
-        }
+        //    if (GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv > 0 && _curSelectIndex > RoleDataManager.vipLv - 1) { leftRed = true; }
+        //    if (GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 0 && RoleDataManager.vipLv > 0 && _curSelectIndex + 1 < RoleDataManager.vipLv) { rightRed = true; }
+        //    RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, leftRed);
+        //    RedDotController.Instance.SetComRedDot(_ui.m_btnRight, rightRed);
+
+        //}
 
         private void OnListItemClick(EventContext context)
         {
@@ -269,5 +276,10 @@ namespace GFGGame
             ItemCfg itemCfg = comItem.data as ItemCfg;
             GoodsItemTipsController.ShowItemTips(itemCfg.id);
         }
+
+        private void OnBtnBackClick()
+        {
+            ViewManager.GoBackFrom(typeof(NewLimitChargeView).FullName);
+        }
     }
 }

BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_1!a.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_1.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_2.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_4!a.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_4.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_5!a.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_atlas0_5.png


BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_fui.bytes