浏览代码

物品图标

zhaoyang 2 年之前
父节点
当前提交
aba1d2ba18

+ 5 - 15
FGUIProject/assets/CommonGame/components/ComItem.xml

@@ -1,19 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="221,222" overflow="hidden">
+<component size="221,222" overflow="hidden" opaque="false">
   <displayList>
-    <image id="n25_pu55" name="n25" src="orsttit" fileName="images/wpbb_di.png" xy="0,0" group="n21_qr4e"/>
-    <loader id="n12_ehs9" name="loaIcon" xy="110,111" pivot="0.5,0.5" anchor="true" size="140,140" group="n21_qr4e" aspect="true" url="ui://xz8kxrecng0i27" fill="scaleFree"/>
-    <text id="n14_ehs9" name="txtName" xy="111,194" pivot="0.5,0" anchor="true" size="228,44" group="n21_qr4e" visible="false" fontSize="32" color="#9b7f61" text="赵钱孙李·巴拉"/>
-    <text id="n17_j48o" name="txtHasCount" xy="112,243" pivot="0.5,0" anchor="true" size="105,36" group="n21_qr4e" visible="false" fontSize="26" color="#a28d77" vars="true" text="已拥有:{count=0}"/>
-    <loader id="n18_j48o" name="loaRarity" xy="164,0" size="44,94" group="n21_qr4e" url="ui://eg2y0ldpd4iw52" autoSize="true"/>
-    <text id="n15_ehs9" name="txtCount" xy="204,178" pivot="1,0" anchor="true" size="50,36" group="n21_qr4e" fontSize="26" color="#fbf6eb" vars="true" strokeColor="#8c7358" strokeSize="2" text="x{count=20}"/>
-    <image id="n23_slyz" name="imgHas" src="slyzthy" fileName="images/yx_yihd.png" xy="21,91" group="n29_pu55"/>
-    <image id="n22_cs8j" name="imgNotHas" src="cs8jthx" fileName="images/yx_whd.png" xy="21,91" group="n29_pu55"/>
-    <image id="n28_pu55" name="imgShowTong" src="tc539z" fileName="images/zx_jqgka_stjl.png" xy="30,91" group="n29_pu55"/>
-    <group id="n29_pu55" name="n29" xy="21,91" size="178,40" group="n21_qr4e" advanced="true"/>
-    <group id="n21_qr4e" name="n21" xy="-3,0" size="228,279"/>
-    <image id="n24_pu55" name="n24" src="pu55tiw" fileName="images/pfjl_and.png" xy="0,1" group="n27_pu55"/>
-    <image id="n26_pu55" name="n26" src="orsttis" fileName="images/pfjl_ywc.png" xy="68,86" group="n27_pu55"/>
-    <group id="n27_pu55" name="grpGot" xy="0,1" size="221,220" visible="false" advanced="true"/>
+    <component id="n25_pu55" name="comItemIcon" src="ng0itiz" fileName="components/ComItemIcon.xml" xy="0,0" pivot="0.5,0.5" size="222,222" aspect="true"/>
+    <text id="n15_ehs9" name="txtCount" xy="205,178" pivot="1,0" anchor="true" size="50,36" fontSize="26" color="#fbf6eb" vars="true" strokeColor="#8c7358" strokeSize="2" text="x{count=20}">
+      <relation target="n25_pu55" sidePair="right-right,top-top"/>
+    </text>
   </displayList>
 </component>

