Exemple #1
0
    public MTJSONObject ToJson()
    {
        var js = MTJSONObject.CreateDict();

        js.Add(TrackGameStateName, StartStateName);
        js.Add(TrackLvId, LvId);
        js.Add("trackMode", trackMode);
        js.Add(TrackWin, Win);

        return(js);
    }
Exemple #2
0
    public void SaveToFile()
    {
        MTJSONObject setJs = MTJSONObject.CreateDict();

        setJs.Set(SettingEnum.totalCoin.ToString(), totalCoin);

        setJs.Set(SettingEnum.recordCoin.ToString(), recordCoin);

        setJs.Set(SettingEnum.recordScore.ToString(), recordScore);

        setJs.Set(SettingEnum.recordBomb.ToString(), recordBomb);
        setJs.Set(SettingEnum.recordRound.ToString(), recordRound);
        setJs.Set(SettingEnum.recordMatch.ToString(), recordMatch);



        var bt = MTXXTea.Encrypt(setJs.ToString(), SKEY);

        File.WriteAllBytes(GetPath(), bt);
    }
Exemple #3
0
    public MTJSONObject SerializeToJson(bool justSyncData)
    {
        MTJSONObject res = MTJSONObject.CreateDict();

        res.Set("id", _id);
        res.Set("name", _name);
        res.Set("maxLevel", _maxLevel);

        // levels
        var          levelsEnum = _levels.GetEnumerator();
        MTJSONObject levelsJson = MTJSONObject.CreateDict();

        while (levelsEnum.MoveNext())
        {
            var current = levelsEnum.Current;
            levelsJson.Set(current.Key.ToString(), current.Value);
        }
        res.Set("levels", levelsJson);

        return(res);
    }