コード例 #1
0
 private void AddMissionLibraryMissionBehaviors(MissionView entranceView)
 {
     //MissionStartingManager.AddMissionBehaviour(entranceView,
     //    Global.GetProvider<AInputControllerFactory>().CreateInputController(entranceView.Mission));
     MissionStartingManager.AddMissionBehaviour(entranceView, AMenuManager.Get().CreateMenuView());
     MissionStartingManager.AddMissionBehaviour(entranceView, AMenuManager.Get().CreateGameKeyConfigView());
 }
コード例 #2
0
        public HttpResponseMessage EmployMission(int missionId, int employeeId)
        {
            var mission  = this._context.missions.FirstOrDefault(m => m.id == missionId);
            var employee = this._context.employees.FirstOrDefault(e => e.id == employeeId);

            if (mission != null && employee != null)
            {
                try
                {
                    mission.employee = employee;
                    this._context.SaveChanges();

                    var view = new MissionView(mission);

                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, view);
                    //response.Headers.Location = new Uri(Url.Link("Default", new { id = performer.performerID }));
                    return(response);
                }
                catch (Exception ex)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
                }
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
コード例 #3
0
        protected void ManualControl()
        {
            MissionView missionView = (MissionView)_mission?.MissionBehaviors.Where(mb => mb is MissionView && (mb as MissionView).MissionScreen?.LastFollowedAgent != null).FirstOrDefault();

            if (missionView != null)
            {
                var lastFollowedAgent = missionView.MissionScreen.LastFollowedAgent;
                if (lastFollowedAgent.Health > 0.0f && lastFollowedAgent.Team != null)
                {
                    if (lastFollowedAgent.Team.IsPlayerTeam)
                    {
                        // take control of party soldier
                        TakeControlOfFriendlyAgent(lastFollowedAgent);
                    }
                    else if (lastFollowedAgent.Team.IsFriendOf(_playerTeam))
                    {
                        // attempt to take control of ally soldier
                        if (_allowControlAllies)
                        {
                            TakeControlOfFriendlyAgent(lastFollowedAgent);
                        }
                        else
                        {
                            PrintInformation($"You can't take control of ally '{ lastFollowedAgent.Name }'");
                        }
                    }
                    else if (lastFollowedAgent.Team.IsEnemyOf(_playerTeam))
                    {
                        // inform player that they can't take control of enemy soldiers
                        PrintInformation($"You can't take control of enemy '{ lastFollowedAgent.Name }'");
                    }
                }
            }
        }
コード例 #4
0
        public IQueryable <MissionView> Disabled()
        {
            var models = repo.getAllMissions().Where(m => !m.enabled);
            var views  = MissionView.getViews(models);

            return(views.AsQueryable());
        }
コード例 #5
0
        public static MissionView[] OpenCustomSiegeBattleMission(Mission mission)
        {
            List <MissionView> missionViewList = new List <MissionView>();

            mission.GetMissionBehaviour <SiegeDeploymentHandler>();
            missionViewList.Add(ViewCreator.CreateMissionSingleplayerEscapeMenu());
            missionViewList.Add(ViewCreator.CreateMissionAgentLabelUIHandler(mission));
            missionViewList.Add(ViewCreator.CreateMissionBattleScoreUIHandler(mission, (ScoreboardVM) new CustomBattleScoreboardVM()));
            missionViewList.Add(ViewCreator.CreateOptionsUIHandler());
            MissionView missionOrderUiHandler = ViewCreator.CreateMissionOrderUIHandler((Mission)null);

            missionViewList.Add(missionOrderUiHandler);
            missionViewList.Add((MissionView) new OrderTroopPlacer());
            missionViewList.Add(ViewCreator.CreateMissionAgentStatusUIHandler(mission));
            missionViewList.Add(ViewCreator.CreateMissionMainAgentEquipmentController(mission));
            missionViewList.Add((MissionView) new MusicBattleMissionView(true));
            missionViewList.Add((MissionView) new SiegeMissionView());
            ISiegeDeploymentView isiegeDeploymentView = missionOrderUiHandler as ISiegeDeploymentView;

            missionViewList.Add((MissionView) new MissionEntitySelectionUIHandler(new Action <GameEntity>(isiegeDeploymentView.OnEntitySelection), new Action <GameEntity>(isiegeDeploymentView.OnEntityHover)));
            missionViewList.Add(ViewCreator.CreateMissionBoundaryCrossingView());
            missionViewList.Add(ViewCreator.CreateSingleplayerMissionKillNotificationUIHandler());
            missionViewList.Add((MissionView) new MissionBoundaryMarker((IEntityFactory) new FlagFactory("swallowtail_banner"), 2f));
            missionViewList.Add(ViewCreator.CreateMissionFormationMarkerUIHandler(mission));
            missionViewList.Add(ViewCreator.CreateMissionSpectatorControlView(mission));
            missionViewList.Add((MissionView) new SiegeDeploymentVisualizationMissionView());
            missionViewList.Add((MissionView) new MissionAgentContourControllerView());
            missionViewList.Add((MissionView) new MissionCustomBattlePreloadView());
            return(missionViewList.ToArray());
        }
