浏览代码

修复套装图鉴特效显示问题

leiyasi 1 年之前
父节点
当前提交
54340bec88

+ 6 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/FieldGuide/UI_CompSuitItem.cs

@@ -8,14 +8,15 @@ namespace UI.FieldGuide
     {
         public GComponent target;
         public Controller m_c1;
+        public Controller m_state;
         public GLoader m_bg;
-        public GGraph m_holderBg;
         public GLoader m_loaderPic;
         public UI_BonusBox m_loaderBonusBox;
         public GProgressBar m_progBar;
         public GLoader m_rarity;
         public GTextField m_txtName;
         public GImage m_unlockMask;
+        public GGraph m_holderBg;
         public const string URL = "ui://vqq9h9h4e3ot6n";
         public const string PACKAGE_NAME = "FieldGuide";
         public const string RES_NAME = "CompSuitItem";
@@ -64,20 +65,21 @@ namespace UI.FieldGuide
         private void Init(GComponent comp)
         {
             m_c1 = comp.GetController("c1");
+            m_state = comp.GetController("state");
             m_bg = (GLoader)comp.GetChild("bg");
-            m_holderBg = (GGraph)comp.GetChild("holderBg");
             m_loaderPic = (GLoader)comp.GetChild("loaderPic");
             m_loaderBonusBox = (UI_BonusBox)UI_BonusBox.Create(comp.GetChild("loaderBonusBox"));
             m_progBar = (GProgressBar)comp.GetChild("progBar");
             m_rarity = (GLoader)comp.GetChild("rarity");
             m_txtName = (GTextField)comp.GetChild("txtName");
             m_unlockMask = (GImage)comp.GetChild("unlockMask");
+            m_holderBg = (GGraph)comp.GetChild("holderBg");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_c1 = null;
+            m_state = null;
             m_bg = null;
-            m_holderBg = null;
             m_loaderPic = null;
             m_loaderBonusBox.Dispose();
             m_loaderBonusBox = null;
@@ -85,6 +87,7 @@ namespace UI.FieldGuide
             m_rarity = null;
             m_txtName = null;
             m_unlockMask = null;
+            m_holderBg = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 18 - 15
GameClient/Assets/Game/HotUpdate/Views/FieldGuide/SuitGuideDetailView.cs

@@ -16,6 +16,12 @@ namespace GFGGame
         private Dictionary<int, EffectUI> _effectUIDic = new Dictionary<int, EffectUI>();
         public override void Dispose()
         {
+            foreach (var v in _effectUIDic)
+            {
+                EffectUIPool.Recycle(v.Value);
+            }
+            _effectUIDic.Clear();
+
             if (_ui != null)
             {
                 _ui.Dispose();
@@ -65,12 +71,6 @@ namespace GFGGame
         {
             base.OnHide();
 
-            foreach (var v in _effectUIDic)
-            {
-                EffectUIPool.Recycle(v.Value);
-            }
-            _effectUIDic.Clear();
-
             DressUpMenuItemDataManager.Clear();
 
             // 清空服装过滤界面选择
@@ -143,12 +143,6 @@ namespace GFGGame
                 _ui.m_progress.m_rate.SetVar("rate", "0").FlushVars();
             }
 
-            foreach (var v in _effectUIDic)
-            {
-                EffectUIPool.Recycle(v.Value);
-            }
-            _effectUIDic.Clear();
-
             _ui.m_listSuit.numItems = _suitIds.Count;
             _ui.m_listSuit.scrollPane.ScrollTop();
         }
@@ -158,11 +152,19 @@ namespace GFGGame
             UI_CompSuitItem listItem = UI_CompSuitItem.Proxy(item);
             int suitId = _suitIds[index];
             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
+
+            if ((suitCfg.rarity - 1) == 3)
+            {
+                bool haveSuit = DressUpMenuSuitDataManager.CheckHaveSuit(suitId);
+                if (haveSuit && !_effectUIDic.ContainsKey(index))
+                {
+                    _effectUIDic.Add(index, EffectUIPool.CreateEffectUI(listItem.m_holderBg, "ui_KP", "KP_Other_Gold_Frame"));
+                }
+            }
+
             listItem.m_txtName.text = suitCfg.name;
             listItem.m_loaderPic.url = ResPathUtil.GetFieldGuideIconPath(suitCfg.res);
             listItem.m_c1.SetSelectedIndex(suitCfg.rarity - 1);
-            if((suitCfg.rarity - 1) == 3)
-                _effectUIDic.Add(index, EffectUIPool.CreateEffectUI(listItem.m_holderBg, "ui_KP", "KP_Other_Gold_Frame"));
             RarityIconController.UpdateRarityIcon(listItem.m_rarity, suitId, false, true);
             listItem.target.data = suitId;
             UpdateSuitStatusView(listItem);
@@ -194,7 +196,7 @@ namespace GFGGame
             listItem.m_progBar.max = totalCount;
             listItem.m_progBar.value = count;
             bool haveSuit = DressUpMenuSuitDataManager.CheckHaveSuit(suitId);
-            listItem.m_unlockMask.visible = !haveSuit;
+            listItem.m_state.selectedIndex = (haveSuit ? 0 : 1);
             int status = DressUpMenuSuitDataManager.GetSuitGuideBonusStatus(suitId);
             RedDotController.Instance.SetComRedDot(listItem.m_loaderBonusBox.target, status == ConstBonusStatus.CAN_GET, "", -3, -1);
             if (status == ConstBonusStatus.CAN_GET)
@@ -205,6 +207,7 @@ namespace GFGGame
             {
                 listItem.m_loaderBonusBox.m_loaderBonusBox.url = "ui://FieldGuide/tujian_lw_2";
             }
+
             listItem.m_bg.onClick.Clear();
             listItem.m_bg.onClick.Add(() =>
             {

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -554,7 +554,7 @@ namespace GFGGame
                             _dressUpObj.AddOrRemove(headAniCfg.faceId, true);
                             //_dressUpObjUI.UpdateWrapper(_ui.m_dialogHead.m_compDressUp.m_holder);
                         }
-                        ShowSelfHeadImg();
+                        _ui.m_dialogHead.m_compDressUp.target.visible = true;
                     }
                     _ui.m_dialogHead.target.visible = true;
                     _wordTextField = _ui.m_dialogHead.m_txtContent;
@@ -658,7 +658,7 @@ namespace GFGGame
         private async void ShowSelfHeadImg()
         {
             _ui.m_dialogHead.m_compDressUp.target.visible = false;
-            await Task.Delay(10);
+            await Task.Delay(80);
             _ui.m_dialogHead.m_compDressUp.target.visible = true;
         }
 

+ 26 - 3
GameClient/Assets/Game/HotUpdate/Views/MainStory/TypingFadeEffectPro.cs

@@ -4,6 +4,7 @@ using UnityEngine;
 using FairyGUI;
 using System;
 using System.Threading.Tasks;
+using System.Threading;
 
 namespace GFGGame
 {
@@ -20,6 +21,8 @@ namespace GFGGame
         protected float showNextWordInternal = 0.06f;
         // 字符渐变时间
         protected float charFadeDuration = 0.15f;
+        // 异步函数的取消控制
+        private CancellationTokenSource _cancellationTokenSource;
 
         /// <summary>
         /// 
@@ -50,6 +53,7 @@ namespace GFGGame
             _printIndex = 0;
             _vertIndex = 0;
             _started = true;
+            _cancellationTokenSource = new CancellationTokenSource();
 
             int vertCount = _textField.graphics.mesh.vertexCount;
 
@@ -166,6 +170,7 @@ namespace GFGGame
             if (!_started)
                 return;
 
+            StopMyAsyncFunction();
             _started = false;
             _textField.graphics.meshModifier -= OnMeshModified;
             _textField.graphics.SetMeshDirty();
@@ -202,6 +207,13 @@ namespace GFGGame
             int listCnt = charPositions.Count;
             float timer = 0;
 
+            //for(int i=0;i<= listCnt - 1; i++)
+            //{
+            //    PrintFade(i, 0, _vertIndex);
+            //    _vertIndex += charPositions[_printIndex].vertCount;
+            //}
+            //_vertIndex = 0;
+
             while (true)
             {
                 if (!_started)
@@ -218,7 +230,7 @@ namespace GFGGame
                     }
                     else
                     {
-                        UpdateFadeProgressSingle(_printIndex, _vertIndex);
+                        UpdateFadeProgressSingle(_printIndex, _vertIndex, _cancellationTokenSource.Token);
                         ++_printIndex;
                         if(_printIndex < listCnt - 1)
                         {
@@ -231,9 +243,10 @@ namespace GFGGame
             }
         }
 
-        async Task UpdateFadeProgressSingle(int printIndex, int vertIndex)
+        async Task UpdateFadeProgressSingle(int printIndex, int vertIndex, CancellationToken cancellationToken)
         {
             float _currentCharFadeTime = 0;
+
             while (true)
             {
                 if (!_started)
@@ -251,7 +264,7 @@ namespace GFGGame
                     byte alpha = (byte)(progress * 255);
                     PrintFade(printIndex, alpha, vertIndex);
                 }
-                await Task.Delay(16);
+                await Task.Delay(16, cancellationToken);
             }
         }
 
@@ -269,6 +282,16 @@ namespace GFGGame
             charFadeDuration = showNextWordInternal + 0.05f;
         }
 
+        // 取消异步函数
+        public void StopMyAsyncFunction()
+        {
+            if (_cancellationTokenSource != null)
+            {
+                _cancellationTokenSource.Cancel();
+                _cancellationTokenSource.Dispose();
+                _cancellationTokenSource = null;
+            }
+        }
     }
 
 }

二进制
GameClient/Assets/ResIn/UI/FieldGuide/FieldGuide_fui.bytes