Browse Source

每日补给

zhaoyang 2 years ago
parent
commit
6247e41eea

+ 1 - 1
FGUIProject/assets/DailyWelfare/components/ComSupply.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="378,643" opaque="false">
+<component size="378,643">
   <controller name="c1" exported="true" pages="0,,1," selected="1"/>
   <displayList>
     <image id="n29_qik1" name="n29" src="qik1z" fileName="images/mrbj_tb1.png" xy="-8,24" group="n27_qik1">

+ 71 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_BtnStyle000.cs

@@ -0,0 +1,71 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.CommonGame
+{
+    public partial class UI_BtnStyle000
+    {
+        public GButton target;
+        public Controller m_c1;
+        public const string URL = "ui://eg2y0ldpqik1tm1";
+        public const string PACKAGE_NAME = "CommonGame";
+        public const string RES_NAME = "BtnStyle000";
+        private static UI_BtnStyle000 _proxy;
+
+        public static UI_BtnStyle000 Create(GObject gObject = null)
+        {
+            var ui = new UI_BtnStyle000();
+            if(gObject == null)
+            	ui.target =  (GButton)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GButton)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_BtnStyle000 Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_BtnStyle000();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GButton)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GButton)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");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_c1 = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_BtnStyle000.cs.meta

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

+ 33 - 16
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/DailySupplyView.cs

@@ -1,6 +1,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Threading.Tasks;
 using ET;
 using FairyGUI;
 using UI.DailyWelfare;
@@ -39,8 +40,9 @@ namespace GFGGame
             packageName = UI_DailySupplyUI.PACKAGE_NAME;
             _ui = UI_DailySupplyUI.Create();
             this.viewCom = _ui.target;
-            isfullScreen = true;
-
+            this.viewCom.Center();
+            this.modal = true;
+            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
             // _valueBarController = new ValueBarController(_ui.m_comValueBar);
 
             // _ui.m_btnback.onClick.Add(OnBtnBackClick);
@@ -49,7 +51,7 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
         }
 
         protected override void OnShown()
@@ -84,8 +86,7 @@ namespace GFGGame
                 _month = DateTime.Now.Month;
                 _day = DateTime.Now.Day;
             }
-            // _ui.m_list.ScrollToView(0);
-            UpdateView();
+            UpdateSupplyView();
         }
 
         protected override void OnHide()
@@ -96,7 +97,7 @@ namespace GFGGame
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
-            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
         }
 
         private void OnBtnBackClick()
@@ -125,13 +126,7 @@ namespace GFGGame
             long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
             item.m_txtTime.text = TimeUtil.FormattingTime6(openTime) + "-" + TimeUtil.FormattingTime6(endTime);
             item.m_txtCount.text = supplyCfg.bonusArr[0][1].ToString();
-            // if (item.m_comItem.data == null)
-            // {
-            //     item.m_comItem.data = new ItemView(item.m_comItem);
-            // }
-            // ItemData itemData = ItemUtil.createItemData(supplyCfg.bonusArr[0]);
-            // (item.m_comItem.data as ItemView).SetData(itemData);
-            // (item.m_comItem.data as ItemView).ShowTips = false;
+
             ItemUtil.UpdateItemNeedNum(item.m_comCost, GlobalCfgArray.globalCfg.dailySupplyConsumeArr[0]);
             item.m_comCost.visible = false;
 
@@ -143,7 +138,7 @@ namespace GFGGame
             }
 
             long curTime = TimeHelper.ServerNow();
-            if (curTime < openTime)
+            if (curTime < openTime && curTime > TimeUtil.GetCurDayTime(GlobalCfgArray.globalCfg.refreshTime))
             {
                 item.m_btnGet.title = "领取";
                 item.m_btnGet.enabled = false;
@@ -166,13 +161,35 @@ namespace GFGGame
             item.m_btnGet.data = supplyCfg;
             UI_ComSupply.ProxyEnd();
         }
-        private async void OnBtnGetSupplyClick(EventContext context)
+        private void OnBtnGetSupplyClick(EventContext context)
         {
             GObject obj = context.sender as GObject;
             DailySupplyCfg supplyCfg = obj.data as DailySupplyCfg;
             long openTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.openTime).ToString("HH:mm:ss"));
             long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
-            bool result = await DailyWelfareSProxy.ReqGetSupplyReward(supplyCfg.id);
+            if (TimeHelper.ServerNow() > endTime)
+            {
+                int[] cost = GlobalCfgArray.globalCfg.dailySupplyConsumeArr[0];
+                AlertUI.Show(string.Format("是否确定花费{0}{1}补领?", cost[1], ItemCfgArray.Instance.GetCfg(cost[0]).name)).
+                  SetLeftButton(true, "否").
+                  SetRightButton(true, "是", (object param) =>
+                   {
+                       if (ItemDataManager.GetItemNum(cost[0]) < cost[1])
+                       {
+                           PromptController.Instance.ShowFloatTextPrompt("消耗不足");
+                           return;
+                       }
+                       ReqSupplyAsync(supplyCfg.id);
+                   });
+            }
+            else
+            {
+                ReqSupplyAsync(supplyCfg.id);
+            }
+        }
+        private async void ReqSupplyAsync(int id)
+        {
+            bool result = await DailyWelfareSProxy.ReqGetSupplyReward(id);
             if (result)
             {
                 UpdateSupplyView();

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


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