public override void InitializeLevelSelectScreen(LevelSelectScreenViewModel viewModel)
        {
            base.InitializeLevelSelectScreen(viewModel);
            // This is called when a LevelSelectScreenViewModel is created

            /*
             * Add available levels to the LevelSelectScreen viewmodel
             */
            foreach (var levelDescriptor in LevelManagementService.Levels)
            {
                viewModel.AvailableLevels.Add(levelDescriptor);
            }
        }
        public override void SelectLevel(LevelSelectScreenViewModel viewModel, LevelDescriptor arg)
        {
            base.SelectLevel(viewModel, arg);

            // This can be extracted into a service to load levels from other places
            // without duplicated code. Also external service could handle rules,
            // under which certain level can/cannot be loaded

            if (arg.IsLocked)
            {
                return;               //Level is locked, do not switch scenes
            }
            Publish(new UnloadSceneCommand()
            {
                SceneName = "MainMenuScene" // Unload  main menu scene
            });

            Publish(new LoadSceneCommand()
            {
                SceneName = arg.LevelScene // Load level scene
            });
        }
Esempio n. 3
0
 public virtual void SelectLevel(LevelSelectScreenViewModel viewModel, LevelDescriptor arg)
 {
 }
Esempio n. 4
0
 public virtual void InitializeLevelSelectScreen(LevelSelectScreenViewModel viewModel)
 {
     // This is called when a LevelSelectScreenViewModel is created
     viewModel.SelectLevel.Action = this.SelectLevelHandler;
     LevelSelectScreenViewModelManager.Add(viewModel);
 }