public BoxSetupWizardDialog(Screen screen)
            : base(screen)
        {
            viewModel = new BoxSetupViewModel(screen.Game);
            DataContext = viewModel;

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

            tabControl = new TabControl(screen)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Content = tabControl;

            attentionTabItem = new AttentionTabItem(Screen);
            attentionTabItem.FocusToDefault();
            attentionTabItem.AgreeSelected += OnAttentionTabItemAgreeSelected;
            attentionTabItem.CancelSelected += OnAttentionTabItemCancelSelected;
            tabControl.Items.Add(attentionTabItem);
            tabControl.SelectedIndex = 0;

            authorizationTabItem = new AuthorizationTabItem(Screen);
            authorizationTabItem.NextSelected += OnAuthorizationTabItemNextSelected;
            authorizationTabItem.BackSelected += OnAuthorizationTabItemBackSelected;
            tabControl.Items.Add(authorizationTabItem);

            accessTabItem = new AccessTabItem(Screen);
            accessTabItem.NextSelected += OnAccessTabItemNextSelected;
            accessTabItem.BackSelected += OnAccessTabItemBackSelected;
            tabControl.Items.Add(accessTabItem);

            prepareFolderTreeTabItem = new PrepareFolderTreeTabItem(Screen);
            prepareFolderTreeTabItem.CreateSelected += OnPrepareFolderTreeTabItemCreateSelected;
            prepareFolderTreeTabItem.CancelSelected += OnPrepareFolderTreeTabItemCancelSelected;
            tabControl.Items.Add(prepareFolderTreeTabItem);

            saveSettingsTabItem = new SaveSettingsTabItem(Screen);
            saveSettingsTabItem.YesSelected += OnSaveSettingsTabItemYesSelected;
            saveSettingsTabItem.NoSelected += OnSaveSettingsTabItemNoSelected;
            tabControl.Items.Add(saveSettingsTabItem);

            finishTabItem = new FinishTabItem(Screen);
            finishTabItem.UploadSelected += OnFinishTabItemUploadSelected;
            finishTabItem.CancelSelected += OnFinishTabItemCancelSelected;
            tabControl.Items.Add(finishTabItem);

            openAnimation = new FloatLerpAnimation
            {
                Action = (current) => { Width = current; },
                From = 0,
                To = 480,
                Duration = TimeSpan.FromSeconds(0.1f)
            };
            Animations.Add(openAnimation);
        }
示例#2
0
        public BlockEditWindow(Screen screen)
            : base(screen)
        {
            var stackPanel = new StackPanel(screen)
            {
                Orientation = Orientation.Vertical,
                Padding = new Thickness(8)
            };
            Content = stackPanel;

            sectionControl = new SectionControl(screen)
            {
                DataContext = (DataContext as Workspace).Section
            };
            stackPanel.Children.Add(sectionControl);

            var selectedMaterialControl = new SelectedMaterialControl(screen)
            {
                Width = 64,
                Height = 64
            };
            stackPanel.Children.Add(selectedMaterialControl);

            sectionControl.Focus();
        }
示例#3
0
        public ConfirmationDialog(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);

            cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton);
            stackPanel.Children.Add(cancelButton);
            RegisterCancelButton(cancelButton);
        }
示例#4
0
        public MaterialEditWindow(Screen screen)
            : base(screen)
        {
            DataContext = new MaterialEdit();

            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;

            diffuseColorButton = new LightColorButton(screen);
            diffuseColorButton.NameTextBlock.Text = "Diffuse color";
            diffuseColorButton.Click += OnDiffuseColorButtonClick;
            stackPanel.Children.Add(diffuseColorButton);

            specularColorButton = new LightColorButton(screen);
            specularColorButton.NameTextBlock.Text = "Specular color";
            specularColorButton.Click += OnSpecularColorButtonClick;
            stackPanel.Children.Add(specularColorButton);
        }
