Bläddra i källkod

恭喜获得优化 和 摘星增加免费获得

huangxiaoyue 2 år sedan
förälder
incheckning
0ec6cfce22

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -74,7 +74,8 @@ namespace GFGGame
         {
             luckyBoxFreeTimeMillDic.Clear();
             int count = response.KsLuckyBoxId.Count;
-            for(var i = 0; i < count; i++)
+            ET.Log.Debug("打印测试-------进入游戏时候的保存---------" + count);
+            for (var i = 0; i < count; i++)
             {
                 luckyBoxFreeTimeMillDic[response.KsLuckyBoxId[i]] = response.VsFreeTime[i];
             }

+ 7 - 7
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_RewardList.cs → GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_ComRewardList.cs

@@ -4,18 +4,18 @@ using FairyGUI;
 
 namespace UI.CommonGame
 {
-    public partial class UI_RewardList
+    public partial class UI_ComRewardList
     {
         public GComponent target;
         public GList m_listReward;
         public const string URL = "ui://eg2y0ldpgo1ltow";
         public const string PACKAGE_NAME = "CommonGame";
-        public const string RES_NAME = "RewardList";
-        private static UI_RewardList _proxy;
+        public const string RES_NAME = "ComRewardList";
+        private static UI_ComRewardList _proxy;
 
-        public static UI_RewardList Create(GObject gObject = null)
+        public static UI_ComRewardList Create(GObject gObject = null)
         {
-            var ui = new UI_RewardList();
+            var ui = new UI_ComRewardList();
             if(gObject == null)
             	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
             else
@@ -24,11 +24,11 @@ namespace UI.CommonGame
             return ui;
         }
 
-        public static UI_RewardList Proxy(GObject gObject = null)
+        public static UI_ComRewardList Proxy(GObject gObject = null)
         {
             if(_proxy == null)
             {
-                _proxy = new UI_RewardList();
+                _proxy = new UI_ComRewardList();
             }
             var ui = _proxy;
             if(gObject == null)

+ 1 - 1
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_RewardList.cs.meta → GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_ComRewardList.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 63092a1883009be4883d3047521d5a53
+guid: fd47d9a17d7050b47ae168cab2158195
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 5 - 2
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_RewardUI.cs

@@ -10,8 +10,9 @@ namespace UI.CommonGame
         public GGraph m_bg;
         public GGraph m_holderTitle;
         public GGroup m_downTipsText;
-        public UI_RewardList m_comList;
+        public UI_ComRewardList m_comList;
         public GGroup m_grp;
+        public Transition m_openViewAction;
         public const string URL = "ui://eg2y0ldpm9wm8q";
         public const string PACKAGE_NAME = "CommonGame";
         public const string RES_NAME = "RewardUI";
@@ -62,8 +63,9 @@ namespace UI.CommonGame
             m_bg = (GGraph)comp.GetChild("bg");
             m_holderTitle = (GGraph)comp.GetChild("holderTitle");
             m_downTipsText = (GGroup)comp.GetChild("downTipsText");
-            m_comList = (UI_RewardList)UI_RewardList.Create(comp.GetChild("comList"));
+            m_comList = (UI_ComRewardList)UI_ComRewardList.Create(comp.GetChild("comList"));
             m_grp = (GGroup)comp.GetChild("grp");
+            m_openViewAction = comp.GetTransition("openViewAction");
         }
         public void Dispose(bool disposeTarget = false)
         {
@@ -73,6 +75,7 @@ namespace UI.CommonGame
             m_comList.Dispose();
             m_comList = null;
             m_grp = null;
+            m_openViewAction = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 4 - 29
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/LuckyBox/UI_ComBox1.cs

@@ -14,15 +14,7 @@ namespace UI.LuckyBox
         public GGroup m_grpTitle;
         public GButton m_btnPreview;
         public GTextField m_txtOwned;
-        public UI_ComCost m_comCostOne;
-        public UI_ComCost m_comCostTen;
-        public GButton m_btnBuyOne;
-        public GButton m_btnBuyTen;
-        public GTextField m_txtRemainTimes;
-        public GImage m_imgSpecial;
-        public GGraph m_holder;
-        public GGroup m_grpSpecial;
-        public GTextField m_txtFreeTime;
+        public UI_comLuckBoxBtn m_comLuckBoxBtn;
         public const string URL = "ui://drx9d1usduuftcr";
         public const string PACKAGE_NAME = "LuckyBox";
         public const string RES_NAME = "ComBox1";
@@ -77,15 +69,7 @@ namespace UI.LuckyBox
             m_grpTitle = (GGroup)comp.GetChild("grpTitle");
             m_btnPreview = (GButton)comp.GetChild("btnPreview");
             m_txtOwned = (GTextField)comp.GetChild("txtOwned");
-            m_comCostOne = (UI_ComCost)UI_ComCost.Create(comp.GetChild("comCostOne"));
-            m_comCostTen = (UI_ComCost)UI_ComCost.Create(comp.GetChild("comCostTen"));
-            m_btnBuyOne = (GButton)comp.GetChild("btnBuyOne");
-            m_btnBuyTen = (GButton)comp.GetChild("btnBuyTen");
-            m_txtRemainTimes = (GTextField)comp.GetChild("txtRemainTimes");
-            m_imgSpecial = (GImage)comp.GetChild("imgSpecial");
-            m_holder = (GGraph)comp.GetChild("holder");
-            m_grpSpecial = (GGroup)comp.GetChild("grpSpecial");
-            m_txtFreeTime = (GTextField)comp.GetChild("txtFreeTime");
+            m_comLuckBoxBtn = (UI_comLuckBoxBtn)UI_comLuckBoxBtn.Create(comp.GetChild("comLuckBoxBtn"));
         }
         public void Dispose(bool disposeTarget = false)
         {
@@ -97,17 +81,8 @@ namespace UI.LuckyBox
             m_grpTitle = null;
             m_btnPreview = null;
             m_txtOwned = null;
-            m_comCostOne.Dispose();
-            m_comCostOne = null;
-            m_comCostTen.Dispose();
-            m_comCostTen = null;
-            m_btnBuyOne = null;
-            m_btnBuyTen = null;
-            m_txtRemainTimes = null;
-            m_imgSpecial = null;
-            m_holder = null;
-            m_grpSpecial = null;
-            m_txtFreeTime = null;
+            m_comLuckBoxBtn.Dispose();
+            m_comLuckBoxBtn = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 97 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/LuckyBox/UI_comLuckBoxBtn.cs

@@ -0,0 +1,97 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.LuckyBox
+{
+    public partial class UI_comLuckBoxBtn
+    {
+        public GComponent target;
+        public UI_ComCost m_comCostOne;
+        public UI_ComCost m_comCostTen;
+        public GButton m_btnBuyOne;
+        public GButton m_btnBuyTen;
+        public GTextField m_txtRemainTimes;
+        public GImage m_imgSpecial;
+        public GGraph m_holder;
+        public GGroup m_grpSpecial;
+        public GTextField m_txtFreeTime;
+        public const string URL = "ui://drx9d1usdkohtf7";
+        public const string PACKAGE_NAME = "LuckyBox";
+        public const string RES_NAME = "comLuckBoxBtn";
+        private static UI_comLuckBoxBtn _proxy;
+
+        public static UI_comLuckBoxBtn Create(GObject gObject = null)
+        {
+            var ui = new UI_comLuckBoxBtn();
+            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_comLuckBoxBtn Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_comLuckBoxBtn();
+            }
+            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_comCostOne = (UI_ComCost)UI_ComCost.Create(comp.GetChild("comCostOne"));
+            m_comCostTen = (UI_ComCost)UI_ComCost.Create(comp.GetChild("comCostTen"));
+            m_btnBuyOne = (GButton)comp.GetChild("btnBuyOne");
+            m_btnBuyTen = (GButton)comp.GetChild("btnBuyTen");
+            m_txtRemainTimes = (GTextField)comp.GetChild("txtRemainTimes");
+            m_imgSpecial = (GImage)comp.GetChild("imgSpecial");
+            m_holder = (GGraph)comp.GetChild("holder");
+            m_grpSpecial = (GGroup)comp.GetChild("grpSpecial");
+            m_txtFreeTime = (GTextField)comp.GetChild("txtFreeTime");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_comCostOne.Dispose();
+            m_comCostOne = null;
+            m_comCostTen.Dispose();
+            m_comCostTen = null;
+            m_btnBuyOne = null;
+            m_btnBuyTen = null;
+            m_txtRemainTimes = null;
+            m_imgSpecial = null;
+            m_holder = null;
+            m_grpSpecial = null;
+            m_txtFreeTime = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/LuckyBox/UI_comLuckBoxBtn.cs.meta

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

+ 3 - 2
GameClient/Assets/Game/HotUpdate/ServerProxy/LuckyBoxSProxy.cs

@@ -7,6 +7,7 @@ namespace ET
     {
         protected override async ETTask Run(Session session, S2C_NoticeLuckyBoxFreeTime message)
         {
+            ET.Log.Debug("打印测试----------服务器下发-------");
             LuckyBoxDataManager.Instance.UpdateFreeTime(message.LuckyBoxId, message.FreeTime);
             await ETTask.CompletedTask;
         }
@@ -18,7 +19,6 @@ namespace GFGGame
 
     public class LuckyBoxSProxy
     {
-
         //抽奖
         public static async ETTask<bool> ReqGetBonus(int luckyBoxId, int times, bool free = false)
         {
@@ -64,8 +64,9 @@ namespace GFGGame
             response = (S2C_GetLuckyBoxInfo)await MessageHelper.SendToServer(new C2S_GetLuckyBoxInfo() { });
             if(response != null)
             {
-                if(response.Error == ErrorCode.ERR_Success)
+                if (response.Error == ErrorCode.ERR_Success)
                 {
+                    ET.Log.Debug("打印测试-------请求抽奖初始信息---------" + response.Error);
                     LuckyBoxDataManager.Instance.InitServerData(response);
                 }
             }

+ 80 - 19
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -128,12 +128,42 @@ namespace GFGGame
             _ui.m_listBg.scrollPane.decelerationRate = 0.8f;
             LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex;
 
-
             OnListBgScroll();
             updateBoxEffect();
-            UpdateFreeInfo();
 
             Timers.inst.AddUpdate(CheckGuide);
+
+            Timers.inst.Add(0.1f, 0, OnTimerUpdate, 1);
+        }
+
+        private void OnTimerUpdate(object param)
+        {
+            int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
+            long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
+            GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
+            UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
+            if (freeTime > 0)
+            {
+                if (freeTime > TimeHelper.ClientNow())
+                {
+                    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
+                    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true;
+                    string strFreeTime = TimeUtil.FormattingTimeTo_HHmmss(freeTime - TimeHelper.ClientNow());
+                    comBox.m_comLuckBoxBtn.m_txtFreeTime.text = string.Format("{0}后免费", strFreeTime);
+                }
+                else
+                {
+                    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1;
+                    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
+                }
+            }
+            //else
+            //{
+            //    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
+            //    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
+            //}
+
+            UI_ComBox1.ProxyEnd();
         }
 
         private void RenderListBgItem(int index, GObject obj)
@@ -193,29 +223,27 @@ namespace GFGGame
 
             _lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnShown(LuckyBoxDataManager.Instance.currentBoxId);
 
-            comBox.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
-            GGraph holder = comBox.m_btnBuyTen.GetChild("holder").asGraph;
+            comBox.m_comLuckBoxBtn.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
+            GGraph holder = comBox.m_comLuckBoxBtn.m_btnBuyTen.GetChild("holder").asGraph;
             holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
-            comBox.m_holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
+            comBox.m_comLuckBoxBtn.m_holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
 
             _effectUI1 = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", "Button_Glow");
-            _effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_holder, "ui_LuckyBox", "but_text_dc");
+            _effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_comLuckBoxBtn.m_holder, "ui_LuckyBox", "but_text_dc");
 
-            comBox.m_comCostOne.m_txtCost.text = cfg.costNum.ToString();
-            comBox.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
-            comBox.m_comCostTen.m_txtCost.text = cfg.costNumTen.ToString();
-            comBox.m_comCostTen.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
-            if (comBox.m_btnBuyOne.data == null)
+            comBox.m_comLuckBoxBtn.m_comCostTen.m_txtCost.text = cfg.costNumTen.ToString();
+            comBox.m_comLuckBoxBtn.m_comCostTen.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
+            if (comBox.m_comLuckBoxBtn.m_btnBuyOne.data == null)
             {
-                comBox.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne);
+                comBox.m_comLuckBoxBtn.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne);
             }
-            comBox.m_btnBuyOne.data = boxId;
+            comBox.m_comLuckBoxBtn.m_btnBuyOne.data = boxId;
 
-            if (comBox.m_btnBuyTen.data == null)
+            if (comBox.m_comLuckBoxBtn.m_btnBuyTen.data == null)
             {
-                comBox.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen);
+                comBox.m_comLuckBoxBtn.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen);
             }
-            comBox.m_btnBuyTen.data = boxId;
+            comBox.m_comLuckBoxBtn.m_btnBuyTen.data = boxId;
 
             if (comBox.m_btnPreview.data == null)
             {
@@ -242,6 +270,7 @@ namespace GFGGame
             }
             UI_ComBox1.ProxyEnd();
             UpdateListItemData();
+            UpdateFreeInfo();
         }
         private void UpdateListItemData()
         {
@@ -253,7 +282,7 @@ namespace GFGGame
             comBox.m_txtOwned.SetVar("v1", "" + count).FlushVars();
             comBox.m_txtOwned.SetVar("v2", "" + totalCount).FlushVars();
             int boughtCount = GameGlobal.myNumericComponent.GetAsInt(cfg.numericType);
-            comBox.m_txtRemainTimes.text = string.Format("今日剩余次数:{0}", cfg.maxCount - boughtCount);
+            comBox.m_comLuckBoxBtn.m_txtRemainTimes.text = string.Format("今日剩余次数:{0}", cfg.maxCount - boughtCount);
             UI_ComBox1.ProxyEnd();
         }
 
@@ -306,7 +335,13 @@ namespace GFGGame
             }
             LuckyBoxDataManager.Instance.CheckItemEnough(boxId, LuckyBoxDataManager.ONCE_TIME, async () =>
              {
-                 bool result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME);
+                 long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
+                 bool result = false;
+                 if (freeTime > 0 && freeTime > TimeHelper.ClientNow())
+                    result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME, true);
+                 else
+                    result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME);
+                  
                  if (result)
                  {
                      ViewManager.Show<LuckyBoxStarView>(null, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
@@ -355,6 +390,7 @@ namespace GFGGame
                 _lcukyBoxCtrl[key].OnHide();
             }
 
+            Timers.inst.Remove(OnTimerUpdate);
             Timers.inst.Remove(CheckTime);
             // Timers.inst.Remove(UpdateBg);
             Timers.inst.Remove(CheckGuide);
@@ -418,7 +454,32 @@ namespace GFGGame
 
         private void UpdateFreeInfo()
         {
-
+            ET.Log.Debug("打印测试-------运行一次ddd---");
+            int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
+            LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
+            long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
+            GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
+            UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
+            if (freeTime > 0)
+            {
+                if (freeTime > TimeHelper.ClientNow())
+                {
+                    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
+                    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true;
+                }
+                else
+                {
+                    comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1;
+                    comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
+                }
+            }
+            else
+            {
+                comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
+                comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
+                comBox.m_comLuckBoxBtn.m_comCostOne.m_txtCost.text = cfg.costNum.ToString();
+                comBox.m_comLuckBoxBtn.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
+            }
         }
     }
 }

BIN
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_fui.bytes


BIN
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_fui.bytes