Beispiel #1
0
 /// <summary>
 /// 添加静态方法命令
 /// </summary>
 /// <param name="info"></param>
 /// <param name="attr"></param>
 private void AddStaticMethodCommand(MethodInfo info, MethodCommandAttribute attr)
 {
     if (m_commandDictionary.ContainsKey(attr.name))
     {
         Debug.LogError("Multiple commands with the same name are not allowed. [" + attr.name + "]");
         return;
     }
     else
     {
         var command = new StaticMethodCommand(attr.name, attr.description, info);
         m_commandDictionary.Add(attr.name, command);
         m_commandsTrie.Add(new TrieEntry <string>(attr.name, attr.name));
     }
 }
Beispiel #2
0
 /// <summary>
 /// 添加静态方法命令
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="methodName"></param>
 /// <param name="type"></param>
 public void AddStaticMethodCommand(string name, string description, string methodName, Type type)
 {
     if (m_commandDictionary.ContainsKey(name))
     {
         Debug.LogError("Multiple commands with the same name are not allowed. [" + name + "]");
         return;
     }
     else
     {
         var info = type.GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
         if (info != null)
         {
             var command = new StaticMethodCommand(name, description, info);
             m_commandDictionary.Add(name, command);
             m_commandsTrie.Add(new TrieEntry <string>(name, name));
         }
     }
 }