Code structure cleanup. (2)

This commit is contained in:
2023-08-24 16:18:16 +08:00
parent 1f58390298
commit 8fa2bd1e81
55 changed files with 77 additions and 65 deletions

View File

@@ -0,0 +1,41 @@
using Cryville.Common;
using Cryville.Common.Collections.Specialized;
using Cryville.Common.Pdt;
using UnityEngine;
namespace Cryville.Crtr.Skin {
public abstract class SkinComponent : MonoBehaviour {
/// <summary>
/// The property operators of the component.
/// </summary>
public IntKeyedDictionary<SkinProperty> Properties { get; private set; }
/// <summary>
/// Submits a property.
/// </summary>
/// <param name="name">The name of the property.</param>
/// <param name="property">The property.</param>
protected void SubmitProperty(string name, PdtOperator property, int udl = 1) {
Properties.Add(IdentifierManager.Shared.Request(name), new SkinProperty(property, udl));
}
/// <summary>
/// Creates a skin component.
/// </summary>
protected SkinComponent() {
Properties = new IntKeyedDictionary<SkinProperty>();
}
public virtual void Init() { }
public virtual void Rewind(double time, Transform target) { }
public virtual void Tick(SkinContainer c, double time) { }
protected abstract void OnDestroy();
}
public struct SkinProperty {
public PdtOperator Operator { get; set; }
public int UpdateDynamicLevel { get; set; }
public SkinProperty(PdtOperator op, int udl = 0) {
Operator = op;
UpdateDynamicLevel = udl;
}
}
}