예제 #1
0
    void PopulateEdit(PListDictionary dic)
    {
        ResetEntry();
        _name               = dic.StringValue(DISPLAY_NAME_KEY);
        _setting            = dic.StringValue(SETTING_KEY);
        _isValidSettingName = ValidateSettingString(_setting);
        _groupIndex         = System.Array.IndexOf(_groups, dic.StringValue(GROUP_KEY));

        if (_groupIndex < 0)
        {
            _groupIndex = 0;
        }

        _entryType = (SettingType)System.Enum.Parse(typeof(SettingType), dic.StringValue(TYPE_KEY));

        switch (_entryType)
        {
        case SettingType.Bool:
            _boolDefaultValue = dic.BoolValue(VALUE_KEY);
            break;

        case SettingType.Enum:
            var valDic = dic.DictionaryValue(VALUE_KEY);

            if (valDic != null)
            {
                foreach (var key in valDic.Keys)
                {
                    _enumValues[key] = valDic.StringValue(key);
                }
            }

            var defaultIndex = dic.IntValue(DEFAULT_INDEX);
            _defaultEnum = _enumValues.Keys.ToList()[defaultIndex];
            break;

        case SettingType.String:
            _stringDefaultValue = dic.StringValue(VALUE_KEY);
            _isPath             = dic.BoolValue(PATH_KEY);
            break;

        case SettingType.Array:
        case SettingType.StringList:
            _isInherit = dic.BoolValue(INHERIT_KEY);
            _isPath    = dic.BoolValue(PATH_KEY);
            break;

        default:
            break;
        }
    }
예제 #2
0
    void DrawEnumEntry(PListDictionary dic)
    {
        var enumDic = dic.DictionaryValue(VALUE_KEY);

        if (enumDic == null)
        {
            EditorGUILayout.LabelField("NO VALUES DEFINED", GUILayout.MaxWidth(600));
        }
        else
        {
            List <string> entries = new List <string>();

            foreach (var kvp in enumDic)
            {
                entries.Add(kvp.Key + " | " + kvp.Value);
            }

            int selectedIndex = dic.IntValue(DEFAULT_INDEX);
            EditorGUILayout.Popup(selectedIndex, entries.ToArray(), GUILayout.MaxWidth(600));
        }
    }