using System; using UnityEngine; namespace SLZ.Marrow.Warehouse { [Serializable] public class DataCardReference : ScannableReference { public DataCardReference() : base(Warehouse.Barcode.EmptyBarcode()) { } public DataCardReference(Barcode barcode) : base(barcode) { } public DataCardReference(string barcode) : base(barcode) { } public DataCard DataCard { get { TryGetDataCard(out var retDataCard); return retDataCard; } } public bool TryGetDataCard(out DataCard dataCard) { dataCard = null; bool success = false; if (AssetWarehouse.ready) { success = AssetWarehouse.Instance.TryGetDataCard(Barcode, out dataCard); } return success; } public static bool IsValid(DataCardReference dataCardReference) { return dataCardReference != null && Barcode.IsValid(dataCardReference.Barcode); } } [Serializable] public class DataCardReference : ScannableReference where T : DataCard { public DataCardReference() : base(Warehouse.Barcode.EmptyBarcode()) { } public DataCardReference(Barcode barcode) : base(barcode) { } public DataCardReference(string barcode) : base(barcode) { } public new T DataCard { get { TryGetDataCard(out var retDataCard); return retDataCard; } } public bool TryGetDataCard(out T dataCard) { dataCard = null; bool success = false; if (AssetWarehouse.ready) { success = AssetWarehouse.Instance.TryGetDataCard(Barcode, out dataCard); } return success; } } [Serializable] public class BoneTagReference : DataCardReference { public BoneTagReference() : base(Warehouse.Barcode.EmptyBarcode()) { } public BoneTagReference(Barcode barcode) : base(barcode) { } public BoneTagReference(string barcode) : base(barcode) { } } [Serializable] public class MonoDiscReference : DataCardReference { public MonoDiscReference() : base(Warehouse.Barcode.EmptyBarcode()) { } public MonoDiscReference(Barcode barcode) : base(barcode) { } public MonoDiscReference(string barcode) : base(barcode) { } } }