Ejemplo n.º 1
0
 public GameDebugTree(IGame game, IRenderLayer layer, InspectorPanel inspector)
 {
     _game         = game;
     _inspector    = inspector;
     _addedObjects = new AGSConcurrentHashSet <string>(100, false);
     _layer        = layer;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 public GameDebugView(IGame game, KeyboardBindings keyboardBindings)
 {
     _game             = game;
     _keyboardBindings = keyboardBindings;
     _layer            = new AGSRenderLayer(AGSLayers.UI.Z - 1, independentResolution: new Size(1800, 1200));
     _inspector        = new InspectorPanel(game, _layer);
     _debugTree        = new GameDebugTree(game, _layer, _inspector);
     _displayList      = new GameDebugDisplayList(game, _layer);
     _input            = game.Input;
     keyboardBindings.OnKeyboardShortcutPressed.Subscribe(onShortcutKeyPressed);
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
        public void Load()
        {
            float center  = _editor.ToEditorResolution(_editor.Game.Settings.VirtualResolution.Width / 2f, 0f, null).x;
            var   factory = _editor.Editor.Factory;

            _parent             = factory.UI.GetPanel($"MethodWizardPanel_{_method.Name}", 600f, 400f, -1000f, 100f, addToUi: false);
            _parent.RenderLayer = _layer;
            _parent.Tint        = GameViewColors.Panel;
            _parent.Border      = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 3f);
            var host = new AGSComponentHost(_editor.GameResolver);

            host.Init(_parent, typeof(AGSComponentHost));
            _modal = host.AddComponent <IModalWindowComponent>();
            _modal.GrabFocus();
            var box = _parent.AddComponent <IBoundingBoxWithChildrenComponent>();

            box.IncludeSelf = false;

            _parent.Visible = false;
            _editor.Editor.State.UI.Add(_parent);

            var inspectorParent = factory.UI.GetPanel("WizardInspectorParentPanel", WIDTH, 300f, MARGIN_HORIZONTAL, 0f, _parent);

            inspectorParent.Tint  = Colors.Transparent;
            inspectorParent.Pivot = (0f, 1f);

            _inspector = new InspectorPanel(_editor, _layer, new ActionManager(), "Wizard");
            _inspector.Load(inspectorParent);
            _inspector.Inspector.SortValues = false;

            var methodDescriptor = new MethodTypeDescriptor(_method, _hideProperties, _overrideDefaults);

            _inspector.Show(methodDescriptor);

            _addUiExternal?.Invoke(_parent);
            addButtons();

            var layout = _parent.AddComponent <IStackLayoutComponent>();

            layout.AbsoluteSpacing = -30f;
            layout.LayoutAfterCrop = true;

            box.OnBoundingBoxWithChildrenChanged.Subscribe(() =>
            {
                layout.StartLocation = box.BoundingBoxWithChildren.Height + MARGIN_VERTICAL;
                _parent.BaseSize     = (box.BoundingBoxWithChildren.Width + MARGIN_HORIZONTAL * 2f, box.BoundingBoxWithChildren.Height + MARGIN_VERTICAL * 2f);
                _parent.X            = center - _parent.BaseSize.Width / 2f;
            });

            layout.StartLayout();
        }
Ejemplo n.º 6
0
        public void Load()
        {
            float center  = _editor.ToEditorResolution(_editor.Game.Settings.VirtualResolution.Width / 2f, 0f, null).x;
            var   factory = _editor.Editor.Factory;
            var   title   = _parentForm == null ? _title : $"{_parentForm.Header.Text}->{_title}";

            _form         = factory.UI.GetForm($"MethodWizardPanel{_idSuffix}", title, 600f, 30f, 400f, -1000f, 100f, addToUi: false);
            _form.Visible = false;

            var host = new AGSComponentHost(_editor.GameResolver);

            host.Init(_form.Contents, typeof(AGSComponentHost));
            _modal = host.AddComponent <IModalWindowComponent>();
            _modal.GrabFocus();
            var box = _form.Contents.AddComponent <IBoundingBoxWithChildrenComponent>();

            box.IncludeSelf = false;

            setupForm(_form.Contents, factory);
            setupForm(_form.Header, factory);

            var layoutPanel = factory.UI.GetPanel($"WizardLayoutPanel{_idSuffix}", 1f, 1f, 0f, 0f, _form.Contents);

            layoutPanel.Tint = Colors.Transparent;

            var inspectorParent = factory.UI.GetPanel($"WizardInspectorParentPanel{_idSuffix}", WIDTH, 300f, MARGIN_HORIZONTAL, 0f, layoutPanel);

            inspectorParent.Tint  = Colors.Transparent;
            inspectorParent.Pivot = (0f, 1f);

            _inspector = new InspectorPanel(_editor, _layer, new ActionManager(), $"Wizard{_idSuffix}");
            _inspector.Load(inspectorParent, _form);
            _inspector.Inspector.SortValues = false;

            var methodDescriptor = new MethodTypeDescriptor(_method, _hideProperties, _overrideDefaults);

            if (!_inspector.Show(methodDescriptor) && _addUiExternal == null)
            {
                closeForm(new Dictionary <string, ValueModel>());
                return;
            }

            _addUiExternal?.Invoke(layoutPanel);
            addButtons(layoutPanel);

            var layout = layoutPanel.AddComponent <IStackLayoutComponent>();

            layout.AbsoluteSpacing = -30f;
            layout.LayoutAfterCrop = true;

            box.OnBoundingBoxWithChildrenChanged.Subscribe(() =>
            {
                layoutPanel.Y           = box.BoundingBoxWithChildren.Height + MARGIN_VERTICAL;
                _form.Contents.BaseSize = (_form.Contents.BaseSize.Width, box.BoundingBoxWithChildren.Height + MARGIN_VERTICAL * 2f);
                _form.Width             = box.BoundingBoxWithChildren.Width + MARGIN_HORIZONTAL * 2f;
                _form.X = center - _form.Contents.BaseSize.Width / 2f;
            });

            layout.StartLayout();
            layout.ForceRefreshLayout();
        }