Exemple #1
0
        private void CreateFieldPanel()
        {
            _FieldPanel = new Grid()
            {
                Row = 0, Padding = new Thickness(2)
            };
            _FieldPanel.ColumnDefinitions.Add(1, GridUnitType.Star);    // object field
            _FieldPanel.ColumnDefinitions.Add(220, GridUnitType.Pixel); // filter textfiald
            _FieldPanel.ColumnDefinitions.Add(180, GridUnitType.Pixel); // tabs

            Box box = new Box()
            {
                Row = 0, Column = 0, RowSpan = 10, ColumnSpan = 3
            };

            _FieldPanel.Controls.Add(box);

            _ObjectField = new Skill.Editor.UI.ObjectField <Dictionary>()
            {
                Column = 0, Margin = new Thickness(2, 2, 30, 2), VerticalAlignment = VerticalAlignment.Top
            };
            _ObjectField.Label.text = "Dictionary";
            _FieldPanel.Controls.Add(_ObjectField);

            _ObjectField.ObjectChanged += _ObjectField_ObjectChanged;


            _TxtFilter = new UI.TextField()
            {
                Column = 1
            };
            _FieldPanel.Controls.Add(_TxtFilter);
            _TxtFilter.TextChanged += _TxtFilter_TextChanged;

            _LblFilter = new Label()
            {
                Column = 1, Text = "filter", HorizontalAlignment = HorizontalAlignment.Center, Width = 40
            };
            _FieldPanel.Controls.Add(_LblFilter);

            _LayoutButtonsPanel = new Toolbar()
            {
                Column = 3
            };
            _TBtnAudioPanel = new ToolbarButton();
            _TBtnTextPanel  = new ToolbarButton();

            _TBtnAudioPanel.Content.text = "Audio"; _TBtnAudioPanel.Content.tooltip = "set subtitles for audio files";
            _TBtnTextPanel.Content.text  = "Text"; _TBtnTextPanel.Content.tooltip = "add text";


            _LayoutButtonsPanel.Items.Add(_TBtnTextPanel);
            _LayoutButtonsPanel.Items.Add(_TBtnAudioPanel);
            _LayoutButtonsPanel.SelectedIndex = 0;

            _FieldPanel.Controls.Add(_LayoutButtonsPanel);

            _TBtnAudioPanel.Selected += LayoutButtons_Selected;
            _TBtnTextPanel.Selected  += LayoutButtons_Selected;
        }
Exemple #2
0
                public AudioFieldProperties(AudioField af)
                    : base(af)
                {
                    _AudioField       = af;
                    this._ObjectField = new Skill.Editor.UI.ObjectField <AudioClip>()
                    {
                        Column = 0, Margin = ControlMargin
                    };
                    this._ObjectField.Label.text = "Clip";
                    this.Controls.Add(_ObjectField);

                    this._ObjectField.ObjectChanged += _ObjectField_ObjectChanged;
                }