示例#5
0
 public SectionIndexControl(Screen screen)
     : base(screen)
 {
     GridColor = Color.White;
     CursorColor = Color.Blue;
     CellSize = 16;
 }
        public SelectLanguageDialog(Screen screen)
            : base(screen)
        {
            // 開く際に openAnimation で Width を設定するので 0 で初期化します。
            Width = 0;
            ShadowOffset = new Vector2(4);
            Padding = new Thickness(16);

            Overlay.Opacity = 0.5f;

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

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

            var separator = ControlUtil.CreateDefaultSeparator(screen);
            stackPanel.Children.Add(separator);

            var jaButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.JaButton);
            jaButton.Click += OnJaButtonClick;
            stackPanel.Children.Add(jaButton);

            var enButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.EnButton);
            enButton.Click += OnEnButtonClick;
            stackPanel.Children.Add(enButton);

            var defaultButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.DefaultButton);
            defaultButton.Click += OnDefaultButtonClick;
            stackPanel.Children.Add(defaultButton);

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

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

            cancelButon.Focus();
        }
示例#7
0
 public MaterialWindow(Screen screen)
     : base(screen)
 {
     var stackPanel = new StackPanel(screen)
     {
     };
     Content = stackPanel;
 }
示例#8
0
        /// <summary>
        /// インスタンスを生成します。
        /// </summary>
        /// <param name="screen">Screen。</param>
        internal Root(Screen screen)
            : base(screen)
        {
            Desktop = new Desktop(screen);
            // Desktop を子として関連付けます。
            AddChild(Desktop);

            Windows = new WindowCollection(this);
        }
示例#9
0
 public static Image CreateDefaultSeparator(Screen screen)
 {
     return new Image(screen)
     {
         Texture = screen.Content.Load<Texture2D>("UI/Separator"),
         HorizontalAlignment = HorizontalAlignment.Stretch,
         Margin = new Thickness(0, 8, 0, 4)
     };
 }
示例#10
0
        public AuthorizationTabItem(Screen screen)
            : base(screen)
        {
            var stackPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Content = stackPanel;

            var titleTextBlock = new TextBlock(Screen)
            {
                Text = Strings.BoxWizAuthorizationTitle,
                ForegroundColor = Color.Yellow,
                BackgroundColor = Color.Black,
                ShadowOffset = new Vector2(2)
            };
            stackPanel.Children.Add(titleTextBlock);

            var messageTextBlock = new TextBlock(Screen)
            {
                Text = Strings.BoxWizAuthorizationMessage,
                TextWrapping = TextWrapping.Wrap,
                TextHorizontalAlignment = HorizontalAlignment.Left,
                ForegroundColor = Color.White,
                BackgroundColor = Color.Black
            };
            stackPanel.Children.Add(messageTextBlock);

            var separator = ControlUtil.CreateDefaultSeparator(Screen);
            stackPanel.Children.Add(separator);

            var buttonPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Bottom
            };
            stackPanel.Children.Add(buttonPanel);

            var launchWebBrowserButton = ControlUtil.CreateDefaultDialogButton(Screen, Strings.LaunchWebBrowserButton);
            launchWebBrowserButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                NextSelected(this, EventArgs.Empty);
            };
            buttonPanel.Children.Add(launchWebBrowserButton);

            var backButton = ControlUtil.CreateDefaultDialogButton(Screen, Strings.BackButton);
            backButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                BackSelected(this, EventArgs.Empty);
            };
            buttonPanel.Children.Add(backButton);

            defaultFocusedButton = launchWebBrowserButton;
        }
示例#11
0
 /// <summary>
 /// インスタンスを生成します。
 /// </summary>
 /// <param name="screen">Screen。</param>
 internal Desktop(Screen screen)
     : base(screen)
 {
     var viewportBounds = screen.GraphicsDevice.Viewport.TitleSafeArea;
     BackgroundColor = Color.CornflowerBlue;
     Margin = new Thickness(viewportBounds.Left, viewportBounds.Top, 0, 0);
     Width = viewportBounds.Width;
     Height = viewportBounds.Height;
 }
