コード例 #1
0
    public void LoadGame()
    {
        GameFields loadedGamesState = gameState.Load();

        string[] names = loadedGamesState.items.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        Item[]   items = itemsData.GetItemsByNames(names);
        User.I.OnUserLoadedState(loadedGamesState.userData, items);
    }
コード例 #2
0
    public GameFields Load()
    {
        GameFields gameFields = new GameFields();

        if (PlayerPrefs.HasKey("Name"))
        {
            gameFields.userData.Name  = PlayerPrefs.GetString("Name");
            gameFields.userData.Coins = PlayerPrefs.GetInt("Coins");
            gameFields.userData.Level = PlayerPrefs.GetInt("Level");
        }
        else
        {
            gameFields.userData = UserDataGetter.GetUserData();
        }
        gameFields.items = PlayerPrefs.GetString("Items", "");
        PlayerPrefs.DeleteAll();
        return(gameFields);
    }