Esempio n. 1
0
    public static Vector2 GetVector2(this ValMap map, string key, Vector2 defValue = default(Vector2))
    {
        Value val = null;

        if (!map.TryGetValue(key, out val))
        {
            return(defValue);
        }
        return(val.ToVector2());
    }
Esempio n. 2
0
    public static string GetString(this ValMap map, string key, string defaultValue = null)
    {
        Value val = null;

        if (!map.TryGetValue(key, out val) || val == null)
        {
            return(defaultValue);
        }
        return(val.ToString());
    }
Esempio n. 3
0
    public static bool GetBool(this ValMap map, string key, bool defaultValue = false)
    {
        Value val = null;

        if (!map.TryGetValue(key, out val) || val == null)
        {
            return(defaultValue);
        }
        return(val.BoolValue());
    }
Esempio n. 4
0
    public static int GetInt(this ValMap map, string key, int defaultValue)
    {
        Value val = null;

        if (!map.TryGetValue(key, out val) || val == null)
        {
            return(defaultValue);
        }
        return(val.IntValue());
    }
Esempio n. 5
0
    public static double GetDouble(this ValMap map, string key, float defaultValue)
    {
        Value val = null;

        if (!map.TryGetValue(key, out val) || val == null)
        {
            return(defaultValue);
        }
        return(val.DoubleValue());
    }
Esempio n. 6
0
    public static ValMap GetMap(this ValMap map, string key, bool createIfNotFound = false)
    {
        Value val = null;

        if (!map.TryGetValue(key, out val) || !(map is ValMap))
        {
            val = null;
            if (createIfNotFound)
            {
                val      = new ValMap();
                map[key] = val;
            }
        }
        return((ValMap)val);
    }