Пример #1
0
        protected override void CellsCreated()
        {
            if (_commonResources == null)
            {
                return;
            }

            var cellSize = new Vector2I(42, 42);

            for (var x = 0; x < UiGrid.GetLength(0); x++)
            {
                for (var y = 0; y < UiGrid.GetLength(1); y++)
                {
                    var cell = UiGrid[x, y];

                    cell.CustomBackground      = _commonResources.StInventorySlot;
                    cell.CustomBackgroundHover = _commonResources.StInventorySlotHover;
                    cell.Bounds                = new S33M3CoreComponents.GUI.Nuclex.UniRectangle(GridOffset.X + x * cellSize.X, GridOffset.Y + y * cellSize.Y, 42, 42);
                    cell.DrawIconsGroupId      = 5;
                    cell.DrawIconsActiveCellId = 6;
                }
            }

            foreach (var ingredientCell in _ingredientCells)
            {
                ingredientCell.CustomBackground      = _commonResources.StInventorySlot;
                ingredientCell.CustomBackgroundHover = _commonResources.StInventorySlotHover;
                ingredientCell.DrawIconsGroupId      = 5;
                ingredientCell.DrawIconsActiveCellId = 6;
            }
        }
Пример #2
0
        private void setupUI()
        {
            gridOne = new UiGrid(assetMngr);
            OSTI    = new OnScreenTextInput();

            continueBtn = UiMngr.createUIObj(continueText, new InstructPtr(uiContinue), new Tuple <int, int>(0, -39), (SpaceMngr.scale / 23f));

            //Profile Select Test
            profileSelBtn    = UiMngr.createUIObj(blank, new InstructPtr(uiSelectList), new Tuple <int, int>(0, 30), (SpaceMngr.scale / 2f));
            createProfileBtn = UiMngr.createUIObj(continueText, new InstructPtr(createProfile), new Tuple <int, int>(0, -50), (SpaceMngr.scale / 23f));
        }
Пример #3
0
        public Vector3Control()
        {
            UiGrid grid = new UiGrid();

            grid.SetCols(6);
            grid.ColumnDefinitions[0].Width = GridLength.Auto;
            grid.ColumnDefinitions[2].Width = GridLength.Auto;
            grid.ColumnDefinitions[4].Width = GridLength.Auto;

            TextBlock xLabel = grid.AddUiElement(new TextBlock {
                Text = "x:"
            }, 0, 0);

            xLabel.Margin = new Thickness(3, 3, 5, 3);

            _x               = grid.AddUiElement(new SingleUpDown(), 0, 1);
            _x.Value         = 0;
            _x.Increment     = 0.5f;
            _x.FormatString  = "F3";
            _x.ValueChanged += XChanged;
            _x.Margin        = new Thickness(3);

            TextBlock yLabel = grid.AddUiElement(new TextBlock {
                Text = "y:"
            }, 0, 2);

            yLabel.Margin = new Thickness(10, 3, 5, 3);

            _y               = grid.AddUiElement(new SingleUpDown(), 0, 3);
            _y.Value         = 0;
            _y.Increment     = 0.5f;
            _y.FormatString  = "F3";
            _y.ValueChanged += YChanged;
            _y.Margin        = new Thickness(3);

            TextBlock zLabel = grid.AddUiElement(new TextBlock {
                Text = "z:"
            }, 0, 4);

            zLabel.Margin = new Thickness(10, 3, 5, 3);

            _z               = grid.AddUiElement(new SingleUpDown(), 0, 5);
            _z.Value         = 0;
            _z.Increment     = 0.5f;
            _z.FormatString  = "F3";
            _z.ValueChanged += ZChanged;
            _z.Margin        = new Thickness(3);

            this.Content = grid;
        }
