Наследование: ISourceControlIntegration
Пример #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();
        }
Пример #2
0
        public DialogEditor(Dialog dialogToEdit, AGSEditor agsEditor)
        {
            _dialog = dialogToEdit;
            _agsEditor = agsEditor;

            Init();
        }
Пример #3
0
 public InspectorPanel(AGSEditor editor, IRenderLayer layer, ActionManager actions, string idPrefix = "")
 {
     _idPrefix = idPrefix;
     _editor   = editor;
     _actions  = actions;
     _layer    = layer;
 }
Пример #4
0
        public static async Task Show(AGSEditor editor)
        {
            if (_component != null)
            {
                _component.PropertyChanged -= onPropertyChanged;
            }
            var gameSelector      = new ComboboxboxField("Game", "Game", "Editor");
            var entitySelector    = new TextboxField("Entity ID");
            var componentSelector = new TextboxField("Component");
            var propertySelector  = new TextboxField("Property Name");
            var simpleForm        = new SimpleForm(editor.Editor, gameSelector, entitySelector, componentSelector, propertySelector);
            await simpleForm.ShowAsync("Break Debugger when property changes");

            var game   = gameSelector.Value == "Game" ? editor.Game : editor.Editor;
            var entity = game.Find <IEntity>(entitySelector.Value);

            if (entity == null)
            {
                await AGSMessageBox.DisplayAsync($"Did not find entity id {entitySelector.Value}", editor.Editor);

                return;
            }
            var component = entity.FirstOrDefault(c => c.Name == componentSelector.Value);

            if (component == null)
            {
                await AGSMessageBox.DisplayAsync($"Did not find component {componentSelector.Value} for entity id {entitySelector.Value}", editor.Editor);

                return;
            }
            _component = component;
            _property  = propertySelector.Value;
            component.PropertyChanged += onPropertyChanged;
        }
 public FactoryImplementationOption(HasFactoryAttribute attr, AGSEditor editor)
 {
     _editor     = editor;
     _factory    = FactoryProvider.GetFactory(attr.FactoryType, editor.Game);
     _methodName = attr.MethodName;
     Name        = attr.DisplayName ?? attr.MethodName.Humanize();
 }
Пример #6
0
        public DialogEditor(Dialog dialogToEdit, AGSEditor agsEditor)
        {
            _dialog    = dialogToEdit;
            _agsEditor = agsEditor;

            Init();
        }
Пример #7
0
 public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor, Action<Script> showMatchingScript)
 {
     _showMatchingScript = showMatchingScript;
     _agsEditor = agsEditor;
     Init(scriptToEdit);
     _room = null;
     _roomNumber = 0;
 }
Пример #8
0
 public static void SetupResolver()
 {
     Resolver.Override(resolver => resolver.Builder.RegisterType <KeyboardBindings>().SingleInstance());
     Resolver.Override(resolver => resolver.Builder.RegisterType <ActionManager>().SingleInstance());
     Resolver.Override(resolver => resolver.Builder.RegisterAssemblyTypes(typeof(GameLoader).Assembly).
                       Except <InspectorTreeNodeProvider>().Except <EditorShouldBlockEngineInput>().Except <EditorUIEvents>().AsImplementedInterfaces().ExternallyOwned());
     Resolver.Override(resolver => { var editor = new AGSEditor(resolver); resolver.Builder.RegisterInstance(editor); });
 }
Пример #9
0
        public DialogEditor(Dialog dialogToEdit, AGSEditor agsEditor)
        {
            _dialog    = dialogToEdit;
            _agsEditor = agsEditor;

            InitializeComponent();
            this.Load += new EventHandler(DialogEditor_Load);
        }
Пример #10
0
 public InstancePropertyEditor(IGameFactory factory, ActionManager actions, StateModel model, AGSEditor editor,
                               IForm parentForm, Action refreshNode)
 {
     _refreshNode  = refreshNode;
     _parentForm   = parentForm;
     _editor       = editor;
     _selectEditor = new SelectEditor(factory, actions, model, getOptions, getValue);
 }
Пример #11
0
 public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor, Action<Script> showMatchingScript)
 {
     _showMatchingScript = showMatchingScript;
     _agsEditor = agsEditor;
     Init(scriptToEdit);
     _room = null;
     _roomNumber = 0;
 }
Пример #12
0
 public GameDebugTree(AGSEditor editor, IRenderLayer layer, InspectorPanel inspector)
 {
     _editor          = editor;
     _inspector       = inspector;
     _entitiesToNodes = new ConcurrentDictionary <string, ITreeStringNode>();
     _addedObjects    = new AGSConcurrentHashSet <string>(100, false);
     _roomSubscribers = new List <RoomSubscriber>(20);
     _layer           = layer;
 }
