Browse Source

修复背景问题会报错

WGL 1 tháng trước cách đây
mục cha
commit
6ff59fe0f6

+ 1 - 0
ActionTowerDefense/Assets/Resources/Prefab/RougueUI/TreasureDetails.prefab

@@ -983,6 +983,7 @@ MonoBehaviour:
   TreasureBackgrounds:
   - {fileID: 21300000, guid: 8f3b16bc9aa84a840a8241b05e628e4e, type: 3}
   - {fileID: 21300000, guid: 9e6f22d4e598bb84db092780d40f392c, type: 3}
+  background: {fileID: 3265704620539566501}
   islock: 0
   isNull: 0
   owner: {fileID: 0}

+ 1 - 34
ActionTowerDefense/Assets/Resources/Prefab/RougueUI/TreasureDetails_inBag.prefab

@@ -11,7 +11,6 @@ GameObject:
   - component: {fileID: 7651723693019617734}
   - component: {fileID: 4143843158174667828}
   - component: {fileID: 7797600145746121108}
-  - component: {fileID: 7459853836633788355}
   m_Layer: 5
   m_Name: Background
   m_TagString: Untagged
@@ -81,39 +80,6 @@ MonoBehaviour:
   m_FillOrigin: 0
   m_UseSpriteMesh: 0
   m_PixelsPerUnitMultiplier: 1
---- !u!114 &7459853836633788355
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 94965461660060619}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 51aa7dae8793be1449d257b1963603af, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
-  shopUI: {fileID: 0}
-  unlock: {fileID: 0}
-  iconBackground: {fileID: 7521208752501601909}
-  icon: {fileID: 2355606707355201125}
-  tags:
-  - {fileID: 6523006866775466620}
-  - {fileID: 8335028947233067992}
-  - {fileID: 1280505464873624511}
-  - {fileID: 6984009017944538448}
-  - {fileID: 8013639610058713296}
-  - {fileID: 1966067753254030813}
-  - {fileID: 7079870652623182134}
-  - {fileID: 4964443517577500918}
-  nameText: {fileID: 3607824093767581651}
-  attribute: {fileID: 6166639240687408386}
-  buy: {fileID: 0}
-  price: {fileID: 0}
-  TreasureBackgrounds: []
-  islock: 0
-  isNull: 0
-  owner: {fileID: 0}
 --- !u!1 &788412244512764877
 GameObject:
   m_ObjectHideFlags: 0
@@ -1094,6 +1060,7 @@ MonoBehaviour:
   TreasureBackgrounds:
   - {fileID: 21300000, guid: 8f3b16bc9aa84a840a8241b05e628e4e, type: 3}
   - {fileID: 21300000, guid: 9e6f22d4e598bb84db092780d40f392c, type: 3}
+  background: {fileID: 7797600145746121108}
   islock: 0
   isNull: 0
   owner: {fileID: 0}

+ 3 - 2
ActionTowerDefense/Assets/Scripts/UI/TreasuresSaleUI.cs

@@ -46,6 +46,7 @@ public class TreasuresSaleUI : MonoBehaviour
     [FoldoutGroup("×é¼þ")] public ButtonUI buy;
     [FoldoutGroup("×é¼þ")] public TextMeshProUGUI price;
     [FoldoutGroup("×é¼þ")] public List<Sprite> TreasureBackgrounds;
+    [FoldoutGroup("×é¼þ")] public Image background;
 
     public bool islock;
     public bool isNull;
@@ -97,11 +98,11 @@ public class TreasuresSaleUI : MonoBehaviour
         }
         if (treasure.tags.Count == 0)
         {
-            transform.GetComponent<Image>().sprite = TreasureBackgrounds[1];
+            background.sprite = TreasureBackgrounds[1];
         }
         else
         {
-            transform.GetComponent<Image>().sprite = TreasureBackgrounds[0];
+            background.sprite = TreasureBackgrounds[0];
         }
         nameText.text = treasure.name;
         nameText.color = treasure.qualityText;