Пример #4
0
        //Profile Selection List
        private void setProfileSelListUI()
        {
            uiProfilePtr profileFunc = new uiProfilePtr(uiProfile);

            gridProfileSel = new UiGrid(assetMngr);

            gridProfileSel.createGrid(1, profileMngr.getProfileNum()); Console.WriteLine("profile num: ");

            int profilePos = 0;
            int position   = 50;

            foreach (KeyValuePair <string, ProfileMngr.Profile> profile in profileMngr.profileLib)
            {
                string         profileName        = profile.Value.profileName;
                RenderTarget2D renderTargetString = new RenderTarget2D(assetMngr.gDevice, 2500, 200);

                assetMngr.spriteBatch.Begin();
                assetMngr.spriteBatch.DrawString(miramo, profileName, Vector2.Zero, Color.White, 0f, Vector2.Zero, 10f, new SpriteEffects(), 0f);

                assetMngr.gDevice.SetRenderTarget(renderTargetString);

                Texture2D profileNameText = (Texture2D)renderTargetString;

                assetMngr.gDevice.Clear(new Color(0, 0, 0, 0));
                assetMngr.spriteBatch.End();

                UIObj profileBtn = UiMngr.createUIObj(profileName, profileNameText, profileFunc, new Tuple <int, int>(0, position), (SpaceMngr.scale / 23f));

                gridProfileSel.setGrid(profileBtn, 0, profilePos);

                profilePos = profilePos + 1;
                position   = position - 10;
            }

            assetMngr.gDevice.SetRenderTarget(null);

            firstPass = false;
        }
Пример #5
0
        public UiRectPositionControl()
        {
            UiGrid grid = new UiGrid();

            grid.SetCols(4);
            grid.ColumnDefinitions[0].Width = GridLength.Auto;
            grid.ColumnDefinitions[2].Width = GridLength.Auto;

            TextBlock xLabel = grid.AddUiElement(new TextBlock {
                Text = "x:"
            }, 0, 0);

            xLabel.Margin = new Thickness(3, 3, 5, 3);

            _relative               = grid.AddUiElement(new SingleUpDown(), 0, 1);
            _relative.Value         = 0;
            _relative.Increment     = 0.1f;
            _relative.FormatString  = "F3";
            _relative.ValueChanged += RelativeChanged;
            _relative.Margin        = new Thickness(3);

            TextBlock yLabel = grid.AddUiElement(new TextBlock {
                Text = "y:"
            }, 0, 2);

            yLabel.Margin = new Thickness(10, 3, 5, 3);

            _absolute               = grid.AddUiElement(new IntegerUpDown(), 0, 3);
            _absolute.Value         = 0;
            _absolute.Increment     = 1;
            _absolute.FormatString  = "F3";
            _absolute.ValueChanged += AbsoluteChanged;
            _absolute.Margin        = new Thickness(3);

            this.Content = grid;
        }
Пример #6
0
        public RectControl()
        {
            UiGrid grid = new UiGrid();

            grid.SetCols(8);
            grid.ColumnDefinitions[0].Width = GridLength.Auto;
            grid.ColumnDefinitions[2].Width = GridLength.Auto;
            grid.ColumnDefinitions[4].Width = GridLength.Auto;
            grid.ColumnDefinitions[6].Width = GridLength.Auto;

            TextBlock xLabel = grid.AddUiElement(new TextBlock {
                Text = "x:"
            }, 0, 0);

            xLabel.Margin = new Thickness(3, 3, 5, 3);

            _x               = grid.AddUiElement(new SingleUpDown(), 0, 1);
            _x.Value         = 0;
            _x.Increment     = 0.5f;
            _x.FormatString  = "F3";
            _x.ValueChanged += XChanged;
            _x.Margin        = new Thickness(3);

            TextBlock yLabel = grid.AddUiElement(new TextBlock {
                Text = "y:"
            }, 0, 2);

            yLabel.Margin = new Thickness(10, 3, 5, 3);

            _y               = grid.AddUiElement(new SingleUpDown(), 0, 3);
            _y.Value         = 0;
            _y.Increment     = 0.5f;
            _y.FormatString  = "F3";
            _y.ValueChanged += YChanged;
            _y.Margin        = new Thickness(3);

            TextBlock wLabel = grid.AddUiElement(new TextBlock {
                Text = "width:"
            }, 0, 6);

            wLabel.Margin = new Thickness(10, 3, 5, 3);

            _w               = grid.AddUiElement(new SingleUpDown(), 0, 7);
            _w.Value         = 0;
            _w.Increment     = 0.5f;
            _w.FormatString  = "F3";
            _w.ValueChanged += WChanged;
            _w.Margin        = new Thickness(3);

            TextBlock hLabel = grid.AddUiElement(new TextBlock {
                Text = "height:"
            }, 0, 4);

            hLabel.Margin = new Thickness(10, 3, 5, 3);

            _h               = grid.AddUiElement(new SingleUpDown(), 0, 5);
            _h.Value         = 0;
            _h.Increment     = 0.5f;
            _h.FormatString  = "F3";
            _h.ValueChanged += HChanged;
            _h.Margin        = new Thickness(3);

            this.Content = grid;
        }
