Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
                }
Exemplo n.º 3
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
                    };
                }
Exemplo n.º 4
0
            public LightColorButton(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 = 140,
                    ForegroundColor = Color.White,
                    BackgroundColor = Color.Black,
                    ShadowOffset = new Vector2(2),
                    TextHorizontalAlignment = HorizontalAlignment.Left
                };
                stackPanel.Children.Add(NameTextBlock);

                ColorCanvas = new Canvas(screen)
                {
                    Width = 28,
                    Height = 28,
                    Margin = new Thickness(4)
                };
                stackPanel.Children.Add(ColorCanvas);

                // ControlUtil では対応できないので固有で設定します。
                PopupFontOnGotFocus();
            }
Exemplo n.º 5
0
        void InitializeControls()
        {
            var canvas = new Canvas(this);
            canvas.BackgroundColor = Color.CornflowerBlue;
            canvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            canvas.VerticalAlignment = VerticalAlignment.Stretch;
            Desktop.Content = canvas;

            blockMeshView = new BlockMeshView(this)
            {
                Width = Desktop.Width,
                Height = Desktop.Height,
                Focusable = true,
                DataContext = mainViewModel.ViewerViewModel
            };
            canvas.Children.Add(blockMeshView);

            mainMenuButton = new ImageButton(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top
            };
            mainMenuButton.Image.Texture = Content.Load<Texture2D>("UI/MainMenuButton");
            mainMenuButton.TextBlock.Text = Strings.MainMenuButton;
            mainMenuButton.TextBlock.HorizontalAlignment = HorizontalAlignment.Right;
            mainMenuButton.TextBlock.Padding = new Thickness(4);
            mainMenuButton.TextBlock.ForegroundColor = Color.Yellow;
            mainMenuButton.TextBlock.BackgroundColor = Color.Black;
            mainMenuButton.TextBlock.ShadowOffset = new Vector2(2);
            mainMenuButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                mainMenuButton.Visible = false;
                mainMenuWindow.Show();
            };
            canvas.Children.Add(mainMenuButton);

            mainMenuWindow = new MainMenuWindow(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top
            };
            mainMenuWindow.VisibleChanged += (s, e) =>
            {
                mainMenuButton.Visible = !mainMenuWindow.Visible;
            };

            var overlay = new FadeOverlay(this);
            overlay.OpacityAnimation.From = 1;
            overlay.OpacityAnimation.To = 0;
            overlay.OpacityAnimation.Duration = TimeSpan.FromSeconds(1);
            overlay.OpacityAnimation.Completed += (s, e) =>
            {
                overlay.Close();
                // Desktop をアクティブにしておきます。
                Desktop.Activate();
                // キー操作が行えるようにします。
                canHandleKey = true;
            };
            overlay.Show();

            Root.KeyDown += OnRootKeyDown;

            // BlockMeshView にフォーカスを設定しておきます。
            blockMeshView.Focus();

            // Desktop をアクティブ化します。
            Desktop.Activate();
        }
Exemplo n.º 6
0
        void InitializeControls()
        {
            var canvas = new Canvas(this)
            {
                BackgroundColor = Color.CornflowerBlue,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Desktop.Content = canvas;

            blockViewControl = new BlockViewControl(this)
            {
                //Width = Desktop.Width,
                //Height = Desktop.Height,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Width = Desktop.Width * 0.5f,
                Height = Desktop.Height * 0.5f,
                Focusable = true,
                DataContext = (DataContext as Workspace).Scene
            };
            canvas.Children.Add(blockViewControl);

            blockEditWindow = new BlockEditWindow(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top
            };
            blockEditWindow.Show();
        }