Browse Source

修改bug

lzx 2 days ago
parent
commit
056af2ba15

+ 84 - 20
Assets/Scripts/Core/UI/UTool/MyImage.cs

@@ -1,10 +1,13 @@
 using System;
 using System;
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
 using System.Text;
+using Fort23.Core;
 using Fort23.Mono;
 using Fort23.Mono;
 using Fort23.UTool;
 using Fort23.UTool;
 #if UNITY_EDITOR
 #if UNITY_EDITOR
+using System.IO;
 using UnityEditor;
 using UnityEditor;
 #endif
 #endif
 using UnityEngine.Experimental.Rendering;
 using UnityEngine.Experimental.Rendering;
@@ -251,6 +254,71 @@ namespace UnityEngine.UI
         {
         {
             SetPack();
             SetPack();
         }
         }
+#if UNITY_EDITOR
+
+        [ContextMenu("重新设置图片")]
+        public void SetPackEditor()
+        {
+            if (packInfo != null && CurrSpriteAtlas != null)
+            {
+                string assetName = icon_name;
+                if (string.IsNullOrEmpty(icon_name) && sprite != null)
+                {
+                    assetName = sprite.name;
+                }
+
+                var loadSprite = CurrSpriteAtlas.GetSprite(assetName);
+                bool isoK = loadSprite != null;
+                if (isoK)
+                {
+                    SetSprite(loadSprite);
+                }
+            }
+        }
+        [ContextMenu("自动匹配图集")]
+        public void CompareSpritesInAtlas()
+        {
+            if(sprite == null || CurrSpriteAtlas!= null || icon_name != "")
+                return;
+            string targetPath = AssetDatabase.GetAssetPath(sprite);
+            if (string.IsNullOrEmpty(targetPath))
+            {
+                Debug.LogError("无法获取目标 Sprite 的源文件路径");
+                return;
+            }
+
+            string targetMD5 = MD5Helper.FileMD5("D:/FB/XiuXianGame/" + targetPath);
+
+
+            foreach (var allPackgInfo in UGUICacheInfo.uguiPackDB.allPackgInfos)
+            {
+                string path = Application.dataPath + allPackgInfo.PackageJsonPath;
+
+
+                string jsonPath = File.ReadAllText(path);
+                TextrueJson textrueJson = JsonUtility.FromJson<TextrueJson>(jsonPath);
+
+                for (int i = 0; i < textrueJson.newTextureJson.Count; i++)
+                {
+                    string texturePath = "/Art/UIAssets" + textrueJson.newTextureJson[i].filePath;
+
+                    string spriteMD5 = MD5Helper.FileMD5(Application.dataPath + texturePath);
+
+                    if (spriteMD5 == targetMD5)
+                    {
+                        LogTool.Log($"找到匹配的 Sprite: {textrueJson.newTextureJson[i].textrueName},所在图集: {allPackgInfo.packName},源文件: {targetPath}");
+                        packInfo = allPackgInfo;
+                        CurrSpriteAtlas = UGUICacheInfo.GetSpriteAtlas(allPackgInfo.packName);
+                        icon_name = textrueJson.newTextureJson[i].textrueName;
+                        ReashUI();
+                        return;
+                    }
+                }
+            }
+
+            LogTool.Log("未找到任何匹配的 Sprite");
+        }
+#endif
 
 
         private void SetPack()
         private void SetPack()
         {
         {
@@ -306,12 +374,12 @@ namespace UnityEngine.UI
             Vertical,
             Vertical,
             Horizontal
             Horizontal
         }
         }
-        
+
         [SerializeField] private bool useGradient = false;
         [SerializeField] private bool useGradient = false;
         [SerializeField] private Color topOrLeftColor = Color.white;
         [SerializeField] private Color topOrLeftColor = Color.white;
         [SerializeField] private Color bottomOrRightColor = Color.black;
         [SerializeField] private Color bottomOrRightColor = Color.black;
         [SerializeField] private GradientDirection direction = GradientDirection.Vertical;
         [SerializeField] private GradientDirection direction = GradientDirection.Vertical;
