private void GUIInput(int id, string text) { float min = minInput(id); float max = maxInput(id); GUILayout.Label( text + " Val=" + inputs[id].ToString("F4") + " Min=" + min.ToString("F4") + " Max=" + max.ToString("F4")); if (overRideInputs) { GUILayout.BeginHorizontal(); boxInput[id] = GUILayout.Toggle(boxInput[id], "", GUILayout.ExpandWidth(false)); if (boxInput[id]) { float.TryParse( GUILayout.TextField(inputs[id].ToString("F4"), GUILayout.ExpandWidth(true), GUILayout.Width(100)), out inputs[id]); } else { inputs[id] = GUILayout.HorizontalSlider( inputs[id], minInput(id), maxInput(id), GUILayout.ExpandWidth(true)); } SmokeScreenConfig.Instance.sharedInputs[id] = inputs[id]; GUILayout.EndHorizontal(); } }
private void OnGUI() { if (!HighLogic.LoadedSceneIsFlight) { return; } if (showUI && hostPart != null) { winPos = GUILayout.Window( winID, winPos, windowGUI, hostPart.name + " " + effectName + " " + instanceName, GUILayout.MinWidth(300)); } }
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].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.Clear(true); } } 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 = SmokeScreenUtil.WriteRootNode(GetEffectConfig()); 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")) { ConfigNode node = ConfigNode.Parse(nodeText); 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(); }