コード例 #6
0
        public static MissionView[] OpenSiegeBattleMission(Mission mission)
        {
            MissionView          missionOrderUiHandler = ViewCreator.CreateMissionOrderUIHandler();
            ISiegeDeploymentView siegeDeploymentView   = missionOrderUiHandler as ISiegeDeploymentView;
            List <MissionView>   missionViewList       = new List <MissionView>
            {
                ViewCreator.CreateMissionSingleplayerEscapeMenu(),
                                 ViewCreator.CreateMissionAgentLabelUIHandler(mission),
                ViewCreator.CreateMissionBattleScoreUIHandler(mission, new EnhancedBattleTestScoreBoardVM()),
                ViewCreator.CreateOptionsUIHandler(),
                missionOrderUiHandler,
                new OrderTroopPlacer(),
                new MissionSingleplayerUIHandler(),
                ViewCreator.CreateMissionAgentStatusUIHandler(mission),
                ViewCreator.CreateMissionMainAgentEquipmentController(mission),
                ViewCreator.CreateMissionMainAgentCheerControllerView(mission),
                new MusicBattleMissionView(true),
                new SiegeMissionView(),
                new MissionEntitySelectionUIHandler(siegeDeploymentView.OnEntitySelection,
                                                    siegeDeploymentView.OnEntityHover),
                ViewCreator.CreateMissionBoundaryCrossingView(),
                ViewCreator.CreateSingleplayerMissionKillNotificationUIHandler(),
                new MissionBoundaryMarker(new FlagFactory("swallowtail_banner")),
                ViewCreator.CreateMissionFormationMarkerUIHandler(mission),
                ViewCreator.CreateMissionSpectatorControlView(mission),
                new SiegeDeploymentVisualizationMissionView(),
                ViewCreator.CreatePlayerRoleSelectionUIHandler(),
                new MissionItemContourControllerView(),
                new MissionAgentContourControllerView(),
                new EnhancedBattleTestPreloadView()
            };

            return(missionViewList.ToArray());
        }
コード例 #7
0
 public void CheckMissionTag(MissionView misView)
 {
     if (e_CheckTagMission != null)
     {
         e_CheckTagMission(misView);
     }
 }
コード例 #8
0
 public override void OnCreated(MissionView entranceView)
 {
     foreach (var handler in _handlers)
     {
         handler.OnCreated(entranceView);
     }
 }
コード例 #9
0
 public override void OnPreMissionTick(MissionView entranceView, float dt)
 {
     foreach (var handler in _handlers)
     {
         handler.OnPreMissionTick(entranceView, dt);
     }
 }
コード例 #10
0
        public IQueryable <MissionView> Unemployed()
        {
            var models = repo.getAllMissions().Where(m => m.employee == null && m.enabled);
            var views  = MissionView.getViews(models);

            return(views.AsQueryable());
        }
コード例 #11
0
        public IQueryable <MissionView> All()
        {
            var models = repo.getAllMissions();
            var views  = MissionView.getViews(models);

            return(views.AsQueryable());
        }
コード例 #12
0
        public override void OnCreated(MissionView entranceView)
        {
            List <MissionBehaviour> list = new List <MissionBehaviour>
            {
                new RTSCameraSelectCharacterView(),

                new RTSCameraLogic(),

                new HideHUDView(),
                new FlyCameraMissionView()
            };


            foreach (var missionBehaviour in list)
            {
                MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
            }

            foreach (var extension in RTSCameraExtension.Extensions)
            {
                foreach (var missionBehaviour in extension.CreateMissionBehaviours(entranceView.Mission))
                {
                    MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
                }
            }

            foreach (var extension in MissionExtensionCollection.Extensions)
            {
                foreach (var missionBehaviour in extension.CreateMissionBehaviours(entranceView.Mission))
                {
                    MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
                }
            }
        }
