コード例 #1
0
        public async Task PlayGame()
        {
            _appStateManager.CurrentState = AppState.Loading;
            await _gameLoader.LoadGame(new GameInfo(0, ""));

            _appStateManager.CurrentState = AppState.Game;
        }
コード例 #2
0
        /// <summary>
        ///     Loads the game based on parameters.
        /// </summary>
        /// <typeparam name="TLoadSource">Source type.</typeparam>
        /// <param name="canLoad">Object which can load the game.</param>
        /// <param name="source">Source from which we can load the game.</param>
        /// <returns>Loaded game.</returns>
        public static Game Load <TLoadSource>(IGameLoader <TLoadSource> canLoad, TLoadSource source)
        {
            byte[] serializedGame = canLoad.LoadGame(source);
            Game   game           = (Game)SerializationObjectWrapper.Deserialize(serializedGame).Value;

            game.ReconstructOriginalGraph();
            game.Refresh();
            return(game);
        }
コード例 #3
0
        public IEnumerator LoadSceneTest()
        {
            var loadTask = gameLoader.LoadGame(1);

            yield return(loadTask.AsIEnumerator());

            Assert.That(loadTask.IsCompleted && !loadTask.IsCanceled && !loadTask.IsFaulted);
            var gameType = loadTask.Result;

            Assert.That(gameType, Is.Not.Null);

            yield return(new WaitForSeconds(10));
        }
コード例 #4
0
        public async Task Load()
        {
            var loadingView = (ILoadingView)(await windowNavigation.Show <ILoadingView>(CancellationToken.None));

            loadingView.UpdateProgress(null);

            resourcesData = await resourcesDataProvider.GetData();

            player.InitResources(resourcesData);

            currentGame = await gameLoader.LoadGame(1, CancellationToken.None);

            _ = windowNavigation.Hide <ILoadingView>(CancellationToken.None);
        }
コード例 #5
0
        public async Task Load(Game game)
        {
            currentGame = game;
            gameType    = await gameLoader.LoadGame((int)currentGame.GameType);

            gameType.GridAdapter.Init(game.Width, game.Height);
            gameType.SetupCamera();


            currentGameResult = new GameResult()
            {
                Score        = 0,
                Stars        = 0,
                WavesAlive   = 0,
                WavesResults = new WaveResult[currentGame.Waves.Length],
            };

            for (int i = 0; i < currentGameResult.WavesResults.Length; i++)
            {
                currentGameResult.WavesResults[i] = CreateSkippedResult();
            }
        }
コード例 #6
0
 public void OnPlayButtonClick()
 {
     _gameLoader.LoadGame(_gamesList[gamesSelectionDropdown.value]);
 }