public bool Start() { List <Type> types = ClassUtil.GetClasses(CmdPackage); foreach (Type type in types) { Attr attr = ClassUtil.GetAttribe <Attr>(type); if (attr != null) { ICommand cmd = (ICommand)Activator.CreateInstance(type); if (cmds.ContainsKey(attr.Code)) { Debug.Log("Cmd组件启动失败"); return(false); } cmds.Add(attr.Code, cmd); } } Print(); Debug.Log("Cmd组件启动成功"); return(true); }