Exemplo n.º 1
0
        public ErrorDialog(Screen screen)
            : base(screen)
        {
            ShadowOffset = new Vector2(4);
            Padding      = new Thickness(16);

            var stackPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            Content = stackPanel;

            messageContainer = new DialogMessageContainer(screen)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };
            stackPanel.Children.Add(messageContainer);

            var separator = ControlUtil.CreateDefaultSeparator(screen);

            stackPanel.Children.Add(separator);

            var okButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.OKButton);

            stackPanel.Children.Add(okButton);
            RegisterOKButton(okButton);

            okButton.Focus();
        }
Exemplo n.º 2
0
        public DirectionalLightWindow(Screen screen)
            : base(screen)
        {
            ShadowOffset        = new Vector2(4);
            Padding             = new Thickness(16);
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment   = VerticalAlignment.Top;

            var stackPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            Content = stackPanel;

            titleTextBlock = new TextBlock(screen)
            {
                Padding                 = new Thickness(4),
                ForegroundColor         = Color.Yellow,
                BackgroundColor         = Color.Black,
                HorizontalAlignment     = HorizontalAlignment.Stretch,
                TextHorizontalAlignment = HorizontalAlignment.Left,
                ShadowOffset            = new Vector2(2)
            };
            stackPanel.Children.Add(titleTextBlock);

            var separator = ControlUtil.CreateDefaultSeparator(screen);

            stackPanel.Children.Add(separator);

            switchLightButton         = ControlUtil.CreateDefaultDialogButton(screen, "");
            switchLightButton.Padding = new Thickness(16, 0, 16, 0);
            switchLightButton.Click  += OnSwitchLightButtonClick;
            stackPanel.Children.Add(switchLightButton);

            diffuseColorButton = new LightColorButton(screen);
            diffuseColorButton.NameTextBlock.Text = Strings.DiffuseColorLabel;
            diffuseColorButton.Click += OnDiffuseColorButtonClick;
            stackPanel.Children.Add(diffuseColorButton);

            specularColorButton = new LightColorButton(screen);
            specularColorButton.NameTextBlock.Text = Strings.SpecularColorLabel;
            specularColorButton.Click += OnSpecularColorButtonClick;
            stackPanel.Children.Add(specularColorButton);
        }
Exemplo n.º 3
0
        public LoadBlockMeshDialog(Screen screen)
            : base(screen)
        {
            // 開く際に openAnimation で Width を設定するので 0 で初期化します。
            Width        = 0;
            ShadowOffset = new Vector2(4);
            Padding      = new Thickness(16);

            var stackPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            Content = stackPanel;

            var pageButtonPanel = new StackPanel(screen)
            {
                HorizontalAlignment = HorizontalAlignment.Right
            };

            stackPanel.Children.Add(pageButtonPanel);

            var backPageButton = new Button(screen)
            {
                Focusable           = false,
                Width               = BlockViewerGame.SpriteSize,
                HorizontalAlignment = HorizontalAlignment.Left,
                Content             = new Image(screen)
                {
                    Texture = screen.Content.Load <Texture2D>("UI/ArrowLeft")
                }
            };

            backPageButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                ViewModel.BackPage();
            };
            pageButtonPanel.Children.Add(backPageButton);

            pageTextBlock = new TextBlock(screen)
            {
                Width           = BlockViewerGame.SpriteSize * 2,
                ForegroundColor = Color.White,
                BackgroundColor = Color.Black,
                ShadowOffset    = new Vector2(2)
            };
            pageButtonPanel.Children.Add(pageTextBlock);

            var forwardPageButton = new Button(screen)
            {
                Focusable           = false,
                Width               = BlockViewerGame.SpriteSize,
                HorizontalAlignment = HorizontalAlignment.Right,
                Content             = new Image(screen)
                {
                    Texture = screen.Content.Load <Texture2D>("UI/ArrowRight")
                }
            };

            forwardPageButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                ViewModel.ForwardPage();
            };
            pageButtonPanel.Children.Add(forwardPageButton);

            var fileListPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            stackPanel.Children.Add(fileListPanel);

            for (int i = 0; i < fileButtons.Length; i++)
            {
                fileButtons[i] = new FileButton(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch
                };
                fileButtons[i].Click   += OnFileButtonClick;
                fileButtons[i].KeyDown += OnFileNameButtonKeyDown;
                fileListPanel.Children.Add(fileButtons[i]);
            }

            var separator = ControlUtil.CreateDefaultSeparator(screen);

            stackPanel.Children.Add(separator);

            cancelButton        = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton);
            cancelButton.Click += (Control s, ref RoutedEventContext c) => Close();
            stackPanel.Children.Add(cancelButton);

            const float windowWidth = 480;

            openAnimation = new FloatLerpAnimation
            {
                Action   = (current) => { Width = current; },
                From     = 0,
                To       = windowWidth,
                Duration = TimeSpan.FromSeconds(0.1f)
            };
            Animations.Add(openAnimation);

            // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。
            closeAnimation = new FloatLerpAnimation
            {
                Action   = (current) => { Width = current; },
                From     = windowWidth,
                To       = 0,
                Duration = TimeSpan.FromSeconds(0.1f)
            };
            closeAnimation.Completed += (s, e) => base.Close();
            Animations.Add(closeAnimation);
        }