コード例 #13
0
        public HttpResponseMessage PostAndContact(MissionView view)
        {
            var response = this.Post(view);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                return(response);
            }

            var employees = repo.getAllEmployees()
                            .Where(e => e.enabled == true)
                            .Where(e => view.categoryIds.All(c => e.categories.Select(c2 => c2.id).Contains(c)));

            var models = new List <TextMessageView>();

            foreach (var employee in employees)
            {
                var messageView = new TextMessageView()
                {
                    from    = "Jobsystems",
                    message = "Hej " + employee.firstName + "!" +
                              "\r\nVi har ett nytt uppdrag till dig:" +
                              "\r\n" +
                              "\r\nDatum: " + view.date.Split('T')[0] +
                              "\r\nTid: " + view.date.Split('T')[1].Substring(0, 5) +
                              "\r\nPlats: " + view.address.street + ", " + view.address.postalCode + " " + view.address.postalTown +
                              "\r\n" +
                              "\r\nLåter detta intressant?",
                    to = employee.phoneNumber,
                };

                var elkResponse = ElkTextMessage.send(messageView);

                var model = messageView.getModel();
                model.created = DateTime.UtcNow;

                if (elkResponse.StatusCode == HttpStatusCode.OK)
                {
                    var body = elkResponse.DynamicBody;

                    model.apiId = body.id;
                    model.error = false;

                    model = repo.createTextMessage(model);
                }
                else
                {
                    var message = elkResponse.RawText.Replace("\"", String.Empty);

                    model.error        = true;
                    model.errorMessage = message;
                    model = repo.createTextMessage(model);
                }

                models.Add(new TextMessageView(model));
            }

            return(response);
        }
コード例 #14
0
 public override void OnCreated(MissionView entranceView)
 {
     AddMissionLibraryMissionBehaviors(entranceView);
     foreach (var handler in _handlers)
     {
         handler.OnCreated(entranceView);
     }
 }
コード例 #15
0
        public void Put(int id, MissionView view)
        {
            view.id = id;
            var model = view.getModel(repo);

            model.updated = DateTime.UtcNow;
            repo.update(model);
        }
コード例 #16
0
        public override void OnPreMissionTick(MissionView entranceView, float dt)
        {
            var orderTroopPlacer = entranceView.Mission.GetMissionBehaviour <OrderTroopPlacer>();

            if (orderTroopPlacer != null)
            {
                entranceView.Mission.RemoveMissionBehaviour(orderTroopPlacer);
            }
        }
コード例 #17
0
        private static void DisableNextCharacterSpectatorUiPostfix(MissionView __instance, ref MissionSpectatorControlVM ____dataSource)
        {
            if (____dataSource.IsEnabled && (!__instance?.Mission?.IsOrderMenuOpen ?? false))
            {
                return;
            }

            ____dataSource.IsEnabled = false;
        }
コード例 #18
0
    public bool DeleteMission(MissionView misView)
    {
        //lz-2017.01.03 crash bug 错误 #8204
        if (null == misView)
        {
            return(false);
        }

        return(DeleteMission(misView.mMissionID));
    }
コード例 #19
0
        public override void OnCreated(MissionView entranceView)
        {
            var list = new List <MissionBehaviour>
            {
                new BattleMiniMapView()
            };


            foreach (var missionBehaviour in list)
            {
                MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
            }
        }
コード例 #20
0
        public HttpResponseMessage Get(int id)
        {
            var model = repo.getMission(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var view = new MissionView(model);
                return(Request.CreateResponse(HttpStatusCode.OK, view));
            }
        }
コード例 #21
0
        public override void OnCreated(MissionView entranceView)
        {
            List <MissionBehaviour> list = new List <MissionBehaviour>
            {
                new SetPlayerHealthLogic(),
                new CinematicCameraMenuView()
            };


            foreach (var missionBehaviour in list)
            {
                MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
            }
        }
コード例 #22
0
        public override void OnCreated(MissionView entranceView)
        {
            var config = RTSCameraConfig.Get();

            if (config.AttackSpecificFormation)
            {
                PatchChargeToFormation.Patch();
            }

            if (config.FixCircularArrangement)
            {
                PatchCircularFormation.Patch();
            }
            List <MissionBehaviour> list = new List <MissionBehaviour>
            {
                new RTSCameraSelectCharacterView(),

                new RTSCameraLogic(),

                new HideHUDView(),
                new RTSCameraMenuView(),
                new FlyCameraMissionView(),
                new RTSCameraGameKeyConfigView(),
                new FormationColorMissionView(),
                new RTSCameraOrderTroopPlacer()
            };


            foreach (var missionBehaviour in list)
            {
                MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
            }

            foreach (var extension in RTSCameraExtension.Extensions)
            {
                foreach (var missionBehaviour in extension.CreateMissionBehaviours(entranceView.Mission))
                {
                    MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
                }
            }

            foreach (var extension in MissionExtensionCollection.Extensions)
            {
                foreach (var missionBehaviour in extension.CreateMissionBehaviours(entranceView.Mission))
                {
                    MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
                }
            }
        }
