refactor: Update Unity to 2022.3.62

This commit is contained in:
2025-06-21 01:22:02 +08:00
parent d71bf7d4a5
commit 283783954f
112 changed files with 778 additions and 907 deletions

View File

@@ -30,13 +30,13 @@ namespace Cryville.Common.Unity {
[SerializeField]
public string Attribute;
public bool Equals(AttributeBinding other) {
public readonly bool Equals(AttributeBinding other) {
return Component.Equals(other.Component) && Attribute.Equals(other.Attribute);
}
public override bool Equals(object obj) {
return obj is AttributeBinding && Equals((AttributeBinding)obj);
public override readonly bool Equals(object obj) {
return obj is AttributeBinding other && Equals(other);
}
public override int GetHashCode() {
public override readonly int GetHashCode() {
return Component.GetHashCode() ^ Attribute.GetHashCode();
}
}
@@ -44,10 +44,10 @@ namespace Cryville.Common.Unity {
[SerializeField]
StateTweener[] m_children;
readonly List<string> _statePriority = new List<string>();
readonly Dictionary<AttributeBinding, object> _defaults = new Dictionary<AttributeBinding, object>();
readonly Dictionary<AttributeBinding, PropertyTweener<object>> _tweeners = new Dictionary<AttributeBinding, PropertyTweener<object>>();
readonly Dictionary<string, Dictionary<AttributeBinding, object>> _runtimeStates = new Dictionary<string, Dictionary<AttributeBinding, object>>();
readonly List<string> _statePriority = new();
readonly Dictionary<AttributeBinding, object> _defaults = new();
readonly Dictionary<AttributeBinding, PropertyTweener<object>> _tweeners = new();
readonly Dictionary<string, Dictionary<AttributeBinding, object>> _runtimeStates = new();
void Awake() {
var types = new Dictionary<AttributeBinding, Type>();
@@ -130,7 +130,7 @@ namespace Cryville.Common.Unity {
foreach (var tweener in _tweeners) tweener.Value.Advance(Time.deltaTime);
}
readonly List<string> m_cState = new List<string>();
readonly List<string> m_cState = new();
public IReadOnlyList<string> CurrentState => m_cState;
public void ClearState(float transitionDuration = float.Epsilon) {
foreach (var child in m_children) child.ClearState(transitionDuration);
@@ -161,7 +161,7 @@ namespace Cryville.Common.Unity {
if (index < 0) return;
m_cState.RemoveAt(index);
if (index < m_cState.Count) return;
var attrs = m_cState.Count == 0 ? _defaults : _runtimeStates[m_cState[m_cState.Count - 1]];
var attrs = m_cState.Count == 0 ? _defaults : _runtimeStates[m_cState[^1]];
foreach (var tweener in _tweeners) {
tweener.Value.Start(attrs[tweener.Key], transitionDuration);
}