Exemplo n.º 1
0
        public ApplicationController()
        {
            _events                 = Factory.Events;
            _agsEditor              = Factory.AGSEditor;
            _guiController          = Factory.GUIController;
            _componentController    = Factory.ComponentController;
            _nativeProxy            = Factory.NativeProxy;
            _pluginEditorController = new AGSEditorController(_componentController, _agsEditor, _guiController);

            _events.GameLoad                     += new EditorEvents.GameLoadHandler(_events_GameLoad);
            _events.GamePostLoad                 += new EditorEvents.GamePostLoadHandler(_events_GamePostLoad);
            _events.GameSettingsChanged          += new EditorEvents.ParameterlessDelegate(_events_GameSettingsChanged);
            _events.ImportedOldGame              += new EditorEvents.ParameterlessDelegate(_events_ImportedOldGame);
            _events.RefreshAllComponentsFromGame += new EditorEvents.ParameterlessDelegate(_events_RefreshAllComponentsFromGame);
            _events.SavingGame                   += new EditorEvents.SavingGameHandler(_events_SavingGame);
            _events.SavingUserData               += new EditorEvents.SavingUserDataHandler(_events_SavingUserData);
            _events.LoadedUserData               += new EditorEvents.LoadedUserDataHandler(_events_LoadedUserData);
            _agsEditor.PreSaveGame               += new AGSEditor.PreSaveGameHandler(_agsEditor_PreSaveGame);

            _guiController.OnEditorShutdown += new GUIController.EditorShutdownHandler(GUIController_OnEditorShutdown);
            _guiController.Initialize(_agsEditor);
            _agsEditor.DoEditorInitialization();
            AGSColor.ColorMapper = new ColorMapper(_agsEditor);
            CreateComponents();
        }
Exemplo n.º 2
0
        public ApplicationController()
        {
            _events = Factory.Events;
            _agsEditor = Factory.AGSEditor;
            _guiController = Factory.GUIController;
            _componentController = Factory.ComponentController;
            _nativeProxy = Factory.NativeProxy;
            _pluginEditorController = new AGSEditorController(_componentController, _agsEditor, _guiController);

            _events.GameLoad += new EditorEvents.GameLoadHandler(_events_GameLoad);
            _events.GamePostLoad += new EditorEvents.GamePostLoadHandler(_events_GamePostLoad);
            _events.GameSettingsChanged += new EditorEvents.ParameterlessDelegate(_events_GameSettingsChanged);
            _events.ImportedOldGame += new EditorEvents.ParameterlessDelegate(_events_ImportedOldGame);
            _events.RefreshAllComponentsFromGame += new EditorEvents.ParameterlessDelegate(_events_RefreshAllComponentsFromGame);
            _events.SavingGame += new EditorEvents.SavingGameHandler(_events_SavingGame);
            _events.SavingUserData += new EditorEvents.SavingUserDataHandler(_events_SavingUserData);
            _events.LoadedUserData += new EditorEvents.LoadedUserDataHandler(_events_LoadedUserData);
            _agsEditor.PreSaveGame += new AGSEditor.PreSaveGameHandler(_agsEditor_PreSaveGame);

            _guiController.OnEditorShutdown += new GUIController.EditorShutdownHandler(GUIController_OnEditorShutdown);
            _guiController.Initialize(_agsEditor);
            _agsEditor.DoEditorInitialization();
            AGSColor.ColorMapper = new ColorMapper(_agsEditor);
            CreateComponents();
        }
Exemplo n.º 3
0
        public EditorPlugin(string fileName, AGSEditorController pluginEditorController)
        {
            Type     mainClass = null;
            Assembly assembly  = Assembly.LoadFile(Path.GetFullPath(fileName));

            foreach (Type type in assembly.GetExportedTypes())
            {
                if (type.IsClass)
                {
                    foreach (Type iface in type.GetInterfaces())
                    {
                        if (iface == typeof(IAGSEditorPlugin))
                        {
                            if (mainClass != null)
                            {
                                throw new AGSEditorException("Plugin has multiple classes implementing IAGSEditorPlugin");
                            }
                            mainClass = type;
                            break;
                        }
                    }
                }
            }
            if (mainClass == null)
            {
                throw new AGSEditorException("Plugin does not contain any classes that implement IAGSEditorPlugin");
            }

            VerifyRequiredAGSVersion(mainClass);

            ConstructorInfo ctor = mainClass.GetConstructor(new Type[] { typeof(IAGSEditor) });

            if (ctor == null)
            {
                throw new AGSEditorException("Class '" + mainClass.Name + "' does not have a (IAGSEditor) constructor");
            }

            _plugin   = (IAGSEditorPlugin)ctor.Invoke(new object[] { pluginEditorController });
            _fileName = fileName;
        }
Exemplo n.º 4
0
        public EditorPlugin(string fileName, AGSEditorController pluginEditorController)
        {
            Type mainClass = null;
            Assembly assembly = Assembly.LoadFile(Path.GetFullPath(fileName));
            foreach (Type type in assembly.GetExportedTypes())
            {
                if (type.IsClass)
                {
                    foreach (Type iface in type.GetInterfaces())
                    {
                        if (iface == typeof(IAGSEditorPlugin))
                        {
                            if (mainClass != null)
                            {
                                throw new AGSEditorException("Plugin has multiple classes implementing IAGSEditorPlugin");
                            }
                            mainClass = type;
                            break;
                        }
                    }
                }
            }
            if (mainClass == null)
            {
                throw new AGSEditorException("Plugin does not contain any classes that implement IAGSEditorPlugin");
            }

            VerifyRequiredAGSVersion(mainClass);

            ConstructorInfo ctor = mainClass.GetConstructor(new Type[] { typeof(IAGSEditor) });
            if (ctor == null)
            {
                throw new AGSEditorException("Class '" + mainClass.Name + "' does not have a (IAGSEditor) constructor");
            }

            _plugin = (IAGSEditorPlugin)ctor.Invoke(new object[] { pluginEditorController });
            _fileName = fileName;
        }