예제 #1
0
파일: SaveManager.cs 프로젝트: Yuwn/RTS
    private void LoadSave()
    {
        string json = File.ReadAllText(Application.dataPath + "/Resources/save.json");

        Debug.Log(json);
        gameInfos = JsonUtility.FromJson <GameInfos>(json);
    }
예제 #2
0
        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");
            }
        }
예제 #3
0
 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);
 }
예제 #4
0
 void onHardcore()
 {
     GameInfos.clear();
     GameInfos.modifiers           = m_startModifiers;
     GameInfos.playerModifierCount = m_startModifiers.Count;
     GameInfos.hardmode            = true;
     SceneSystem.changeScene(gameName);
 }
예제 #5
0
 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));
 }
예제 #6
0
        public void Remove(Guid gameId)
        {
            var gameInfo = GameInfos.FirstOrDefault(x => x.GameId == gameId);

            if (gameInfo != null)
            {
                GameInfos.Remove(gameInfo);
            }
            OnPropertyChanged(nameof(Games));
        }
예제 #7
0
 public WorldSelectionForm(GameInfos _game)
 {
     InitializeComponent();
     gameToEdit        = _game;
     lblGreetings.Text = greetings;
     GetListOfGames();
     cbTitle.Items.Clear();
     GetGamesTitlesInCbTitles();
     cbTitle.Select();
 }
예제 #8
0
        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));
        }
예제 #9
0
        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;
        }
예제 #10
0
        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);
        }
예제 #11
0
 void OnEnable()
 {
     i = (GameInfos)target;
 }