-        
+
         public bool UseGradient
         public bool UseGradient
         {
         {
             get => useGradient;
             get => useGradient;
@@ -321,7 +389,7 @@ namespace UnityEngine.UI
                 SetVerticesDirty();
                 SetVerticesDirty();
             }
             }
         }
         }
-        
+
         public Color TopOrLeftColor
         public Color TopOrLeftColor
         {
         {
             get => topOrLeftColor;
             get => topOrLeftColor;
@@ -331,7 +399,7 @@ namespace UnityEngine.UI
                 SetVerticesDirty();
                 SetVerticesDirty();
             }
             }
         }
         }
-        
+
         public Color BottomOrRightColor
         public Color BottomOrRightColor
         {
         {
             get => bottomOrRightColor;
             get => bottomOrRightColor;
@@ -341,7 +409,7 @@ namespace UnityEngine.UI
                 SetVerticesDirty();
                 SetVerticesDirty();
             }
             }
         }
         }
-        
+
         public GradientDirection Direction
         public GradientDirection Direction
         {
         {
             get => direction;
             get => direction;
@@ -351,36 +419,36 @@ namespace UnityEngine.UI
                 SetVerticesDirty();
                 SetVerticesDirty();
             }
             }
         }
         }
-        
+
         protected override void OnPopulateMesh(VertexHelper vh)
         protected override void OnPopulateMesh(VertexHelper vh)
         {
         {
             base.OnPopulateMesh(vh);
             base.OnPopulateMesh(vh);
-        
+
             if (!useGradient || vh.currentVertCount == 0)
             if (!useGradient || vh.currentVertCount == 0)
                 return;
                 return;
-        
+
             List<UIVertex> verts = new List<UIVertex>();
             List<UIVertex> verts = new List<UIVertex>();
             vh.GetUIVertexStream(verts);
             vh.GetUIVertexStream(verts);
-        
+
             for (int i = 0; i < verts.Count; i += 6)
             for (int i = 0; i < verts.Count; i += 6)
             {
             {
                 ApplyGradientToQuad(verts, i);
                 ApplyGradientToQuad(verts, i);
             }
             }
-        
+
             vh.Clear();
             vh.Clear();
             vh.AddUIVertexTriangleStream(verts);
             vh.AddUIVertexTriangleStream(verts);
         }
         }
-        
+
         private void ApplyGradientToQuad(List<UIVertex> verts, int startIndex)
         private void ApplyGradientToQuad(List<UIVertex> verts, int startIndex)
         {
         {
             if (startIndex + 5 >= verts.Count)
             if (startIndex + 5 >= verts.Count)
                 return;
                 return;
-        
+
             float top = verts[startIndex].position.y;
             float top = verts[startIndex].position.y;
             float bottom = verts[startIndex].position.y;
             float bottom = verts[startIndex].position.y;
             float left = verts[startIndex].position.x;
             float left = verts[startIndex].position.x;
             float right = verts[startIndex].position.x;
             float right = verts[startIndex].position.x;
-        
+
             for (int i = 1; i < 6; i++)
             for (int i = 1; i < 6; i++)
             {
             {
                 var pos = verts[startIndex + i].position;
                 var pos = verts[startIndex + i].position;
@@ -389,16 +457,16 @@ namespace UnityEngine.UI
                 left = Mathf.Min(left, pos.x);
                 left = Mathf.Min(left, pos.x);
                 right = Mathf.Max(right, pos.x);
                 right = Mathf.Max(right, pos.x);
             }
             }
-        
+
             for (int i = 0; i < 6; i++)
             for (int i = 0; i < 6; i++)
             {
             {
                 var vert = verts[startIndex + i];
                 var vert = verts[startIndex + i];
                 var pos = vert.position;
                 var pos = vert.position;
-        
+
                 float t = direction == GradientDirection.Vertical
                 float t = direction == GradientDirection.Vertical
                     ? Mathf.InverseLerp(bottom, top, pos.y)
                     ? Mathf.InverseLerp(bottom, top, pos.y)
                     : Mathf.InverseLerp(left, right, pos.x);
                     : Mathf.InverseLerp(left, right, pos.x);
-        
+
                 Color gradientColor = Color.Lerp(bottomOrRightColor, topOrLeftColor, t);
                 Color gradientColor = Color.Lerp(bottomOrRightColor, topOrLeftColor, t);
                 gradientColor.r *= color.r;
                 gradientColor.r *= color.r;
                 gradientColor.g *= color.g;
                 gradientColor.g *= color.g;
@@ -408,9 +476,5 @@ namespace UnityEngine.UI
                 verts[startIndex + i] = vert;
                 verts[startIndex + i] = vert;
             }
             }
         }
         }
