Beispiel #1
0
        /// <summary>
        /// Called by the game when the mod is initialised at the start of the loading process.
        /// </summary>
        /// <param name="loading">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnCreated(ILoading loading)
        {
            Logging.KeyMessage("version ", BOBMod.Version, " loading");

            // Don't do anything if not in game (e.g. if we're going into an editor).
            if (loading.currentMode != AppMode.Game && loading.currentMode != AppMode.MapEditor)
            {
                isModEnabled = false;
                Logging.KeyMessage("not loading into game, skipping activation");

                // Unload Harmony patches and exit before doing anything further.
                Patcher.UnpatchAll();
                return;
            }

            // All good to go at this point.
            isModEnabled = true;

            // Initialise data sets prior to savegame load.
            new AllBuildingReplacement();
            new AllNetworkReplacement();
            new BuildingReplacement();
            new NetworkReplacement();
            new IndividualBuildingReplacement();
            new IndividualNetworkReplacement();
            new MapTreeReplacement();
            new MapPropReplacement();
            new Scaling();

            base.OnCreated(loading);
        }
Beispiel #2
0
 /// <summary>
 /// Called by the game when the mod is disabled.
 /// </summary>
 public void OnDisabled()
 {
     // Unapply Harmony patches via Cities Harmony.
     if (HarmonyHelper.IsHarmonyInstalled)
     {
         Patcher.UnpatchAll();
     }
 }