Exemple #1
0
    void DrawChoosen(bool installed, ref string installPath)
    {
        switch (installed)
        {
        case true:
            EditorGUILayout.HelpBox(string.Format("{0} was installed.", installPath), MessageType.Info);

            break;

        case false:
            string tempInstallPath = installPath;
            EaGUI.Horizontal(() =>
            {
                EditorGUILayout.LabelField("Install File", EditorStyles.helpBox, GUILayout.MinWidth(50));
                EditorGUILayout.LabelField(tempInstallPath, EditorStyles.helpBox, GUILayout.MinWidth(150));
            });
            if (GUILayout.Button("Change Install File"))
            {
                var selectedPath = EditorUtility.OpenFilePanel("Select packages", installPath, "unitypackage");
                if (!string.IsNullOrEmpty(selectedPath))
                {
                    installPath = selectedPath;
                }
            }
            break;
        }
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        EaGUI.Horizontal(() =>
        {
            EditorGUILayout.LabelField("Key", GUILayout.MaxWidth(100));
            key = EditorGUILayout.TextField(key);
        });
        EaGUI.Horizontal(() =>
        {
            EditorGUILayout.LabelField("Value", GUILayout.MaxWidth(100));
            value = EditorGUILayout.TextField(value);
        });
        bool disabled = key == null || key == string.Empty ? true : EaString.instance.ContainsKey(key);

        EditorGUI.BeginDisabledGroup(disabled);
        if (GUILayout.Button("Add"))
        {
            EaString.instance.globalString.Add(new EditableString(key, value));
        }
        EditorGUI.EndDisabledGroup();


        //draw list editor
        int leng = EaString.instance.globalString.Count;
        //Debug.Log("fa");
        bool breakLoop = false;

        for (int i = 0; i < leng; i++)
        {
            if (breakLoop)
            {
                break;
            }
            EaGUI.Horizontal(() =>
            {
                string convertedKey = EaString.instance.globalString[i].key.ToLower();
                EditorGUILayout.LabelField(convertedKey, GUILayout.MaxWidth(100));
                GUI.backgroundColor = Color.cyan;
                EaString.instance.globalString[i].value = EditorGUILayout.TextField(EaString.instance.globalString[i].value);

                if (GUILayout.Button("x", style, GUILayout.MaxHeight(15), GUILayout.MaxWidth(18)))
                {
                    EaString.instance.globalString.Remove(EaString.instance.globalString[i]);
                    breakLoop = true;//redraw
                }
            });
        }
    }
Exemple #3
0
    public override void OnInspectorGUI()
    {
        keys = EaString.instance.allKeys.ToList();
        keys.Add(EaString.primaryKey);

        switch (keys.Count)
        {
        case 1:
            keys.Clear();
            keys.AddRange(new string[] { "No ☭ found", "⚒ Create" });
            current = EditorGUILayout.Popup(current, keys.ToArray());
            if (current == 1)
            {
                EaString.CreateText();
            }

            break;

        default:
            EaGUI.Horizontal(() =>
            {
                EditorGUILayout.LabelField("Key", GUILayout.MaxWidth(100));
                current = EditorGUILayout.Popup(current, keys.ToArray());
            });
            break;
        }


        if (current == EaString.instance.allKeys.Length)
        {
            current = 0;
            EaString.CreateText();
            return;
        }
        string key = EaString.instance.allKeys[current];

        instance.textKey   = key;
        instance.text.text = EaString.instance.GetValue(key);
        EaGUI.Horizontal(() =>
        {
            EditorGUILayout.LabelField("Value", GUILayout.MaxWidth(100));
            EaString.instance.globalString[current].value = EditorGUILayout.TextField(EaString.instance.GetValue(key));
        });
    }