示例#1
0
        public UiGameFilePreviewZtr()
        {
            #region Constructor

            _textBox = new UiTextBox {TextWrapping = TextWrapping.Wrap, AcceptsReturn = true, IsReadOnly = true, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto};
            AddUiElement(_textBox, 0, 0);

            #endregion
        }
示例#2
0
        public UiGameFilePreviewZtr()
        {
            #region Constructor

            _textBox = new UiTextBox {
                TextWrapping = TextWrapping.Wrap, AcceptsReturn = true, IsReadOnly = true, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };
            AddUiElement(_textBox, 0, 0);

            #endregion
        }
        public UiGameFileCommanderSettingsWindow(bool isExtracting)
        {
            #region Construct

            SizeToContent = SizeToContent.WidthAndHeight;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowStyle = WindowStyle.None;

            UiGrid root = UiGridFactory.Create(3, 1);
            {
                Thickness margin = new Thickness(3);

                UiStackPanel maskPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    UiTextBlock maskLabel = UiTextBlockFactory.Create("Маска: ");
                    {
                        maskLabel.Margin = margin;
                        maskLabel.VerticalAlignment = VerticalAlignment.Center;
                        maskPanel.AddUiElement(maskLabel);
                    }

                    _wildcardBox = UiTextBoxFactory.Create("*");
                    {
                        _wildcardBox.Width = 300;
                        _wildcardBox.Margin = margin;
                        maskPanel.AddUiElement(_wildcardBox);
                    }

                    root.AddUiElement(maskPanel, 0, 0);
                }

                UiStackPanel settingsPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    if (!isExtracting)
                    {
                        _compressBox = UiCheckBoxFactory.Create("Сжать", false);
                        {
                            _compressBox.Margin = margin;
                            _compressBox.IsThreeState = true;
                            _compressBox.IsChecked = null;
                            settingsPanel.AddUiElement(_compressBox);
                        }
                    }

                    _convertBox = UiCheckBoxFactory.Create("Конвертировать", false);
                    {
                        _convertBox.Margin = margin;
                        _convertBox.IsThreeState = true;
                        _convertBox.IsChecked = null;
                        settingsPanel.AddUiElement(_convertBox);
                    }

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

                UiStackPanel buttonsPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    buttonsPanel.HorizontalAlignment = HorizontalAlignment.Right;

                    UiButton okButton = UiButtonFactory.Create("OK");
                    {
                        okButton.Width = 100;
                        okButton.Margin = margin;
                        okButton.Click += OnOkButtonClick;
                        buttonsPanel.AddUiElement(okButton);
                    }

                    UiButton cancelButton = UiButtonFactory.Create("Отмена");
                    {
                        cancelButton.Width = 100;
                        cancelButton.Margin = margin;
                        cancelButton.Click += OnCancelButtonClick;
                        buttonsPanel.AddUiElement(cancelButton);
                    }

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

            Content = root;

            #endregion
        }
示例#4
0
        public QuestionPopUp(string[] questionDetails)
        {
            QuestionDetails = questionDetails;
            correctAnsID = questionDetails[4];

            QuestionBox = new UiTextBox(Art.UiFont, questionDetails[0], new Vector2(250, 150), Color.White, Art.TextBoxBackGround, false);
            CorrectBox = new UiTextBox(Art.UiFont, "Correct! A soldier joins your cause!\n\nClick to continue", new Vector2(250, 150), Color.White, Art.TextBoxBackGround, false);
            WrongBox = new UiTextBox(Art.UiFont, "Wrong! Better luck next time!\n\nClick to continue", new Vector2(250, 150), Color.White, Art.TextBoxBackGround, false);
            Answers.Add(new UiButton(Art.UiFont, new Vector2(350, 400), new Vector2(300, 100), Art.TextBoxBackGround, Art.ButtonEffectTexture, "Ans1", true));
            Answers.Add(new UiButton(Art.UiFont, new Vector2(350, 520), new Vector2(300, 100), Art.TextBoxBackGround, Art.ButtonEffectTexture, "Ans2", true));
            Answers.Add(new UiButton(Art.UiFont, new Vector2(350, 640), new Vector2(300, 100), Art.TextBoxBackGround, Art.ButtonEffectTexture, "Ans3", true));

            QuestionBox.TextBoxSize = new Vector2(500, 200);
            QuestionBox.StringOffset = new Vector2(10, 0);
            QuestionBox.LineWrapper();

            CorrectBox.TextBoxSize = new Vector2(500, 200);
            CorrectBox.StringOffset = new Vector2(10, 0);
            CorrectBox.LineWrapper();

            WrongBox.TextBoxSize = new Vector2(500, 200);
            WrongBox.StringOffset = new Vector2(10, 0);
            WrongBox.LineWrapper();


            Answers[0].StringText = questionDetails[1];
            Answers[0].TextBoxInfo = "An answer box.";
            Answers[1].StringText = questionDetails[2];
            Answers[1].TextBoxInfo = "An answer box.";
            Answers[2].StringText = questionDetails[3];
            Answers[2].TextBoxInfo = "An answer box.";

            foreach (UiButton button in Answers)
            {
                UiButtonMessenger.RegisterButton(button);
                button.StringOffset = new Vector2(10, 0);
                button.TextBoxRectangleSet();
                button.LineWrapper();

                button.SetButtonState = UiButton.UiButtonStates.Button_Up;
            }

            State = QuestionState.Asking;
        }
示例#5
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
        }