This commit is contained in:
CortexCore
2023-06-05 19:57:17 +08:00
parent f05e28ec58
commit 7f2fea821c
6195 changed files with 489001 additions and 636 deletions

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BITKit
{
public interface IOptional
{
bool Allow { get; }
object Value { get; }
}
public interface IOptional<T>
{
bool Allow { get; }
T Value { get; }
}
[System.Serializable]
public record Optional<T> : IOptional<T>
{
#if UNITY
[UnityEngine.SerializeField]
bool allow;
[UnityEngine.SerializeField]
T value;
#else
bool allow;
T value;
#endif
public bool Allow { get => allow; set => allow = value;}
public T Value { get => value; set => this.value = value; }
public void SetValueThenAllow(T newValue) => value = newValue;
public void Clear()
{
Allow = false;
value = default;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8dfee8f9fb8b4f4b844b1f12b3eabf7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: