From ac93e899d5c6331e89ccae552ecbb502a9652d01 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 27 一月 2026 18:49:43 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/FuncPreset/FuncPresetChooseCells.cs | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/Main/System/FuncPreset/FuncPresetChooseCells.cs b/Main/System/FuncPreset/FuncPresetChooseCells.cs
index 9b360a0..3bd43e9 100644
--- a/Main/System/FuncPreset/FuncPresetChooseCells.cs
+++ b/Main/System/FuncPreset/FuncPresetChooseCells.cs
@@ -14,13 +14,19 @@
public class FuncPresetChooseCells : MonoBehaviour
{
+ [SerializeField] HorizontalLayoutGroup layoutGroup;
[SerializeField] FuncPresetChooseCell[] cells;
[SerializeField] Button unFoldBtn; //灞曞紑鏇村
//琚�変腑鐨勬柟妗堜細鏄剧ず鍦ㄥ灞傦紝濡傛灉涓嶆槸绗洓涓垯绗洓涓細鏄剧ず鍦ㄦ渶涓婇潰
+
+ [SerializeField] Transform moreCellObj;
[SerializeField] FuncPresetChooseMoreCell[] moreCells;
+ [SerializeField] Canvas canvas;
bool forceUnFold = false; //寮哄埗灞曞紑锛屼笉鑳芥敹缂�; 娴佹淳鐣岄潰鐨勯渶姹�
[NonSerialized] public int unFoldID = 0; //褰撳墠灞曞紑鐨勬柟妗圛D锛屽湪閫変腑鐨勬儏鍐典笅鎵嶇敓鏁�
int curBattleType;
+ int curFuncType;
+
/// <summary>
/// 鏄剧ず鏂规棰勮
@@ -33,10 +39,15 @@
{
forceUnFold = _forceUnFold;
curBattleType = battleType;
+ curFuncType = funcType;
var selectID = FuncPresetManager.Instance.GetFuncPresetIDByBattleType(battleType, funcType);
var showCount = FuncPresetManager.Instance.GetShowFuncPresetCount(funcType);
unFoldBtn.SetActive(showCount > 4);
+ unFoldBtn.AddListener(() =>
+ {
+ moreCellObj.SetActive(true);
+ });
for (int i = 0; i < cells.Length; i++)
{
@@ -45,12 +56,12 @@
cells[i].SetActive(true);
if (i < 3)
{
- var _unFoldState = forceUnFold ? true : i + 1 == unFoldID;
+ var _unFoldState = forceUnFold ? i + 1 == selectID : i + 1 == unFoldID;
cells[i].Display(battleType, funcType, i + 1, _unFoldState);
}
else
{
- var _unFoldState = forceUnFold ? true : (selectID > 4 ? selectID : 4) == unFoldID;
+ var _unFoldState = forceUnFold ? selectID >= 4: (selectID > 4 ? selectID : 4) == unFoldID;
//绗洓涓姩鎬佸彉鍖�
cells[i].Display(battleType, funcType, selectID > 4 ? selectID : 4, _unFoldState);
}
@@ -62,7 +73,7 @@
}
var showMoreCount = showCount - 4;
- for (int i = 0; i < showMoreCount; i++)
+ for (int i = 0; i < moreCells.Length; i++)
{
if (i < showMoreCount)
{
@@ -85,6 +96,7 @@
void OnEnable()
{
+ canvas.sortingLayerName = "UI";
FuncPresetManager.Instance.OnSelectPresetEvent += OnSelectPresetEvent;
}
@@ -94,8 +106,17 @@
FuncPresetManager.Instance.OnSelectPresetEvent -= OnSelectPresetEvent;
}
- void OnSelectPresetEvent(int funcType, int id, bool isUnFold)
+ void OnSelectPresetEvent(int battleType, int _funcType, int id, bool isUnFold)
{
- Display(curBattleType, funcType, forceUnFold);
+ if (battleType != curBattleType || curFuncType != _funcType)
+ return;
+ Display(curBattleType, _funcType, forceUnFold);
}
+
+ //榛樿鏄眳涓潬鍙�
+ public void ChangeAlignment(TextAnchor type)
+ {
+ layoutGroup.childAlignment = type;
+ }
+
}
--
Gitblit v1.8.0