示例#1
0
    public static void FromJson(string json)
    {
        List <object> list = json.listFromJson();

        _map   = new Dictionary <int, ConfigRooms>(list.Count);
        _datas = new List <ConfigRooms>(list.Count);

        for (int i = 0; i < list.Count; i++)
        {
            Dictionary <string, object> inDict = list[i] as Dictionary <string, object>;
            ConfigRooms data = FromJson(inDict);
            _map.Add(data.RoomId, data);
            _datas.Add(data);
        }
    }
示例#2
0
    static ConfigRooms FromJson(Dictionary <string, object> inDict)
    {
        ConfigRooms data = new ConfigRooms();

        if (inDict.ContainsKey("RoomId"))
        {
            data.RoomId = inDict["RoomId"].GetJsonConverter().toInt();
        }
        if (inDict.ContainsKey("RoomName"))
        {
            data.RoomName = inDict["RoomName"].GetJsonConverter().toStr();
        }
        if (inDict.ContainsKey("RoomType"))
        {
            data.RoomType = inDict["RoomType"].GetJsonConverter().toEnum <RoomType>();
        }
        if (inDict.ContainsKey("MatchType"))
        {
            data.MatchType = inDict["MatchType"].GetJsonConverter().toEnum <MatchType>();
        }
        if (inDict.ContainsKey("BaseScore"))
        {
            data.BaseScore = inDict["BaseScore"].GetJsonConverter().toInt();
        }
        if (inDict.ContainsKey("MinCoinLimit"))
        {
            data.MinCoinLimit = inDict["MinCoinLimit"].GetJsonConverter().toInt();
        }
        if (inDict.ContainsKey("MaxCoinLimit"))
        {
            data.MaxCoinLimit = inDict["MaxCoinLimit"].GetJsonConverter().toInt();
        }
        if (inDict.ContainsKey("Icon"))
        {
            data.Icon = inDict["Icon"].GetJsonConverter().toStr();
        }

        return(data);
    }