+ 19 - 0
FGUIProject/assets/CommonGame/components/ComItemIcon.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="222,222">
+  <displayList>
+    <image id="n25_pu55" name="n25" src="orsttit" fileName="images/wpbb_di.png" xy="0,0" size="222,222">
+      <relation target="" sidePair="width-width,height-height"/>
+    </image>
+    <loader id="n12_ehs9" name="loaIcon" xy="110,111" pivot="0.5,0.5" anchor="true" size="140,140" aspect="true" url="ui://xz8kxrecng0i27" fill="scaleFree"/>
+    <text id="n14_ehs9" name="txtName" xy="111,194" pivot="0.5,0" anchor="true" size="228,44" visible="false" fontSize="32" color="#9b7f61" text="赵钱孙李·巴拉"/>
+    <text id="n17_j48o" name="txtHasCount" xy="112,243" pivot="0.5,0" anchor="true" size="105,36" visible="false" fontSize="26" color="#a28d77" vars="true" text="已拥有:{count=0}"/>
+    <loader id="n18_j48o" name="loaRarity" xy="164,0" size="44,94" url="ui://eg2y0ldpd4iw52" autoSize="true"/>
+    <image id="n23_slyz" name="imgHas" src="slyzthy" fileName="images/yx_yihd.png" xy="21,91" size="178,40" group="n29_pu55"/>
+    <image id="n22_cs8j" name="imgNotHas" src="cs8jthx" fileName="images/yx_whd.png" xy="21,91" size="178,40" group="n29_pu55"/>
+    <image id="n28_pu55" name="imgShowTong" src="tc539z" fileName="images/zx_jqgka_stjl.png" xy="30,91" size="160,40" group="n29_pu55"/>
+    <group id="n29_pu55" name="n29" xy="21,91" size="178,40" advanced="true"/>
+    <image id="n24_pu55" name="n24" src="pu55tiw" fileName="images/pfjl_and.png" xy="0,1" size="221,220" group="n27_pu55"/>
+    <image id="n26_pu55" name="n26" src="orsttis" fileName="images/pfjl_ywc.png" xy="68,86" size="85,49" group="n27_pu55"/>
+    <group id="n27_pu55" name="grpGot" xy="0,1" size="221,220" visible="false" advanced="true"/>
+  </displayList>
+</component>

+ 1 - 0
FGUIProject/assets/CommonGame/package.xml

@@ -225,6 +225,7 @@
     <image id="orsttis" name="pfjl_ywc.png" path="/images/"/>
     <image id="orsttit" name="wpbb_di.png" path="/images/"/>
     <image id="pu55tiw" name="pfjl_and.png" path="/images/"/>
+    <component id="ng0itiz" name="ComItemIcon.xml" path="/components/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\CommonGame" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 4 - 24
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_ComItem.cs

