zouweichen 4 일 전
부모
커밋
6b02c4b261

BIN
Assets/Res/Addressable/FGUI/Partner/Partner_fui.bytes


+ 14 - 4
Assets/Scripts/Business/Runtime/Data/Items/ItemService.cs

@@ -37,7 +37,7 @@ namespace FL.Data
         /// <returns></returns>
         public IItemBase GetItemBase(int id, int count, int kind)
         {
-            if (kind == 1) 
+            if (kind == 1)
             {
                 var equipItem = new EquipItemBase();
                 equipItem.InitById(id);
@@ -45,9 +45,19 @@ namespace FL.Data
             }
             else
             {
-                var item = new ItemBase();
-                item.Init(id, count);
-                return item;
+                var table = ItemTableRepo.Get(id);
+                if (table.Type == (int)EItemType.Partner)
+                {
+                    var item = new PartnerItemBase();
+                    item.Init(id);
+                    return item;
+                }
+                else
+                {
+                    var item = new ItemBase();
+                    item.Init(id, count);
+                    return item;
+                }
             }
         }
     }

+ 7 - 1
Assets/Scripts/Business/Runtime/FGUI/Common/ItemBase/CommonItemBaseCtrl.cs

@@ -92,7 +92,13 @@ namespace FL.FGUI
             }
             else if (item is EquipItemBase equipItemBase)
             {
-                VM.LvLabel.text = $"Lv.{equipItemBase.Level}";
+                VM.LvLabel.text = $"LV.{equipItemBase.Level}";
+                VM.CountLabel.visible = false;
+                VM.LvLabel.visible = true;
+            }
+            else if (item is PartnerItemBase partnerItemBase)
+            {
+                VM.LvLabel.text = $"LV.{partnerItemBase.Level}";
                 VM.CountLabel.visible = false;
                 VM.LvLabel.visible = true;
             }

+ 25 - 0
Assets/Scripts/Business/Runtime/FGUI/Common/ItemBase/PartnerItemBase.cs

@@ -0,0 +1,25 @@
+using XGame.Database;
+
+namespace FL.Data.Items
+{
+    public class PartnerItemBase : IItemBase
+    {
+        private PartnerTable _table;
+        private ItemTable _itemTable;
+        private PartnerAttributes _attributes;
+
+        public int TableId => _table.Id;
+
+        public EQualityLevel Quality => _itemTable.Quality;
+
+        public string Icon => _itemTable.Icon;
+        public int Level => _attributes.Level;
+
+        public void Init(int id)
+        {
+            _table = PartnerTableRepo.Get(id);
+            _itemTable = ItemTableRepo.Get(id);
+            _attributes = PartnersData.Instance.GetPartnerAttrByTableId(id);
+        }
+    }
+}

+ 11 - 0
Assets/Scripts/Business/Runtime/FGUI/Common/ItemBase/PartnerItemBase.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: DXNOsX/+WigYe1nsdY/X+efRw1/bUXoaP5tP5UbPZ/I1lXRxhbiwuyI=
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 0
Assets/Scripts/Business/Runtime/FGUI/Partner/CostLabel/PartnerCostLabelCtrl.cs

@@ -1,3 +1,4 @@
+
 /// #pkgName FGUI包名
 /// #panelName UIPanel名字
 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字

+ 2 - 0
Assets/Scripts/Business/Runtime/FGUI/Partner/CostLabel/PartnerCostLabelVM.Gen.cs

