コード例 #1
0
        private MainMenuState CreateMainMenuState(ITAlertPhotonClient photonClient, ScenarioController scenarioController)
        {
            var input = new MenuStateInput(photonClient, scenarioController);
            var state = new MainMenuState(input);

            var joinGameTransition        = new OnEventTransition(GamesListState.StateName);
            var createGameTransition      = new OnEventTransition(ScenarioListState.StateName);
            var settingsTransition        = new OnEventTransition(SettingsState.StateName);
            var joinGameSuccessTransition = new OnEventTransition(RoomState.StateName);
            var quitTransition            = new QuitTransition();

            input.JoinGameEvent          += joinGameTransition.ChangeState;
            input.CreateGameClickedEvent += createGameTransition.ChangeState;
            input.SettingsClickedEvent   += settingsTransition.ChangeState;
            input.JoinGameSuccessEvent   += joinGameSuccessTransition.ChangeState;
            input.QuitClickedEvent       += quitTransition.Quit;

            state.AddTransitions(joinGameTransition, createGameTransition, settingsTransition, joinGameSuccessTransition,
                                 quitTransition);

            return(state);
        }
コード例 #2
0
        public TickStateController Create()
        {
            var createGameController = new CreateGameController(_photonClient);
            var scenarioController   = new ScenarioController(_photonClient, createGameController);

            var mainMenuState     = CreateMainMenuState(_photonClient, scenarioController);
            var scenarioListState = CreateScenarioListState(_photonClient, scenarioController);
            var gameListState     = CreateGameListState(_photonClient);
            var createGameState   = CreateCreateGameState(_photonClient, createGameController, scenarioController);
            var settingsState     = CreateSettingsState();

            var stateController = new TickStateController(
                mainMenuState,
                scenarioListState,
                gameListState,
                createGameState,
                settingsState);

            stateController.SetParent(ParentStateController);

            return(stateController);
        }
コード例 #3
0
 public DbMngr()
 {
     UserController      = new UserController();
     AppLocaleController = new AppLocaleController();
     AppTextController   = new AppTextController();
     BankController      = new BankController();
     BattleController    = new BattleController();
     CityController      = new CityController();
     HarborController    = new HarborController();
     InventoryController = new InventoryController();
     ItemController      = new ItemController();
     MarketController    = new MarketController();
     PowerupController   = new PowerupController();
     ProfileAiController = new ProfileAIController();
     QuestController     = new QuestController();
     ResourceController  = new ResourceController();
     RewardController    = new RewardController();
     ScenarioController  = new ScenarioController();
     UserGameController  = new UserGameController();
     VesselController    = new VesselController();
     WeaponController    = new WeaponController();
 }
コード例 #4
0
        /// <summary>
        /// This routine tries to ackquire the asteroid lock. If we have it spawn the needed asteroids.
        /// </summary>
        /// <returns></returns>
        private void CheckAsteroidsToSpawn()
        {
            if (!Enabled || !AsteroidSystemReady)
            {
                return;
            }

            if (LockSystem.LockQuery.AsteroidLockBelongsToPlayer(SettingsSystem.CurrentSettings.PlayerName))
            {
                //We have the spawn lock so spawn some asteroids if there are less than expected
                var beforeSpawn      = GetAsteroidCount();
                var asteroidsToSpawn = SettingsSystem.ServerSettings.MaxNumberOfAsteroids - beforeSpawn;

                if (asteroidsToSpawn > 0)
                {
                    LunaLog.Log($"[LMP]: Spawning {asteroidsToSpawn} asteroids");
                    for (var i = 0; i < asteroidsToSpawn; i++)
                    {
                        ScenarioController?.SpawnAsteroid();
                    }
                }
            }
        }
        public async Task SaveTestScenario_WhenUserDoesHaveEditQaTestPermission_ThenActionAllowed()
        {
            // Arrange
            string specificationId = "abc123";

            IAuthorizationHelper authorizationHelper = Substitute.For <IAuthorizationHelper>();

            authorizationHelper
            .DoesUserHavePermission(Arg.Any <ClaimsPrincipal>(), Arg.Is(specificationId), Arg.Is(SpecificationActionTypes.CanEditQaTests))
            .Returns(true);

            IScenariosApiClient scenariosClient = CreateScenariosClient();

            scenariosClient.UpdateTestScenario(Arg.Any <TestScenarioUpdateModel>())
            .Returns(new ApiResponse <TestScenario>(HttpStatusCode.OK, new TestScenario()));

            ScenarioController controller = CreateScenarioController(authorizationHelper: authorizationHelper, scenariosClient: scenariosClient);

            // Act
            IActionResult result = await controller.SaveTestScenario(specificationId, "test123", new ScenarioEditViewModel());

            // Assert
            result.Should().BeOfType <OkObjectResult>();
        }
