| | |
| | | |
| | | public class FuncPresetChooseCells : MonoBehaviour |
| | | { |
| | | [SerializeField] HorizontalLayoutGroup layoutGroup; |
| | | [SerializeField] FuncPresetChooseCell[] cells; |
| | | [SerializeField] Button unFoldBtn; //展开更多 |
| | | //被选中的方案会显示在外层,如果不是第四个则第四个会显示在最上面 |
| | | |
| | | [SerializeField] Transform moreCellObj; |
| | | [SerializeField] FuncPresetChooseMoreCell[] moreCells; |
| | | bool forceUnFold = false; //强制展开,不能收缩; 流派界面的需求 |
| | | [NonSerialized] public int unFoldID = 0; //当前展开的方案ID,在选中的情况下才生效 |
| | | int curBattleType; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 显示方案预设 |
| | |
| | | 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++) |
| | | { |
| | |
| | | } |
| | | |
| | | var showMoreCount = showCount - 4; |
| | | for (int i = 0; i < showMoreCount; i++) |
| | | for (int i = 0; i < moreCells.Length; i++) |
| | | { |
| | | if (i < showMoreCount) |
| | | { |
| | |
| | | { |
| | | Display(curBattleType, funcType, forceUnFold); |
| | | } |
| | | |
| | | //默认是居中靠右 |
| | | public void ChangeAlignment(TextAnchor type) |
| | | { |
| | | layoutGroup.childAlignment = type; |
| | | } |
| | | |
| | | } |