Example #1
0
        public static void OnScriptCompiled(RoadEvent ev, object sender, EventArgs args)
        {
            CommandMgr.handles.Clear();
            int a = CommandMgr.SearchCommandHandlers(Assembly.GetAssembly(typeof(BaseGame)));

            CommandMgr.log.Debug("Loaded" + a.ToString() + "Command");
        }
Example #2
0
        protected static int SearchCommandHandlers(Assembly assembly)
        {
            int num = 0;

            Type[] types = assembly.GetTypes();
            for (int i = 0; i < types.Length; i++)
            {
                Type type = types[i];
                if (type.IsClass && type.GetInterface("Game.Logic.Cmd.ICommandHandler") != null)
                {
                    GameCommandAttribute[] array = (GameCommandAttribute[])type.GetCustomAttributes(typeof(GameCommandAttribute), true);
                    if (array.Length > 0)
                    {
                        num++;
                        CommandMgr.RegisterCommandHandler(array[0].Code, Activator.CreateInstance(type) as ICommandHandler);
                    }
                }
            }
            return(num);
        }
Example #3
0
 public static void OnScriptCompiled(RoadEvent ev, object sender, EventArgs args)
 {
     CommandMgr.handles.Clear();
     CommandMgr.SearchCommandHandlers(Assembly.GetAssembly(typeof(BaseGame)));
 }