示例#12
0
        public FinishTabItem(Screen screen)
            : base(screen)
        {
            var stackPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Content = stackPanel;

            var titleTextBlock = new TextBlock(Screen)
            {
                Text = Strings.BoxWizFinishTitle,
                ForegroundColor = Color.Yellow,
                BackgroundColor = Color.Black,
                ShadowOffset = new Vector2(2)
            };
            stackPanel.Children.Add(titleTextBlock);

            var messageTextBlock = new TextBlock(Screen)
            {
                Text = Strings.BoxWizFinishMessage,
                TextWrapping = TextWrapping.Wrap,
                TextHorizontalAlignment = HorizontalAlignment.Left,
                ForegroundColor = Color.White,
                BackgroundColor = Color.Black
            };
            stackPanel.Children.Add(messageTextBlock);

            var separator = ControlUtil.CreateDefaultSeparator(Screen);
            stackPanel.Children.Add(separator);

            var buttonPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Bottom
            };
            stackPanel.Children.Add(buttonPanel);

            var uploadButton = ControlUtil.CreateDefaultDialogButton(Screen, Strings.UploadButton);
            uploadButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                UploadSelected(this, EventArgs.Empty);
            };
            buttonPanel.Children.Add(uploadButton);

            var cancelButton = ControlUtil.CreateDefaultDialogButton(Screen, Strings.CancelButton);
            cancelButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                CancelSelected(this, EventArgs.Empty);
            };
            buttonPanel.Children.Add(cancelButton);

            defaultFocusedButton = uploadButton;
        }
示例#13
0
 public FadeOverlay(Screen screen)
     : base(screen)
 {
     OpacityAnimation = new FloatLerpAnimation
     {
         Action = (current) => { Opacity = current; },
         To = 1
     };
     Animations.Add(OpacityAnimation);
 }
示例#14
0
        public BoxProgressDialog(Screen scree)
            : base(scree)
        {
            Height = 96;
            Overlay.Opacity = 0.5f;

            textBlock = new TextBlock(Screen)
            {
                ForegroundColor = Color.White,
                BackgroundColor = Color.Black,
                Padding = new Thickness(16)
            };
            Content = textBlock;
        }
示例#15
0
        public ImageButton(Screen screen)
            : base(screen)
        {
            canvas = new Canvas(screen)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Content = canvas;

            Image = new Image(screen);
            canvas.Children.Add(Image);

            TextBlock = new TextBlock(screen);
            canvas.Children.Add(TextBlock);
        }
        public SelectedMaterialControl(Screen screen)
            : base(screen)
        {
            cubeMesh = new CubeMesh(screen.GraphicsDevice, 1);
            cubeMesh.Effect.EnableDefaultLighting();

            view = new ChaseView
            {
                Distance = 3.5f,
                Angle = new Vector2(-MathHelper.PiOver4 * 0.5f, MathHelper.PiOver4)
            };
            projection = new PerspectiveFov
            {
                NearPlaneDistance = 0.01f,
                FarPlaneDistance = 100
            };
        }
示例#17
0
        /// <summary>
        /// インスタンスを生成します。
        /// </summary>
        /// <param name="screen">Screen。</param>
        public StartMenuWindow(Screen screen)
            : base(screen)
        {
            viewModel = new StartMenuViewModel(screen.Game);
            DataContext = viewModel;

            Width = 320;
            ShadowOffset = new Vector2(4);
            Padding = new Thickness(16);

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

            var startButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.StartButton);
            startButton.Click += OnStartButtonClick;
            stackPanel.Children.Add(startButton);

            var selectLanguageButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.SelectLanguageButton);
            selectLanguageButton.Click += OnLanguageSettingButtonClick;
            stackPanel.Children.Add(selectLanguageButton);

            var installDemoBlocksButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.InstallDemoBlocksButton);
            installDemoBlocksButton.Click += OnInstallDemoBlocksButtonClick;
            stackPanel.Children.Add(installDemoBlocksButton);

            var uploadDemoBlocksButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.UploadDemoBlocksButton);
            uploadDemoBlocksButton.Enabled = viewModel.BoxIntegrationEnabled;
            uploadDemoBlocksButton.Click += OnUploadDemoBlocksButtonClick;
            stackPanel.Children.Add(uploadDemoBlocksButton);

            changeLookAndFeelButton = ControlUtil.CreateDefaultMenuButton(screen, "Look & Feel [Debug]");
            changeLookAndFeelButton.Click += OnChangeLookAndFeelButtonClick;
            stackPanel.Children.Add(changeLookAndFeelButton);

            var exitButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.ExitButton);
            exitButton.Click += OnExitButtonClick;
            stackPanel.Children.Add(exitButton);

            // デフォルト フォーカス。
            startButton.Focus();
        }
        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);
        }