@@ -18,11 +18,13 @@ namespace FL.FGUI
     /// </summary>
     public partial class PartnerCostLabelVM : FguiViewModel
     {
+        public Controller IsEnough { get; private set; }
         public GLoader IconLoader { get; private set; }
         public GTextField CountLabel { get; private set; }
 
         protected override void BindComponents(GComponent panel, IUIViewAdapter adapter)
         {
+            IsEnough = panel.GetController("IsEnough");
             IconLoader = panel.GetChild("IconLoader") as GLoader;
             CountLabel = panel.GetChild("CountLabel") as GTextField;
 

+ 25 - 0
Assets/Scripts/Business/Runtime/FGUI/Partner/SbBagPanel/PartnerSbBagPanelCtrl.cs

@@ -133,6 +133,31 @@ namespace FL.FGUI
             {
                 dataList.Add(item.Id);
             }
+            dataList.Sort((a, b) =>
+            {
+                PartnersData.Instance.TryGetPartnerAttrByTableId(a, out var aAttr);
+                PartnersData.Instance.TryGetPartnerAttrByTableId(b, out var bAttr);
+                if (aAttr != null && bAttr != null)
+                {
+                    if (aAttr.Status != bAttr.Status)
+                    {
+                        return bAttr.Status - aAttr.Status;
+                    }
+                    else if (bAttr.Level != aAttr.Level)
+                    {
+                        return bAttr.Level - aAttr.Level;
+                    }
+                }
+                else if (aAttr == null && bAttr != null)
+                {
+                    return 1;
+                }
+                else if (aAttr != null && bAttr == null)
+                {
+                    return -1;
+                }
+                return b - a;
+            });
             VM.List.BindDatas(dataList);
         }
     }

+ 2 - 2
Assets/Scripts/Business/Runtime/FGUI/Partner/SbBagPanel/PartnerSbBagPanelVM.Gen.cs

@@ -22,11 +22,11 @@ namespace FL.FGUI
         public Controller OpenSelect { get; private set; }
         public GList List { get; private set; }
         public GButton OnStrongBtn { get; private set; }
+        public GButton SortBtn { get; private set; }
         public GButton ShangZhenBtn { get; private set; }
         public GButton PinZhiBtn { get; private set; }
         public GButton DengJiBtn { get; private set; }
         public GButton IDBtn { get; private set; }
-        public GButton SortBtn { get; private set; }
 
         protected override void BindComponents(GComponent panel, IUIViewAdapter adapter)
         {
@@ -35,11 +35,11 @@ namespace FL.FGUI
             List = panel.GetChild("List") as GList;
             List.Init(typeof(PartnerSbBagListItemView), adapter.CreateListItem);
             OnStrongBtn = panel.GetChild("OnStrongBtn") as GButton;
+            SortBtn = panel.GetChild("SortBtn") as GButton;
             ShangZhenBtn = panel.GetChild("ShangZhenBtn") as GButton;
             PinZhiBtn = panel.GetChild("PinZhiBtn") as GButton;
             DengJiBtn = panel.GetChild("DengJiBtn") as GButton;
             IDBtn = panel.GetChild("IDBtn") as GButton;
-            SortBtn = panel.GetChild("SortBtn") as GButton;
 
         }
     }

+ 6 - 8
Assets/Scripts/Business/Runtime/FGUI/Partner/SbDetailNested/PartnerSbDetailNestedCtrl.cs

@@ -44,13 +44,12 @@ namespace FL.FGUI
             _sbId = id;
             if (_sbId == 0)
             {
+                VM.ItemBase.Disable();
                 VM.IsEmpty.selectedIndex = 1;
                 return;
             }
-            else
-            {
-                VM.IsEmpty.selectedIndex = 0;
-            }
+            VM.ItemBase.Enable(null);
+            VM.IsEmpty.selectedIndex = 0;
             var table = PartnerTableRepo.Get(_sbId);
             XGame.Framework.Assert.IsNotNull(table, $"圣兵表不存在,id:{_sbId}");
             VM.NameLabel.text = table.Name;
@@ -75,9 +74,9 @@ namespace FL.FGUI
             VM.TypeLoader.url = AddressableDefine.SbTypeIcon(table.Type);
             //
             VM.AttrLabel.text = $"+{table.Own_attr[1] / 100f}%";
-            var item = new ItemBase();
-            //item.Init(table, table.Id);
-            //VM.ItemBase.Ctrl.ShowUI()
+            var item = new PartnerItemBase();
+            item.Init(_sbId);
+            VM.ItemBase.Ctrl.ShowUI(item);
         }
 
         private void ShowStar(int star)
@@ -104,7 +103,6 @@ namespace FL.FGUI
             string descSpeed =
                 atkSpeed > 0 ? TableUtils.ToRealDouble(atkSpeed).ToString("F1") : "0";
             VM.SpeedValLabel.text = descSpeed;