Exemple #3
0
        private void CreateUI()
        {
            Thickness margin = new Thickness(0, 2, 0, 4);

            _Frame = new Skill.Framework.UI.Frame("Frame");
            _Panel = new StackPanel();

            Grid pnlToggles = new Grid()
            {
                Height = 22
            };

            pnlToggles.ColumnDefinitions.Add(1, GridUnitType.Star);
            pnlToggles.ColumnDefinitions.Add(1, GridUnitType.Star);

            _TbEnable = new UI.ToggleButton()
            {
                IsChecked = _Implant.IsEnable, Margin = margin, Left = true, Column = 0
            }; _TbEnable.Label.text = "Enable";
            _TbUniform = new UI.ToggleButton()
            {
                IsChecked = _Implant.Uniform, Margin = margin, Left = true, Column = 1
            }; _TbUniform.Label.text = "Uniform";

            pnlToggles.Controls.Add(_TbEnable);
            pnlToggles.Controls.Add(_TbUniform);

            _AssetField = new Skill.Editor.UI.ObjectField <ImplantAsset>()
            {
                VerticalAlignment = VerticalAlignment.Center, Margin = margin, AllowSceneObjects = false
            };
            _AssetField.Label.text = "ImplantAsset";
            if (_Implant.ImplantAsset != null)
            {
                _Asset = _Implant.ImplantAsset as ImplantAsset;
                _Implant.ImplantAsset = _AssetField.Object = _Asset;
            }

            _RootField = new ObjectField <Transform>()
            {
                Margin = margin, AllowSceneObjects = true, Object = _Implant.Root
            }; _RootField.Label.text = "Root";

            _Layers = new Skill.Editor.UI.LayerMaskField()
            {
                Layers = _Implant.LayerMask, VerticalAlignment = VerticalAlignment.Center, Margin = margin
            };
            _Layers.Label.text = "Raycast layers";

            _SliDensity = new Skill.Editor.UI.IntSlider()
            {
                Value = _Implant.Density, MinValue = 1, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliDensity.Label.text = "Density"; _SliDensity.Label.tooltip = "Shift + (W/S)";
            _SliRotation = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.Rotation, MinValue = 0.0f, MaxValue = 360, Margin = margin, Height = 16
            }; _SliRotation.Label.text = "Rotation"; _SliRotation.Label.tooltip = "Shift + (A/D)";
            _SliOffsetY = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.OffsetY, MinValue = -10.0f, MaxValue = 20, Margin = margin, Height = 16
            }; _SliOffsetY.Label.text = "Offset Y"; _SliOffsetY.Label.tooltip = "Offset in Y axis)";
            _SliMinRadius             = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.MinRadius, MinValue = 0.0f, MaxValue = 200, Margin = margin, Height = 16
            }; _SliMinRadius.Label.text = "Min Radius";
            _SliMaxRadius = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.MaxRadius, MinValue = 0.0f, MaxValue = 200, Margin = margin, Height = 16
            }; _SliMaxRadius.Label.text = "Max Radius";
            _SliRectWidth = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.RectWidth, MinValue = 0.0f, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliRectWidth.Label.text = "Width";
            _SliRectHeight = new Skill.Editor.UI.Slider()
            {
                Value = _Implant.RectHeight, MinValue = 0.0f, MaxValue = 1000, Margin = margin, Height = 16
            }; _SliRectHeight.Label.text = "Height";
            _Help = new Skill.Editor.UI.HelpBox()
            {
                Message = "Hold Ctrl and Right Click to implant obejcts.\nMouse3 to shuffle.\nShift + R : Make reference point.\nSpace : R reference point", Height = 60, Margin = new Thickness(0, 10, 0, 0)
            };

            _TbModes = new TabHeader {
                Margin = new Thickness(0, 2, 0, 10), HorizontalAlignment = HorizontalAlignment.Center, Width = 200, Height = 20
            };
            _TbModes[0].text     = "Circle";
            _TbModes[1].text     = "Rectangle";
            _TbModes.SelectedTab = _Implant.BrushMode;


            _Panel.Controls.Add(pnlToggles);
            _Panel.Controls.Add(_AssetField);
            _Panel.Controls.Add(_RootField);
            _Panel.Controls.Add(_Layers);
            _Panel.Controls.Add(_SliDensity);
            _Panel.Controls.Add(_SliRotation);
            _Panel.Controls.Add(_SliOffsetY);
            _Panel.Controls.Add(_TbModes);
            _Panel.Controls.Add(_SliMinRadius);
            _Panel.Controls.Add(_SliMaxRadius);
            _Panel.Controls.Add(_SliRectWidth);
            _Panel.Controls.Add(_SliRectHeight);
            _Panel.Controls.Add(_Help);
            _Frame.Grid.Controls.Add(_Panel);

            ChangeMode();
            UpdateRotation();

            _AssetField.ObjectChanged   += _AssetField_ObjectChanged;
            _RootField.ObjectChanged    += _RootField_ObjectChanged;
            _Layers.LayersChanged       += _Layers_LayersChanged;
            _SliDensity.ValueChanged    += _SliDensity_ValueChanged;
            _SliRotation.ValueChanged   += _SliRotation_ValueChanged;
            _TbModes.SelectedTabChanged += _TbModes_SelectedTabChanged;
            _SliMinRadius.ValueChanged  += _SliMinRadius_ValueChanged;
            _SliMaxRadius.ValueChanged  += _SliMaxRadius_ValueChanged;
            _SliRectWidth.ValueChanged  += _SliRectWidth_ValueChanged;
            _SliRectHeight.ValueChanged += _SliRectHeight_ValueChanged;
            _SliOffsetY.ValueChanged    += _SliOffsetY_ValueChanged;
            _TbEnable.Changed           += _TbEnable_Changed;
            _TbUniform.Changed          += _TbUniform_Changed;
        }