Exemplo n.º 4
0
        /// <summary>
        /// インスタンスを生成します。
        /// </summary>
        /// <param name="screen"></param>
        public PredefinedColorDialog(Screen screen)
            : base(screen)
        {
            PredefinedColors = new List <PredefinedColor>();
            PredefinedColors.AddRange(PredefinedColor.PredefinedColors);
            PredefinedColors.Sort((x, y) => x.Name.CompareTo(y.Name));

            // 開く際に openAnimation で Width を設定するので 0 で初期化します。
            Width        = 0;
            ShadowOffset = new Vector2(4);
            Padding      = new Thickness(16);

            var stackPanel = new StackPanel(screen)
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            Content = stackPanel;

            tab = new TabControl(screen)
            {
                SelectedIndex = 0
            };
            stackPanel.Children.Add(tab);

            predefinedColorGrid = new PredefinedColorGrid(screen, this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };
            tab.Items.Add(predefinedColorGrid);

            predefinedColorList = new PredefinedColorList(screen, this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch
            };
            tab.Items.Add(predefinedColorList);

            var separator = ControlUtil.CreateDefaultSeparator(screen);

            stackPanel.Children.Add(separator);

            viewModeButton        = ControlUtil.CreateDefaultDialogButton(screen, Strings.ListViewModeButton);
            viewModeButton.Click += OnViewModeButtonClick;
            stackPanel.Children.Add(viewModeButton);

            var sortByNameButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.SortByNameButton);

            sortByNameButton.Click += OnSortByNameClick;
            stackPanel.Children.Add(sortByNameButton);

            var sortByColorButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.SortByColorButton);

            sortByColorButton.Click += OnSortByColorClick;
            stackPanel.Children.Add(sortByColorButton);

            cancelButton        = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton);
            cancelButton.Click += (Control s, ref RoutedEventContext c) => Close();
            stackPanel.Children.Add(cancelButton);

            const float windowWidth = 400;

            openAnimation = new FloatLerpAnimation
            {
                Action   = (current) => { Width = current; },
                From     = 0,
                To       = windowWidth,
                Duration = TimeSpan.FromSeconds(0.1f)
            };
            Animations.Add(openAnimation);

            // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。
            closeAnimation = new FloatLerpAnimation
            {
                Action   = (current) => { Width = current; },
                From     = windowWidth,
                To       = 0,
                Duration = TimeSpan.FromSeconds(0.1f)
            };
            closeAnimation.Completed += (s, e) => base.Close();
            Animations.Add(closeAnimation);
        }