Exemplo n.º 1
0
        private void BackgroundImageExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.None:
                ModelEditorService.Instance.BackImageFileName = "";
                break;

            case EditorSetOptions.Set:
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Filter           = "jpg|*.jpg|jpeg|*.jpeg|png|*.png";
                dlg.InitialDirectory = Engine.Instance.GetBaseDirectory();
                bool?ret = dlg.ShowDialog(ShellService.Instance.MainWindow);
                if (ret.HasValue && ret.Value)
                {
                    ModelEditorService.Instance.BackImageFileName = dlg.FileName;
                }
            }
            break;

            default:
                break;
            }
            Engine.Instance.SceneManager.BackImageFileName = ModelEditorService.Instance.BackImageFileName;
        }
Exemplo n.º 2
0
        private void EditorFontColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
                Application.Current.Resources["TextBrush"] = new SolidColorBrush(Colors.White);
                break;

            case EditorSetOptions.Set:
            {
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                SolidColorBrush brush = Application.Current.Resources["TextBrush"] as SolidColorBrush;
                dialog.InitialColor = brush.Color;
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Application.Current.Resources["TextBrush"] = new SolidColorBrush(dialog.SelectedColor);
                }
            }
            break;
            }
        }
Exemplo n.º 3
0
        private void cameraPositionExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
            {
                Camera cam = EngineService.Instance.MainCamera;
                if (cam != null)
                {
                    cam.Position = new vector3df(0, 5, -10);
                    cam.Dir      = new vector3df(0, -5, 10);
                    cam.RecalculateAll();
                }
            }

            break;

            case EditorSetOptions.Set:
                break;
            }
        }
Exemplo n.º 4
0
        private void EditorFontExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
                Application.Current.Resources["WindowFontFamily"] = new FontFamily();
                Application.Current.Resources["WindowFontStyle"]  = new FontStyle();
                Application.Current.Resources["WindowFontWeight"] = new FontWeight();
                break;

            case EditorSetOptions.Set:
            {
                FontDialog.FontDialogBox dialog = new FontDialog.FontDialogBox();

                FontFamily family = Application.Current.Resources["WindowFontFamily"] as FontFamily;
                FontStyle? style  = Application.Current.Resources["WindowFontStyle"] as FontStyle?;
                FontWeight?weight = Application.Current.Resources["WindowFontWeight"] as FontWeight?;

                dialog.FontFamily = family;
                if (style.HasValue)
                {
                    dialog.FontStyle = style.Value;
                }
                if (weight.HasValue)
                {
                    dialog.FontWeight = weight.Value;
                }
                dialog.Owner = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Application.Current.Resources["WindowFontFamily"] = dialog.FontFamily;
                    Application.Current.Resources["WindowFontStyle"]  = dialog.FontStyle;
                    Application.Current.Resources["WindowFontWeight"] = dialog.FontWeight;
                }
            }
            break;
            }
        }
Exemplo n.º 5
0
        private void BackgroundColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
                Engine.Instance.SceneManager.BackgroundColor = SceneManager.DefaultBackgroundColor;
                break;

            case EditorSetOptions.Set:
            {
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                dialog.colorPickerFull.SelectedColorChanged += (s, param) =>
                {
                    Engine.Instance.SceneManager.BackgroundColor = param.Value.ToSColor();
                };
                SColor scolor = Engine.Instance.SceneManager.BackgroundColor;
                dialog.InitialColor = Color.FromArgb(scolor.A, scolor.R, scolor.G, scolor.B);
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Engine.Instance.SceneManager.BackgroundColor = dialog.SelectedColor.ToSColor();
                }
                else
                {
                    Engine.Instance.SceneManager.BackgroundColor = dialog.InitialColor.ToSColor();
                }
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
        private void ModelColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            switch (option.Value)
            {
            case EditorSetOptions.Set:
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                dialog.colorPickerFull.SelectedColorChanged += (s, param) =>
                {
                    node.ModelColor = param.Value.ToSColor();
                };
                SColor scolor = node.ModelColor;
                dialog.InitialColor = Color.FromArgb(scolor.A, scolor.R, scolor.G, scolor.B);
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    node.ModelColor = dialog.SelectedColor.ToSColor();
                }
                else
                {
                    node.ModelColor = dialog.InitialColor.ToSColor();
                }
                break;

            case EditorSetOptions.Default:
                node.ModelColor = Colors.White.ToSColor();
                break;
            }
        }