0.5.2
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d9bb294fcaf499299a69cdd86a8163b
|
||||
timeCreated: 1758179759
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Deconstruction.UI.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 层级控制
|
||||
/// </summary>
|
||||
public interface IHierarchyControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置可见性
|
||||
/// </summary>
|
||||
public bool GetActive();
|
||||
|
||||
/// <summary>
|
||||
/// 设置可见性
|
||||
/// </summary>
|
||||
public bool GetActiveInHierarchy();
|
||||
|
||||
/// <summary>
|
||||
/// 设置可见性
|
||||
/// </summary>
|
||||
public void SetActive(bool active);
|
||||
|
||||
/// <summary>
|
||||
/// 设置可见性
|
||||
/// </summary>
|
||||
public void SetActiveInHierarchy(bool active);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 487067e5309b46ad8b1312356751f795
|
||||
timeCreated: 1758179860
|
||||
+23
-2
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Deconstruction.UI.Interface;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@@ -121,7 +122,7 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
/// </code>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ToggleMapping : IEnumerable<Toggle>
|
||||
public class ToggleMapping : IEnumerable<Toggle>, IHierarchyControl
|
||||
{
|
||||
#region 事件委托
|
||||
|
||||
@@ -150,7 +151,6 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
// 当前选中的项目
|
||||
private int _nowSelectToggleIndex = -1;
|
||||
|
||||
|
||||
public Transform TogglesContext => ToggleGroup.transform;
|
||||
|
||||
/// <summary>
|
||||
@@ -479,6 +479,27 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
=> DestroyAllToggle();
|
||||
|
||||
#endregion
|
||||
|
||||
#region 额外方法
|
||||
|
||||
public bool GetActive() => toggleList.Any(a => a.gameObject.activeSelf);
|
||||
|
||||
public bool GetActiveInHierarchy() => toggleList.Any(a => a.gameObject.activeInHierarchy);
|
||||
|
||||
public void SetActive(bool active)
|
||||
{
|
||||
ToggleGroup.gameObject.SetActivity(active);
|
||||
toggleList.ForEachDo(a => a.gameObject.SetActive(active));
|
||||
}
|
||||
|
||||
public void SetActiveInHierarchy(bool active)
|
||||
{
|
||||
ToggleGroup.gameObject.SetActivity(active);
|
||||
toggleList.ForEachDo(a => a.gameObject.SetActivityInHierarchy(active));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user