Ver.0.3.0.33

This commit is contained in:
2025-07-08 08:32:46 +00:00
parent 99f4dd67c2
commit 0ad5e29917
6831 changed files with 695623 additions and 234455 deletions
@@ -0,0 +1,57 @@
using System;
using UnityEngine.Events;
using UnityEngine.UI;
namespace AibisDream
{
public class BaseButton : Button
{
public SelectionType CurSelectionState => TransStateToType(currentSelectionState);
public UnityEvent<SelectionType, bool> onStateTransition = new();
protected override void DoStateTransition(SelectionState state, bool instant)
{
if (!gameObject.activeInHierarchy)
return;
onStateTransition?.Invoke(TransStateToType(state), instant);
}
protected static SelectionType TransStateToType(SelectionState state)
{
return Enum.Parse<SelectionType>(state.ToString());
}
}
/// <summary>
/// 因为作用域问题把枚举转出来用
/// </summary>
public enum SelectionType
{
/// <summary>
/// The UI object can be selected.
/// </summary>
Normal,
/// <summary>
/// The UI object is highlighted.
/// </summary>
Highlighted,
/// <summary>
/// The UI object is pressed.
/// </summary>
Pressed,
/// <summary>
/// The UI object is selected
/// </summary>
Selected,
/// <summary>
/// The UI object cannot be selected.
/// </summary>
Disabled
}
}