public ButtonOption(string option, Action action)
        {
            this.grid = new Grid();

            grid.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;
            grid.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center;
            grid.Width = 475;
            grid.Height = 139;

            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });

            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });

            Button b_option = new Button()
            {
                Text = string.Empty,
                IsBorder = false,
                BackgroundImage = Directories.Textures + option + "_bt.png.wpk",
                PressedBackgroundImage = Directories.Textures + option + "_bt_pressed.png.wpk",
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
            };
            b_option.Click += (s, o) => action();
            b_option.SetValue(GridControl.RowProperty, 0);
            b_option.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(b_option);
           
            TextBlock t_option = new TextBlock()
            {
                Width = 322, 
                Height = 65,
                FontPath = WaveContent.Assets.Fonts.Gotham_Bold_16_ttf,
                Text = option.ToUpper(),
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                DrawOrder = 0.4f,
                Margin = new WaveEngine.Framework.UI.Thickness(0, 13, 0,0)
            };
            t_option.SetValue(GridControl.RowProperty, 0);
            t_option.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(t_option);

            Image bg_option = new Image(WaveContent.Assets.Textures.bg_options_pause_PNG)
            {
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Margin = new WaveEngine.Framework.UI.Thickness(-45,0,0,0),
                DrawOrder = 0.9f,
            };
            bg_option.SetValue(GridControl.RowProperty, 0);
            bg_option.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(bg_option);

            this.entity = grid.Entity;
        }
예제 #2
0
        private void CreateGrid()
        {
            Grid grid = new Grid()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Height = WaveServices.Platform.ScreenHeight,
            };

            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(4, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(3, GridUnitType.Proportional) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(200, GridUnitType.Pixel) });

            EntityManager.Add(grid);

            #region Color UI
            TextBlock t_colors = new TextBlock()
                {
                    Text = "Colors",
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Margin = new Thickness(10),
                };

            t_colors.SetValue(GridControl.RowProperty, 0);
            t_colors.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(t_colors);

            StackPanel stackPanel = new StackPanel()
            {
                Margin = new Thickness(30, 0, 0, 0),
            };

            stackPanel.SetValue(GridControl.RowProperty, 1);
            stackPanel.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(stackPanel);

            RadioButton radio1 = new RadioButton()
            {
                Text = "Red",
                GroupName = "colors",
                Foreground = Color.Red,
            };

            radio1.Checked += (s, o) =>
            {
                this.cubeMaterial.DiffuseColor = Color.Red;
            };

            stackPanel.Add(radio1);

            RadioButton radio2 = new RadioButton()
            {
                Text = "Green",
                GroupName = "colors",
                Foreground = Color.Green,
            };

            radio2.Checked += (s, o) =>
            {
                this.cubeMaterial.DiffuseColor = Color.Green;
            };

            stackPanel.Add(radio2);

            RadioButton radio3 = new RadioButton()
            {
                Text = "Blue",
                GroupName = "colors",
                Foreground = Color.Blue,
            };

            radio3.Checked += (s, o) =>
            {
                this.cubeMaterial.DiffuseColor = Color.Blue;
            };

            stackPanel.Add(radio3);

            RadioButton radio4 = new RadioButton()
            {
                Text = "White",
                GroupName = "colors",
                Foreground = Color.White,
                IsChecked = true,
            };

            radio4.Checked += (s, o) =>
            {
                this.cubeMaterial.DiffuseColor = Color.White;
            };

            stackPanel.Add(radio4); 
            #endregion

            #region Texture UI
            TextBlock t_texture = new TextBlock()
                {
                    Text = "Textures",
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Margin = new Thickness(10),
                };

            t_texture.SetValue(GridControl.RowProperty, 2);
            t_texture.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(t_texture);

            ToggleSwitch toggleTexture = new ToggleSwitch()
            {
                Margin = new Thickness(30, 0, 0, 0),
                Foreground = darkColor,
                Background = lightColor,
                IsOn = true,
            };

            toggleTexture.Toggled += (s, o) =>
            {
                this.cubeMaterial.TextureEnabled = toggleTexture.IsOn;
            };

            toggleTexture.SetValue(GridControl.RowProperty, 3);
            toggleTexture.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(toggleTexture); 
            #endregion

            #region Scale UI
            TextBlock t_scale = new TextBlock()
                {
                    Text = "Scale",
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Margin = new Thickness(10),
                };

            t_scale.SetValue(GridControl.RowProperty, 4);
            t_scale.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(t_scale);

            Slider sliderScale = new Slider()
            {
                Width = 150,
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin = new Thickness(30, 0, 0, 0),
                Foreground = darkColor,
                Background = lightColor,
                Value = 50,
            };

            sliderScale.RealTimeValueChanged += (s, o) =>
            {
                this.cubeTransform.Scale = Vector3.One / 2 + (Vector3.One * (o.NewValue / 100f));
            };

            sliderScale.SetValue(GridControl.RowProperty, 5);
            sliderScale.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(sliderScale); 
            #endregion

            #region Reset UI
            Button b_reset = new Button()
                {
                    Text = "Reset",
                    Margin = new Thickness(10, 0, 0, 20),
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Foreground = Color.White,
                    BackgroundColor = lightColor,
                };

            b_reset.Click += (s, o) =>
            {
                radio4.IsChecked = true;
                toggleTexture.IsOn = true;
                sliderScale.Value = 50;
                this.sliderRotX.Value = 0;
                this.sliderRotY.Value = 0;
            };

            b_reset.SetValue(GridControl.RowProperty, 6);
            b_reset.SetValue(GridControl.ColumnProperty, 0);

            grid.Add(b_reset); 
            #endregion
        }
예제 #3
0
        public HubPanel()
        {
            Grid grid = new Grid("HubPanel")
            {
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Width = 800,
                Height = 40,
            };

            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });

            Image background = new Image(Directories.Textures + "hubBackground.wpk");
            background.SetValue(GridControl.RowProperty, 0);
            background.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(background);

            // Life
            this.progressBar = new ProgressBar()
            {
                Height = 25,
                Width = 300,
                Foreground = Color.Gold,
                Background = Color.Red,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
            };
            progressBar.SetValue(GridControl.RowProperty, 0);
            progressBar.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(progressBar);

            // Murders
            this.murdersText = new TextBlock()
            {
                //FontPath = Directories.Fonts + "Coalition.wpk",                
                Text = "#00",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
            };
            murdersText.SetValue(GridControl.RowProperty, 0);
            murdersText.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(murdersText);

            this.entity = grid.Entity;

        }