@@ -7,15 +7,8 @@ namespace UI.CommonGame
     public partial class UI_ComItem
     {
         public GComponent target;
-        public GLoader m_loaIcon;
-        public GTextField m_txtName;
-        public GTextField m_txtHasCount;
-        public GLoader m_loaRarity;
+        public UI_ComItemIcon m_comItemIcon;
         public GTextField m_txtCount;
-        public GImage m_imgHas;
-        public GImage m_imgNotHas;
-        public GImage m_imgShowTong;
-        public GGroup m_grpGot;
         public const string URL = "ui://eg2y0ldpj48o98";
         public const string PACKAGE_NAME = "CommonGame";
         public const string RES_NAME = "ComItem";
@@ -63,27 +56,14 @@ namespace UI.CommonGame
 
         private void Init(GComponent comp)
         {
-            m_loaIcon = (GLoader)comp.GetChild("loaIcon");
-            m_txtName = (GTextField)comp.GetChild("txtName");
-            m_txtHasCount = (GTextField)comp.GetChild("txtHasCount");
-            m_loaRarity = (GLoader)comp.GetChild("loaRarity");
+            m_comItemIcon = (UI_ComItemIcon)UI_ComItemIcon.Create(comp.GetChild("comItemIcon"));
             m_txtCount = (GTextField)comp.GetChild("txtCount");
-            m_imgHas = (GImage)comp.GetChild("imgHas");
-            m_imgNotHas = (GImage)comp.GetChild("imgNotHas");
-            m_imgShowTong = (GImage)comp.GetChild("imgShowTong");
-            m_grpGot = (GGroup)comp.GetChild("grpGot");
         }
         public void Dispose(bool disposeTarget = false)
         {
-            m_loaIcon = null;
-            m_txtName = null;
-            m_txtHasCount = null;
-            m_loaRarity = null;
+            m_comItemIcon.Dispose();
+            m_comItemIcon = null;
             m_txtCount = null;
-            m_imgHas = null;
-            m_imgNotHas = null;
-            m_imgShowTong = null;
-            m_grpGot = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 92 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_ComItemIcon.cs

@@ -0,0 +1,92 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.CommonGame
+{
+    public partial class UI_ComItemIcon
+    {
+        public GComponent target;
+        public GLoader m_loaIcon;
+        public GTextField m_txtName;
+        public GTextField m_txtHasCount;
+        public GLoader m_loaRarity;
+        public GImage m_imgHas;
+        public GImage m_imgNotHas;
+        public GImage m_imgShowTong;
+        public GGroup m_grpGot;
+        public const string URL = "ui://eg2y0ldpng0itiz";
+        public const string PACKAGE_NAME = "CommonGame";
+        public const string RES_NAME = "ComItemIcon";
+        private static UI_ComItemIcon _proxy;
+
+        public static UI_ComItemIcon Create(GObject gObject = null)
+        {
+            var ui = new UI_ComItemIcon();
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_ComItemIcon Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_ComItemIcon();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)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_loaIcon = (GLoader)comp.GetChild("loaIcon");
+            m_txtName = (GTextField)comp.GetChild("txtName");
+            m_txtHasCount = (GTextField)comp.GetChild("txtHasCount");
+            m_loaRarity = (GLoader)comp.GetChild("loaRarity");
+            m_imgHas = (GImage)comp.GetChild("imgHas");
+            m_imgNotHas = (GImage)comp.GetChild("imgNotHas");
+            m_imgShowTong = (GImage)comp.GetChild("imgShowTong");
+            m_grpGot = (GGroup)comp.GetChild("grpGot");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_loaIcon = null;
+            m_txtName = null;
+            m_txtHasCount = null;
+            m_loaRarity = null;
+            m_imgHas = null;
+            m_imgNotHas = null;
+            m_imgShowTong = null;
+            m_grpGot = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

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

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

+ 26 - 12
GameClient/Assets/Game/HotUpdate/Views/CommonGame/ItemView.cs

@@ -4,6 +4,7 @@ namespace GFGGame
     public class ItemView
     {
         private GComponent _obj;
+        private GComponent _item;
         private GLoader _loaIcon;
         private GLoader _loaRarity;
         private GTextField _txtName;
@@ -23,25 +24,26 @@ namespace GFGGame
         public ItemView(GComponent obj)
         {
             _obj = obj;
-            _loaIcon = obj.GetChild("loaIcon") as GLoader;
-            _loaRarity = obj.GetChild("loaRarity") as GLoader;
-            _txtName = obj.GetChild("txtName") as GTextField;
+            _item = obj.GetChild("comItemIcon").asCom;
+            _loaIcon = _item.GetChild("loaIcon") as GLoader;
+            _loaRarity = _item.GetChild("loaRarity") as GLoader;
+            _txtName = _item.GetChild("txtName") as GTextField;
             _txtCount = obj.GetChild("txtCount") as GTextField;
-            _txtHasCount = obj.GetChild("txtHasCount") as GTextField;
+            _txtHasCount = _item.GetChild("txtHasCount") as GTextField;
             // _imgGot = obj.GetChild("imgGot") as GImage;
-            _grpGot = obj.GetChild("grpGot") as GGroup;
-            _imgNotHas = obj.GetChild("imgNotHas") as GImage;
-            _imgHas = obj.GetChild("imgHas") as GImage;
-            _imgShouTong = obj.GetChild("imgShowTong") as GImage;
+            _grpGot = _item.GetChild("grpGot") as GGroup;
+            _imgNotHas = _item.GetChild("imgNotHas") as GImage;
+            _imgHas = _item.GetChild("imgHas") as GImage;
+            _imgShouTong = _item.GetChild("imgShowTong") as GImage;
             // _grpCount = obj.GetChild("grpCount") as GGroup;
             // AddClickListener();
-            _obj.onClick.Remove(AddClickListener);
-            _obj.onClick.Add(AddClickListener);
+            _item.onClick.Remove(AddClickListener);
+            _item.onClick.Add(AddClickListener);
         }
         public void Dispose()
         {
-            _obj.onClick.Remove(AddClickListener);
-            _obj.Dispose();
+            _item.onClick.Remove(AddClickListener);
+            _item.Dispose();
         }
         private void AddClickListener()
         {
@@ -206,5 +208,17 @@ namespace GFGGame
                 _showTips = value;
             }
         }
+
+        public float SetComItemScale
+        {
+            set
+            {
+                _item.SetScale(value, value);
+            }
+        }
+        public void SetTxtCountPos(int x, int y)
+        {
+            _txtCount.SetPosition(x, y, 0);
+        }
     }
 }

二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_fui.bytes