Пример #13
0
 public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor, Action <Script> showMatchingScript)
 {
     _showMatchingScript = showMatchingScript;
     _agsEditor          = agsEditor;
     Init(scriptToEdit);
     _room       = null;
     _roomNumber = 0;
     Factory.GUIController.ColorThemes.Apply(LoadColorTheme);
 }
Пример #14
0
 public EditorProvider(IGameFactory factory, ActionManager actions, StateModel model,
                       IGameSettings settings, AGSEditor editor, IForm parentForm)
 {
     _parentForm = parentForm;
     _editor     = editor;
     _factory    = factory;
     _actions    = actions;
     _model      = model;
     _settings   = settings;
 }
Пример #15
0
 public AGSInspector(IGameFactory factory, IGameSettings gameSettings, IGameSettings editorSettings,
                     ActionManager actions, StateModel model, AGSEditor editor, IForm parentForm)
 {
     _cleanup        = new List <Action>(50);
     _actions        = actions;
     _model          = model;
     _props          = new Dictionary <InspectorCategory, List <IProperty> >();
     _factory        = factory;
     _font           = editorSettings.Defaults.TextFont;
     _editorProvider = new EditorProvider(factory, actions, model, gameSettings, editor, parentForm);
 }
Пример #16
0
 public FactoryWizard(IForm parentForm, string title, AGSEditor editor, Action <IPanel> addUiExternal,
                      Func <Dictionary <string, ValueModel>, Task <bool> > validate,
                      Action <Dictionary <string, object> > setDefaults)
 {
     _title         = title;
     _parentForm    = parentForm;
     _editor        = editor;
     _addUiExternal = addUiExternal;
     _validate      = validate;
     _setDefaults   = setDefaults;
 }
Пример #17
0
 public GameDebugView(AGSEditor editor, KeyboardBindings keyboardBindings, ActionManager actions, GameToolbar toolbar)
 {
     _toolbar     = toolbar;
     _actions     = actions;
     _editor      = editor;
     _layer       = new AGSRenderLayer(AGSLayers.UI.Z - 1, independentResolution: _resolution);
     _inspector   = new InspectorPanel(editor, _layer, actions);
     Tree         = new GameDebugTree(editor, _layer, _inspector);
     _displayList = new GameDebugDisplayList(editor.Editor, editor.Game, _layer);
     _input       = editor.Editor.Input;
     keyboardBindings.OnKeyboardShortcutPressed.Subscribe(onShortcutKeyPressed);
 }
Пример #18
0
 public MethodWizard(MethodInfo method, HashSet <string> hideProperties, Dictionary <string, object> overrideDefaults,
                     Action <IPanel> addUiExternal, AGSEditor editor, Func <Dictionary <string, object>, Task <bool> > validate)
 {
     _method               = method;
     _editor               = editor;
     _validate             = validate;
     _layer                = new AGSRenderLayer(AGSLayers.UI.Z - 1);
     _hideProperties       = hideProperties;
     _overrideDefaults     = overrideDefaults;
     _addUiExternal        = addUiExternal;
     _taskCompletionSource = new TaskCompletionSource <Dictionary <string, object> >();
 }
Пример #19
0
        public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor, Action <Script> showMatchingScript)
        {
            InitializeComponent();

            _agsEditor          = agsEditor;
            _script             = scriptToEdit;
            _showMatchingScript = showMatchingScript;
            _room       = null;
            _roomNumber = 0;

            this.Load   += new EventHandler(ScriptEditor_Load);
            this.Resize += new EventHandler(ScriptEditor_Resize);
        }
Пример #20
0
 public EntityDesigner(AGSEditor editor, ActionManager actions)
 {
     _actions = actions;
     _editor  = editor;
     _factory = editor.Editor.Factory;
     _state   = editor.Editor.State;
     _events  = editor.Editor.Events;
     _input   = editor.Editor.Input;
     _window  = editor.GameResolver.Container.Resolve <IWindowInfo>();
     _window.PropertyChanged += onWindowPropertyChanged;
     _resizeVisible           = true;
     _resizeHandles           = new List <ResizeHandle>(8);
     _rotateHandles           = new List <RotateHandle>(4);
 }
        public TypeImplementationOption(Type type, Type targetType, AGSEditor editor)
        {
            _editor = editor;
            if (type.IsGenericTypeDefinition)
            {
                _type = type.MakeGenericType(targetType.GetGenericArguments());
            }
            else
            {
                _type = type;
            }
            var attr = type.GetCustomAttribute <ConcreteImplementationAttribute>();

            Name = attr?.DisplayName ?? _type.Name.Humanize();
        }