示例#19
0
        public static Button CreateDefaultMenuButton(Screen screen, String text)
        {
            var button = new Button(screen)
            {
                Height = menuButtonHeight,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Padding = new Thickness(4),

                Content = new TextBlock(screen)
                {
                    Text = text,
                    ForegroundColor = Color.White,
                    BackgroundColor = Color.Black,
                    ShadowOffset = new Vector2(2)
                }
            };

            SetDefaultBehavior(button);

            return button;
        }
示例#20
0
        public LodWindow(Screen screen)
            : base(screen)
        {
            // この Window はアクティブにできません。
            Activatable = false;

            ShadowOffset = new Vector2(4);
            Padding = new Thickness(8);

            var stackPanel = new StackPanel(screen)
            {
                Orientation = Orientation.Vertical
            };
            Content = stackPanel;

            for (int i = 0; i < 4; i++)
            {
                var lodControl = CreateLodControl(i);
                stackPanel.Children.Add(lodControl);
            }
        }
示例#21
0
        public SectionControl(Screen screen)
            : base(screen)
        {
            const float cellSize = 16;

            var stackPanel = new StackPanel(screen)
            {
                Orientation = Orientation.Vertical
            };
            Content = stackPanel;

            var selectorPanel = new StackPanel(screen)
            {
                //Margin = new Thickness(8)
            };
            stackPanel.Children.Add(selectorPanel);

            var changeOrientationButton = new Button(screen)
            {
                Width = cellSize,
                Height = cellSize,
                Margin = new Thickness(0, 0, 8, 0)
            };
            changeOrientationButton.Click += OnChangeOrientationButtonClick;
            selectorPanel.Children.Add(changeOrientationButton);

            var indexControl = new SectionIndexControl(screen)
            {
                CellSize = cellSize
            };
            selectorPanel.Children.Add(indexControl);

            var editControl = new SectionEditControl(screen)
            {
                CellSize = cellSize,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = new Thickness(0, 8, 0, 0)
            };
            stackPanel.Children.Add(editControl);
        }
示例#22
0
        void LoadScreenWaitCallback(object state)
        {
            var screen = LoadScreen();

            lock (this)
            {
                loadedScreen = screen;
            }
        }
示例#23
0
                public ItemButton(Screen screen)
                    : base(screen)
                {
                    var stackPanel = new StackPanel(screen)
                    {
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        Padding = new Thickness(16, 0, 16, 0)
                    };
                    Content = stackPanel;

                    NameTextBlock = new TextBlock(screen)
                    {
                        Width = 200,
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        ShadowOffset = new Vector2(2),
                        TextHorizontalAlignment = HorizontalAlignment.Left
                    };
                    stackPanel.Children.Add(NameTextBlock);

                    ColorCanvas = new Canvas(screen)
                    {
                        Width = 124,
                        Height = 30,
                        Margin = new Thickness(2)
                    };
                    stackPanel.Children.Add(ColorCanvas);
                }
示例#24
0
            public PredefinedColorList(Screen screen, PredefinedColorDialog owner)
                : base(screen)
            {
                this.owner = owner;

                paging.ItemCountPerPage = 5;

                var stackPanel = new StackPanel(screen)
                {
                    Orientation = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment = VerticalAlignment.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) => 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) => ForwardPage();
                pageButtonPanel.Children.Add(forwardPageButton);

                for (int i = 0; i < itemButtons.Length; i++)
                {
                    itemButtons[i] = new ItemButton(screen);
                    itemButtons[i].KeyDown += OnListItemButtonKeyDown;
                    itemButtons[i].Click += OnListItemButtonClick;
                    stackPanel.Children.Add(itemButtons[i]);
                }
            }
