You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
745 B
36 lines
745 B
using System;
|
|
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "StringKey", menuName = "ScriptableObject/Util/StringKey")]
|
|
public class StringKey : ScriptableObject, ICloneable
|
|
{
|
|
[SerializeField] string key;
|
|
public string Key => key;
|
|
|
|
public bool Equals(StringKey other)
|
|
{
|
|
return key == other.key;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is StringKey other && Equals(other);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return key.GetHashCode();
|
|
}
|
|
|
|
public object Clone()
|
|
{
|
|
return Instantiate(this);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return key;
|
|
}
|
|
|
|
public static implicit operator string(StringKey key) => key.key;
|
|
}
|