Пример #22
0
 public MethodWizard(IForm parentForm, string title, MethodBase method, HashSet <string> hideProperties, Dictionary <string, object> overrideDefaults,
                     Action <IPanel> addUiExternal, AGSEditor editor, Func <Dictionary <string, ValueModel>, Task <bool> > validate)
 {
     _parentForm           = parentForm;
     _title                = title;
     _method               = method;
     _idSuffix             = $"_{_method.DeclaringType}_{_method.Name}_{_index++}";
     _editor               = editor;
     _validate             = validate;
     _layer                = new AGSRenderLayer(AGSLayers.UI.Z - 1);
     _hideProperties       = hideProperties;
     _overrideDefaults     = overrideDefaults;
     _addUiExternal        = addUiExternal;
     _taskCompletionSource = new TaskCompletionSource <Dictionary <string, ValueModel> >();
 }
Пример #23
0
        public void Init(IGameFactory factory, AGSEditor editor)
        {
            _pointer       = factory.UI.GetLabel("PointerCursor", "", 25f, 25f, 0f, 0f, config: FontIcons.IconConfig, addToUi: false);
            _pointer.Text  = FontIcons.Pointer;
            _pointer.Pivot = new PointF(0.29f, 0.83f);

            var toolbarHeight = _resolution.Height / 20f;

            _toolbar              = factory.UI.GetPanel("GameToolbar", _resolution.Width / 2f, toolbarHeight, _resolution.Width / 2f, _resolution.Height - toolbarHeight);
            _toolbar.Pivot        = new PointF(0.5f, 0f);
            _toolbar.Tint         = GameViewColors.SubPanel;
            _toolbar.RenderLayer  = new AGSRenderLayer(-99999, independentResolution: _resolution);
            _toolbar.ClickThrough = false;
            _toolbar.Border       = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 3f, true);

            var         idle         = new ButtonAnimation(null, FontIcons.ButtonConfig, GameViewColors.Button);
            var         hover        = new ButtonAnimation(null, AGSTextConfig.ChangeColor(FontIcons.ButtonConfig, Colors.Yellow, Colors.White, 0f), GameViewColors.HoveredButton);
            var         pushed       = new ButtonAnimation(null, FontIcons.ButtonConfig, GameViewColors.PushedButton);
            const float buttonWidth  = 50f;
            float       buttonHeight = _toolbar.Height * 3 / 4f;
            float       buttonY      = _toolbar.Height / 2f;
            float       buttonX      = _toolbar.Width / 2f;

            _playPauseButton             = factory.UI.GetButton("PlayPauseGameButton", idle, hover, pushed, buttonX, buttonY, _toolbar, width: buttonWidth, height: buttonHeight);
            _playPauseButton.Text        = FontIcons.Pause;
            _playPauseButton.Pivot       = new PointF(0.5f, 0.5f);
            _playPauseButton.RenderLayer = _toolbar.RenderLayer;
            _playPauseButton.MouseClicked.Subscribe(onPlayPauseClicked);

            _fpsLabel       = factory.UI.GetLabel("FPS Label (Editor)", "", 30f, 25f, 0f, _playPauseButton.Y, _toolbar, config: factory.Fonts.GetTextConfig(autoFit: AutoFit.LabelShouldFitText, font: _font));
            _fpsLabel.Pivot = new PointF(0f, 0.5f);
            _fpsLabel.TextBackgroundVisible = false;
            _fpsLabel.RenderLayer           = _toolbar.RenderLayer;
            _fpsLabel.Enabled = true;
            _fpsLabel.MouseEnter.Subscribe(_ => _fpsLabel.Tint = Colors.Indigo);
            _fpsLabel.MouseLeave.Subscribe(_ => _fpsLabel.Tint = Colors.IndianRed.WithAlpha(125));

            _mousePosLabel = factory.UI.GetLabel("Mouse Position Label (Editor)", "", 1f, 1f, 120f, _playPauseButton.Y, _toolbar, config: factory.Fonts.GetTextConfig(autoFit: AutoFit.LabelShouldFitText, font: _font));
            _mousePosLabel.TextBackgroundVisible = false;
            _mousePosLabel.Pivot       = new PointF(0f, 0.5f);
            _mousePosLabel.RenderLayer = _toolbar.RenderLayer;

            _hotspotLabel = factory.UI.GetLabel("Debug Hotspot Label (Editor)", "", 250f, _fpsLabel.Height, _toolbar.Width, _playPauseButton.Y, _toolbar, config: factory.Fonts.GetTextConfig(alignment: Alignment.TopRight,
                                                                                                                                                                                              autoFit: AutoFit.TextShouldFitLabel, font: _font));
            _hotspotLabel.TextBackgroundVisible = false;
            _hotspotLabel.Pivot       = new PointF(1f, 0.5f);
            _hotspotLabel.RenderLayer = _toolbar.RenderLayer;
        }