コード例 #6
0
 public void Init(ScenarioController controller)
 {
     curwindow = (ScenarioNodeEditor)EditorWindow.GetWindow <ScenarioNodeEditor>();
     //curwindow.window.width = 500;
     //curwindow.window.height = 500;
     // styleskin = Resources.Load<GUISkin>("Style");
     //curwindow.title = "TEST";
     scenarioSteps = controller.allSteps;
     actions       = Resources.LoadAll("ScenarioActions/");
     helpactions   = Resources.LoadAll("ScenarioHelpActions/");
     states        = Resources.LoadAll("Conditions/");
     conditions    = Resources.LoadAll("State(Check)/");
     if (scenarioSteps == null || scenarioSteps.Count == 0)
     {
         Init(controller, "ScenarioStartAction");
     }
     else
     {
         if (scenarioSteps[0].scriptableObjectName != "ScenarioStartAction")
         {
             scenarioSteps[0].scriptableObjectName = "ScenarioStartAction";
         }
     }
 }
コード例 #7
0
 public QuestionnaireState(QuestionnaireStateInput input, ScenarioController scenarioController) : base(input)
 {
     _scenarioController = scenarioController;
 }
コード例 #8
0
 public LevelState(LevelStateInput input, ScenarioController scenarioController) : base(input)
 {
     _scenarioController = scenarioController;
 }
コード例 #9
0
 public GameState(GameStateInput input, ScenarioController scenarioController, ModulesController modulesController) : base(input)
 {
     _scenarioController = scenarioController;
     _modulesController  = modulesController;
 }
コード例 #10
0
 public GameStateControllerFactory(ScenarioController scenarioController, ModulesController modulesController)
 {
     _scenarioController = scenarioController;
     _modulesController  = modulesController;
 }
