浏览代码

商城物品数量颜色,买的起显示黑字,买不起的显示红字

zhaoyang 3 年之前
父节点
当前提交
a5ce2cf466

+ 3 - 3
FGUIProject/assets/ClothingShop/components/ShopListItemRender.xml

@@ -6,9 +6,9 @@
     <text id="n26_hinb" name="txtName" xy="18,266" size="200,37" fontSize="26" color="#aa8e71" align="center" autoSize="none" text="名字"/>
     <loader id="n27_hinb" name="icon" xy="38,32" size="160,160" aspect="true" url="ui://e5hnfx8ahinb1a" fill="scale"/>
     <image id="n28_hinb" name="imgOwned" src="hinb1b" fileName="images/fzd_yyy.png" xy="44,166"/>
-    <loader id="n31_ugdz" name="iconPrice" xy="43,228" size="32,32" group="n33_ugdz" aspect="true" url="ui://eg2y0ldpq08x3" fill="scale"/>
-    <text id="n32_ugdz" name="txtPrice" xy="86,226" size="115,36" group="n33_ugdz" fontSize="26" color="#f2989b" autoClearText="true" text="9999999"/>
-    <group id="n33_ugdz" name="n33" xy="43,226" size="150,37" advanced="true">
+    <loader id="n31_ugdz" name="iconPrice" xy="36,228" size="32,32" group="n33_ugdz" aspect="true" url="ui://eg2y0ldpq08x3" fill="scale"/>
+    <text id="n32_ugdz" name="txtPrice" xy="79,226" size="121,36" group="n33_ugdz" fontSize="26" color="#f2989b" ubb="true" bold="true" autoClearText="true" text="9999999"/>
+    <group id="n33_ugdz" name="n33" xy="36,226" size="164,36" advanced="true">
       <relation target="" sidePair="center-center"/>
     </group>
   </displayList>

+ 5 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingShop/ClothingShopView.cs

@@ -87,6 +87,8 @@ namespace GFGGame
             _ui.m_compItemInfo.m_listTag.itemRenderer = RenderListTagItem;
 
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateItemChange);
+            EventAgent.AddEventListener(ConstMessage.MONEY_CHANGE, UpdateItemChange);
+            // EventAgent.DispatchEvent(ConstMessage.MONEY_CHANGE, RoleDataManager.gold);
 
         }
 
@@ -202,6 +204,8 @@ namespace GFGGame
             GuideController.TryGuideClothingShopViewBtnBack(_ui.m_btnBack);
 
             UpdateCJGoodsCount();
+            UpdateList(false);
+
         }
         private void UpdateCJGoodsCount()
         {
@@ -307,8 +311,8 @@ namespace GFGGame
             RarityIconController.UpdateRarityIcon(listItem.m_rarity, cfg.itemID, false);
             ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(cfg.costID);
             listItem.m_iconPrice.url = "ui://CommonGame/" + costItemCfg.res;
-            listItem.m_txtPrice.text = "" + cfg.costNum;
             listItem.m_imgOwned.visible = ItemDataManager.GetItemNum(cfg.itemID) > 0;
+            listItem.m_txtPrice.text = ItemDataManager.GetItemNum(cfg.costID) >= cfg.costNum ? StringUtil.GetColorText(cfg.costNum.ToString(), "#DD994A") : StringUtil.GetColorText(cfg.costNum.ToString(), "#F2989B");
         }
 
         private void UpdateSelectedItemInfo(GComponent listItem, bool tween)

二进制
GameClient/Assets/ResIn/UI/ClothingShop/ClothingShop_fui.bytes