-            //VM.ItemBase.Ctrl.ShowUI()
         }
 
         /// <summary>

+ 0 - 1
Assets/Scripts/Business/Runtime/FGUI/Partner/SbDetailNoIconNested/PartnerSbDetailNoIconNestedCtrl.cs

@@ -80,7 +80,6 @@ namespace FL.FGUI
             string descSpeed =
                 atkSpeed > 0 ? TableUtils.ToRealDouble(atkSpeed).ToString("F1") : "0";
             VM.SpeedValLabel.text = descSpeed;
-            //VM.ItemBase.Ctrl.ShowUI()
         }
 
         /// <summary>

+ 28 - 10
Assets/Scripts/Business/Runtime/FGUI/Partner/SbStarUpBtn/PartnerSbStarUpBtnCtrl.cs

@@ -4,6 +4,7 @@
 /// 该脚本由模板创建
 /// created by cb 2024
 
+using Codice.CM.Common;
 using FairyGUI;
 using FL.Data;
 using XGame;
@@ -29,21 +30,38 @@ namespace FL.FGUI
         }
 
         #region UI事件
-        private void AddUIListenres() { }
+        private void AddUIListenres()
+        {
+            EventSingle.Instance.AddListener(EventDefine.UpdataItemData, OnItemUpdate);
+        }
 
-        private void RemoveUIListenres() { }
+        private void RemoveUIListenres()
+        {
+            EventSingle.Instance.RemoveListener(EventDefine.UpdataItemData, OnItemUpdate);
+        }
 
+        private void OnItemUpdate(int eventId, object args)
+        {
+            ShowUI();
+        }
         #endregion
-        public void ShowUI(int sbId)
+        private int _sbId;
+
+        public void SetData(int sbId)
+        {
+            _sbId = sbId;
+            ShowUI();
+        }
+
+        private void ShowUI()
         {
-            var attr = PartnersData.Instance.GetPartnerAttrByTableId(sbId);
+            var attr = PartnersData.Instance.GetPartnerAttrByTableId(_sbId);
             var star = attr?.RisingStarLv ?? 1;
-            var starUpTable = partnerStarUpTableRepo.GetPartnerStarTable(sbId, star);
-            if (starUpTable == null)
-            {
-                Log.Error($"圣兵升星表不存在,id:{sbId},starlv:{star}");
-                return;
-            }
+            var starUpTable = partnerStarUpTableRepo.GetPartnerStarTable(_sbId, star);
+            XGame.Framework.Assert.IsNotNull(
+                starUpTable,
+                $"圣兵升星表不存在,id:{_sbId},starlv:{star}"
+            );
             var num = ItemData.Instance.GetItemNum(starUpTable.PetId);
             VM.SpPbar.max = starUpTable.StarUpCost;
             VM.SpPbar.value = num;

+ 24 - 9
Assets/Scripts/Business/Runtime/FGUI/Partner/SbStrengthPanel/PartnerSbStrengthPanelCtrl.cs

@@ -7,7 +7,6 @@
 using System.Collections.Generic;
 using FairyGUI;
 using FL.Data;
-using XGame;
 using XGame.Database;
 using XGame.Framework.UI;
 
@@ -38,7 +37,7 @@ namespace FL.FGUI
             VM.UpBtn.onClick.Add(OnClickUpBtn);
             VM.LeftBtn.onClick.Add(OnClickLeftBtn);
             VM.RightBtn.onClick.Add(OnClickRightBtn);
-            //VM.MwSet.onClick.Add(OnClickMwSet);
+            VM.MwSet.VM.PanelEvent.Add(OnClickMwSet);
             VM.StarUpBtn.VM.PanelEvent.Add(OnClickStarUp);
             VM.LevelUpBtn.VM.PanelEvent.Add(OnClickLevelUp);
             VM.DownBtn.onClick.Add(OnClickDownBtn);
@@ -51,7 +50,7 @@ namespace FL.FGUI
             VM.UpBtn.onClick.Remove(OnClickUpBtn);
             VM.LeftBtn.onClick.Remove(OnClickLeftBtn);
             VM.RightBtn.onClick.Remove(OnClickRightBtn);
-            //VM.MwSet.onClick.Remove(OnClickMwSet);
+            VM.MwSet.VM.PanelEvent.Remove(OnClickMwSet);
             VM.StarUpBtn.VM.PanelEvent.Remove(OnClickStarUp);
             VM.LevelUpBtn.VM.PanelEvent.Remove(OnClickLevelUp);
             VM.DownBtn.onClick.Remove(OnClickDownBtn);
@@ -128,7 +127,9 @@ namespace FL.FGUI
             OnSelectPartnerOffset(1);
         }
 
