Пример #1
0
    void OnGUI()
    {
        Color oldColor = GUI.backgroundColor;

        defs = GlobalDefinesManager.Defines;

        scroll = GUILayout.BeginScrollView(scroll);

        GUI.backgroundColor = Color.cyan;
        if (GUILayout.Button("Add"))
        {
            defs.Add("NEW_DEFINE");
        }
        GUI.backgroundColor = oldColor;

        GUILayout.Space(4);

        List <string> v_definesToRemove = new List <string>();

        for (int i = 0; i < defs.Count; i++)
        {
            GUILayout.BeginHorizontal();

            defs[i] = EditorGUILayout.TextField(defs[i]);

            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("X", GUILayout.MaxWidth(24), GUILayout.MaxHeight(15)))
            {
                v_definesToRemove.AddChecking(defs[i]);
            }
            GUI.backgroundColor = oldColor;

            GUILayout.EndHorizontal();
        }

        foreach (string v_defineToRemove in v_definesToRemove)
        {
            GlobalDefinesManager.RemoveDefineChecking(v_defineToRemove);
        }
        v_definesToRemove.Clear();

        GUILayout.Space(4);

        GUILayout.EndScrollView();


        GUILayout.BeginHorizontal();
        GUI.backgroundColor = Color.green;
        if (GUILayout.Button("Apply"))
        {
            GlobalDefinesManager.Save();
        }
        GUI.backgroundColor = Color.magenta;
        if (GUILayout.Button("Refresh"))
        {
            GlobalDefinesManager.Load();
        }

        GUILayout.EndHorizontal();
        GUI.backgroundColor = oldColor;
    }
Пример #2
0
 void OnEnable()
 {
     GlobalDefinesManager.Load();
 }