Browse Source

圣兵排序

zouweichen 1 week ago
parent
commit
65cd3c9d89

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


+ 4 - 0
Assets/Scripts/Business/Runtime/Define/PersistenceKeys.cs

@@ -3,5 +3,9 @@
     public static partial class PersistenceKeys
     {
         public const string last_login_account = "fl_last_login_account";
+        /// <summary>
+        /// 圣兵列表排序类型
+        /// </summary>
+        public const string partner_sort_type = "partner_sort_type";
     }
 }

+ 70 - 16
Assets/Scripts/Business/Runtime/FGUI/Partner/SbBagPanel/PartnerSbBagPanelCtrl.cs

@@ -5,9 +5,13 @@
 /// created by cb 2024
 
 using System.Collections.Generic;
+using System.Runtime.Remoting.Contexts;
 using FairyGUI;
 using FL.Data;
+using UnityEngine;
+using XGame;
 using XGame.Database;
+using XGame.Framework.Persistence;
 using XGame.Framework.UI;
 
 namespace FL.FGUI
@@ -46,6 +50,11 @@ namespace FL.FGUI
         {
             VM.OnStrongBtn.onClick.Add(OnClickOnStrongBtn);
             VM.SortBtn.onClick.Add(OnClickSortBtn);
+            VM.ShangZhenBtn.onClick.Add(OnClickSortTypeBtn);
+            VM.PinZhiBtn.onClick.Add(OnClickSortTypeBtn);
+            VM.DengJiBtn.onClick.Add(OnClickSortTypeBtn);
+            VM.IDBtn.onClick.Add(OnClickSortTypeBtn);
+            VM.PanelEvent.Add(OnClickPanel);
             EventSingle.Instance.AddListener(EventDefine.PartnerDown, OnUpdateList);
             EventSingle.Instance.AddListener(EventDefine.PartnerUp, OnUpdateList);
             EventSingle.Instance.AddListener(EventDefine.PartnerUpLevel, OnUpdateList);
@@ -57,6 +66,11 @@ namespace FL.FGUI
         {
             VM.OnStrongBtn.onClick.Remove(OnClickOnStrongBtn);
             VM.SortBtn.onClick.Remove(OnClickSortBtn);
+            VM.ShangZhenBtn.onClick.Remove(OnClickSortTypeBtn);
+            VM.PinZhiBtn.onClick.Remove(OnClickSortTypeBtn);
+            VM.DengJiBtn.onClick.Remove(OnClickSortTypeBtn);
+            VM.IDBtn.onClick.Remove(OnClickSortTypeBtn);
+            VM.PanelEvent.Remove(OnClickPanel);
             EventSingle.Instance.RemoveListener(EventDefine.PartnerDown, OnUpdateList);
             EventSingle.Instance.RemoveListener(EventDefine.PartnerUp, OnUpdateList);
             EventSingle.Instance.RemoveListener(EventDefine.PartnerUpLevel, OnUpdateList);
@@ -64,6 +78,26 @@ namespace FL.FGUI
             EventSingle.Instance.RemoveListener(EventDefine.PartnerUpStar, OnUpdateList);
         }
 
+        private void OnClickPanel()
+        {
+            if (VM.OpenSelect.selectedIndex == 1)
+                return;
+            VM.OpenSelect.selectedIndex = 1;
+        }
+
+        private void OnClickSortTypeBtn(EventContext context)
+        {
+            context.StopPropagation();
+            if (_curSortType == VM.CurSelect.selectedIndex)
+                return;
+            _curSortType = VM.CurSelect.selectedIndex;
+            Persistence.Write(
+                PlayerData.Instance.UID + PersistenceKeys.partner_sort_type,
+                _curSortType
+            );
+            ShowUI();
+        }
+
         private void OnClickOnStrongBtn(EventContext context)
         {
             var list = PartnersData.Instance.PartnerList;
@@ -97,6 +131,7 @@ namespace FL.FGUI
 
         private void OnClickSortBtn(EventContext context)
         {
+            context.StopPropagation();
             VM.OpenSelect.selectedIndex = VM.OpenSelect.selectedIndex > 0 ? 0 : 1;
         }
 
@@ -107,12 +142,17 @@ namespace FL.FGUI
         #endregion
         private List<PartnerSbBagListParam> _dataList = new List<PartnerSbBagListParam>();
         private bool _init = false;
+        private int _curSortType = 0;
 
         private void InitView()
         {
             if (_init)
                 return;
             _init = true;
+            VM.CurSelect.selectedIndex = Persistence.Read(
+                PlayerData.Instance.UID + PersistenceKeys.partner_sort_type,
+                0
+            );
             VM.List.ListType = EGListType.Virtual;
         }
 
@@ -138,19 +178,28 @@ namespace FL.FGUI
                 {
                     PartnersData.Instance.TryGetPartnerAttrByTableId(a, out var aAttr);
                     PartnersData.Instance.TryGetPartnerAttrByTableId(b, out var bAttr);
-                    if (aAttr.Status != bAttr.Status)
-                    {
-                        return bAttr.Status - aAttr.Status;
-                    }
-                    else if (bAttr.Level != aAttr.Level)
-                    {
-                        return bAttr.Level - aAttr.Level;
-                    }
-                    var aTable = PartnerTableRepo.Get(a);
-                    var bTable = PartnerTableRepo.Get(b);
-                    if (aTable.Quality != bTable.Quality)
+                    switch (VM.CurSelect.selectedIndex)
                     {
-                        return bTable.Quality - aTable.Quality;
+                        case 0:
+                            if (aAttr.Status != bAttr.Status)
+                            {
+                                return bAttr.Status - aAttr.Status;
+                            }
+                            break;
+                        case 1:
+                            var aTable = PartnerTableRepo.Get(a);
+                            var bTable = PartnerTableRepo.Get(b);
+                            if (aTable.Quality != bTable.Quality)
+                            {
+                                return bTable.Quality - aTable.Quality;
+                            }
+                            break;
+                        case 2:
+                            if (bAttr.Level != aAttr.Level)
+                            {
+                                return bAttr.Level - aAttr.Level;
+                            }
+                            break;
                     }
                     return a - b;
                 }
@@ -158,11 +207,16 @@ namespace FL.FGUI
             noHaveList.Sort(
                 (a, b) =>
                 {
-                    var aTable = PartnerTableRepo.Get(a);
-                    var bTable = PartnerTableRepo.Get(b);
-                    if (aTable.Quality != bTable.Quality)
+                    switch (VM.CurSelect.selectedIndex)
                     {
-                        return bTable.Quality - aTable.Quality;
+                        case 1:
+                            var aTable = PartnerTableRepo.Get(a);
+                            var bTable = PartnerTableRepo.Get(b);
+                            if (aTable.Quality != bTable.Quality)
+                            {
+                                return bTable.Quality - aTable.Quality;
+                            }
+                            break;
                     }
                     return a - b;
                 }

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

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="756,1344" scroll="horizontal" designImage="ui://2981jnh7ifoa5i" designImageAlpha="22" designImageLayer="1">
+<component size="756,1344" scroll="horizontal" designImage="ui://2981jnh7ifoa5i" designImageAlpha="100" designImageLayer="1">
   <controller name="CurSelect" pages="0,,1,,2,,3," selected="0">
     <remark page="0" value="上阵"/>
     <remark page="1" value="品质"/>
@@ -48,11 +48,11 @@
       <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" visible="false">
+    <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">
       <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">
+    <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"/>

+ 16 - 0
fl-fgui-project/assets/Partner/NewPartner/components/SpIconProgress.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="76,26" extention="ProgressBar">
+  <displayList>
+    <image id="n18_q0v6" name="n18" src="q0v66h" fileName="NewPartner/img/suipianjdt2.png" xy="0,6">
+      <relation target="" sidePair="height-height,rightext-right"/>
+    </image>
+    <image id="n19_q0v6" name="bar" src="q0v66i" fileName="NewPartner/img/suipianjdt.png" xy="2,8">
+      <relation target="" sidePair="height-height,rightext-right"/>
+    </image>
+    <image id="n21_li13" name="n21" src="q0v66g" fileName="NewPartner/img/suipian.png" xy="-6,2"/>
+    <text id="n20_q0v6" name="title" xy="24,0" pivot="0.5,0.5" size="31,26" fontSize="18" color="#ffffff" strokeColor="#000000" strokeSize="2" autoClearText="true" text="2/2">
+      <relation target="" sidePair="center-center,middle-middle"/>
+    </text>
+  </displayList>
+  <ProgressBar titleType="valueAndmax"/>
+</component>

+ 3 - 6
fl-fgui-project/assets/Partner/NewPartner/item/SbBaseItem.xml

@@ -13,14 +13,11 @@
     <text id="n13_vn6w" name="LevelTxt" xy="32,3" size="65,29" fontSize="20" color="#ffffff" align="center" vAlign="middle" strokeColor="#000000" strokeSize="2" text="Lv.102">
       <gearDisplay controller="Have" pages="0"/>
     </text>
-    <component id="n18_q0v6" name="SpPbar" src="q0v66j" fileName="NewPartner/components/SpProgress.xml" xy="18,28" group="n22_lkie">
+    <component id="n18_q0v6" name="SpPbar" src="q0v66j" fileName="NewPartner/components/SpIconProgress.xml" xy="18,28">
+      <gearDisplay controller="Have" pages="0"/>
+      <gearDisplay2 controller="ShowOther" pages="0" condition="0"/>
       <ProgressBar value="2" max="2"/>
     </component>
-    <image id="n19_q0v6" name="n19" src="q0v66g" fileName="NewPartner/img/suipian.png" xy="13,30" group="n22_lkie"/>
-    <group id="n22_lkie" name="n22" xy="13,28" size="81,26" advanced="true">
-      <gearDisplay controller="ShowOther" pages="0"/>
-      <gearDisplay2 controller="Have" pages="0" condition="0"/>
-    </group>
     <loader id="n20_q0v6" name="ElementLoader" xy="-8,-7" pivot="0.5,0.5" size="46,46" scale="0.7,0.7" url="ui://2981jnh7q0v66y" align="center" vAlign="middle" autoSize="true" clearOnPublish="true"/>
     <list id="n21_q0v6" name="StarList" xy="5,196" size="200,34" scale="0.5,0.5" layout="row" colGap="-8" defaultItem="ui://2981jnh7q0v67w" align="center" autoClearItems="true">
       <gearDisplay controller="ShowOther" pages="0"/>

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

@@ -37,7 +37,7 @@
     <loader id="n76_q0v6" name="ElementLoader" xy="167,73" size="35,30" group="n83_q0v6" url="ui://2981jnh7q0v66f"/>
     <loader id="n77_q0v6" name="TypeLoader" xy="209,73" size="53,29" group="n83_q0v6" url="ui://2981jnh7q0v66v"/>
     <group id="n83_q0v6" name="n83" xy="167,73" size="95,30" group="n81_q0v6"/>
-    <component id="n78_q0v6" name="SpPbar" src="q0v66j" fileName="NewPartner/components/SpProgress.xml" xy="45,145" size="90,30" group="n85_lkie">
+    <component id="n78_q0v6" name="SpPbar" src="li138l" fileName="NewPartner/components/SpProgress.xml" xy="45,145" size="90,30" group="n85_lkie">
       <ProgressBar value="50" max="100"/>
     </component>
     <image id="n79_q0v6" name="n79" src="q0v66g" fileName="NewPartner/img/suipian.png" xy="25,146" group="n85_lkie" scale="1.4,1.4"/>

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

@@ -9,7 +9,7 @@
       <gearDisplay controller="grayed" pages="0"/>
     </image>
     <text id="n117_q0v6" name="n117" xy="100,27" size="52,34" fontSize="24" color="#ffffff" align="center" strokeColor="#000000" strokeSize="2" text="升星"/>
-    <component id="n119_q0v6" name="SpPbar" src="q0v66j" fileName="NewPartner/components/SpProgress.xml" xy="84,3" size="90,30">
+    <component id="n119_q0v6" name="SpPbar" src="li138l" fileName="NewPartner/components/SpProgress.xml" xy="84,3" size="90,30">
       <ProgressBar value="50" max="100"/>
     </component>
     <image id="n118_q0v6" name="n118" src="q0v66g" fileName="NewPartner/img/suipian.png" xy="64,4" scale="1.4,1.4"/>

+ 2 - 1
fl-fgui-project/assets/Partner/package.xml

@@ -139,7 +139,7 @@
     <image id="q0v66g" name="suipian.png" path="/NewPartner/img/"/>
     <image id="q0v66h" name="suipianjdt2.png" path="/NewPartner/img/"/>
     <image id="q0v66i" name="suipianjdt.png" path="/NewPartner/img/" scale="9grid" scale9grid="6,3,60,6"/>
-    <component id="q0v66j" name="SpProgress.xml" path="/NewPartner/components/"/>
+    <component id="q0v66j" name="SpIconProgress.xml" path="/NewPartner/components/"/>
     <image id="q0v66k" name="banping2bg.png" path="/NewPartner/img/" scale="9grid" scale9grid="178,31,356,14"/>
     <component id="q0v66l" name="BlueBtn.xml" path="/NewPartner/components/"/>
     <component id="q0v66m" name="YellowBtn.xml" path="/NewPartner/components/"/>
@@ -208,6 +208,7 @@
     <image id="uai38g" name="partner_icon2_20111.png" path="/Epigraph/Images/mwpinzhi/"/>
     <image id="uai38i" name="partner_icon_20121.png" path="/NewPartner/design/img/"/>
     <image id="x2tq8k" name="partner2_20121.png" path="/NewPartner/design/img/"/>
+    <component id="li138l" name="SpProgress.xml" path="/NewPartner/components/"/>
   </resources>
   <publish name="" genCode="true" excluded="uai38g,v4ke16,v4ke11,pu684a,drii42,v4ke1z,v4ke1a,v4ke1q,v4ke2m"/>
 </packageDescription>