コード例 #1
0
        public static TempShopValue getNewest()
        {
            string        obj  = File.ReadAllText(@"..\\..\\Shop\\Shop.json");
            TempShopValue temp = JsonConvert.DeserializeObject <TempShopValue>(obj);

            return(temp);
        }
コード例 #2
0
        public static void saveToJson()
        {
            TempShopValue obj = new TempShopValue();

            obj.Apokalypsecount = nh.Apokalypsecount;
            obj.GoldAmount      = nh.GoldAmount;
            obj.SupernovaCount  = nh.SupernovaCount;
            obj.VBombCount      = nh.VBombCount;
            obj.Lives           = nh.LivesExceed;
            if (_highscore < nh.Score)
            {
                obj.HighestScore = nh.Score;
            }
            else
            {
                obj.HighestScore = _highscore;
            }
            if (_waveScore < nh.Waves)
            {
                obj.WaveHighScore = nh.Waves;
            }
            else
            {
                obj.WaveHighScore = _waveScore;
            }

            string json = JsonConvert.SerializeObject(obj);

            File.WriteAllText(@"..\\..\\Shop\\Shop.json", json);
        }
コード例 #3
0
        public static void LoadFromJson()
        {
            string        obj  = File.ReadAllText(@"..\\..\\Shop\\Shop.json");
            TempShopValue temp = JsonConvert.DeserializeObject <TempShopValue>(obj);

            nh                 = NotifyHandler.InstanceCreation();
            nh.VBombCount      = temp.VBombCount;
            nh.Apokalypsecount = temp.Apokalypsecount;
            nh.GoldAmount      = temp.GoldAmount;
            nh.SupernovaCount  = temp.SupernovaCount;
            nh.HighestScore    = temp.HighestScore;
            _highscore         = temp.HighestScore;
            nh.WaveHighScore   = temp.WaveHighScore;
            _waveScore         = temp.WaveHighScore;
            nh.LivesExceed     = temp.Lives;
        }