Ejemplo n.º 1
0
    public void DrawLightProbeSetting(SerializedObject serializedObject)
    {
        foldoutProbeset = EditorGUILayout.Foldout(foldoutProbeset, "LightProbe Adjustment", true, Style.Foldout);
        if (!foldoutProbeset)
        {
            return;
        }

        GUILayout.BeginHorizontal("box");
        if (inputNumber > 5.0f)
        {
            sliderValue = 5.0f;
        }
        else if (inputNumber < 1)
        {
            sliderValue = 1;
        }

        const string inputText = " ";

        sliderValue = EditorGUILayout.Slider(sliderValue, minSliderValue, maxSliderValue);

        if (Math.Abs(inputNumber - sliderValue) > 0.01f)
        {
            if (float.TryParse(inputText, out inputNumber))
            {
                sliderValue = Mathf.Clamp(inputNumber, minSliderValue, maxSliderValue);
            }
            else if (inputText.IsNullOrEmpty())
            {
                inputNumber = sliderValue;
            }
        }

        EditorPrefs.SetFloat("hoohTool_probeStrength", sliderValue);

        if (GUILayout.Button(_icons["plus"], smallButton))
        {
            _guiEventAction = () =>
            {
                ProbeIntensity.ScaleLightProbeData(sliderValue);
                ProbeIntensity.DisplayWarning();
            }
        }
        ;

        if (GUILayout.Button(_icons["minus"], smallButton))
        {
            _guiEventAction = () => { ProbeIntensity.ScaleLightProbeData(1 / Mathf.Abs(sliderValue)); }
        }
        ;

        if (GUILayout.Button(_icons["reset"], smallButton))
        {
            _guiEventAction = () =>
            {
                ProbeIntensity.ResetProbeData();
                ProbeIntensity.DisplayWarning();
            }
        }
        ;

        GUILayout.EndHorizontal();
    }
