|
@@ -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;
|
|
|
}
|