コード例 #23
0
        public HttpResponseMessage Missions(int id)
        {
            var model = repo.getCategory(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var missions = model.missions;
                var views    = MissionView.getViews(missions);
                return(Request.CreateResponse(HttpStatusCode.OK, views));
            }
        }
コード例 #24
0
        public HttpResponseMessage Post(MissionView view)
        {
            var model = view.getModel(repo);

            model.created = DateTime.UtcNow;
            model.updated = DateTime.UtcNow;
            model.enabled = true;
            model.fakeId  = Guid.NewGuid();
            model         = repo.createMission(model);
            view          = new MissionView(model);

            var    response = Request.CreateResponse <MissionView>(HttpStatusCode.Created, view);
            string uri      = Url.Route(null, new { id = view.id });

            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return(response);
        }
コード例 #25
0
    public bool AddMission(MissionView misView, bool isIgnoreHadCreate = false)
    {
        if (!isIgnoreHadCreate)
        {
            if (m_MissonMap.ContainsKey(misView.mMissionID))
            {
                return(false);
            }
            m_MissonMap[misView.mMissionID] = misView;
        }

        if (e_AddMission != null)
        {
            e_AddMission(misView);
        }

        return(true);
    }
コード例 #26
0
        public static void OnMissionScreenTickPostfixPatch(MissionView __instance, float dt)
        {
            // Stay in sync with any changes to the setting made in the game settings
            bool currentOptionState = ManagedOptions.GetConfig(ManagedOptions.ManagedOptionsType.ShowBannersOnFriendlyTroops) == 1f;

            if (currentOptionState != lastOptionState)
            {
                initialOptionState = lastOptionState = newOptionState = currentOptionState;
            }

            // Handle sticky toggle key
            bool stickyToggleKeyState = Input.IsKeyDown(FriendlyTroopBannerHotkeysModSettings.Settings.StickyBannerToggleHotkey);

            if (stickyToggleKeyState == true && lastPermToggleKeyState == false)
            {
                lastPermToggleKeyState = true;
                initialOptionState     = !initialOptionState;
                newOptionState         = !lastOptionState;
            }
            else if (stickyToggleKeyState == false && lastPermToggleKeyState == true)
            {
                lastPermToggleKeyState = false;
            }

            // Handle momentary toggle key
            bool momentaryToggleKeyState = FriendlyTroopBannerHotkeysModSettings.Settings.UseGameShowIndicatorsBindingForMomentary ?
                                           __instance.Input.IsGameKeyDown(GenericGameKeyContext.ShowIndicators) :
                                           Input.IsKeyDown(FriendlyTroopBannerHotkeysModSettings.Settings.MomentaryBannerToggleHotkey);

            if (momentaryToggleKeyState != lastTempToggleKeyState)
            {
                lastTempToggleKeyState = momentaryToggleKeyState;
                newOptionState         = initialOptionState ? !momentaryToggleKeyState : momentaryToggleKeyState;
            }

            // Update game settings with current option state
            if (newOptionState != lastOptionState)
            {
                lastOptionState = newOptionState;
                ManagedOptions.SetConfig(ManagedOptions.ManagedOptionsType.ShowBannersOnFriendlyTroops, newOptionState ? 1f : 0f);
            }
        }
コード例 #27
0
        public override void OnCreated(MissionView entranceView)
        {
            var config = CommandSystemConfig.Get();

            if (config.AttackSpecificFormation)
            {
                PatchChargeToFormation.Patch();
            }
            List <MissionBehaviour> list = new List <MissionBehaviour>
            {
                new CommandSystemLogic(),
                new CommandSystemOrderTroopPlacer(),
                new DragWhenCommandView()
            };

            foreach (var missionBehaviour in list)
            {
                MissionStartingManager.AddMissionBehaviour(entranceView, missionBehaviour);
            }
        }
コード例 #28
0
 public override void OnPreMissionTick(MissionView entranceView, float dt)
 {
 }
コード例 #29
0
 public static void AddMissionBehaviour(MissionView entranceView, MissionBehaviour behaviour)
 {
     behaviour.OnAfterMissionCreated();
     entranceView.Mission.AddMissionBehaviour(behaviour);
 }
コード例 #30
0
 private void AddMissionLibraryMissionBehaviors(MissionView entranceView)
 {
     AddMissionBehaviour(entranceView, Global.GetProvider <AInputControllerFactory>().CreateInputController(entranceView.Mission));
     AddMissionBehaviour(entranceView, new OptionView(24, new Version(1, 0, 0)));
 }