コード例 #1
0
        private bool SaveFile(string filename)
        {
            if (filename.IsNullOrEmpty())
            {
                return(false);
            }

            if (!Directory.Exists(PluginPath.presetDirBust))
            {
                Directory.CreateDirectory(PluginPath.presetDirBust);
            }
            string pathBust = Path.Combine(PluginPath.presetDirBust, filename) + ".xml";

            if (!Directory.Exists(PluginPath.presetDirHip))
            {
                Directory.CreateDirectory(PluginPath.presetDirHip);
            }
            string pathHip = Path.Combine(PluginPath.presetDirHip, filename) + ".xml";

            ParamCharaController.ParamsKind paramsKind = _parent.GetSelectedParamsKind();
            switch (paramsKind)
            {
            case ParamCharaController.ParamsKind.Naked:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBustNaked, pathBust);
                break;

            case ParamCharaController.ParamsKind.Bra:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBust[_parent.GetSelectedCoordinate()][paramsKind], pathBust);
                break;

            case ParamCharaController.ParamsKind.Tops:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBust[_parent.GetSelectedCoordinate()][paramsKind], pathBust);
                break;

            case ParamCharaController.ParamsKind.Hip:
                XMLPresetIO.SaveXMLHip(_parent.GetSelectedController().paramCustom.paramHip, pathHip);
                break;

            default:
                break;
            }
            return(true);
        }
コード例 #2
0
        public void Draw(int windowID)
        {
            //Outline
            GUILayout.BeginArea(new Rect(2, 2, WindowRect.width - 4, WindowRect.height - 4), Style.WindowInside);

            //Title
            GUILayout.BeginArea(new Rect(3, 3, WindowRect.width - 10, 20), Style.WindowContents);
            GUILayout.Label("Tools", Style.LabelWindowTitle);
            GUILayout.EndArea();

            //Contents


            if (presetSelectBust._show) //Show preset select
            {
                GUILayout.Label("Select one preset to load.", Style.LabelLarge);
                if (presetSelectBust.Draw())
                {
                    OnPresetSelected(presetSelectBust);
                }
            }
            else if (presetSelectHip._show) //Show preset select
            {
                GUILayout.Label("Select one preset to load.", Style.LabelLarge);
                if (presetSelectHip.Draw())
                {
                    OnPresetSelected(presetSelectHip);
                }
            }
            else
            {
                //Enable or Disable all
                GUILayout.BeginArea(new Rect(3, 26, WindowRect.width - 10, 55), Style.WindowContents);
                GUILayout.Label("Enable or Disable", Style.LabedMiddleSubject);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Disable all"))
                {
                    _parent.GetSelectedController().ChangeEnabledAll(false);
                }
                if (GUILayout.Button("Enable all"))
                {
                    _parent.GetSelectedController().ChangeEnabledAll(true);
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                //if show destination coordinate for copy, dont draw area under Copy tools.
                //dont forget to expand area.
                if (coordinateSelect._show)
                {
                    //Copy tools
                    GUILayout.BeginArea(new Rect(3, 84, WindowRect.width - 10, 254), Style.WindowContents); //expand area than when coordinateSelect isnt shown.
                    GUILayout.Label("Copy", Style.LabedMiddleSubject);
                    if (GUILayout.Button("Copy parameter set to all coordinates"))
                    {
                        _parent.GetSelectedController().CopyParamAllCoordinate(_parent.GetSelectedCoordinate());
                        msgBox.Show("Copied parameter set to all coordinates.");
                    }
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Copy parameter set"))
                    {
                        _parent.GetSelectedController().CopyParamCoordinate(_parent.GetSelectedCoordinate(), coordinateSelect.GetSelectedCoordinate());
                        msgBox.Show("Copied parameter set\r\n" + _parent.GetSelectedCoordinate() + " to " + coordinateSelect.GetSelectedCoordinate());
                    }
                    GUILayout.Label("to", Style.LabedMiddleSubject);
                    coordinateSelect.Draw();
                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();
                }
                else
                {
                    //Copy tools
                    GUILayout.BeginArea(new Rect(3, 84, WindowRect.width - 10, 80), Style.WindowContents);
                    GUILayout.Label("Copy", Style.LabedMiddleSubject);
                    if (GUILayout.Button("Copy parameter set to all coordinates"))
                    {
                        _parent.GetSelectedController().CopyParamAllCoordinate(_parent.GetSelectedCoordinate());
                        msgBox.Show("Copied parameter set to all coordinates.");
                    }
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Copy parameter set"))
                    {
                        _parent.GetSelectedController().CopyParamCoordinate(_parent.GetSelectedCoordinate(), coordinateSelect.GetSelectedCoordinate());
                        msgBox.Show("Copied parameter set\r\n" + _parent.GetSelectedCoordinate() + " to " + coordinateSelect.GetSelectedCoordinate());
                    }
                    GUILayout.Label("to", Style.LabedMiddleSubject);
                    coordinateSelect.Draw();
                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();

                    //Preset Load
                    GUILayout.BeginArea(new Rect(3, 167, WindowRect.width - 10, 80), Style.WindowContents);
                    GUILayout.Label("Preset", Style.LabedMiddleSubject);
                    GUILayout.BeginHorizontal();
                    presetSelectBust.Draw();
                    presetSelectHip.Draw();
                    GUILayout.EndHorizontal();

                    //Preset Save
                    if (GUILayout.Button("Save preset"))
                    {
                        s_dialog._show = true;
                    }
                    GUILayout.EndArea();

                    //For default parameter
                    GUILayout.BeginArea(new Rect(3, 250, WindowRect.width - 10, 55), Style.WindowContents);
                    GUILayout.Label("Default Status", Style.LabedMiddleSubject);
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("Save as default"))
                    {
                        if (_parent.GetSelectedController().SaveDefaultStatus())
                        {
                            msgBox.Show("Saved default status");
                        }
                    }
                    if (GUILayout.Button("Load default"))
                    {
                        if (_parent.GetSelectedController().LoadDefaultStatus(false))
                        {
                            msgBox.Show("Loaded default status");
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();

                    GUILayout.BeginArea(new Rect(3, 308, WindowRect.width - 10, 30), Style.WindowContents);
                    if (GUILayout.Button("Close this window"))
                    {
                        _show = false;
                    }
                    GUILayout.EndArea();
                }
            }

            GUILayout.EndArea();

            if (WindowRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)) &&
                Event.current.type != EventType.KeyDown && Event.current.type != EventType.KeyUp)
            {
                Input.ResetInputAxes();
            }

            GUI.DragWindow();
        }