Пример #7
0
        public UiEncodingWindow()
        {
            #region Construct

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ResizeMode            = ResizeMode.CanMinimize;
            Width  = 1024;
            Height = 768;

            UiGrid root = UiGridFactory.Create(4, 1);
            {
                root.RowDefinitions[0].Height = GridLength.Auto;
                root.RowDefinitions[2].Height = GridLength.Auto;
                root.RowDefinitions[3].Height = GridLength.Auto;

                _comboBox = UiComboBoxFactory.Create();
                {
                    _comboBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    _comboBox.Margin            = new Thickness(3);
                    _comboBox.DisplayMemberPath = "DisplayName";
                    _comboBox.SelectionChanged += OnComboBoxItemChanged;
                    root.AddUiElement(_comboBox, 0, 0);
                }

                _editViewport = new UiDxViewport();
                {
                    _editViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    _editViewport.VerticalAlignment   = VerticalAlignment.Stretch;

                    _editViewport.DrawSprites    += OnEditViewportDrawSprites;
                    _editViewport.DrawPrimitives += OnEditViewportDrawPrimitives;

                    _editViewport.DxControl.Control.MouseDown += OnDxControlElementMouseDown;
                    _editViewport.DxControl.Control.MouseUp   += OnDxControlElementMouseUp;
                    _editViewport.DxControl.Control.MouseMove += OnDxControlElementMouseMove;

                    root.AddUiElement(_editViewport, 1, 0);
                }

                UiGrid previewGroup = UiGridFactory.Create(2, 2);
                {
                    previewGroup.RowDefinitions[0].Height   = GridLength.Auto;
                    previewGroup.ColumnDefinitions[1].Width = GridLength.Auto;

                    _previewViewport = new UiDxViewport();
                    {
                        _previewViewport.Height = 200;
                        _previewViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                        _previewViewport.VerticalAlignment   = VerticalAlignment.Stretch;

                        _previewViewport.DrawSprites += OnPreviewViewportDraw;
                        _previewViewport.DxControl.RenderContainer.BackBuffer.BackgroundColor = Colors.Black;

                        previewGroup.AddUiElement(_previewViewport, 0, 0, 2);
                    }

                    UiEncodingLabeledNumber scale = new UiEncodingLabeledNumber("Масштаб:", 200, 100, 400, OnScaleValueChanged);
                    {
                        scale.Value = 100;
                        scale.NumberControl.Increment = 25;
                        previewGroup.AddUiElement(scale, 0, 1);
                    }

                    UiTextBox textBox = UiTextBoxFactory.Create();
                    {
                        textBox.Text         = _previewText;
                        textBox.TextChanged += OnPreviewTextChanged;
                        previewGroup.AddUiElement(textBox, 1, 1);
                    }

                    root.AddUiElement(previewGroup, 2, 0);
                }

                _charactersControl = new UiEncodingCharactersControl();
                {
                    root.AddUiElement(_charactersControl, 3, 0);
                }

                UiButton button = UiButtonFactory.Create("OK");
                {
                    button.Width  = 70;
                    button.Margin = new Thickness(3);
                    button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    button.Click += (s, a) => DialogResult = true;
                    root.AddUiElement(button, 3, 0);
                }
            }
            Content = root;

            _editViewport.DxControl.RenderContainer.Reseted += ResetBurshes;
            ResetBurshes(_editViewport.DxControl.RenderContainer);

            Thread movingThread = new Thread(MovingThread);
            movingThread.Start();

            Activated += OnWindowActivated;
            Closing   += (s, e) => ClosingEvent.Set();
            Closing   += OnWindowClosing;

            #endregion
        }