-        private void OnClickMwSet(EventContext context) { }
+        private void OnClickMwSet(EventContext context) {
+            //Context.UI.OpenAsync(UIKeys.PartnerEpiChangePanel, )
+        }
 
         #endregion
         private bool _init = false;
@@ -159,6 +160,8 @@ namespace FL.FGUI
             XGame.Framework.Assert.IsNotNull(table, $"圣兵表不存在,id:{_curSelectId}");
             VM.NameLabel.text = table.Name;
             var attr = PartnersData.Instance.GetPartnerAttrByTableId(table.Id);
+            var level = attr == null ? 1 : attr.Level;
+            var star = attr == null ? 1 : attr.RisingStarLv;
             if (attr == null)
             {
                 VM.StarUpBtn.Disable();
@@ -167,14 +170,26 @@ namespace FL.FGUI
             }
             else
             {
-                VM.StarUpBtn.Enable(null);
-                VM.LevelUpBtn.Enable(null);
+                if (partnerStarUpTableRepo.GetPartnerStarTable(_curSelectId, star + 1) == null)
+                {
+                    VM.StarUpBtn.Disable();
+                }
+                else
+                {
+                    VM.StarUpBtn.Enable(null);
+                }
+                if (partnerLvUpTableRepo.GetPartnerLvUpTable(_curSelectId, level + 1) == null)
+                {
+                    VM.LevelUpBtn.Disable();
+                }
+                else
+                {
+                    VM.LevelUpBtn.Enable(null);
+                }
                 VM.Have.selectedIndex = 0;
                 var pos = PartnersData.Instance.UpSbPosMap.GetValueOrDefault(_curSelectId, -1);
                 VM.IsUp.selectedIndex = pos < 0 ? 0 : 1;
             }
-            var level = attr == null ? 1 : attr.Level;
-            var star = attr == null ? 1 : attr.RisingStarLv;
             ShowStar(star);
             VM.LvLabel.text = $"Lv {level}";
             VM.DetailNested.Ctrl.ShowUI(_curSelectId);
@@ -212,7 +227,7 @@ namespace FL.FGUI
 
         private void ShowUpBtn(int sbId)
         {
-            VM.StarUpBtn.Ctrl.ShowUI(sbId);
+            VM.StarUpBtn.Ctrl.SetData(sbId);
             VM.LevelUpBtn.Ctrl.ShowUI(sbId);
         }
 

+ 7 - 7
fl-fgui-project/assets/Partner/NewPartner/SbBagPanel.xml

@@ -48,10 +48,16 @@
       <relation target="" sidePair="bottom-bottom"/>
       <Button title="一键强化"/>
     </component>
-    <image id="n103_q0v6" name="n103" src="q0v67c" fileName="NewPartner/img/shaixuanbg.png" xy="621,1181" pivot="0.5,1" anchor="true" size="172,315">
+    <image id="n103_q0v6" name="n103" src="q0v67c" fileName="NewPartner/img/shaixuanbg.png" xy="621,1181" pivot="0.5,1" anchor="true" size="172,315" visible="false">
       <gearSize controller="OpenSelect" pages="1" values="172,69,1,1" default="172,315,1,1"/>
       <relation target="" sidePair="bottom-bottom"/>
     </image>
