Forráskód Böngészése

抽卡多倍奖励表现添加

lzx 2 napja
szülő
commit
b68ab977c4

+ 9 - 2
Assets/Scripts/GameUI/UI/BoxPanel/GachaPanel.cs

@@ -16,7 +16,7 @@ namespace Fort23.Mono
     [UIBinding(prefab = "GachaPanel")]
     public partial class GachaPanel : UIPanel
     {
-        List<WidgetItem> widgetItems = new List<WidgetItem>();
+        List<WidgetItemType2> widgetItems = new List<WidgetItemType2>();
         private List<ItemInfo> itemInfos;
         private int type;
 
@@ -58,6 +58,7 @@ namespace Fort23.Mono
         {
             tenButton.onClick.AddListener(() =>
             {
+                tenButton.gameObject.SetActive(false);
                 float beLv =
                     Utility.UtilTools.GetRandomByWeight(_openBoxConfig.betPara1.ToList(), _openBoxConfig.betPara2);
 
@@ -66,8 +67,13 @@ namespace Fort23.Mono
                     ItemInfo itemInfo1 = new ItemInfo(itemInfo.itemID, (long)(itemInfo.count.Value * (beLv - 1)));
                     PlayerManager.Instance.BagController.AddItem(itemInfo1);
                 }
+                
+                foreach (var widgetItemType2 in widgetItems)
+                {
+                    widgetItemType2.Play(beLv);
+                }
 
-                UIManager.Instance.HideUIUIPanel<GachaPanel>();
+                // UIManager.Instance.HideUIUIPanel<GachaPanel>();
             });
             Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel<GachaPanel>(); });
         }
@@ -134,6 +140,7 @@ namespace Fort23.Mono
                         await UIManager.Instance.CreateGComponentForObject<WidgetItemType2>(TenWidgetitems[i], null);
                     widgetItem.InitWidget(itemInfos[i]);
                     widgetItem.own.SetActive(true);
+                    widgetItems.Add(widgetItem);
                     await TimerComponent.Instance.WaitAsync(50);
                 }
             }

+ 25 - 3
Assets/Scripts/GameUI/UI/BoxPanel/WidgetItemType2.cs

@@ -1,5 +1,6 @@
 using System.Linq;
 using Core.Language;
+using Core.UI.UTool;
 using Excel2Json;
 using Fort23.UTool;
 using GameLogic.Bag;
@@ -11,6 +12,9 @@ namespace Fort23.Mono
     [UIBinding(prefab = "WidgetItemType2")]
     public partial class WidgetItemType2 : UIComponent
     {
+        ItemInfo itemInfo;
+        private int count;
+
         private void Init()
         {
         }
@@ -27,8 +31,22 @@ namespace Fort23.Mono
         {
         }
 
+        public void Play(float bl)
+        {
+            // long count = itemInfo.count.Value;
+            AccumulatorUtility.StartAccumulation(
+                (int)(count * bl), 0.2f, 20,
+                current =>
+                {
+                    count += current;
+                    Text_Count.text = $"x{count}";
+                }
+            );
+        }
+
         public void InitWidget(ItemInfo itemInfo)
         {
+            this.itemInfo = itemInfo;
             ItemConfig itemConfig = itemInfo.config;
             Icon_New.gameObject.SetActive(false);
             //法宝
@@ -42,7 +60,8 @@ namespace Fort23.Mono
                 {
                     itemConfig = ConfigComponent.Instance.Get<ItemConfig>(itemInfo.config.associateVlaue[0]);
                     Icon_SuiPian.gameObject.SetActive(true);
-                    Text_Count.text = $"x{itemInfo.config.associateVlaue[2]}";
+                    count = itemInfo.config.associateVlaue[2];
+                    Text_Count.text = $"x{count}";
                 }
                 else
                 {
@@ -61,7 +80,9 @@ namespace Fort23.Mono
                 {
                     itemConfig = ConfigComponent.Instance.Get<ItemConfig>(itemInfo.config.associateVlaue[0]);
                     Icon_SuiPian.gameObject.SetActive(true);
-                    Text_Count.text = $"x{itemInfo.config.associateVlaue[2]}";
+                    count = itemInfo.config.associateVlaue[2];
+                    Text_Count.text = $"x{count}";
+                    // Text_Count.text = $"x{itemInfo.config.associateVlaue[2]}";
                     // Icon_New.gameObject.SetActive(true);
                 }
                 else
@@ -73,7 +94,8 @@ namespace Fort23.Mono
             else
             {
                 Icon_SuiPian.gameObject.SetActive(false);
-                Text_Count.text = $"x{itemInfo.count}";
+                count = (int)(itemInfo.count.Value);
+                Text_Count.text = $"x{count}";
                 csc.ChangeState(0);
             }