From 0093693d72b0cb69bc9fb16b2f26d028c783893d Mon Sep 17 00:00:00 2001
From: LiRuoChen <571244399@qq.com>
Date: Mon, 28 Jul 2025 10:06:17 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=92=8C=E9=87=8D=E6=8B=8D?=
=?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=94=AF=E6=8C=81=E7=BB=A7=E6=89=BF=E7=B1=BB?=
=?UTF-8?q?=E4=B8=AD=E7=BB=A7=E7=BB=AD=E5=AE=9A=E4=B9=89=E5=85=B6=E4=BB=96?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84=E5=8A=9F=E8=83=BD=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FlipPage/XericFlipPageIndexVesselBase.cs | 21 ++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/Runtime/FlipPage/XericFlipPageIndexVesselBase.cs b/Runtime/FlipPage/XericFlipPageIndexVesselBase.cs
index 6ab2d56..ec329da 100644
--- a/Runtime/FlipPage/XericFlipPageIndexVesselBase.cs
+++ b/Runtime/FlipPage/XericFlipPageIndexVesselBase.cs
@@ -602,26 +602,33 @@ namespace XericUI.FlipPage
///
/// 备份所有数据项目
///
- public void BackupItemsFormPages()
+ public List BackupItemsFormPages()
{
_backupItemInfos = AllItemInfos.ToList();
+ return _backupItemInfos;
}
///
/// 保存所有数据项目(强制重排操作)
///
- public void RestoreItemsToPages()
+ public void RestoreItemsToPages(List overrideDatas = null)
{
- if (ItemIndex2PageIndex(_backupItemInfos.Count - 1) > _pageInfos.Count)
+ var od = overrideDatas ?? _backupItemInfos;
+ if (od == null)
{
- Debug.LogError($"重排数据时,原有数据数量({_backupItemInfos.Count})超出现有面板数量({_pageInfos.Count}),已拒绝重排", this);
+ Debug.LogError($"重排数据需要一个有效的数据对象列表", this);
return;
}
- // 执行重拍
+ if (ItemIndex2PageIndex(od.Count - 1) > _pageInfos.Count)
+ {
+ Debug.LogError($"重排数据时,原有数据数量({od.Count})超出现有面板数量({_pageInfos.Count}),已拒绝重排", this);
+ return;
+ }
+ // 执行重排
var page = _pageInfos.First;
page.Value.itemInfos.Clear();
var pageIndex = 0;
- for (int i = 0; i < _backupItemInfos.Count; i++)
+ for (int i = 0; i < od.Count; i++)
{
var newPageIndex = ItemIndex2PageIndex(i);
if (pageIndex != newPageIndex)
@@ -635,7 +642,7 @@ namespace XericUI.FlipPage
}
page.Value.itemInfos.Clear();
}
- page.Value.itemInfos.Add(_backupItemInfos[i]);
+ page.Value.itemInfos.Add(od[i]);
}
}