Ejemplo n.º 2
0
    private void OnGUI()
    {
        InitStyle();

        if (GUILayout.Button("Check Updates"))
        {
            Application.OpenURL("https://github.com/hooh-hooah/ModdingTool/tree/release/");
        }

        if (GUILayout.Button("How to make mods for AI?"))
        {
            Application.OpenURL("https://github.com/hooh-hooah/AI_Tips");
        }

        DrawUILine(new Color(0, 0, 0));
        EditorGUILayout.BeginVertical();
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(0), GUILayout.Height(0));
        {
            foldoutElement = EditorGUILayout.Foldout(foldoutElement, "Element Generator", true, foldoutStyle);
            if (foldoutElement)
            {
                EditorPrefs.SetInt("hoohTool_category", int.Parse(EditorGUILayout.TextField("Big Category Number: ", category.ToString())));
                EditorPrefs.SetInt("hoohTool_categorysmall", int.Parse(EditorGUILayout.TextField("Mid Category Number: ", categorySmall.ToString())));
                EditorPrefs.SetString("hoohTool_sideloadString", EditorGUILayout.TextField("Game Assetbundle Path: ", sideloaderString));

                category         = EditorPrefs.GetInt("hoohTool_category");      // this is mine tho
                sideloaderString = EditorPrefs.GetString("hoohTool_sideloadString");
                categorySmall    = EditorPrefs.GetInt("hoohTool_categorysmall"); // this is mine tho

                if (GUILayout.Button("Generate And Fill Item List in mod.xml"))
                {
                    if (CheckGoodSelection())
                    {
                        try {
                            GameObject[] selections = Selection.gameObjects;
                            string       path       = Path.Combine(Path.Combine(Directory.GetCurrentDirectory(), ModPacker.GetProjectPath()), "mod.xml").Replace("\\", "/");

                            XDocument document = TouchXML.GetXMLObject(path);
                            TouchXML.GenerateObjectString(document, selections);
                            TouchXML.GenerateBundleString(document, selections);
                            Debug.Log(path);
                            document.Save(path);
                        } catch (InvalidCastException e) {
                            Debug.LogError("You've selected wrong kind of object. You should only select prefabs!");
                        } catch (Exception e) {
                            Debug.LogError(e);
                        }
                    }
                }

                if (GUILayout.Button("Add Bone Information of this object"))
                {
                    if (CheckGoodSelection())
                    {
                        try {
                            GameObject[] selections = Selection.gameObjects;
                            string       path       = Path.Combine(Path.Combine(Directory.GetCurrentDirectory(), ModPacker.GetProjectPath()), "mod.xml").Replace("\\", "/");

                            XDocument document = TouchXML.GetXMLObject(path);
                            TouchXML.GenerateBoneString(document, selections);
                            Debug.Log(path);
                            document.Save(path);
                        } catch (InvalidCastException e) {
                            Debug.LogError("You've selected wrong kind of object. You should only select prefabs!");
                        } catch (Exception e) {
                            Debug.LogError(e);
                        }
                    }
                }
            }

            foldoutMacros = EditorGUILayout.Foldout(foldoutMacros, "Quick Unity Macros", true, foldoutStyle);
            if (foldoutMacros)
            {
                gap  = EditorGUILayout.IntField("Showcase Gap: ", gap);
                cols = EditorGUILayout.IntField("Showcase Columns: ", cols);
                if (GUILayout.Button("Showcase Mode"))
                {
                    if (CheckGoodSelection())
                    {
                        ShowcaseMode();
                    }
                }

                if (GUILayout.Button("Randomize Rotation"))
                {
                    if (CheckGoodSelection())
                    {
                        RandomizeRotation();
                    }
                }

                if (GUILayout.Button("Wrap Object with new GameObject and Scale"))
                {
                    if (CheckGoodSelection())
                    {
                        WrapObjectScale();
                    }
                }

                if (GUILayout.Button("Wrap Object with new GameObject"))
                {
                    if (CheckGoodSelection())
                    {
                        WrapObject();
                    }
                }
                if (GUILayout.Button("Create Prefab from Selected Objects"))
                {
                    if (CheckGoodSelection())
                    {
                        CreatePrefab();
                    }
                }
                lightScaleSize = EditorGUILayout.FloatField("Light Scale Size: ", lightScaleSize);
                if (GUILayout.Button("Scale Lights and Probes"))
                {
                    if (CheckGoodSelection())
                    {
                        ScaleLightsAndProbes();
                    }
                }
            }

            foldoutProbeset = EditorGUILayout.Foldout(foldoutProbeset, "LightProbe Adjustment", true, foldoutStyle);
            if (foldoutProbeset)
            {
                if (inputNumber > 5.0f)
                {
                    sliderValue = 5.0f;
                }
                else if (inputNumber < 1)
                {
                    sliderValue = 1;
                }

                string inputText = " ";
                sliderValue = EditorGUILayout.Slider(sliderValue, minSliderValue, maxSliderValue);

                if (inputNumber != sliderValue)
                {
                    if (float.TryParse(inputText, out inputNumber))
                    {
                        sliderValue = Mathf.Clamp(inputNumber, minSliderValue, maxSliderValue);
                    }
                    else if (inputText == " ")
                    {
                        inputNumber = sliderValue;
                    }
                }

                EditorPrefs.SetFloat("hoohTool_probeStrength", sliderValue);

                if (GUILayout.Button("Increase Intensity"))
                {
                    ProbeIntensity.ScaleLightProbeData(sliderValue);
                    ProbeIntensity.DisplayWarning();
                }

                if (GUILayout.Button("Decrease Intensity"))
                {
                    ProbeIntensity.ScaleLightProbeData(1 / Mathf.Abs(sliderValue));
                }

                if (GUILayout.Button("Reset Intensity"))
                {
                    ProbeIntensity.ResetProbeData();
                    ProbeIntensity.DisplayWarning();
                }
            }

            foldoutScaffolding = EditorGUILayout.Foldout(foldoutScaffolding, "Mod Scaffolding", true, foldoutStyle);
            if (foldoutScaffolding)
            {
                if (GUILayout.Button("Initialize Hair"))
                {
                    if (CheckGoodSelection())
                    {
                        AIObjectHelper.InitializeHair((GameObject)Selection.activeObject);
                    }
                }

                if (GUILayout.Button("Initialize Accessory"))
                {
                    if (CheckGoodSelection())
                    {
                        AIObjectHelper.InitializeAccessory((GameObject)Selection.activeObject);
                    }
                }

                if (GUILayout.Button("Initialize Clothes"))
                {
                    if (CheckGoodSelection())
                    {
                        AIObjectHelper.InitializeClothes((GameObject)Selection.activeObject);
                    }
                }

                if (GUILayout.Button("Initialize Studio Item (If it has more info)"))
                {
                    if (CheckGoodSelection())
                    {
                        AIObjectHelper.InitializeItem((GameObject)Selection.activeObject);
                    }
                }
            }

            foldoutMod = EditorGUILayout.Foldout(foldoutMod, "Build Mod", true, foldoutStyle);
            if (foldoutMod)
            {
                EditorPrefs.SetString("hoohTool_exportPath", EditorGUILayout.TextField("Zipmod Destination: ", gameExportPath));
                gameExportPath = EditorPrefs.GetString("hoohTool_exportPath");

                if (GUILayout.Button("Build Mod"))
                {
                    ModPacker.PackMod(gameExportPath);
                }
            }


            foldoutBundler = EditorGUILayout.Foldout(foldoutBundler, "Assetbundle Builder", true, foldoutStyle);
            if (foldoutBundler)
            {
                if (GUILayout.Button("Build All Assetbundles"))
                {
                    BuildAllAssetBundles();
                }
            }
        }

        EditorPrefs.SetBool("hoohTool_foldoutElement", foldoutElement);
        EditorPrefs.SetBool("hoohTool_foldoutMacros", foldoutMacros);
        EditorPrefs.SetBool("hoohTool_foldoutProbeset", foldoutProbeset);
        EditorPrefs.SetBool("hoohTool_foldoutScaffolding", foldoutScaffolding);
        EditorPrefs.SetBool("hoohTool_foldoutMod", foldoutMod);
        EditorPrefs.SetBool("hoohTool_foldoutBundler", foldoutBundler);

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();
    }