示例#1
0
    public static void LoadAllInformation()
    {
        GameInformation.PlayerName   = PlayerPrefs.GetString("PLAYERNAME");
        GameInformation.PlayerLevel  = PlayerPrefs.GetInt("PLAYERLEVEL");
        GameInformation.Strength     = PlayerPrefs.GetInt("STRENGTH");
        GameInformation.Agility      = PlayerPrefs.GetInt("AGILITY");
        GameInformation.Dexterity    = PlayerPrefs.GetInt("DEXTERITY");
        GameInformation.Vitality     = PlayerPrefs.GetInt("VITALITY");
        GameInformation.Intelligence = PlayerPrefs.GetInt("INTELLIGENCE");
        GameInformation.Luck         = PlayerPrefs.GetInt("LUCK");
        GameInformation.Gold         = PlayerPrefs.GetInt("GOLD");

        GameInformation.PlayerClass = (BaseCharacterClass)PlayerInfoSerialization.Load("PLAYERCLASS");

        if (PlayerPrefs.GetString("EQUIPMENTITEM1") != null)
        {
            GameInformation.EquipmentOne = (BaseEquipment)PlayerInfoSerialization.Load("EQUIPMENTITEM1");
        }
    }
示例#2
0
    public static void SaveAllInformation()
    {
        PlayerPrefs.SetString("PLAYERNAME", GameInformation.PlayerName);
        PlayerPrefs.SetInt("PLAYERLEVEL", GameInformation.PlayerLevel);
        PlayerPrefs.SetInt("STRENGTH", GameInformation.Strength);
        PlayerPrefs.SetInt("AGILITY", GameInformation.Agility);
        PlayerPrefs.SetInt("DEXTERITY", GameInformation.Dexterity);
        PlayerPrefs.SetInt("VITALITY", GameInformation.Vitality);
        PlayerPrefs.SetInt("INTELLIGENCE", GameInformation.Intelligence);
        PlayerPrefs.SetInt("LUCK", GameInformation.Luck);
        PlayerPrefs.SetInt("GOLD", GameInformation.Gold);

        PlayerInfoSerialization.Save("PLAYERCLASS", GameInformation.PlayerClass);

        if (GameInformation.EquipmentOne != null)
        {
            PlayerInfoSerialization.Save("EQUIPMENTITEM1", GameInformation.EquipmentOne);
        }

        Debug.Log("SAVED ALL INFORMATION");
    }