예제 #1
0
        public static SaveOutput SaveGame(TaleWorlds.Core.Game game, ISaveDriver driver)
        {
            EntitySystem <GameHandler> entitySystem =
                Utils.GetPrivateField <EntitySystem <GameHandler> >(
                    typeof(TaleWorlds.Core.Game),
                    "_gameEntitySystem",
                    game);
            MetaData metaData = GetMetaData();

            // Code copied from TaleWorlds.Game.Save(MetaData, ISaveDriver)
            foreach (GameHandler gameHandler in entitySystem.Components)
            {
                gameHandler.OnBeforeSave();
            }

            SaveOutput saveOutput = SaveManager.Save(game, metaData, driver);

            saveOutput.PrintStatus();
            foreach (GameHandler gameHandler2 in entitySystem.Components)
            {
                gameHandler2.OnAfterSave();
            }
            // End code copy

            return(saveOutput);
        }
예제 #2
0
        protected override void OnInitialize()
        {
            TaleWorlds.Core.Game currentGame = this.CurrentGame;
            currentGame.FirstInitialize(false);
            InitializeGameTexts(currentGame.GameTextManager);
            IGameStarter gameStarter = new BasicGameStarter();

            InitializeGameModels(gameStarter);
            GameManager.OnGameStart(currentGame, gameStarter);
            MBObjectManager objectManager = currentGame.ObjectManager;

            currentGame.SecondInitialize(gameStarter.Models);
            currentGame.CreateGameManager();
            GameManager.BeginGameStart(currentGame);
            currentGame.ThirdInitialize();
            currentGame.CreateObjects();
            currentGame.InitializeDefaultGameObjects();
            currentGame.LoadBasicFiles(false);
            LoadXmls();
            currentGame.SetDefaultEquipments((IReadOnlyDictionary <string, Equipment>) new Dictionary <string, Equipment>());
            currentGame.CreateLists();
            ObjectManager.LoadXML("MPClassDivisions");
            objectManager.ClearEmptyObjects();
            MultiplayerClassDivisions.Initialize();
            GameManager.OnCampaignStart(this.CurrentGame, (object)null);
            GameManager.OnAfterCampaignStart(this.CurrentGame);
            GameManager.OnGameInitializationFinished(this.CurrentGame);
            CurrentGame.AddGameHandler <ChatBox>();
        }
예제 #3
0
        public static T GetGameModel <T>(this TaleWorlds.Core.Game game)
            where T : GameModel
        {
            foreach (GameModel model in game.BasicModels.GetGameModels())
            {
                if (model is T t)
                {
                    return(t);
                }
            }

            return(null);
        }
예제 #4
0
 public override void OnGameEnd(TaleWorlds.Core.Game game)
 {
 }
예제 #5
0
        public override void OnGameEnd(TaleWorlds.Core.Game game)
        {
            base.OnGameEnd(game);

            EnhancedBattleTestPartyController.OnGameEnd();
        }
예제 #6
0
        public override void OnGameStart(TaleWorlds.Core.Game game, IGameStarter gameStarter)
        {
            base.OnGameStart(game, gameStarter);

            InitializeGameTexts(TaleWorlds.Core.Game.Current.GameTextManager);
        }
예제 #7
0
        public override void OnGameStart(TaleWorlds.Core.Game game, IGameStarter gameStarter)
        {
            base.OnGameStart(game, gameStarter);

            InitializeGameModels(gameStarter);
        }