Exemplo n.º 1
0
    public void Restore()
    {
        //print("Restore node_backup is\n " + node_backup.Replace(Environment.NewLine, Environment.NewLine + "ModelMultiParticlePersistFX "));
        string[]   text = node_backup.Split(new[] { "\n" }, StringSplitOptions.None);
        ConfigNode node = SmokeScreenUtil.RecurseFormat(SmokeScreenUtil.PreFormatConfig(text));

        OnLoad(node);
    }
Exemplo n.º 2
0
    private void windowGUI(int ID)
    {
        GUILayout.BeginVertical();

        activated = GUILayout.Toggle(activated, "Active");

        GUILayout.Space(10);

        overRideInputs = GUILayout.Toggle(overRideInputs, "Manual Inputs");

        GUIInput((int)MultiInputCurve.Inputs.power, "Power");
        GUIInput((int)MultiInputCurve.Inputs.density, "Atmo Density");
        GUIInput((int)MultiInputCurve.Inputs.mach, "Mach Speed");
        GUIInput((int)MultiInputCurve.Inputs.parttemp, "Part Temperature");
        GUIInput((int)MultiInputCurve.Inputs.externaltemp, "External Temperature");

        if (persistentEmitters.Count > 0)
        {
            GUILayout.Label("Shader: " + persistentEmitters[0].pe.pr.material.shader.name);
        }

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Single Emit Timer"))
        {
            OnEvent();
        }

        if (GUILayout.Button("Clear Particles"))
        {
            for (int i = 0; i < persistentEmitters.Count; i++)
            {
                persistentEmitters[i].pe.pe.ClearParticles();
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        nodeEdit = GUILayout.Toggle(nodeEdit, "Open Config Editor");

        if (nodeEdit)
        {
            GUILayout.BeginHorizontal();

            // Set the node with what was in the .cfg
            if (GUILayout.Button("Import"))
            {
                nodeText = string.Copy(node_backup);

                //print("Displaying node \n " + nodeText.Replace("\n", "\n" + "ModelMultiParticlePersistFX "));
            }

            // Rebuild the text from the active config
            if (GUILayout.Button("Rebuild"))
            {
                ConfigNode node = new ConfigNode();
                OnSave(node);
                nodeText = SmokeScreenUtil.WriteRootNode(node);
            }

            // Apply the text
            if (GUILayout.Button("Apply"))
            {
                string[]   text = nodeText.Split(new[] { "\n" }, StringSplitOptions.None);
                ConfigNode node = SmokeScreenUtil.RecurseFormat(SmokeScreenUtil.PreFormatConfig(text));
                OnLoad(node);
            }

            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.MinHeight(300));

            nodeText = GUILayout.TextArea(nodeText, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();
        }

        GUILayout.EndVertical();

        GUI.DragWindow();
    }