Пример #24
0
        public GameCanvas(AGSEditor editor, GameToolbar toolbar, GameDebugTree tree)
        {
            _toolbar = toolbar;
            _tree    = tree;
            _editor  = editor;
            var canvasHitTest = new CanvasHitTest(editor);

            editor.CanvasHitTest = canvasHitTest;
            _menu                        = new CanvasMenu(editor, toolbar);
            _selectionMarker             = editor.Editor.Factory.Object.GetObject("SelectionMarker");
            _selectionMarker.Visible     = false;
            _selectionMarker.Border      = editor.Editor.Factory.Graphics.Borders.SolidColor(GameViewColors.HoveredText, 2f);
            _selectionMarker.RenderLayer = AGSLayers.UI;

            editor.Editor.State.UI.Add(_selectionMarker);
        }
Пример #25
0
        public DialogEditor(Dialog dialogToEdit, AGSEditor agsEditor)
        {
            InitializeComponent();
            _dialog    = dialogToEdit;
            _agsEditor = agsEditor;

            _extraMenu.Commands.Add(new MenuCommand(FIND_COMMAND, "Find...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(FIND_NEXT_COMMAND, "Find next", System.Windows.Forms.Keys.F3, "FindNextMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_COMMAND, "Replace...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_ALL_COMMAND, "Find All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_ALL_COMMAND, "Replace All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.E));

            scintillaEditor.SetAsDialog();
            scintillaEditor.AutoCompleteEnabled      = true;
            scintillaEditor.IgnoreLinesWithoutIndent = true;
            scintillaEditor.AutoSpaceAfterComma      = false;
            scintillaEditor.CallTipsEnabled          = true;
            scintillaEditor.FixedTypeForThisKeyword  = "Dialog";
            scintillaEditor.SetFillupKeys(Constants.AUTOCOMPLETE_ACCEPT_KEYS);
            //scintillaEditor.SetKeyWords(dialogKeyWords);
            scintillaEditor.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            scintillaEditor.SetClassNamesList(BuildCharacterKeywords());
            scintillaEditor.SetAutoCompleteKeyWords(Constants.SCRIPT_KEY_WORDS);
            scintillaEditor.SetAutoCompleteSource(_dialog);
            scintillaEditor.SetText(dialogToEdit.Script);


            flowLayoutPanel1.Controls.Remove(btnNewOption);
            foreach (DialogOption option in dialogToEdit.Options)
            {
                DialogOptionEditor optionEditor = new DialogOptionEditor(option);
                _optionPanes.Add(optionEditor);
                flowLayoutPanel1.Controls.Add(optionEditor);
            }
            flowLayoutPanel1.Controls.Add(btnNewOption);
            flowLayoutPanel1.Controls.Add(btnDeleteOption);

            if (_dialog.Options.Count >= Dialog.MAX_OPTIONS_PER_DIALOG)
            {
                btnNewOption.Visible = false;
            }
            if (_dialog.Options.Count < 1)
            {
                btnDeleteOption.Visible = false;
            }
        }
Пример #26
0
        public DialogEditor(Dialog dialogToEdit, AGSEditor agsEditor)
        {
            InitializeComponent();
            _dialog = dialogToEdit;
            _agsEditor = agsEditor;

            _extraMenu.Commands.Add(new MenuCommand(FIND_COMMAND, "Find...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(FIND_NEXT_COMMAND, "Find next", System.Windows.Forms.Keys.F3, "FindNextMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_COMMAND, "Replace...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_ALL_COMMAND, "Find All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_ALL_COMMAND, "Replace All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(new MenuCommand(GOTO_LINE_COMMAND, "Go To Line...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G));

            scintillaEditor.SetAsDialog();
            scintillaEditor.AutoCompleteEnabled = true;
            scintillaEditor.IgnoreLinesWithoutIndent = true;
            scintillaEditor.AutoSpaceAfterComma = false;
            scintillaEditor.CallTipsEnabled = true;
            scintillaEditor.FixedTypeForThisKeyword = "Dialog";
            scintillaEditor.SetFillupKeys(Constants.AUTOCOMPLETE_ACCEPT_KEYS);
            //scintillaEditor.SetKeyWords(dialogKeyWords);
            scintillaEditor.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            scintillaEditor.SetClassNamesList(BuildCharacterKeywords());
            scintillaEditor.SetAutoCompleteKeyWords(Constants.SCRIPT_KEY_WORDS);
            scintillaEditor.SetAutoCompleteSource(_dialog);
            scintillaEditor.SetText(dialogToEdit.Script);

            flowLayoutPanel1.Controls.Remove(btnNewOption);
            foreach (DialogOption option in dialogToEdit.Options)
            {
                DialogOptionEditor optionEditor = new DialogOptionEditor(option);
                _optionPanes.Add(optionEditor);
                flowLayoutPanel1.Controls.Add(optionEditor);
            }
            flowLayoutPanel1.Controls.Add(btnNewOption);
            flowLayoutPanel1.Controls.Add(btnDeleteOption);

            if (_dialog.Options.Count >= Dialog.MAX_OPTIONS_PER_DIALOG)
            {
                btnNewOption.Visible = false;
            }
            if (_dialog.Options.Count < 1)
            {
                btnDeleteOption.Visible = false;
            }
        }
Пример #27
0
        public static async Task Show(AGSEditor editor)
        {
            var gameSelector         = new ComboboxboxField("Game", "Game", "Editor");
            var entitySelector       = new TextboxField("Text to search");
            var propertyTypeSelector = new ComboboxboxField("Search By", nameof(IEntity.ID), nameof(ITextComponent.Text));
            var testTypeSelector     = new ComboboxboxField("Test By", "Includes", "Exact Match");
            var caseSensitive        = new CheckboxField("Case Sensitive");
            var simpleForm           = new SimpleForm(editor.Editor, gameSelector, entitySelector, propertyTypeSelector, testTypeSelector, caseSensitive);
            await simpleForm.ShowAsync("Find Object");

            if (entitySelector.Value == null)
            {
                return;
            }
            Debug.WriteLine($"Searching for {entitySelector.Value} ({propertyTypeSelector.Value}, {testTypeSelector.Value}, Case Sensitive={caseSensitive.Value}) in {gameSelector.Value}");
            var game    = gameSelector.Value == "Game" ? editor.Game : editor.Editor;
            var matches = game.State.All <IObject>().Where(e =>
            {
                var property = e.GetType().GetProperty(propertyTypeSelector.Value);
                if (property == null)
                {
                    return(false);
                }
                string value = property.GetValue(e)?.ToString();
                if (value == null)
                {
                    return(false);
                }
                string matchWith = entitySelector.Value;
                if (!caseSensitive.Value)
                {
                    value     = value.ToLowerInvariant();
                    matchWith = matchWith.ToLowerInvariant();
                }
                if (testTypeSelector.Value == "Exact Match")
                {
                    return(value == matchWith);
                }
                return(value.Contains(matchWith));
            });

            foreach (var match in matches)
            {
                Debug.WriteLine($"Found match: {(match, match.Position, match.WorldXY)}");
            }
            await AGSMessageBox.DisplayAsync($"Done. Results written to console.", editor.Editor);
        }
Пример #28
0
            public RotateHandle(ILabel handle, AGSEditor editor, IGameState state, IInput input, ActionManager actions, Direction direction)
            {
                _editor      = editor;
                _actions     = actions;
                _state       = state;
                _idleConfig  = handle.TextConfig;
                _hoverConfig = AGSTextConfig.ChangeColor(handle.TextConfig, Colors.Yellow, Colors.White, 0f);
                _direction   = direction;
                _input       = input;
                _handle      = handle;
                setIcon();
                _handle.Visible               = false;
                _handle.Enabled               = true;
                _handle.RenderLayer           = AGSLayers.UI;
                _handle.TextBackgroundVisible = false;
                _handle.MouseEnter.Subscribe(onMouseEnter);
                _handle.MouseDown.Subscribe(onMouseDown);
                _handle.MouseLeave.Subscribe(onMouseLeave);

                state.UI.Add(_handle);
            }
Пример #29
0
        public static void Run()
        {
            Resolver resolver = new Resolver(AGSGame.Device, new AGSGameSettings("MonoAGS Editor", new Size(1280, 800),
                                                                                 windowSize: new Size(1280, 800), windowState: WindowState.Normal, preserveAspectRatio: false));
            IGame game = AGSGame.Create(resolver);

            //Rendering the text at a 4 time higher resolution than the actual game, so it will still look sharp when maximizing the window.
            GLText.TextResolutionFactorX = 4;
            GLText.TextResolutionFactorY = 4;

            game.Events.OnLoad.Subscribe(async() =>
            {
                game.Factory.Resources.ResourcePacks.Add(new ResourcePack(new FileSystemResourcePack(AGSGame.Device.FileSystem, AGSGame.Device.Assemblies.EntryAssembly), 0));
                game.Factory.Resources.ResourcePacks.Add(new ResourcePack(new EmbeddedResourcesPack(AGSGame.Device.Assemblies.EntryAssembly), 1));
                game.Factory.Fonts.InstallFonts("Fonts/Font Awesome 5 Free-Solid-900.otf", "Fonts/Fira/FiraSans-Regular.ttf");
                FontIcons.Init(game.Factory.Fonts);
                var font = game.Factory.Fonts.LoadFontFromPath("Fonts/Fira/FiraSans-Regular.ttf", 14f, FontStyle.Regular);
                game.Settings.Defaults.Fonts.Text   = font;
                game.Settings.Defaults.Fonts.Speech = font;

                AGSEditor editor = resolver.Container.Resolve <AGSEditor>();
                editor.Editor    = game;

                game.Settings.Defaults.Skin = null;

                WelcomeScreen screen = new WelcomeScreen(editor);
                screen.Load();
                screen.Show();

                var room = game.Factory.Room.GetRoom("MainEditorRoom");
                ReflectionCache.Refresh();
                await game.State.ChangeRoomAsync(room);
            });

            game.Start();
        }
Пример #30
0
        public static void ExpandAroundGameObject(AGSEditor editor, IBoundingBoxComponent boxComponent, IDrawableInfoComponent drawable,
                                                  IImageComponent image, IObject objToExpand, bool updatePosition)
        {
            if (boxComponent == null || image == null)
            {
                return;
            }
            var box = boxComponent.WorldBoundingBox;

            objToExpand.Pivot = image.Pivot;
            var x = MathUtils.Lerp(0f, box.MinX, 1f, box.MaxX, image.Pivot.X);
            var y = MathUtils.Lerp(0f, box.MinY, 1f, box.MaxY, image.Pivot.Y);

            (x, y) = editor.ToEditorResolution(x, y, drawable);

            (var minX, var minY) = editor.ToEditorResolution(box.MinX, box.MinY, drawable);
            (var maxX, var maxY) = editor.ToEditorResolution(box.MaxX, box.MaxY, drawable);

            if (updatePosition)
            {
                objToExpand.Position = (x, y);
            }
            objToExpand.BaseSize = new SizeF(maxX - minX, maxY - minY);
        }
Пример #31
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.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();
        }
Пример #32
0
        public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor)
        {
            InitializeComponent();
            _agsEditor = agsEditor;

            _autocompleteUpdateHandler = new AutoComplete.BackgroundCacheUpdateStatusChangedHandler(AutoComplete_BackgroundCacheUpdateStatusChanged);
            AutoComplete.BackgroundCacheUpdateStatusChanged += _autocompleteUpdateHandler;
            _fileChangedHandler = new EditorEvents.FileChangedInGameFolderHandler(Events_FileChangedInGameFolder);
            Factory.Events.FileChangedInGameFolder += _fileChangedHandler;
            _mainWindowActivatedHandler = new EventHandler(GUIController_OnMainWindowActivated);
            Factory.GUIController.OnMainWindowActivated += _mainWindowActivatedHandler;

            _toolbarIcons.Add(new MenuCommand(CUT_COMMAND, "Cut", "CutIcon"));
            _toolbarIcons.Add(new MenuCommand(COPY_COMMAND, "Copy", "CopyIcon"));
            _toolbarIcons.Add(new MenuCommand(PASTE_COMMAND, "Paste", "PasteIcon"));
            _toolbarIcons.Add(new MenuCommand(UNDO_COMMAND, "Undo", "UndoIcon"));
            _toolbarIcons.Add(new MenuCommand(REDO_COMMAND, "Redo", "RedoIcon"));
            _extraMenu.Commands.Add(new MenuCommand(UNDO_COMMAND, "Undo", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z, "UndoMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REDO_COMMAND, "Redo", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y, "RedoMenuIcon"));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(CUT_COMMAND, "Cut", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X, "CutMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(COPY_COMMAND, "Copy", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C, "CopyMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(PASTE_COMMAND, "Paste", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V, "PasteMenuIcon"));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_COMMAND, "Find...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(FIND_NEXT_COMMAND, "Find next", System.Windows.Forms.Keys.F3, "FindNextMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_COMMAND, "Replace...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_ALL_COMMAND, "Find All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_ALL_COMMAND, "Replace All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(SHOW_AUTOCOMPLETE_COMMAND, "Show Autocomplete", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Space, "ShowAutocompleteMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(TOGGLE_BREAKPOINT_COMMAND, "Toggle Breakpoint", System.Windows.Forms.Keys.F9, "ToggleBreakpointMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(MATCH_BRACE_COMMAND, "Match Brace", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B));

            scintilla.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            UpdateStructHighlighting();

            // pressing ( [ or . will auto-complete
            scintilla.SetFillupKeys(Constants.AUTOCOMPLETE_ACCEPT_KEYS);

            scintilla.EnableLineNumbers();

            scintilla.IsModifiedChanged += new EventHandler(scintilla_IsModifiedChanged);
            scintilla.AttemptModify += new ScintillaWrapper.AttemptModifyHandler(scintilla_AttemptModify);
            scintilla.UpdateUI += new EventHandler(scintilla_UpdateUI);
            scintilla.TextModified += new ScintillaWrapper.TextModifiedHandler(scintilla_TextModified);
            scintilla.ConstructContextMenu += new ScintillaWrapper.ConstructContextMenuHandler(scintilla_ConstructContextMenu);
            scintilla.ActivateContextMenu += new ScintillaWrapper.ActivateContextMenuHandler(scintilla_ActivateContextMenu);
            scintilla.ToggleBreakpoint += new EventHandler<Scintilla.MarginClickEventArgs>(scintilla_ToggleBreakpoint);
            this.Resize += new EventHandler(ScriptEditor_Resize);

            if (!scriptToEdit.IsHeader)
            {
                scintilla.SetAutoCompleteSource(scriptToEdit);
            }

            scintilla.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            UpdateStructHighlighting();

            this.Script = scriptToEdit;
            _room = null;
            _roomNumber = 0;
        }
Пример #33
0
 public ColorMapper(AGSEditor editor)
 {
     _editor = editor;
 }
Пример #34
0
 public AGSEditorController(ComponentController componentController, AGSEditor agsEditor, GUIController guiController)
 {
     _componentController = componentController;
     _agsEditor = agsEditor;
     _guiController = guiController;
 }
Пример #35
0
        public ScriptEditor(Script scriptToEdit, AGSEditor agsEditor)
        {
            InitializeComponent();
            _agsEditor = agsEditor;

            _autocompleteUpdateHandler = new AutoComplete.BackgroundCacheUpdateStatusChangedHandler(AutoComplete_BackgroundCacheUpdateStatusChanged);
            AutoComplete.BackgroundCacheUpdateStatusChanged += _autocompleteUpdateHandler;
            _fileChangedHandler = new EditorEvents.FileChangedInGameFolderHandler(Events_FileChangedInGameFolder);
            Factory.Events.FileChangedInGameFolder      += _fileChangedHandler;
            _mainWindowActivatedHandler                  = new EventHandler(GUIController_OnMainWindowActivated);
            Factory.GUIController.OnMainWindowActivated += _mainWindowActivatedHandler;

            _toolbarIcons.Add(new MenuCommand(CUT_COMMAND, "Cut", "CutIcon"));
            _toolbarIcons.Add(new MenuCommand(COPY_COMMAND, "Copy", "CopyIcon"));
            _toolbarIcons.Add(new MenuCommand(PASTE_COMMAND, "Paste", "PasteIcon"));
            _toolbarIcons.Add(new MenuCommand(UNDO_COMMAND, "Undo", "UndoIcon"));
            _toolbarIcons.Add(new MenuCommand(REDO_COMMAND, "Redo", "RedoIcon"));
            _extraMenu.Commands.Add(new MenuCommand(UNDO_COMMAND, "Undo", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z, "UndoMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REDO_COMMAND, "Redo", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y, "RedoMenuIcon"));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(CUT_COMMAND, "Cut", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X, "CutMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(COPY_COMMAND, "Copy", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C, "CopyMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(PASTE_COMMAND, "Paste", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V, "PasteMenuIcon"));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_COMMAND, "Find...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(FIND_NEXT_COMMAND, "Find next", System.Windows.Forms.Keys.F3, "FindNextMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_COMMAND, "Replace...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(FIND_ALL_COMMAND, "Find All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F, "FindMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(REPLACE_ALL_COMMAND, "Replace All...", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.E));
            _extraMenu.Commands.Add(MenuCommand.Separator);
            _extraMenu.Commands.Add(new MenuCommand(SHOW_AUTOCOMPLETE_COMMAND, "Show Autocomplete", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Space, "ShowAutocompleteMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(TOGGLE_BREAKPOINT_COMMAND, "Toggle Breakpoint", System.Windows.Forms.Keys.F9, "ToggleBreakpointMenuIcon"));
            _extraMenu.Commands.Add(new MenuCommand(MATCH_BRACE_COMMAND, "Match Brace", System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B));

            scintilla.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            UpdateStructHighlighting();

            // pressing ( [ or . will auto-complete
            scintilla.SetFillupKeys(Constants.AUTOCOMPLETE_ACCEPT_KEYS);

            scintilla.EnableLineNumbers();

            scintilla.IsModifiedChanged    += new EventHandler(scintilla_IsModifiedChanged);
            scintilla.AttemptModify        += new ScintillaWrapper.AttemptModifyHandler(scintilla_AttemptModify);
            scintilla.UpdateUI             += new EventHandler(scintilla_UpdateUI);
            scintilla.TextModified         += new ScintillaWrapper.TextModifiedHandler(scintilla_TextModified);
            scintilla.ConstructContextMenu += new ScintillaWrapper.ConstructContextMenuHandler(scintilla_ConstructContextMenu);
            scintilla.ActivateContextMenu  += new ScintillaWrapper.ActivateContextMenuHandler(scintilla_ActivateContextMenu);
            scintilla.ToggleBreakpoint     += new EventHandler <Scintilla.MarginClickEventArgs>(scintilla_ToggleBreakpoint);
            this.Resize += new EventHandler(ScriptEditor_Resize);

            if (!scriptToEdit.IsHeader)
            {
                scintilla.SetAutoCompleteSource(scriptToEdit);
            }

            scintilla.SetKeyWords(Constants.SCRIPT_KEY_WORDS);
            UpdateStructHighlighting();

            this.Script = scriptToEdit;
            _room       = null;
            _roomNumber = 0;
        }
Пример #36
0
 public AGSEditorController(ComponentController componentController, AGSEditor agsEditor, GUIController guiController)
 {
     _componentController = componentController;
     _agsEditor           = agsEditor;
     _guiController       = guiController;
 }
Пример #37
0
        public void Initialize(AGSEditor agsEditor)
        {
            if (_mainForm == null)
            {
                _agsEditor = agsEditor;
                _interactiveTasks = new InteractiveTasks(_agsEditor.Tasks);
                _mainForm = new frmMain();
                SetEditorWindowSizeFromRegistry();
                _treeManager = new ProjectTree(_mainForm.projectPanel.projectTree);
                _treeManager.OnContextMenuClick += new ProjectTree.MenuClickHandler(_mainForm_OnMenuClick);
                _toolBarManager = new ToolBarManager(_mainForm.toolStrip);
                WindowsMenuManager windowsMenuManager = new WindowsMenuManager(_mainForm.windowsToolStripMenuItem,
                    _mainForm.GetStartupPanes(), _mainForm.mainContainer);
                _menuManager = new MainMenuManager(_mainForm.mainMenu, windowsMenuManager);
                _mainForm.OnEditorShutdown += new frmMain.EditorShutdownHandler(_mainForm_OnEditorShutdown);
                _mainForm.OnPropertyChanged += new frmMain.PropertyChangedHandler(_mainForm_OnPropertyChanged);
                _mainForm.OnPropertyObjectChanged += new frmMain.PropertyObjectChangedHandler(_mainForm_OnPropertyObjectChanged);
                _mainForm.OnActiveDocumentChanged += new frmMain.ActiveDocumentChangedHandler(_mainForm_OnActiveDocumentChanged);
                _mainForm.OnMainWindowActivated += new EventHandler(_mainForm_OnMainWindowActivated);
                _menuManager.OnMenuClick += new MainMenuManager.MenuClickHandler(_mainForm_OnMenuClick);
                AutoComplete.BackgroundCacheUpdateStatusChanged += new AutoComplete.BackgroundCacheUpdateStatusChangedHandler(AutoComplete_BackgroundCacheUpdateStatusChanged);
                SystemEvents.DisplaySettingsChanged += new EventHandler(SystemEvents_DisplaySettingsChanging);

                RegisterIcon("GameIcon", Resources.ResourceManager.GetIcon("game.ico"));
                RegisterIcon("CompileErrorIcon", Resources.ResourceManager.GetIcon("eventlogError.ico"));
                RegisterIcon("CompileWarningIcon", Resources.ResourceManager.GetIcon("eventlogWarn.ico"));
                _mainForm.SetTreeImageList(_imageList);
                _mainForm.mainMenu.ImageList = _imageList;
                _mainForm.pnlOutput.SetImageList(_imageList);
                //_mainForm.SetProjectTreeLocation(_agsEditor.Preferences.ProjectTreeOnRight);

                ViewUIEditor.ViewSelectionGUI = new ViewUIEditor.ViewSelectionGUIType(ShowViewChooserFromPropertyGrid);
                SpriteSelectUIEditor.SpriteSelectionGUI = new SpriteSelectUIEditor.SpriteSelectionGUIType(ShowSpriteChooserFromPropertyGrid);
                CustomPropertiesUIEditor.CustomPropertiesGUI = new CustomPropertiesUIEditor.CustomPropertiesGUIType(ShowPropertiesEditorFromPropertyGrid);
                PropertyTabInteractions.UpdateEventName = new PropertyTabInteractions.UpdateEventNameHandler(PropertyTabInteractions_UpdateEventName);
                ScriptFunctionUIEditor.OpenScriptEditor = new ScriptFunctionUIEditor.OpenScriptEditorHandler(ScriptFunctionUIEditor_OpenScriptEditor);
                ScriptFunctionUIEditor.CreateScriptFunction = new ScriptFunctionUIEditor.CreateScriptFunctionHandler(ScriptFunctionUIEditor_CreateScriptFunction);
                RoomMessagesUIEditor.ShowRoomMessagesEditor = new RoomMessagesUIEditor.RoomMessagesEditorType(ShowRoomMessageEditorFromPropertyGrid);
                CustomResolutionUIEditor.CustomResolutionSetGUI = new CustomResolutionUIEditor.CustomResolutionGUIType(ShowCustomResolutionChooserFromPropertyGrid);
            }
        }
Пример #38
0
 public CanvasHitTest(AGSEditor editor)
 {
     _editor = editor;
 }