コード例 #1
0
 private void drawReloadXML(string xmlFile)
 {
     if (Imgui.Button($"Reload {xmlFile}"))
     {
         MBObjectManager.Instance.LoadXML(xmlFile, null);
     }
 }
コード例 #2
0
        private void DrawDevCheats()
        {
            wasEnableAIChanges = enableAIChanges;
            Imgui.Checkbox("Player Invulnerable", ref playerInvulnerable);

            var player = Mission.Current.MainAgent;

            Imgui.Checkbox($"Everyone Invulnerable?: {_allInvulnerable}", ref _allInvulnerable);

            Imgui.Checkbox($"Everyone Passive?: {everyonePassive}", ref everyonePassive);

            Imgui.Checkbox("Enable AI Changes", ref enableAIChanges);


            foreach (var agent in Mission.Current.AllAgents)
            {
                if (agent == null)
                {
                    continue;
                }
                agent?.SetInvulnerable(_allInvulnerable);

                var component = agent?.GetComponent <AgentAIStateFlagComponent>();
                if (component != null)
                {
                    component.IsPaused = everyonePassive;
                }
                if (agent == player)
                {
                    continue;
                }
            }

            if (enableAIChanges)
            {
                if (wasEnableAIChanges)
                {
                    SliderUpdate();
                    AskForApply();
                }
                else
                {
                    BackupStats();
                }
            }
            else if (wasEnableAIChanges)
            {
                ResetStats();
            }


            if (Imgui.Button(" Gib Player 100 Money"))
            {
                var _gameModeServer = Mission.Current.GetMissionBehaviour <MissionMultiplayerGameModeBase>();
                _gameModeServer.ChangeCurrentGoldForPeer(GameNetwork.MyPeer.GetComponent <MissionPeer>(),
                                                         _gameModeServer.GetCurrentGoldForPeer(GameNetwork.MyPeer.GetComponent <MissionPeer>()) + 100);
            }

            player?.SetInvulnerable(playerInvulnerable);
        }
コード例 #3
0
        private void RefreshGUI(float dt)
        {
            Imgui.BeginMainThreadScope();
            Imgui.Begin("Combat Dev Feedback Reload");
            if (Imgui.Button("Reload Managed Core Params"))
            {
                ManagedParameters.Instance.Initialize(ModuleInfo.GetXmlPath("CombatDevTest",
                                                                            "managed_core_parameters"));

                DisplayMessage("Reloaded managed Core Params");
            }

            DrawReloadXMLs();
            Imgui.End();
            Imgui.Begin("Combat Dev Feedback Cheats");
            if (Imgui.Button(" Quit"))
            {
                GameStateManager gameStateManager = Game.Current.GameStateManager;
                if (!(gameStateManager.ActiveState is LobbyState))
                {
                    if (gameStateManager.ActiveState is MissionState)
                    {
                        Imgui.End();
                        Imgui.EndMainThreadScope();
                        NetworkMain.GameClient.Logout();

                        return;
                    }

                    gameStateManager.PopState(0);
                }
            }

            ;
            DrawDevCheats();
            Imgui.End();

            /*Imgui.Begin(("Console"));
             * DrawConsole();
             * Imgui.End();*/
            Imgui.EndMainThreadScope();
        }
コード例 #4
0
        private void AskForApply()
        {
            var player = Mission.Current.MainAgent;

            if (Imgui.Button("UPDATE AI"))
            {
                foreach (var agent in Mission.Current.AllAgents)
                {
                    if (agent == null || agent == player)
                    {
                        continue;
                    }

                    var component = agent?.GetComponent <AgentAIStateFlagComponent>();
                    if (component != null)
                    {
                        component.IsPaused = everyonePassive;
                    }
                    var agentDrivenProperties = (AgentDrivenProperties)agent.GetType()
                                                .GetProperty("AgentDrivenProperties", BindingFlags.NonPublic | BindingFlags.Instance)
                                                ?.GetValue(agent);

                    foreach (DrivenProperty drivenProperty in (DrivenProperty[])Enum.GetValues(typeof(DrivenProperty)))
                    {
                        if (drivenProperty < DrivenProperty.MountManeuver && drivenProperty > DrivenProperty.None)
                        {
                            float val = StatsToSet.GetStat(drivenProperty);

                            agentDrivenProperties?.SetStat(drivenProperty, val);
                        }

                        agent.UpdateAgentProperties();
                    }
                }
            }
        }