using System.Collections.Generic; using UnityEditor; using UnityEngine; namespace Ubisoft.Hotel.Package.Editor { public abstract class PackageProperty : ScriptableObject { public enum EBoolean { AsUnitySettings, // Leave it as it is defined in Unity settings True, False } public string Name { get { return name; } private set { name = value; } } public void Serialize(Object parent) { ExtendedSerialize(parent); name = Name; if (parent != null && this != parent) { AssetDatabase.AddObjectToAsset(this, parent); } } protected virtual void ExtendedSerialize(Object parent) { } public virtual void Destroy() { HtAssetDatabase.DestroyImmediate(this, true, true); } public abstract void Apply(BuildSuite buildSuite); public virtual void AddPackagePropertyPlayer(List list) { } /// /// Callback to give this property the chance to copy stuff over Resources folder. /// /// You don't need to call AssetDatabase.Refresh() after copying over your stuff since it will be called by the caller. /// public virtual void GenerateResources() { } #region log protected enum ELogLevel { Info, Warning, Error }; protected void Log(string message, ELogLevel logLevel) { string className = HtTypes.GetTypeShortName(GetType()); message = $"[{Debug.FormatTextInUserContext(Name)}({Debug.FormatTextInCodeContext(className)})]: {message}"; switch (logLevel) { case ELogLevel.Warning: message = $"WARNING {message}"; Debug.EditorLogWarning(message); break; case ELogLevel.Error: message = $"ERROR {message}"; Debug.EditorLogError(message); break; default: Debug.EditorLog(message); break; } } #endregion } }