private void OnGUI() { Color _oldColor = GUI.backgroundColor; // ****************** // Menu Display // ****************** GUILayout.BeginHorizontal(); { for (int _iter = 0; _iter < kCompilerCount; _iter++) { if (_iter == (int)m_compiler) { GUI.backgroundColor = Color.gray; } GUIStyle _style; switch (_iter) { case 0: _style = EditorStyles.miniButtonLeft; break; case (kCompilerCount - 1): _style = EditorStyles.miniButtonRight; break; default: _style = EditorStyles.miniButtonMid; break; } GlobalDefinesManager.eCompiler _compiler = (GlobalDefinesManager.eCompiler)_iter; if (GUILayout.Button(_compiler.ToString(), _style)) { m_compiler = _compiler; } GUI.backgroundColor = _oldColor; } } GUILayout.EndHorizontal(); // ****************** // Content Display // ****************** GUILayout.Label(m_compiler.ToString() + " User Defines"); m_scrollPostion = GUILayout.BeginScrollView(m_scrollPostion); { List <string> _definesList = m_definesManager.GetDefinesList(m_compiler); for (int _iter = 0; _iter < _definesList.Count; _iter++) { GUILayout.BeginHorizontal(); { _definesList[_iter] = EditorGUILayout.TextField(_definesList[_iter]); GUI.backgroundColor = Color.red; if (GUILayout.Button("x", GUIStyle.none, GUILayout.MaxWidth(18))) { _definesList.RemoveAt(_iter); } GUI.backgroundColor = _oldColor; } GUILayout.EndHorizontal(); } GUILayout.Space(4); GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Add")) { m_definesManager.AddNewDefineSymbol(m_compiler, "NEW_DEFINE"); } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); { GUI.backgroundColor = Color.green; if (GUILayout.Button("Apply")) { m_definesManager.SaveCompiler(m_compiler); } GUI.backgroundColor = Color.red; if (GUILayout.Button("Apply All", GUILayout.MaxWidth(64))) { m_definesManager.SetAllCompilerDefines(m_compiler); m_definesManager.SaveAllCompilers(); } } GUILayout.EndHorizontal(); GUI.backgroundColor = _oldColor; }
private void OnGUI () { Color _oldColor = GUI.backgroundColor; // ****************** // Menu Display // ****************** GUILayout.BeginHorizontal(); { for (int _iter = 0; _iter < kCompilerCount; _iter++) { if (_iter == (int)m_compiler) GUI.backgroundColor = Color.gray; GUIStyle _style; switch(_iter) { case 0: _style = EditorStyles.miniButtonLeft; break; case (kCompilerCount - 1): _style = EditorStyles.miniButtonRight; break; default: _style = EditorStyles.miniButtonMid; break; } GlobalDefinesManager.eCompiler _compiler = (GlobalDefinesManager.eCompiler)_iter; if (GUILayout.Button(_compiler.ToString(), _style)) { m_compiler = _compiler; } GUI.backgroundColor = _oldColor; } } GUILayout.EndHorizontal(); // ****************** // Content Display // ****************** GUILayout.Label(m_compiler.ToString() + " User Defines"); m_scrollPostion = GUILayout.BeginScrollView(m_scrollPostion); { List<string> _definesList = m_definesManager.GetDefinesList(m_compiler); for (int _iter = 0; _iter < _definesList.Count; _iter++) { GUILayout.BeginHorizontal(); { _definesList[_iter] = EditorGUILayout.TextField(_definesList[_iter]); GUI.backgroundColor = Color.red; if (GUILayout.Button("x", GUIStyle.none, GUILayout.MaxWidth(18))) _definesList.RemoveAt(_iter); GUI.backgroundColor = _oldColor; } GUILayout.EndHorizontal(); } GUILayout.Space(4); GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Add")) m_definesManager.AddNewDefineSymbol(m_compiler, "NEW_DEFINE"); } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); { GUI.backgroundColor = Color.green; if (GUILayout.Button("Apply")) { m_definesManager.SaveCompiler(m_compiler); } GUI.backgroundColor = Color.red; if (GUILayout.Button("Apply All", GUILayout.MaxWidth(64))) { m_definesManager.SetAllCompilerDefines(m_compiler); m_definesManager.SaveAllCompilers(); } } GUILayout.EndHorizontal(); GUI.backgroundColor = _oldColor; }
private void OnEnable() { m_definesManager = new GlobalDefinesManager(); m_compiler = GlobalDefinesManager.eCompiler.CSHARP; }
private void OnEnable () { m_definesManager = new GlobalDefinesManager(); m_compiler = GlobalDefinesManager.eCompiler.CSHARP; }