Esempio n. 1
0
    public static void Load()
    {
        string savePath = Path.Combine(Application.dataPath, "GameData.json");

        if (File.Exists(savePath))
        {
            StreamReader read     = File.OpenText(savePath);
            string       text     = read.ReadToEnd();
            JObject      root     = JObject.Parse(text);
            JObject      option   = root["SaveData"] as JObject;
            string       strLevel = option["Level"].ToString();
            string       strExp   = option["Exp"].ToString();
            string       strHP    = option["HP"].ToString();
            string       strMP    = option["MP"].ToString();

            string strDSpell     = option["D_Spell"].ToString();
            string strDSpellTime = option["D_SpellTime"].ToString();
            string strFSpell     = option["F_Spell"].ToString();
            string strFSpellTime = option["F_SpellTime"].ToString();

            if (option["Money"] != null)
            {
                string strMoney = option["Money"].ToString();
                Money = int.Parse(strMoney);
            }
            else
            {
                Money = 50;
            }

            myquestNum.Clear();
            JArray questnum = option["questnum"] as JArray;
            for (int i = 0; i < questnum.Count; i++)
            {
                string strnum = questnum[i].ToString();
                myquestNum.Add(int.Parse(strnum));
            }

            playerLevel = int.Parse(strLevel);
            playerExp   = int.Parse(strExp);
            playerHP    = int.Parse(strHP);
            playerMP    = int.Parse(strMP);

            D_Spell     = int.Parse(strDSpell);
            D_SpellTime = float.Parse(strDSpellTime);
            F_Spell     = int.Parse(strFSpell);
            F_SpellTime = float.Parse(strFSpellTime);

            LevelUpData.levels = LevelUpData.ReadCsv();
            statSetting();

            spellSetting();

            read.Close();
        }
    }
Esempio n. 2
0
 // 스탯세팅
 static PlayerData()
 {
     LevelUpData.levels = LevelUpData.ReadCsv();
     //IEnumerable<LevelUpData.LevelUp> levels = LevelUpData.ReadCsv();
     statSetting();
 }