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); }
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); }