//============================================================================// #region GUI // SHOW MODULE // // // The emitter module is special and needs its own, simplified UI renderer. override public void ShowModule(ref BaseModule selectedModule, out AmpsHelpers.eModuleOperations operation) { GUIStyle actualStyle; operation = AmpsHelpers.eModuleOperations.NoOperation; actualStyle = GUI.skin.GetStyle("moduleBoxSelected"); GUILayout.BeginVertical(actualStyle); //--------------------------------// GUILayout.BeginHorizontal("moduleHeader"); //----------------// GUILayout.FlexibleSpace(); GUILayout.Label(type, "moduleName"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); //----------------\\ GUILayout.BeginHorizontal(); //----------------// GUILayout.BeginVertical(); //--------// GUILayout.Space(8); GUILayout.Label(moduleName.value, "moduleDescription"); GUILayout.EndVertical(); //--------\\ GUILayout.EndHorizontal(); //----------------\\ GUILayout.EndVertical(); //--------------------------------\\ }
// SHOW MODULE // // virtual public void ShowModule(ref BaseModule selectedModule, out AmpsHelpers.eModuleOperations operation) { GUIStyle actualStyle; operation = AmpsHelpers.eModuleOperations.NoOperation; if (selectedModule == this) { actualStyle = GUI.skin.GetStyle("moduleBoxSelected"); } else { actualStyle = GUI.skin.GetStyle("moduleBoxNormal"); } GUILayout.BeginVertical(actualStyle); //--------------------------------// GUILayout.BeginHorizontal("moduleHeader"); //----------------// isEnabled = GUILayout.Toggle(isEnabled, "", "toggle"); GUILayout.FlexibleSpace(); GUILayout.Label(type, "moduleName"); GUILayout.FlexibleSpace(); if (GUILayout.Button("", "optionButton")) { operation = AmpsHelpers.eModuleOperations.ShowOptions; selectedModule = this; } GUILayout.EndHorizontal(); //----------------\\ GUILayout.BeginHorizontal(); //----------------// GUILayout.BeginVertical(); //--------// GUILayout.Space(8); GUILayout.BeginHorizontal(); //----// if (implementsVisualization) { isVisualizationEnabled = GUILayout.Toggle(isVisualizationEnabled, "", "visualizationToggle"); } GUILayout.Label(moduleName.value, "moduleDescription"); GUILayout.EndHorizontal(); //----\\ GUILayout.EndVertical(); //--------\\ GUILayout.BeginVertical("moduleSidebar", GUILayout.Width(17)); //--------// if (GUILayout.Button("", "moveUpButton")) { operation = AmpsHelpers.eModuleOperations.MoveUp; selectedModule = this; } if (GUILayout.Button("", "moveDownButton")) { operation = AmpsHelpers.eModuleOperations.MoveDown; selectedModule = this; } GUILayout.EndVertical(); //--------\\ GUILayout.EndHorizontal(); //----------------\\ GUILayout.EndVertical(); //--------------------------------\\ // Get the rectangle which was drawn last. moduleRect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.MouseDown && moduleRect.Contains(Event.current.mousePosition)) { shouldSelectThis = true; } if (Event.current.type == EventType.Layout && shouldSelectThis) { selectedModule = this; shouldSelectThis = false; } }