コード例 #11
0
        public void GetReturnsNewPartitionScenarioSummary()
        {
            // Arrange
            var scenarioEntity = new Scenario
            {
                ScenarioId             = 100,
                ScenarioName           = "ScenarioName",
                OrganisationId         = 111,
                Week                   = 100,
                ScheduleMask           = 255,
                ScheduleWeekMin        = 100,
                ScheduleWeekMax        = 107,
                ScheduleStageMin       = 1,
                ScheduleStageMax       = 4,
                StageMax               = 4,
                StageOffsetMax         = 8,
                PriceFloor             = null,
                MarkdownCountStartWeek = 800,
                DefaultMarkdownType    = 255,
                AllowPromoAsMarkdown   = false,
                MinimumPromoPercentage = 0M
            };

            var summaryEntity = new ScenarioSummary
            {
                Scenario                      = scenarioEntity,
                ScenarioId                    = scenarioEntity.ScenarioId,
                ScenarioName                  = scenarioEntity.ScenarioName,
                Duration                      = 0,
                ErrorCount                    = 0,
                RecommendationCount           = 0,
                ProductCount                  = 2,
                LastRunDate                   = null,
                SuccessCount                  = 0,
                ProductTotal                  = 0,
                AttemptCountAvg               = 0,
                AttemptCountMax               = 0,
                AttemptCountMin               = 0,
                LastFunctionInstanceId        = null,
                FunctionInstanceCount         = 1,
                FunctionInstanceCountTotal    = 1,
                LastGroupTypeId               = (int)Common.Enums.FunctionGroupType.Partition,
                LastGroupTypeName             = Common.Enums.FunctionGroupType.Partition.ToString(),
                ScenarioSummaryStatusTypeName = ScenarioSummaryStatusType.New.ToString(),
                ScenarioSummaryStatusTypeId   = ScenarioSummaryStatusType.New
            };

            var expected = new VmScenarioSummary
            {
                CustomerId   = scenarioEntity.OrganisationId,
                ScenarioId   = scenarioEntity.ScenarioId,
                ScenarioName = scenarioEntity.ScenarioName,

                Status                         = ScenarioSummaryStatusType.New,
                Duration                       = summaryEntity.Duration,
                PartitionErrorCount            = summaryEntity.ErrorCount,
                PartitionSuccessCount          = summaryEntity.SuccessCount,
                PartitionCount                 = summaryEntity.FunctionInstanceCount,
                PartitionTotal                 = summaryEntity.FunctionInstanceCountTotal,
                LastRunDate                    = summaryEntity.LastRunDate,
                RecommendationCount            = summaryEntity.RecommendationCount,
                TotalNumberRecommendedProducts = summaryEntity.ProductCount,
                PriceFloor                     = scenarioEntity.PriceFloor,

                Week                   = scenarioEntity.Week,
                ScheduleMask           = scenarioEntity.ScheduleMask,
                StageMax               = scenarioEntity.StageMax,
                StageOffsetMax         = scenarioEntity.StageOffsetMax,
                ScheduleWeekMin        = scenarioEntity.ScheduleWeekMin,
                ScheduleWeekMax        = scenarioEntity.ScheduleWeekMax,
                ScheduleStageMin       = scenarioEntity.ScheduleStageMin,
                ScheduleStageMax       = scenarioEntity.ScheduleStageMax,
                MarkdownCountStartWeek = scenarioEntity.MarkdownCountStartWeek
            };

            var scenarioRepository                = new Mock <IScenarioRepository>();
            var scenarioSummaryRepository         = new Mock <IScenarioSummaryRepository>();
            var scenarioHierarchyFilterRepository = new Mock <IScenarioHierarchyFilterRepository>();
            var scenarioProductFilterRepository   = new Mock <IScenarioProductFilterRepository>();

            var scenarioWebService = new ScenarioWebService(scenarioRepository.Object, scenarioSummaryRepository.Object, scenarioProductFilterRepository.Object, scenarioHierarchyFilterRepository.Object);

            scenarioSummaryRepository.Setup(x => x.GetSingle(scenarioEntity.OrganisationId, scenarioEntity.ScenarioId)).ReturnsAsync(summaryEntity);

            var scenarioController = new ScenarioController(_hierarchyServiceMock.Object, scenarioWebService, _recommendationServiceMock.Object, _fileUploadServiceMock.Object, _organisationDataProvider.Object);

            // Act
            var actual = scenarioController.Get(scenarioEntity.ScenarioId, scenarioEntity.OrganisationId).Result;

            // Assert
            actual.ShouldBeEquivalentTo(expected);
        }
