Пример #1
0
 private static void CreateConstantsFromDictionary(Dictionary <string, ConstantsEntry> i_dictionary)
 {
     foreach (KeyValuePair <string, ConstantsEntry> kvp in i_dictionary)
     {
         ConstantsEntry entry = kvp.Value;
         CreateConstantFromEntry(entry);
     }
 }
Пример #2
0
        private static void CreateConstantFromEntry(ConstantsEntry i_entry)
        {
            switch (i_entry.Type)
            {
            case STRING_KEY:
                mConstants[i_entry.ID] = i_entry.Value;
                break;

            case INT_KEY:
                mConstants[i_entry.ID] = int.Parse(i_entry.Value);
                break;

            case BOOL_KEY:
                mConstants[i_entry.ID] = bool.Parse(i_entry.Value);
                break;

            case FLOAT_KEY:
                mConstants[i_entry.ID] = float.Parse(i_entry.Value);
                break;

            case DOUBLE_KEY:
                mConstants[i_entry.ID] = double.Parse(i_entry.Value);
                break;

            case COLOR_KEY:
                mConstants[i_entry.ID] = ParseColor(i_entry.Value);
                break;

            case VECTOR3_KEY:
                mConstants[i_entry.ID] = ParseVector3(i_entry.Value);
                break;

            case STRINGLIST_KEY:
                mConstants[i_entry.ID] = ParseStringList(i_entry.Value);
                break;

            case INTLIST_KEY:
                mConstants[i_entry.ID] = ParseList <int>(i_entry.Value);
                break;

            default:
                MyMessenger.Instance.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Error, "Illegal constant type " + i_entry.Type + " for key " + i_entry.ID, "");
                break;
            }
        }