示例#25
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);
        }
示例#26
0
                public ItemButton(Screen screen)
                    : base(screen)
                {
                    Width = 32;
                    Height = 32;
                    Padding = new Thickness(4);

                    Content = new Canvas(screen)
                    {
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        VerticalAlignment = VerticalAlignment.Stretch
                    };
                }
示例#27
0
            public PredefinedColorGrid(Screen screen, PredefinedColorDialog owner)
                : base(screen)
            {
                this.owner = owner;

                paging.ItemCountPerPage = columnCount * rowCount;

                var stackPanel = new StackPanel(screen)
                {
                    Orientation = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment = VerticalAlignment.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) => 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) => ForwardPage();
                pageButtonPanel.Children.Add(forwardPageButton);

                var vColorPanel = new StackPanel(screen)
                {
                    Orientation = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                stackPanel.Children.Add(vColorPanel);

                for (int i = 0; i < rowCount; i++)
                {
                    var hColorPanel = new StackPanel(screen);
                    vColorPanel.Children.Add(hColorPanel);

                    for (int j = i * columnCount; j < (i + 1) * columnCount; j++)
                    {
                        itemButtons[j] = new ItemButton(screen);
                        hColorPanel.Children.Add(itemButtons[j]);

                        int mod = j % columnCount;
                        if (mod == 0)
                        {
                            itemButtons[j].KeyDown += OnLeftColorButtonKeyDown;
                        }
                        else if (mod == columnCount - 1)
                        {
                            itemButtons[j].KeyDown += OnRightColorButtonKeyDown;
                        }

                        itemButtons[j].GotFocus += OnItemButtonGotFocus;
                        itemButtons[j].LostFocus += OnItemButtonLostFocus;
                        itemButtons[j].Click += OnItemButtonClick;
                    }
                }
            }
示例#28
0
 public MaterialPalletControl(Screen screen)
     : base(screen)
 {
 }
示例#29
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="screen">Screen。</param>
        protected Control(Screen screen)
        {
            if (screen == null) throw new ArgumentNullException("screen");
            Screen = screen;

            PreviewMouseMove += CreateRoutedEventHandler(OnPreviewMouseMove);
            MouseMove += CreateRoutedEventHandler(OnMouseMove);
            PreviewMouseEnter += CreateRoutedEventHandler(OnPreviewMouseEnter);
            MouseEnter += CreateRoutedEventHandler(OnMouseEnter);
            PreviewMouseLeave += CreateRoutedEventHandler(OnPreviewMouseLeave);
            MouseLeave += CreateRoutedEventHandler(OnMouseLeave);
            PreviewMouseDown += CreateRoutedEventHandler(OnPreviewMouseDown);
            MouseDown += CreateRoutedEventHandler(OnMouseDown);
            PreviewMouseUp += CreateRoutedEventHandler(OnPreviewMouseUp);
            MouseUp += CreateRoutedEventHandler(OnMouseUp);

            PreviewKeyDown += CreateRoutedEventHandler(OnPreviewKeyDown);
            KeyDown += CreateRoutedEventHandler(OnKeyDown);
            PreviewKeyUp += CreateRoutedEventHandler(OnPreviewKeyUp);
            KeyUp += CreateRoutedEventHandler(OnKeyUp);
            
            GotFocus += CreateRoutedEventHandler(OnGotFocus);
            LostFocus += CreateRoutedEventHandler(OnLostFocus);
            GotLogicalFocus += CreateRoutedEventHandler(OnGotLogicalFocus);
            LostLogicalFocus += CreateRoutedEventHandler(OnLostLogicalFocus);

            Width = float.NaN;
            Height = float.NaN;
            MaxWidth = float.PositiveInfinity;
            MaxHeight = float.PositiveInfinity;
            Opacity = 1;
            ForegroundColor = Color.Black;
            BackgroundColor = Color.White;
            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment = VerticalAlignment.Center;
            FontStretch = Vector2.One;
            ClipEnabled = true;

            Animations = new List<Animation>();
        }
示例#30
0
 protected ContentControl(Screen screen)
     : base(screen)
 {
 }