Exemple #4
0
        private void CreateUI()
        {
            _Panel = new StackPanel()
            {
                Padding = new Skill.Framework.UI.Thickness(2, 4, 2, 0)
            };
            _TextureField = new Skill.Editor.UI.ObjectField <Texture2D>()
            {
                Object = _PaintColor.Texture, HorizontalAlignment = Skill.Framework.UI.HorizontalAlignment.Center, Width = 80, Height = 80, Margin = new Skill.Framework.UI.Thickness(2)
            };


            #region _TbChannels
            _TbChannels = new UI.TabHeader(4, true)
            {
                Margin = new Thickness(0, 2, 0, 10), HorizontalAlignment = HorizontalAlignment.Center, Width = 200, Height = 20
            };
            _TbChannels[0].text = "R";
            _TbChannels[1].text = "G";
            _TbChannels[2].text = "B";
            _TbChannels[3].text = "A";

            _TbChannels.SetTabSelected(0, _PaintColor.ChannelR);
            _TbChannels.SetTabSelected(1, _PaintColor.ChannelG);
            _TbChannels.SetTabSelected(2, _PaintColor.ChannelB);
            _TbChannels.SetTabSelected(3, _PaintColor.ChannelA);
            #endregion

            #region _LayersField and _PUV and _TbBrush

            Grid layersPanel = new Grid()
            {
                Height = 32, Padding = new Thickness(2, 6)
            };
            layersPanel.ColumnDefinitions.Add(90, GridUnitType.Pixel);
            layersPanel.ColumnDefinitions.Add(50, GridUnitType.Pixel);
            layersPanel.ColumnDefinitions.Add(10, GridUnitType.Pixel);
            layersPanel.ColumnDefinitions.Add(45, GridUnitType.Pixel);
            layersPanel.ColumnDefinitions.Add(1, GridUnitType.Star);


            _TbBrush = new UI.ToggleButton()
            {
                Column = 0, IsChecked = _PaintColor.Brush, Left = true
            };
            _TbBrush.Label.text = "Brush View";
            layersPanel.Controls.Add(_TbBrush);

            _PUV = new Popup()
            {
                Row = 0, Column = 1
            };
            PopupOption uv1 = new PopupOption(0)
            {
                Name = "UV1"
            }; uv1.Content.text = "UV 1";
            PopupOption uv2 = new PopupOption(1)
            {
                Name = "UV2"
            }; uv2.Content.text = "UV 2";
            _PUV.Options.Add(uv1);
            _PUV.Options.Add(uv2);
            _PUV.SelectedIndex = _PaintColor.UV2 ? 1 : 0;
            layersPanel.Controls.Add(_PUV);

            Label lbl = new Label()
            {
                Text = "Layers", Column = 3
            };
            layersPanel.Controls.Add(lbl);


            _LayersField = new LayerMaskField()
            {
                Row = 0, Column = 4
            };
            _LayersField.Layers     = _PaintColor.LayerMask;
            _LayersField.Label.text = string.Empty;
            layersPanel.Controls.Add(_LayersField);


            #endregion

            _PnlFavoriteColors = new Grid()
            {
                Height = 22, Margin = new Thickness(0, 2)
            };
            _FavoriteColors = new Color[] { new Color(1.0f, 0.0f, 0.0f, 0.0f),   // red
                                            new Color(0.0f, 1.0f, 0.0f, 0.0f),   // green
                                            new Color(0.0f, 0.0f, 1.0f, 0.0f),   // blue
                                            new Color(0.0f, 0.0f, 0.0f, 1.0f),   // Alpha
                                            new Color(1.0f, 1.0f, 1.0f, 1.0f),   // white
                                            new Color(0.0f, 0.0f, 0.0f, 0.0f) }; // black
            _PnlFavoriteColors.Controls.Add(new Box()
            {
                Row = 0, Column = 0, ColumnSpan = _FavoriteColors.Length
            });
            for (int i = 0; i < _FavoriteColors.Length; i++)
            {
                _PnlFavoriteColors.ColumnDefinitions.Add(1, GridUnitType.Star);
                Skill.Framework.UI.Button btn = new Skill.Framework.UI.Button()
                {
                    Tag = i.ToString(), Margin = new Thickness(4), Style = new GUIStyle(), Column = i
                };
                string    toolTip    = string.Empty;
                Texture2D background = null;
                if (i == 0)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.Red; toolTip = "Red";
                }
                else if (i == 1)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.Green; toolTip = "Green";
                }
                else if (i == 2)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.Blue; toolTip = "Blue";
                }
                else if (i == 3)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.Transparent; toolTip = "Alpha";
                }
                else if (i == 4)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.White; toolTip = "White";
                }
                else if (i == 5)
                {
                    background = Skill.Editor.Resources.UITextures.Colors.Black; toolTip = "Black";
                }
                btn.Style.normal.background = btn.Style.focused.background = btn.Style.hover.background = btn.Style.active.background = background;
                btn.Content.tooltip         = toolTip;
                btn.Click += btn_Click;
                _PnlFavoriteColors.Controls.Add(btn);
            }


            _ColorField = new ColorField()
            {
                Color = _PaintColor.Color, Margin = new Thickness(2)
            };
            _SliRadius = new Skill.Editor.UI.Slider()
            {
                Value = _PaintColor.Radius, MinValue = 1, MaxValue = 40, Margin = new Thickness(2), Height = 16
            }; _SliRadius.Label.text = "Radius"; _SliRadius.Label.tooltip = "Shift + (A/D)";
            _SliStrength             = new Skill.Editor.UI.Slider()
            {
                Value = _PaintColor.Strength, MinValue = 1f, MaxValue = 100f, Margin = new Thickness(2), Height = 16
            }; _SliStrength.Label.text = "Strength";
            _SliFalloff = new Skill.Editor.UI.Slider()
            {
                Value = _PaintColor.Falloff, MinValue = 0.0f, MaxValue = 1.0f, Margin = new Thickness(2), Height = 16
            }; _SliFalloff.Label.text = "Falloff";
            _HelpBox = new HelpBox()
            {
                Height = 60, Message = "Hold CTRL and drag with Right Click to paint.\nTexture must be read/write enable\nValid texture format:\n    ARGB32, RGBA32, RGB24 and Alpha8"
            };

            _BtnSaveTexture = new Skill.Framework.UI.Button()
            {
                Margin = new Thickness(2), Height = 40
            }; _BtnSaveTexture.Content.text = "Save Texture";
            _TbShadowMode = new UI.ToggleButton()
            {
                Left = false, Margin = new Thickness(2), Height = 20
            }; _TbShadowMode.Label.text = "Shadow Mode";


            _Panel.Controls.Add(_TextureField);
            _Panel.Controls.Add(_TbChannels);
            _Panel.Controls.Add(_PnlFavoriteColors);
            _Panel.Controls.Add(_ColorField);
            _Panel.Controls.Add(layersPanel);
            _Panel.Controls.Add(_SliRadius);
            _Panel.Controls.Add(_SliStrength);
            _Panel.Controls.Add(_SliFalloff);
            _Panel.Controls.Add(_TbShadowMode);
            _Panel.Controls.Add(_HelpBox);
            _Panel.Controls.Add(_BtnSaveTexture);

            _Frame = new Frame("Frame");
            _Frame.Grid.Controls.Add(_Panel);

            _TextureField.ObjectChanged += _TextureField_ObjectChanged;
            _TbBrush.Changed            += _TbBrush_Changed;
            _TbShadowMode.Changed       += _TbShadowMode_Changed;

            _TbChannels.TabChanged += Channel_Changed;

            _LayersField.LayersChanged += _LayersField_LayersChanged;
            _PUV.OptionChanged         += _PUV_OptionChanged;
            _ColorField.ColorChanged   += _ColorField_ColorChanged;

            _SliRadius.ValueChanged   += _SliRadius_ValueChanged;
            _SliStrength.ValueChanged += _SliStrength_ValueChanged;
            _SliFalloff.ValueChanged  += _SliFalloff_ValueChanged;
            _BtnSaveTexture.Click     += _BtnSaveTexture_Click;
        }