Example #1
0
 //
 // Constructor that takes the data returned by the
 // GDEDataManager.Get() method and will now pull out the
 // individual fields using the TryGet() methods.
 //
 public Buff(Dictionary<string, object> data)
 {
     if (data != null)
     {
         data.TryGetString("name", out Name);
         data.TryGetInt("hp_delta", out HPDelta);
         data.TryGetInt("mana_delta", out ManaDelta);
         data.TryGetInt("damage_delta", out DamageDelta);
     }
 }
Example #2
0
    //
    // Constructor that takes the data returned by the
    // GDEDataManager.Get() method and will now pull out the
    // individual fields using the TryGet() methods.
    //
    public Character(Dictionary<string, object> data)
    {
        if (data != null)
        {
            // Pull out the individual fields and load our Character stats.
            data.TryGetString("name", out Name);
            data.TryGetInt("hp", out baseHP);
            data.TryGetInt("mana", out baseMana);
            data.TryGetInt("damage", out baseDamage);

            //
            // Get the Buff list
            //
            // First get a string list of the buffs using TryGetStringList
            List<string> buffKeyList;
            if (data.TryGetStringList("buffs", out buffKeyList))
            {
                //
                // Spin through each of the Buff names and pull out
                // the data with the GDEDataManager.Get() method.
                //
                Buffs = new List<Buff>();
                foreach(string buffKey in buffKeyList)
                {
                    //
                    // Pull out Buff data with Get() method and pass
                    // it down to the Buff classes constructor where
                    // it will pull out the individual fields and set
                    // it's properties.
                    //
                    Buff curBuff;
                    Dictionary<string, object> curBuffData;
                    GDEDataManager.Instance.Get(buffKey, out curBuffData);

                    //
                    // For each Buff in the string list create a new
                    // object passing it the data from the Get()
                    // method and add it to the Buff's list.
                    //
                    curBuff = new Buff(curBuffData);
                    Buffs.Add(curBuff);

                    //
                    // Now that the Buff's properties have been set
                    // from the data in the Buff's constructor add the
                    // bonuses to the HP, Mana, and Damage.
                    //
                    bonusHP += curBuff.HPDelta;
                    bonusMana += curBuff.ManaDelta;
                    bonusDamage += curBuff.DamageDelta;
                }
            }
        }
    }
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetString(descriptionKey, out _description);
                LoadFromSavedData(dataKey);
            }
        }
    void DrawSingleField(string schemaKey, string itemKey, string fieldKey, Dictionary<string, object> itemData)
    {
        string fieldPreviewKey = schemaKey+"_"+itemKey+"_"+fieldKey;
        string fieldType;
        itemData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out fieldType);

        BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
        if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
        {
            fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
            fieldType = GDEItemManager.GetVariableTypeFor(fieldTypeEnum);
        }

        content.text = fieldType;
        drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.TypeSuffix, content, labelStyle, out size);
        size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);

        GUI.Label(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);
        drawHelper.CurrentLinePosition += (size.x + 2);

        content.text = fieldKey.HighlightSubstring(filterText, highlightColor);
        drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.LblSuffix, content, labelStyle, out size);
        size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);

        GUI.Label(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);
        drawHelper.CurrentLinePosition += (size.x + 2);

        switch(fieldTypeEnum)
        {
            case BasicFieldType.Bool:
            {
                DrawBool(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.Int:
            {
                DrawInt(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.Float:
            {
                DrawFloat(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.String:
            {
                DrawString(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.Vector2:
            {
                DrawVector2(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Vector3:
            {
                DrawVector3(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Vector4:
            {
                DrawVector4(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Color:
            {
                DrawColor(fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.GameObject:
            {
                DrawObject<GameObject>(fieldPreviewKey, fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.Texture2D:
            {
                DrawObject<Texture2D>(fieldPreviewKey, fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.Material:
            {
                DrawObject<Material>(fieldPreviewKey, fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            case BasicFieldType.AudioClip:
            {
                DrawAudio(fieldPreviewKey, fieldKey, itemData, GDEConstants.ValueLbl);
                drawHelper.NewLine();
                break;
            }
            default:
            {
                List<string> itemKeys = GetPossibleCustomValues(schemaKey, fieldType);
                DrawCustom(fieldKey, itemData, true, itemKeys);
                drawHelper.NewLine();
                break;
            }
        }
    }
    void DrawListField(string schemaKey, string itemKey, string fieldKey, Dictionary<string, object> itemData)
    {
        try
        {
            string foldoutKey = string.Format(GDEConstants.MetaDataFormat, itemKey, fieldKey);
            bool newFoldoutState;
            bool currentFoldoutState = listFieldFoldoutState.Contains(foldoutKey);
            object defaultResizeValue = null;

            string fieldType;
            itemData.TryGetString(string.Format(GDEConstants.MetaDataFormat, GDEConstants.TypePrefix, fieldKey), out fieldType);

            BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
            if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
            {
                fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
                if (!fieldTypeEnum.Equals(BasicFieldType.Vector2) &&
                    !fieldTypeEnum.Equals(BasicFieldType.Vector3) &&
                    !fieldTypeEnum.Equals(BasicFieldType.Vector4) &&
                    !fieldTypeEnum.Equals(BasicFieldType.Color))
                    fieldType = fieldType.ToLower();

                defaultResizeValue = GetDefaultValueForType(fieldTypeEnum);
            }

            float width = 120;
            newFoldoutState = EditorGUI.Foldout(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), currentFoldoutState, string.Format("List<{0}>", fieldType), true);
            currentLinePosition += (width + 2);

            width = 120;
            EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), fieldKey.HighlightSubstring(filterText, highlightColor), labelStyle);
            currentLinePosition += (width + 2);

            if (newFoldoutState != currentFoldoutState)
            {
                if (newFoldoutState)
                    listFieldFoldoutState.Add(foldoutKey);
                else
                    listFieldFoldoutState.Remove(foldoutKey);
            }

            object temp = null;
            List<object> list = null;

            if (itemData.TryGetValue(fieldKey, out temp))
                list = temp as List<object>;

            GUIContent content = new GUIContent(GDEStrings.SizeLbl);
            width = GUI.skin.label.CalcSize(content).x;
            EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), content);
            currentLinePosition += (width + 2);

            int newListCount;
            string listCountKey = string.Format(GDEConstants.MetaDataFormat, itemKey, fieldKey);
            if (newListCountDict.ContainsKey(listCountKey))
            {
                newListCount = newListCountDict[listCountKey];
            }
            else
            {
                newListCount = list.Count;
                newListCountDict.Add(listCountKey, newListCount);
            }

            width = 40;
            newListCount = EditorGUI.IntField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), newListCount);
            currentLinePosition += (width + 4);

            content.text = GDEStrings.ResizeBtn;
            width = GUI.skin.button.CalcSize(content).x;
            newListCountDict[listCountKey] = newListCount;
            if (newListCount != list.Count && GUI.Button(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), content))
            {
                ResizeList(list, newListCount, defaultResizeValue);
                newListCountDict[listCountKey] = newListCount;
                currentLinePosition += (width + 2);
            }

            NewLine();

            if (newFoldoutState)
            {
                for (int i = 0; i < list.Count; i++)
                {
                   currentLinePosition += GDEConstants.Indent*2;

                    switch (fieldTypeEnum) {
                        case BasicFieldType.Bool:
                        {
                            DrawListBool(i, Convert.ToBoolean(list[i]), list);
                            NewLine();
                            break;
                        }
                        case BasicFieldType.Int:
                        {
                            DrawListInt(i, Convert.ToInt32(list[i]), list);
                            NewLine();
                            break;
                        }
                        case BasicFieldType.Float:
                        {
                            DrawListFloat(i, Convert.ToSingle(list[i]), list);
                            NewLine();
                            break;
                        }
                        case BasicFieldType.String:
                        {
                            DrawListString(i, list[i] as string, list);
                            NewLine();
                            break;
                        }
                        case BasicFieldType.Vector2:
                        {
                            DrawListVector2(i, list[i] as Dictionary<string, object>, list);
                            NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Vector3:
                        {
                            DrawListVector3(i, list[i] as Dictionary<string, object>, list);
                            NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Vector4:
                        {
                            DrawListVector4(i, list[i] as Dictionary<string, object>, list);
                            NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Color:
                        {
                            DrawListColor(i, list[i] as Dictionary<string, object>, list);
                            NewLine();
                            break;
                        }
                        default:
                        {
                            List<string> itemKeys = GetPossibleCustomValues(schemaKey, fieldType);
                            DrawListCustom(i, list[i] as string, list, true, itemKeys);
                            NewLine();
                            break;
                        }
                    }
                }
            }
        }
        catch(Exception ex)
        {
            Debug.LogException(ex);
        }
    }
    void Draw2DListField(string schemaKey, string itemKey, string fieldKey, Dictionary<string, object> itemData)
    {
        try
        {
            string foldoutKey = string.Format(GDMConstants.MetaDataFormat, itemKey, fieldKey);
            object defaultResizeValue;

            string fieldType;
            itemData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out fieldType);

            BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
            if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
            {
                fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
                fieldType = GDEItemManager.GetVariableTypeFor(fieldTypeEnum);
            }

            content.text = string.Format("List<List<{0}>>", fieldType);
            bool isOpen = DrawFoldout(content.text, foldoutKey, string.Empty, string.Empty, null);

            drawHelper.CurrentLinePosition = Math.Max(drawHelper.CurrentLinePosition, GDEConstants.MinLabelWidth+GDEConstants.Indent+4);
            content.text = fieldKey.HighlightSubstring(filterText, highlightColor);
            drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.LblSuffix, content, labelStyle, out size);

            size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), fieldKey.HighlightSubstring(filterText, highlightColor), labelStyle);
            drawHelper.CurrentLinePosition += (size.x + 2);

            object temp = null;
            IList list = null;

            if (itemData.TryGetValue(fieldKey, out temp))
                list = temp as IList;

            content.text = GDEConstants.SizeLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeSizeLblKey, content, EditorStyles.label, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content);
            drawHelper.CurrentLinePosition += (size.x + 2);

            int newListCount;
            string listCountKey = string.Format(GDMConstants.MetaDataFormat, itemKey, fieldKey);
            if (newListCountDict.ContainsKey(listCountKey))
            {
                newListCount = newListCountDict[listCountKey];
            }
            else
            {
                newListCount = list.Count;
                newListCountDict.Add(listCountKey, newListCount);
            }

            size.x = 40;
            newListCount = EditorGUI.IntField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, drawHelper.StandardHeight()), newListCount);
            drawHelper.CurrentLinePosition += (size.x + 4);

            content.text = GDEConstants.ResizeBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeResizeBtnKey, content, GUI.skin.button, out size);
            newListCountDict[listCountKey] = newListCount;
            if (list != null && newListCount != list.Count && GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content))
            {
                if (GDEItemManager.IsUnityType(fieldTypeEnum))
                    defaultResizeValue = Activator.CreateInstance(list.GetType().GetGenericArguments()[0]);
                else
                    defaultResizeValue = new List<object>();

                ResizeList(list, newListCount, defaultResizeValue);
                newListCountDict[listCountKey] = newListCount;
                drawHelper.CurrentLinePosition += (size.x + 2);
            }

            drawHelper.NewLine();

            if (isOpen)
            {
                defaultResizeValue = GDEItemManager.GetDefaultValueForType(fieldTypeEnum);
                for (int index = 0; index < list.Count; index++)
                {
                    IList subList = list[index] as IList;

                    drawHelper.CurrentLinePosition += GDEConstants.Indent*2;
                    content.text = string.Format("[{0}]:    List<{1}>", index, fieldType);

                    isOpen = DrawFoldout(content.text, foldoutKey+"_"+index, string.Empty, string.Empty, null);
                    drawHelper.CurrentLinePosition += 4;

                    // Draw resize
                    content.text = GDEConstants.SizeLbl;
                    drawHelper.TryGetCachedSize(GDEConstants.SizeSizeLblKey, content, EditorStyles.label, out size);
                    EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content);
                    drawHelper.CurrentLinePosition += (size.x + 2);

                    listCountKey = string.Format(GDMConstants.MetaDataFormat, schemaKey, fieldKey)+"_"+index;
                    if (newListCountDict.ContainsKey(listCountKey))
                    {
                        newListCount = newListCountDict[listCountKey];
                    }
                    else
                    {
                        newListCount = subList.Count;
                        newListCountDict.Add(listCountKey, newListCount);
                    }

                    size.x = 40;
                    newListCount = EditorGUI.IntField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, drawHelper.StandardHeight()), newListCount);
                    drawHelper.CurrentLinePosition += (size.x + 2);

                    newListCountDict[listCountKey] = newListCount;

                    content.text = GDEConstants.ResizeBtn;
                    drawHelper.TryGetCachedSize(GDEConstants.SizeResizeBtnKey, content, GUI.skin.button, out size);
                    if (newListCount != subList.Count)
                    {
                        if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content))
                            ResizeList(subList, newListCount, defaultResizeValue);
                        drawHelper.CurrentLinePosition += (size.x + 2);
                    }

                    drawHelper.NewLine();

                    if (isOpen)
                    {
                        for (int x = 0; x < subList.Count; x++)
                        {
                            drawHelper.CurrentLinePosition += GDEConstants.Indent*3;
                            content.text = string.Format("[{0}][{1}]:", index, x);

                            switch (fieldTypeEnum)
                            {
                                case BasicFieldType.Bool:
                                {
                                    DrawListBool(content, x, Convert.ToBoolean(subList[x]), subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.Int:
                                {
                                    DrawListInt(content, x, Convert.ToInt32(subList[x]), subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.Float:
                                {
                                    DrawListFloat(content, x, Convert.ToSingle(subList[x]), subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.String:
                                {
                                    DrawListString(content, x, subList[x] as string, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.Vector2:
                                {
                                    DrawListVector2(content, x, subList[x] as Dictionary<string, object>, subList);
                                    drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                                    break;
                                }
                                case BasicFieldType.Vector3:
                                {
                                    DrawListVector3(content, x, subList[x] as Dictionary<string, object>, subList);
                                    drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                                    break;
                                }
                                case BasicFieldType.Vector4:
                                {
                                    DrawListVector4(content, x, subList[x] as Dictionary<string, object>, subList);
                                    drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                                    break;
                                }
                                case BasicFieldType.Color:
                                {
                                    DrawListColor(content, x, subList[x] as Dictionary<string, object>, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.GameObject:
                                {
                                    DrawListObject<GameObject>(foldoutKey+index+"_"+x, content, x, subList[x] as GameObject, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.Texture2D:
                                {
                                    DrawListObject<Texture2D>(foldoutKey+index+"_"+x, content, x, subList[x] as Texture2D, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.Material:
                                {
                                    DrawListObject<Material>(foldoutKey+index+"_"+x, content, x, subList[x] as Material, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                case BasicFieldType.AudioClip:
                                {
                                    DrawListAudio(foldoutKey+index+"_"+x, content, x, subList[x] as AudioClip, subList);
                                    drawHelper.NewLine();
                                    break;
                                }
                                default:
                                {
                                    List<string> itemKeys = GetPossibleCustomValues(schemaKey, fieldType);
                                    DrawListCustom(content, x, subList[x] as string, subList, true, itemKeys);
                                    drawHelper.NewLine();
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
        catch(Exception ex)
        {
            Debug.LogError(ex);
        }
    }
    void DrawListField(string schemaKey, string itemKey, string fieldKey, Dictionary<string, object> itemData)
    {
        try
        {
            string foldoutKey = string.Format(GDMConstants.MetaDataFormat, itemKey, fieldKey);
            bool newFoldoutState;
            bool currentFoldoutState = listFieldFoldoutState.Contains(foldoutKey);
            object defaultResizeValue = null;

            string fieldType;
            itemData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out fieldType);

            BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
            if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
            {
                fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
                fieldType = GDEItemManager.GetVariableTypeFor(fieldTypeEnum);
                defaultResizeValue = GDEItemManager.GetDefaultValueForType(fieldTypeEnum);
            }

            content.text = string.Format("List<{0}>", fieldType);
            drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.TypeSuffix, content, EditorStyles.foldout, out size);
            size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);
            newFoldoutState = EditorGUI.Foldout(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), currentFoldoutState, content);
            drawHelper.CurrentLinePosition += (size.x + 2);

            content.text = fieldKey.HighlightSubstring(filterText, highlightColor);
            drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.LblSuffix, content, labelStyle, out size);
            size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);
            GUI.Label(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), fieldKey.HighlightSubstring(filterText, highlightColor), labelStyle);
            drawHelper.CurrentLinePosition += (size.x + 2);

            if (newFoldoutState != currentFoldoutState)
            {
                if (newFoldoutState)
                    listFieldFoldoutState.Add(foldoutKey);
                else
                    listFieldFoldoutState.Remove(foldoutKey);
            }

            object temp = null;
            IList list = null;

            if (itemData.TryGetValue(fieldKey, out temp))
                list = temp as IList;

            content.text = GDEConstants.SizeLbl;
            drawHelper.TryGetCachedSize(GDEConstants.SizeSizeLblKey, content, EditorStyles.label, out size);
            EditorGUI.LabelField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content);
            drawHelper.CurrentLinePosition += (size.x + 2);

            int newListCount;
            string listCountKey = string.Format(GDMConstants.MetaDataFormat, itemKey, fieldKey);
            if (newListCountDict.ContainsKey(listCountKey))
            {
                newListCount = newListCountDict[listCountKey];
            }
            else
            {
                newListCount = list.Count;
                newListCountDict.Add(listCountKey, newListCount);
            }

            size.x = 40;
            newListCount = EditorGUI.IntField(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, drawHelper.StandardHeight()), newListCount);
            drawHelper.CurrentLinePosition += (size.x + 4);

            content.text = GDEConstants.ResizeBtn;
            drawHelper.TryGetCachedSize(GDEConstants.SizeResizeBtnKey, content, GUI.skin.button, out size);
            newListCountDict[listCountKey] = newListCount;
            if (newListCount != list.Count && GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content))
            {
                ResizeList(list, newListCount, defaultResizeValue);
                newListCountDict[listCountKey] = newListCount;
                drawHelper.CurrentLinePosition += (size.x + 2);
            }

            drawHelper.NewLine();

            if (newFoldoutState)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    drawHelper.CurrentLinePosition += GDEConstants.Indent*2;
                    content.text = string.Format("[{0}]:", i);

                    switch (fieldTypeEnum) {
                        case BasicFieldType.Bool:
                        {
                            DrawListBool(content, i, Convert.ToBoolean(list[i]), list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.Int:
                        {
                            DrawListInt(content, i, Convert.ToInt32(list[i]), list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.Float:
                        {
                            DrawListFloat(content, i, Convert.ToSingle(list[i]), list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.String:
                        {
                            DrawListString(content, i, list[i] as string, list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.Vector2:
                        {
                            DrawListVector2(content, i, list[i] as Dictionary<string, object>, list);
                            drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Vector3:
                        {
                            DrawListVector3(content, i, list[i] as Dictionary<string, object>, list);
                            drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Vector4:
                        {
                            DrawListVector4(content, i, list[i] as Dictionary<string, object>, list);
                            drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
                            break;
                        }
                        case BasicFieldType.Color:
                        {
                            DrawListColor(content, i, list[i] as Dictionary<string, object>, list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.GameObject:
                        {
                            DrawListObject<GameObject>(foldoutKey+i, content, i, list[i] as GameObject, list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.Texture2D:
                        {
                            DrawListObject<Texture2D>(foldoutKey+i, content, i, list[i] as Texture2D, list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.Material:
                        {
                            DrawListObject<Material>(foldoutKey+i, content, i, list[i] as Material, list);
                            drawHelper.NewLine();
                            break;
                        }
                        case BasicFieldType.AudioClip:
                        {
                            DrawListAudio(foldoutKey+i, content, i, list[i] as AudioClip, list);
                            drawHelper.NewLine();
                            break;
                        }
                        default:
                        {
                            List<string> itemKeys = GetPossibleCustomValues(schemaKey, fieldType);
                            DrawListCustom(content, i, list[i] as string, list, true, itemKeys);
                            drawHelper.NewLine();
                            break;
                        }
                    }
                }
            }
        }
        catch(Exception ex)
        {
            Debug.LogError(ex);
        }
    }
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetInt(KnockbackKey, out _Knockback);
                dict.TryGetInt(AttackRangeKey, out _AttackRange);
                dict.TryGetInt(CostOfUseKey, out _CostOfUse);
                dict.TryGetInt(numberOfUsesKey, out _numberOfUses);
                dict.TryGetString(itemTypeKey, out _itemType);
                dict.TryGetGameObject(ItemModelKey, out _ItemModel);
                LoadFromSavedData(dataKey);
            }
        }
    protected override bool ShouldFilter(string itemKey, Dictionary<string, object> itemData)
    {
        if (itemData == null)
            return true;

        string schemaType = "<unknown>";
        itemData.TryGetString(GDMConstants.SchemaKey, out schemaType);

        // Return if we don't match any of the filter types
        if (GDEItemManager.FilterSchemaKeyArray.IsValidIndex(filterSchemaIndex) &&
            !GDEItemManager.FilterSchemaKeyArray[filterSchemaIndex].Equals(GDEConstants._AllLbl) &&
            !schemaType.Equals(GDEItemManager.FilterSchemaKeyArray[filterSchemaIndex]))
            return true;
        else if (!GDEItemManager.FilterSchemaKeyArray[filterSchemaIndex].Equals(GDEConstants._AllLbl) &&
                 schemaType.Equals(GDEItemManager.FilterSchemaKeyArray[filterSchemaIndex]) &&
                 string.IsNullOrEmpty(filterText))
            return false;

        bool schemaKeyMatch = schemaType.ToLower().Contains(filterText.ToLower());
        bool fieldKeyMatch = !GDEItemManager.ShouldFilterByField(schemaType, filterText);
        bool itemKeyMatch = itemKey.ToLower().Contains(filterText.ToLower());

        // Return if the schema keys don't contain the filter text or
        // if the schema fields don't contain the filter text
        if (!schemaKeyMatch && !fieldKeyMatch && !itemKeyMatch)
            return true;

        return false;
    }
    void DrawSingleField(string schemaKey, string fieldKey, Dictionary<string, object> itemData)
    {
        string fieldType;
        itemData.TryGetString(string.Format(GDEConstants.MetaDataFormat, GDEConstants.TypePrefix, fieldKey), out fieldType);

        BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
        if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
        {
            fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
            if (!fieldTypeEnum.Equals(BasicFieldType.Vector2) &&
                !fieldTypeEnum.Equals(BasicFieldType.Vector3) &&
                !fieldTypeEnum.Equals(BasicFieldType.Vector4) &&
                !fieldTypeEnum.Equals(BasicFieldType.Color))
                fieldType = fieldType.ToLower();
        }

        float width = 120;
        EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), fieldType);
        currentLinePosition += (width + 2);

        width = 120;
        EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), fieldKey.HighlightSubstring(filterText, highlightColor), labelStyle);
        currentLinePosition += (width + 2);

        switch(fieldTypeEnum)
        {
            case BasicFieldType.Bool:
            {
                DrawBool(fieldKey, itemData, GDEStrings.ValueLbl);
                NewLine();
                break;
            }
            case BasicFieldType.Int:
            {
                DrawInt(fieldKey, itemData, GDEStrings.ValueLbl);
                NewLine();
                break;
            }
            case BasicFieldType.Float:
            {
                DrawFloat(fieldKey, itemData, GDEStrings.ValueLbl);
                NewLine();
                break;
            }
            case BasicFieldType.String:
            {
                DrawString(fieldKey, itemData, GDEStrings.ValueLbl);
                NewLine();
                break;
            }
            case BasicFieldType.Vector2:
            {
                DrawVector2(fieldKey, itemData, GDEStrings.ValuesLbl);
                NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Vector3:
            {
                DrawVector3(fieldKey, itemData, GDEStrings.ValuesLbl);
                NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Vector4:
            {
                DrawVector4(fieldKey, itemData, GDEStrings.ValuesLbl);
                NewLine(GDEConstants.VectorFieldBuffer+1);
                break;
            }
            case BasicFieldType.Color:
            {
                DrawColor(fieldKey, itemData, GDEStrings.ValuesLbl);
                NewLine();
                break;
            }

            default:
            {
                List<string> itemKeys = GetPossibleCustomValues(schemaKey, fieldType);
                DrawCustom(fieldKey, itemData, true, itemKeys);
                NewLine();
                break;
            }
        }
    }
Example #11
0
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetBool(bool_fieldKey, out _bool_field);
                dict.TryGetInt(int_fieldKey, out _int_field);
                dict.TryGetFloat(float_fieldKey, out _float_field);
                dict.TryGetString(string_fieldKey, out _string_field);
                dict.TryGetVector2(vector2_fieldKey, out _vector2_field);
                dict.TryGetVector3(vector3_fieldKey, out _vector3_field);
                dict.TryGetVector4(vector4_fieldKey, out _vector4_field);
                dict.TryGetColor(color_fieldKey, out _color_field);

                string customDataKey;
                dict.TryGetString(custom_fieldKey, out customDataKey);
                GDEDataManager.DataDictionary.TryGetCustom(customDataKey, out _custom_field);
                LoadFromSavedData(dataKey);
            }
        }
Example #12
0
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetBool(show_remain_fuelKey, out _show_remain_fuel);
                dict.TryGetBool(long_tap_stage_record_clearKey, out _long_tap_stage_record_clear);
                dict.TryGetBool(soundKey, out _sound);
                dict.TryGetBool(musicKey, out _music);
                dict.TryGetInt(world_countKey, out _world_count);
                dict.TryGetString(versionKey, out _version);
                dict.TryGetString(auto_selected_stage_idKey, out _auto_selected_stage_id);

                dict.TryGetCustomList(stageKey, out stage);
                LoadFromSavedData(dataKey);
            }
        }
Example #13
0
        private static void AppendResetVariableMethods(StringBuilder sb, string schemaKey, Dictionary<string, object> schemaData)
        {
            bool shouldAppendSpace = false;
            bool didAppendSpaceForSection = false;
            bool isFirstSection = true;

            string variableType;

            // Append all the single variables first
            foreach(BasicFieldType fieldType in GDEItemManager.BasicFieldTypes)
            {
                variableType = fieldType.ToString();
                List<string> fieldKeys = GDEItemManager.SchemaFieldKeysOfType(schemaKey, fieldType.ToString(), 0);
                foreach(string fieldKey in fieldKeys)
                {
                    if (shouldAppendSpace)
                        sb.Append("\n");

                    AppendResetVariableMethod(sb, fieldKey, variableType);
                    shouldAppendSpace = true;
                    isFirstSection = false;
                }
            }

            // Append all list variables
            for(int dimension = 1;  dimension <= 2;  dimension++)
            {
                foreach(BasicFieldType fieldType in GDEItemManager.BasicFieldTypes)
                {
                    variableType = fieldType.ToString();
                    List<string> fieldKeys = GDEItemManager.SchemaFieldKeysOfType(schemaKey, variableType, dimension);
                    foreach(string fieldKey in fieldKeys)
                    {
                        if (shouldAppendSpace && !didAppendSpaceForSection && !isFirstSection)
                        {
                            sb.Append("\n");
                        }

                        AppendResetListVariableMethod(sb, fieldKey, variableType, dimension);
                        shouldAppendSpace = true;
                        didAppendSpaceForSection = true;
                        isFirstSection = false;
                    }
                }
                didAppendSpaceForSection = false;
            }

            // Append all custom variables
            for(int dimension = 0;  dimension <= 2;  dimension++)
            {
                List<string> fieldKeys = GDEItemManager.SchemaCustomFieldKeys(schemaKey, dimension);
                foreach(string fieldKey in fieldKeys)
                {
                    if (shouldAppendSpace && !didAppendSpaceForSection && !isFirstSection)
                    {
                        sb.Append("\n");
                    }

                    schemaData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out variableType);
                    variableType = string.Format(GDECodeGenConstants.DataClassNameFormat, variableType);

                    AppendResetCustomVariableMethod(sb, fieldKey, variableType, dimension);
                    shouldAppendSpace = true;
                    didAppendSpaceForSection = true;
                    isFirstSection = false;
                }

                didAppendSpaceForSection = false;
            }
        }
    void DrawSingleField(string schemaKey, string fieldKey, Dictionary<string, object> schemaData)
    {
        string fieldPreviewKey = schemaKey+"_"+fieldKey;
        string fieldType;
        schemaData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out fieldType);

        BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
        if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
        {
            fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
            fieldType = GDEItemManager.GetVariableTypeFor(fieldTypeEnum);
        }

        content.text = fieldType;
        drawHelper.TryGetCachedSize(schemaKey+fieldKey+GDEConstants.TypeSuffix, content, labelStyle, out size);

        size.x = Math.Max(size.x, GDEConstants.MinLabelWidth);
        GUI.Label(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content, labelStyle);
        drawHelper.CurrentLinePosition += (size.x + 2);

        string editFieldKey = string.Format(GDMConstants.MetaDataFormat, schemaKey, fieldKey);
        DrawEditableLabel(fieldKey, editFieldKey, RenameSchemaField, schemaData);

        switch(fieldTypeEnum)
        {
            case BasicFieldType.Bool:
                DrawBool(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;
            case BasicFieldType.Int:
                DrawInt(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;
            case BasicFieldType.Float:
                DrawFloat(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;
            case BasicFieldType.String:
                DrawString(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.Vector2:
                DrawVector2(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;
            case BasicFieldType.Vector3:
                DrawVector3(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;
            case BasicFieldType.Vector4:
                DrawVector4(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.Color:
                DrawColor(fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.GameObject:
                DrawObject<GameObject>(fieldPreviewKey, fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.Texture2D:
                DrawObject<Texture2D>(fieldPreviewKey, fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.Material:
                DrawObject<Material>(fieldPreviewKey, fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            case BasicFieldType.AudioClip:
                DrawAudio(fieldPreviewKey, fieldKey, schemaData, GDEConstants.DefaultValueLbl);
                break;

            default:
                DrawCustom(fieldKey, schemaData, false);
                break;
        }

        content.text = GDEConstants.DeleteBtn;
        drawHelper.TryGetCachedSize(GDEConstants.SizeDeleteBtnKey, content, GUI.skin.button, out size);
        if (fieldTypeEnum.Equals(BasicFieldType.Vector2) ||
            fieldTypeEnum.Equals(BasicFieldType.Vector3) ||
            fieldTypeEnum.Equals(BasicFieldType.Vector4))
        {
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.VerticalMiddleOfLine(), size.x, size.y), content))
                deletedFields.Add(fieldKey);

            drawHelper.NewLine(GDEConstants.VectorFieldBuffer+1);
        }
        else
        {
            if (GUI.Button(new Rect(drawHelper.CurrentLinePosition, drawHelper.TopOfLine(), size.x, size.y), content))
                deletedFields.Add(fieldKey);

            drawHelper.NewLine();
        }
    }
Example #15
0
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetBool(bool_fieldKey, out _bool_field);
                dict.TryGetInt(int_fieldKey, out _int_field);
                dict.TryGetFloat(float_fieldKey, out _float_field);
                dict.TryGetString(descriptionKey, out _description);
                dict.TryGetString(string_fieldKey, out _string_field);
                dict.TryGetVector2(vector2_fieldKey, out _vector2_field);
                dict.TryGetVector3(vector3_fieldKey, out _vector3_field);
                dict.TryGetColor(color_fieldKey, out _color_field);
                LoadFromSavedData(dataKey);
            }
        }
        public override void LoadFromDict(string dataKey, Dictionary<string, object> dict)
        {
            _key = dataKey;

            if (dict == null)
                LoadFromSavedData(dataKey);
            else
            {
                dict.TryGetInt(projectileRangeKey, out _projectileRange);
                dict.TryGetInt(numberOfUsesKey, out _numberOfUses);
                dict.TryGetInt(CostOfUseKey, out _CostOfUse);
                dict.TryGetFloat(itemDurationKey, out _itemDuration);
                dict.TryGetString(itemTypeKey, out _itemType);
                dict.TryGetGameObject(ItemModelKey, out _ItemModel);
                LoadFromSavedData(dataKey);
            }
        }
    void DrawSingleField(string schemaKey, string fieldKey, Dictionary<string, object> schemaData)
    {
        string fieldType;
        schemaData.TryGetString(string.Format(GDEConstants.MetaDataFormat, GDEConstants.TypePrefix, fieldKey), out fieldType);

        BasicFieldType fieldTypeEnum = BasicFieldType.Undefined;
        if (Enum.IsDefined(typeof(BasicFieldType), fieldType))
        {
            fieldTypeEnum = (BasicFieldType)Enum.Parse(typeof(BasicFieldType), fieldType);
            if (!fieldTypeEnum.Equals(BasicFieldType.Vector2) &&
                !fieldTypeEnum.Equals(BasicFieldType.Vector3) &&
                !fieldTypeEnum.Equals(BasicFieldType.Vector4) &&
                !fieldTypeEnum.Equals(BasicFieldType.Color))
                fieldType = fieldType.ToLower();
        }

        float width = 120;
        EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), fieldType);
        currentLinePosition += (width + 2);

        string editFieldKey = string.Format(GDEConstants.MetaDataFormat, schemaKey, fieldKey);
        DrawEditableLabel(fieldKey, editFieldKey, RenameSchemaField, schemaData);

        switch(fieldTypeEnum)
        {
            case BasicFieldType.Bool:
                DrawBool(fieldKey, schemaData, GDEStrings.DefaultValueLbl);
                break;
            case BasicFieldType.Int:
                DrawInt(fieldKey, schemaData, GDEStrings.DefaultValueLbl);
                break;
            case BasicFieldType.Float:
                DrawFloat(fieldKey, schemaData, GDEStrings.DefaultValueLbl);
                break;
            case BasicFieldType.String:
                DrawString(fieldKey, schemaData, GDEStrings.DefaultValueLbl);
                break;

            case BasicFieldType.Vector2:
                DrawVector2(fieldKey, schemaData, GDEStrings.DefaultValuesLbl);
                break;
            case BasicFieldType.Vector3:
                DrawVector3(fieldKey, schemaData, GDEStrings.DefaultValuesLbl);
                break;
            case BasicFieldType.Vector4:
                DrawVector4(fieldKey, schemaData, GDEStrings.DefaultValuesLbl);
                break;

            case BasicFieldType.Color:
                DrawColor(fieldKey, schemaData, GDEStrings.DefaultValuesLbl);
                break;

            default:
                DrawCustom(fieldKey, schemaData, false);
                break;
        }

        GUIContent content = new GUIContent(GDEStrings.DeleteBtn);
        width = GUI.skin.button.CalcSize(content).x;
        if (fieldTypeEnum.Equals(BasicFieldType.Vector2) ||
            fieldTypeEnum.Equals(BasicFieldType.Vector3) ||
            fieldTypeEnum.Equals(BasicFieldType.Vector4))
        {
            if (GUI.Button(new Rect(currentLinePosition, VerticalMiddleOfLine(), width, StandardHeight()), content))
                deletedFields.Add(fieldKey);

            NewLine(GDEConstants.VectorFieldBuffer+1);
        }
        else
        {
            if (GUI.Button(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), content))
                deletedFields.Add(fieldKey);

            NewLine();
        }
    }
Example #18
0
        private static void AppendLoadDictMethod(StringBuilder sb, string schemaKey, Dictionary<string, object> schemaData)
        {
            sb.Append("".PadLeft(GDECodeGenConstants.IndentLevel2));
            sb.Append(GDECodeGenConstants.LoadDictMethod);
            sb.Append("\n");

            bool shouldAppendSpace = false;
            bool didAppendSpaceForSection = false;
            bool isFirstSection = true;

            string variableType;

            // Append all the single variables first
            foreach(BasicFieldType fieldType in GDEItemManager.BasicFieldTypes)
            {
                variableType = fieldType.ToString();
                List<string> fieldKeys = GDEItemManager.SchemaFieldKeysOfType(schemaKey, fieldType.ToString(), 0);
                foreach(string fieldKey in fieldKeys)
                {
                    AppendLoadVariable(sb, variableType, fieldKey);
                    shouldAppendSpace = true;
                    isFirstSection = false;
                }
            }

            // Append the custom types
            bool appendTempKeyDeclaration = true;
            foreach(string fieldKey in GDEItemManager.SchemaCustomFieldKeys(schemaKey, 0))
            {
                if (shouldAppendSpace && !didAppendSpaceForSection && !isFirstSection)
                {
                    sb.Append("\n");
                }

                schemaData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out variableType);
                variableType = string.Format(GDECodeGenConstants.DataClassNameFormat, variableType);

                if (appendTempKeyDeclaration)
                {
                    sb.Append("".PadLeft(GDECodeGenConstants.IndentLevel4));
                    sb.Append(GDECodeGenConstants.TempStringKeyDeclaration);
                    sb.Append("\n");
                    appendTempKeyDeclaration = false;
                }

                AppendLoadCustomVariable(sb, variableType, fieldKey);
                shouldAppendSpace = true;
                didAppendSpaceForSection = true;
                isFirstSection = false;
            }
            didAppendSpaceForSection = false;

            // Append the basic lists
            for(int dimension = 1;  dimension <= 2;  dimension++)
            {
                foreach(BasicFieldType fieldType in GDEItemManager.BasicFieldTypes)
                {
                    List<string> fieldKeys = GDEItemManager.SchemaFieldKeysOfType(schemaKey, fieldType.ToString(), dimension);
                    variableType = fieldType.ToString();

                    foreach(string fieldKey in fieldKeys)
                    {
                        if (shouldAppendSpace && !didAppendSpaceForSection && !isFirstSection)
                        {
                            sb.Append("\n");
                        }

                        AppendLoadListVariable(sb, variableType, fieldKey, dimension);
                        shouldAppendSpace = true;
                        didAppendSpaceForSection = true;
                        isFirstSection = false;
                    }
                }
                didAppendSpaceForSection = false;
            }

            // Append the custom lists
            for(int dimension = 1;  dimension <= 2;  dimension++)
            {
                foreach(string fieldKey in GDEItemManager.SchemaCustomFieldKeys(schemaKey, dimension))
                {
                    if (shouldAppendSpace && !didAppendSpaceForSection && !isFirstSection)
                    {
                        sb.Append("\n");
                    }

                    schemaData.TryGetString(string.Format(GDMConstants.MetaDataFormat, GDMConstants.TypePrefix, fieldKey), out variableType);
                    variableType = "Custom";
                    AppendLoadListVariable(sb, variableType, fieldKey, dimension);

                    shouldAppendSpace = true;
                    isFirstSection = false;
                    didAppendSpaceForSection = true;
                }
            }

            sb.Append("".PadLeft(GDECodeGenConstants.IndentLevel4));
            sb.Append(GDECodeGenConstants.LoadDictMethodEnd);
            sb.Append("\n");
        }