コード例 #1
0
ファイル: MainMenuWindow.cs プロジェクト: willcraftia/Blocks
        void OnExitButtonClick(Control sender, ref RoutedEventContext context)
        {
            var overlay = new FadeOverlay(Screen);

            overlay.OpacityAnimation.To         = 1;
            overlay.OpacityAnimation.Duration   = TimeSpan.FromSeconds(1);
            overlay.OpacityAnimation.Completed += (s, e) => Screen.ShowScreen(ScreenNames.Start);
            overlay.Show();
        }
コード例 #2
0
        void InitializeControls()
        {
            var startMenuWindow = new StartMenuWindow(this);

            startMenuWindow.Show();

            var overlay = new FadeOverlay(this);

            overlay.OpacityAnimation.From       = 1;
            overlay.OpacityAnimation.To         = 0;
            overlay.OpacityAnimation.Duration   = TimeSpan.FromSeconds(0.5d);
            overlay.OpacityAnimation.Completed += (s, e) =>
            {
                overlay.Close();
                startMenuWindow.Activate();
            };
            overlay.Show();
        }
コード例 #3
0
ファイル: StartScreen.cs プロジェクト: willcraftia/Blocks
        void InitializeControls()
        {
            var startMenuWindow = new StartMenuWindow(this);
            startMenuWindow.Show();

            var overlay = new FadeOverlay(this);
            overlay.OpacityAnimation.From = 1;
            overlay.OpacityAnimation.To = 0;
            overlay.OpacityAnimation.Duration = TimeSpan.FromSeconds(0.5d);
            overlay.OpacityAnimation.Completed += (s, e) =>
            {
                overlay.Close();
                startMenuWindow.Activate();
            };
            overlay.Show();
        }
コード例 #4
0
ファイル: StartMenuWindow.cs プロジェクト: willcraftia/Blocks
 void OnStartButtonClick(Control sender, ref RoutedEventContext context)
 {
     var overlay = new FadeOverlay(Screen);
     overlay.OpacityAnimation.To = 1;
     overlay.OpacityAnimation.Duration = TimeSpan.FromSeconds(0.5d);
     overlay.OpacityAnimation.Completed += (s, e) => Screen.ShowScreen(ScreenNames.Main);
     overlay.Show();
 }
コード例 #5
0
ファイル: MainScreen.cs プロジェクト: willcraftia/Blocks
        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();
        }
コード例 #6
0
ファイル: MainScreen.cs プロジェクト: willcraftia/Blocks
        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();
        }