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(); }
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); }
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); }
/// <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); }
public MainMenuWindow(Screen screen) : base(screen) { // 開く際に openAnimation で Width を設定するので 0 で初期化します。 Width = 0; Height = 480; Padding = new Thickness(16); var stackPanel = new StackPanel(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Orientation = Orientation.Vertical }; Content = stackPanel; var title = new TextBlock(screen) { Text = Strings.MainMenuTitle, 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); tab = new TabControl(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, SelectedIndex = mainMenuIndex }; stackPanel.Children.Add(tab); var mainMenuPanel = CreateMainMenuPanel(); tab.Items.Add(mainMenuPanel); var modeMenuPanel = CreateModeMenuPanel(); tab.Items.Add(modeMenuPanel); var lodMenuPanel = CreateLodMenuPanel(); tab.Items.Add(lodMenuPanel); openAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 0, To = 240, Duration = TimeSpan.FromSeconds(0.1f) }; Animations.Add(openAnimation); // 閉じる場合には closeAnimation を実行し、その完了で完全に閉じます。 closeAnimation = new FloatLerpAnimation { Action = (current) => { Width = current; }, From = 240, To = 0, Duration = TimeSpan.FromSeconds(0.1f) }; closeAnimation.Completed += (s, e) => { base.Close(); // Screen は最前面の Window をアクティブにするので、 // 強制的に Desktop をアクティブにします。 //Screen.Desktop.Activate(); }; Animations.Add(closeAnimation); // デフォルト フォーカス。 loadButton.Focus(); }
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(); }