This commit is contained in:
CortexCore
2024-11-03 16:42:23 +08:00
commit b125894cc3
5904 changed files with 1070129 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UIElements;
namespace BITKit
{
public sealed class DictionaryReferenceConfigAttribute : System.Attribute
{
public readonly int index;
public DictionaryReferenceConfigAttribute(int index)
{
this.index = index;
}
public DictionaryReferenceConfigAttribute(string keyword)
{
index=keyword.GetHashCode();
}
public DictionaryReferenceConfigAttribute()
{
index=0;
}
}
[Serializable]
public struct DictionaryReference : IReference
{
[SerializeField] private int index;
#if UNITY_EDITOR
[SerializeField,HideInInspector] private string keyword;
#endif
public string Get()
{
if (DictionaryReferenceScriptableObject.Dictionary.TryGetValue(index, out var value))
{
return value;
}
return "Not Found";
}
}
}