コード例 #12
0
 public void Persist <T>(_Entity entity)
 {
     if (typeof(T) == typeof(User))
     {
         UserController.Create((User)entity);
     }
     else if (typeof(T) == typeof(AppLocale))
     {
         AppLocaleController.Create((AppLocale)entity);
     }
     else if (typeof(T) == typeof(AppText))
     {
         AppTextController.Create((AppText)entity);
     }
     else if (typeof(T) == typeof(Bank))
     {
         BankController.Create((Bank)entity);
     }
     else if (typeof(T) == typeof(Battle))
     {
         BattleController.Create((Battle)entity);
     }
     else if (typeof(T) == typeof(City))
     {
         CityController.Create((City)entity);
     }
     else if (typeof(T) == typeof(Harbor))
     {
         HarborController.Create((Harbor)entity);
     }
     else if (typeof(T) == typeof(Inventory))
     {
         InventoryController.Create((Inventory)entity);
     }
     else if (typeof(T) == typeof(Item))
     {
         ItemController.Create((Item)entity);
     }
     else if (typeof(T) == typeof(Market))
     {
         MarketController.Create((Market)entity);
     }
     else if (typeof(T) == typeof(Powerup))
     {
         PowerupController.Create((Powerup)entity);
     }
     else if (typeof(T) == typeof(ProfileAI))
     {
         ProfileAiController.Create((ProfileAI)entity);
     }
     else if (typeof(T) == typeof(Quest))
     {
         QuestController.Create((Quest)entity);
     }
     else if (typeof(T) == typeof(Resource))
     {
         ResourceController.Create((Resource)entity);
     }
     else if (typeof(T) == typeof(Reward))
     {
         RewardController.Create((Reward)entity);
     }
     else if (typeof(T) == typeof(Scenario))
     {
         ScenarioController.Create((Scenario)entity);
     }
     else if (typeof(T) == typeof(UserGame))
     {
         UserGameController.Create((UserGame)entity);
     }
     else if (typeof(T) == typeof(Vessel))
     {
         VesselController.Create((Vessel)entity);
     }
     else if (typeof(T) == typeof(Weapon))
     {
         WeaponController.Create((Weapon)entity);
     }
     else
     {
         throw new Exception("Controller not implemented yet.");
     }
 }
コード例 #13
0
 public ScoreStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #14
0
 public void Initialize(ScenarioController controller, Action onDown)
 {
     _sceneController = controller;
     _onTapListener.Initialize(onDown);
     OnStartLevel();
 }
コード例 #15
0
 public MenuStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #16
0
 void Awake()
 {
     instance = this;
     CameraController.instance = scenarioCamera.GetComponent <CameraController>();
 }
コード例 #17
0
 public QuestionnaireStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #18
0
        private ScenarioListState CreateScenarioListState(ITAlertPhotonClient client, ScenarioController scenarioController)
        {
            var input = new ScenarioListStateInput(client, scenarioController);
            var state = new ScenarioListState(input, scenarioController);

            var scenarioSelectedTransition = new OnEventTransition(CreateGameState.StateName);
            var quickMatchTransition       = new OnEventTransition(RoomState.StateName);
            var previousStateTransition    = new OnEventTransition(MainMenuState.StateName);

            scenarioController.ScenarioSelectedSuccessEvent += scenarioSelectedTransition.ChangeState;
            scenarioController.QuickMatchSuccessEvent       += quickMatchTransition.ChangeState;
            input.BackClickedEvent += previousStateTransition.ChangeState;

            state.AddTransitions(scenarioSelectedTransition, previousStateTransition, quickMatchTransition);

            return(state);
        }
コード例 #19
0
 public ReviewStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #20
0
 public ScenarioListStateInput(ITAlertPhotonClient photonClient, ScenarioController scenarioController)
 {
     _photonClient       = photonClient;
     _scenarioController = scenarioController;
 }
コード例 #21
0
 public LevelStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #22
0
    //functions

    /// <summary>
    /// sets the scenario controller and scenario boolean
    /// </summary>
    /// <param name="sc"></param>
    public void setScenarioController(ScenarioController sc)
    {
        scenario = true;
        SC       = sc;
    }
コード例 #23
0
 SimChoice()
 {
     scenarioController = GameObject.FindObjectOfType <ScenarioController>();
 }
