private void LoadSave() { string json = File.ReadAllText(Application.dataPath + "/Resources/save.json"); Debug.Log(json); gameInfos = JsonUtility.FromJson <GameInfos>(json); }
private void CreateNewGame() { Menu newGameMenu = new NewGameMenu(); Display.ClearConsole(); newGameMenu.DisplayMenuElements("Please select the game you want to play :"); string gameTitle = newGameMenu.GetChoiceFromPlayerInput(); string path = ""; List <GameInfos> games = new List <GameInfos>(); games = dataManager.GetListOfGames("Games"); foreach (var game in games) { if (game.GameTitle == gameTitle) { path = "Games\\" + game.WorldFileName; currentGameInfos = game; } } if (path != "") { CreateNewSaveGameFromGame(gameTitle, path); } else { Console.WriteLine("File not found in directory"); } }
public void GetGift(GettingGameInfo newGettingGameInfo) { if (GameInfos.Any(buy => buy.Game.Equals(newGettingGameInfo.Game))) { throw new InvalidOperationException("Game already exist in User Account"); } GameInfos.Add(newGettingGameInfo); }
void onHardcore() { GameInfos.clear(); GameInfos.modifiers = m_startModifiers; GameInfos.playerModifierCount = m_startModifiers.Count; GameInfos.hardmode = true; SceneSystem.changeScene(gameName); }
public void Add(Guid deckId, Guid gameId, string hero) { GameInfos.Insert(0, new GameInfo(deckId, gameId, hero)); if (GameInfos.Count > MaxGamesCount) { GameInfos.RemoveAt(MaxGamesCount); } OnPropertyChanged(nameof(Games)); }
public void Remove(Guid gameId) { var gameInfo = GameInfos.FirstOrDefault(x => x.GameId == gameId); if (gameInfo != null) { GameInfos.Remove(gameInfo); } OnPropertyChanged(nameof(Games)); }
public WorldSelectionForm(GameInfos _game) { InitializeComponent(); gameToEdit = _game; lblGreetings.Text = greetings; GetListOfGames(); cbTitle.Items.Clear(); GetGamesTitlesInCbTitles(); cbTitle.Select(); }
public void RemoveDeck(Guid deckId) { if (deckId == Guid.Empty) { return; } var games = GameInfos.Where(x => x.DeckId == deckId); foreach (var game in games) { GameInfos.Remove(game); } OnPropertyChanged(nameof(Games)); }
public void BuyGame(GettingGameInfo newGettingGameInfo) { if (GameInfos.Any(buy => buy.Game.Equals(newGettingGameInfo.Game))) { throw new InvalidOperationException("Game already exist in User Account"); } if (Balance <= newGettingGameInfo.Game.Price) { throw new InvalidOperationException("Balance less then Game Price"); } GameInfos.Add(newGettingGameInfo); Balance -= newGettingGameInfo.Game.Price; }
public void ReturnGame(int gameId, int daysLimit) { var gettingGameInfo = GameInfos.Find(gameInfo => gameInfo.Game.Id == gameId); if (gettingGameInfo == null) { throw new InvalidOperationException(); } if ((gettingGameInfo.Date - DateTime.Now).Days > daysLimit) { throw new InvalidOperationException(); } if (gettingGameInfo.Payer.Id != Id) { gettingGameInfo.Payer.Balance += gettingGameInfo.Game.Price; } else { Balance += gettingGameInfo.Game.Price; } GameInfos.Remove(gettingGameInfo); }
void OnEnable() { i = (GameInfos)target; }