+    <component id="n107_q0v6" name="SortBtn" src="q0v67k" fileName="NewPartner/components/SbShaiXuanBtn.xml" xy="544,1120" visible="false">
+      <gearText controller="CurSelect" pages="0,1,2,3" values="已上阵|品质|等级|ID"/>
+      <gearIcon controller="CurSelect" pages="0,1,2,3" values="ui://2981jnh7q0v67f|ui://2981jnh7q0v67i|ui://2981jnh7q0v67j|ui://2981jnh7q0v67h"/>
+      <relation target="" sidePair="bottom-bottom"/>
+      <Button title="已上阵" icon="ui://2981jnh7q0v67f"/>
+    </component>
     <component id="n110_uai3" name="ShangZhenBtn" src="q0v67g" fileName="NewPartner/components/SbSelectBtn.xml" xy="544,875" group="n114_uai3">
       <Button checked="true" title="已上阵" icon="ui://2981jnh7q0v67f" controller="CurSelect" page="0"/>
     </component>
@@ -68,12 +74,6 @@
       <gearDisplay controller="OpenSelect" pages="0"/>
       <relation target="" sidePair="bottom-bottom"/>
     </group>
-    <component id="n107_q0v6" name="SortBtn" src="q0v67k" fileName="NewPartner/components/SbShaiXuanBtn.xml" xy="544,1120">
-      <gearText controller="CurSelect" pages="0,1,2,3" values="已上阵|品质|等级|ID"/>
-      <gearIcon controller="CurSelect" pages="0,1,2,3" values="ui://2981jnh7q0v67f|ui://2981jnh7q0v67i|ui://2981jnh7q0v67j|ui://2981jnh7q0v67h"/>
-      <relation target="" sidePair="bottom-bottom"/>
-      <Button title="已上阵" icon="ui://2981jnh7q0v67f"/>
-    </component>
   </displayList>
   <scriptData gencodevl6j0="1" gencodeq0v675="1"/>
 </component>

+ 7 - 1
fl-fgui-project/assets/Partner/NewPartner/item/CostLabel.xml

@@ -1,8 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="155,47">
+  <controller name="IsEnough" pages="0,,1," selected="0">
+    <remark page="0" value="满足"/>
+    <remark page="1" value="不满足"/>
+  </controller>
   <displayList>
     <loader id="n120_q0v6" name="IconLoader" xy="-41,-41" pivot="0.5,0.5" size="128,128" scale="0.35,0.35" url="ui://2981jnh7q0v680" align="center" vAlign="middle" autoSize="true" clearOnPublish="true"/>
-    <text id="n121_q0v6" name="CountLabel" xy="42,6" size="113,32" fontSize="22" color="#f85e53" align="center" strokeColor="#000000" strokeSize="2" autoClearText="true" text="1.2K/5600"/>
+    <text id="n121_q0v6" name="CountLabel" xy="42,6" size="113,32" fontSize="22" color="#1ef369" align="center" strokeColor="#000000" strokeSize="2" autoClearText="true" text="1.2K/5600">
+      <gearColor controller="IsEnough" pages="0" values="#1ef369,#000000" default="#f85e53,#000000"/>
+    </text>
   </displayList>
   <relation target="n121_q0v6" sidePair="rightext-right"/>
   <scriptData genuitypeq0v681="1" gencodeq0v681="1"/>

+ 1 - 1
fl-fgui-project/assets/Partner/NewPartner/item/SbLevelUpBtn.xml

@@ -9,7 +9,7 @@
       <gearDisplay controller="grayed" pages="0"/>
     </image>
     <text id="n117_q0v6" name="n117" xy="100,31" size="52,34" fontSize="24" color="#ffffff" align="center" strokeColor="#000000" strokeSize="2" text="升级"/>
-    <component id="n120_q0v6" name="CostLabel" src="q0v681" fileName="NewPartner/item/CostLabel.xml" xy="35,0" pivot="0.5,0.5"/>
+    <component id="n120_q0v6" name="CostLabel" src="q0v681" fileName="NewPartner/item/CostLabel.xml" xy="44,0" pivot="0.5,0.5"/>
   </displayList>
   <Button downEffect="scale" downEffectValue=".9"/>
   <scriptData genuitypeq0v682="1" gencodeq0v682="1"/>