コード例 #24
0
 public ReviewState(ReviewStateInput input, ScenarioController scenarioController) : base(input)
 {
     _scenarioController = scenarioController;
 }
コード例 #25
0
 public void setScenarioController(ScenarioController sc)
 {
     SC = sc;
 }
コード例 #26
0
 public SettingsStateInput(ScenarioController scenarioController)
 {
     _scenarioController = scenarioController;
 }
コード例 #27
0
    void Awake()
    {
        instance = this;

        if (ScenarioController.instance == null)
        {
            //Debug Mode Start (scene open by itself)
            ScenarioController.beatLength = 60f / 130f;
            Time.timeScale = ScenarioController.getSpeedMult(debugSpeed);

            debugObjects = Instantiate(debugObjects, Vector3.zero, Quaternion.identity) as GameObject;

            MicrogameTimer.instance           = debugObjects.transform.FindChild("UI Camera").FindChild("Timer").GetComponent <MicrogameTimer>();
            MicrogameTimer.instance.beatsLeft = (float)beatDuration + (debugSimulateDelay ? 1f : 0f);
            if (!debugTimer)
            {
                MicrogameTimer.instance.disableDisplay = true;
            }
            if (debugTimerTick)
            {
                MicrogameTimer.instance.invokeTick();
            }

            victory           = defaultVictory;
            victoryDetermined = false;

            if (debugMusic && musicClip != null)
            {
                AudioSource source = debugObjects.transform.FindChild("Music").GetComponent <AudioSource>();
                source.clip  = musicClip;
                source.pitch = ScenarioController.getSpeedMult(debugSpeed);
                if (!debugSimulateDelay)
                {
                    source.Play();
                }
                else
                {
                    AudioHelper.playScheduled(source, ScenarioController.beatLength);
                }
            }

            Transform UICam = debugObjects.transform.FindChild("UI Camera");
            commandTransform = UICam.FindChild("Command");
            UICam.gameObject.SetActive(true);
            if (debugCommand)
            {
                commandTransform.gameObject.SetActive(true);
                commandTransform.FindChild("Text").GetComponent <TextMesh>().text = command;
            }

            if (controlScheme == ControlScheme.Mouse)
            {
                Cursor.visible = true;
            }
        }
        else
        {
            //Normal Start
            ScenarioController.instance.scenarioCamera.tag     = "Camera";
            Camera.main.GetComponent <AudioListener>().enabled = false;

            MicrogameTimer.instance.beatsLeft = ScenarioController.instance.getBeatsRemaining();
            MicrogameTimer.instance.gameObject.SetActive(true);

            ScenarioController.instance.microgameMusicSource.clip = musicClip;

            commandTransform = ScenarioController.instance.transform.FindChild("Command");

            ScenarioController.instance.resetVictory();
            ScenarioController.instance.invokeNextCycle();
        }
    }
コード例 #28
0
ファイル: MenuStateInput.cs プロジェクト: playgen/it-alert
 public MenuStateInput(ITAlertPhotonClient photonClient, ScenarioController controller)
 {
     _photonClient = photonClient;
     _controller   = controller;
 }
コード例 #29
0
    public void Button_StartScenario()
    {
        string scenarioName = ScenarioDropdownSelect();

        ScenarioController.StartScenario(scenarioName);
    }
コード例 #30
0
        private static CreateGameState CreateCreateGameState(ITAlertPhotonClient client, CreateGameController createGameController, ScenarioController scenarioController)
        {
            var input = new CreateGameStateInput(client, scenarioController);
            var state = new CreateGameState(input, createGameController);

            var joinedRoomTransition    = new OnEventTransition(RoomState.StateName);
            var previousStateTransition = new OnEventTransition(ScenarioListState.StateName);

            input.JoinedRoomEvent  += joinedRoomTransition.ChangeState;
            input.BackClickedEvent += previousStateTransition.ChangeState;

            state.AddTransitions(joinedRoomTransition, previousStateTransition);

            return(state);
        }