表驱动法
查询表(ookup table)
...
Dictionary<string, bool> testDict = new Dictionary<string, bool>(){ ["key1"] = true, ["key2"] = false, ["测试"] = true};
...
if ( testDict.ContainsKey("测试"))//通过int变量 来查找 对应 的字符串
{
bool value_ = false;
value_ = test_array["测试"];
//Console.WriteLine(value);
Debug.Log(value_);//输出:true
}//
...
Dictionary<string, int> testDict1 = new Dictionary<string, int>(){ ["key1"] = 2, ["key2"] = 1, ["测试"] = 0};//不同的数值代表不同的含义
...
if ( testDict.ContainsKey("测试"))//通过int变量 来查找 对应 的字符串
{
int value_ = false;
value_ = test_array["测试"];
//Console.WriteLine(value);
Debug.Log(value_);//输出:true
}//
...