Files
crtr/Assets/Cryville/Crtr/Components/SkinComponent.cs
2023-01-20 22:26:56 +08:00

40 lines
1.1 KiB
C#

using Cryville.Common;
using Cryville.Common.Pdt;
using System.Collections.Generic;
using UnityEngine;
namespace Cryville.Crtr.Components {
public abstract class SkinComponent : MonoBehaviour {
/// <summary>
/// The property operators of the component.
/// </summary>
public Dictionary<int, 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 uct = 1) {
Properties.Add(IdentifierManager.SharedInstance.Request(name), new SkinProperty(property, uct));
}
/// <summary>
/// Creates a skin component.
/// </summary>
protected SkinComponent() {
Properties = new Dictionary<int, SkinProperty>();
}
public virtual void Init() { }
protected abstract void OnDestroy();
}
public struct SkinProperty {
public PdtOperator Operator { get; set; }
public int UpdateCloneType { get; set; }
public SkinProperty(PdtOperator op, int uct = 1) {
Operator = op;
UpdateCloneType = uct;
}
}
}