-        
-        
-        
-        
     }
     }
 }
 }

+ 4 - 4
Assets/Scripts/GameUI/UI/GongFaUpgradePanel/GongFaUpgradePanel.cs

@@ -83,7 +83,7 @@ namespace Fort23.Mono
                 if (PlayerManager.Instance.myHero.level.Value < _skillInfo.SkillPowerupConfig.PlayerLevelLimit)
                 if (PlayerManager.Instance.myHero.level.Value < _skillInfo.SkillPowerupConfig.PlayerLevelLimit)
                 {
                 {
                     HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(_skillInfo.SkillPowerupConfig.PlayerLevelLimit);
                     HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(_skillInfo.SkillPowerupConfig.PlayerLevelLimit);
-                    TipMessagePanel.OpenTipMessagePanel($"需境界达到{LanguageManager.Instance.Text(heroPowerUpConfig.jingjie1) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjie2) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjie3)}");
+                    TipMessagePanel.OpenTipMessagePanel($"需境界达到{LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[0]) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[1]) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[2])}");
                     return;
                     return;
                 }
                 }
 
 
@@ -277,7 +277,7 @@ namespace Fort23.Mono
                     if (PlayerManager.Instance.myHero.level.Value < _skillInfo.SkillPowerupConfig.PlayerLevelLimit)
                     if (PlayerManager.Instance.myHero.level.Value < _skillInfo.SkillPowerupConfig.PlayerLevelLimit)
                     {
                     {
                         HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(_skillInfo.SkillPowerupConfig.PlayerLevelLimit);
                         HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(_skillInfo.SkillPowerupConfig.PlayerLevelLimit);
-                        Text_UpGrade.text = $"需境界达到{LanguageManager.Instance.Text(heroPowerUpConfig.jingjie1) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjie2) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjie3)}";
+                        Text_UpGrade.text = $"需境界达到{LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[0]) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[1]) + LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[2])}";
                         Btn_UpGrade.gameObject.transform.Gray(true);
                         Btn_UpGrade.gameObject.transform.Gray(true);
                         UpGradeItemRoot.SetActive(false);
                         UpGradeItemRoot.SetActive(false);
                     }
                     }
@@ -302,7 +302,7 @@ namespace Fort23.Mono
                 else
                 else
                 {
                 {
                     Text_UpGrade.text = "已满级";
                     Text_UpGrade.text = "已满级";
-                    Btn_UpStar.gameObject.SetActive(true);
+                    Btn_UpStar.gameObject.SetActive(false);
                     UpGradeItemRoot.SetActive(false);
                     UpGradeItemRoot.SetActive(false);
                 }
                 }
             }
             }
@@ -329,7 +329,7 @@ namespace Fort23.Mono
                 else
                 else
                 {
                 {
                     Text_UpStar.text = "已满星";
                     Text_UpStar.text = "已满星";
-                    Btn_UpGrade.gameObject.SetActive(true);
+                    Btn_UpGrade.gameObject.SetActive(false);
                     UpStarItemRoot.SetActive(false);
                     UpStarItemRoot.SetActive(false);
                 }
                 }
             }
             }