public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            RenderManagerDetour.Deploy();
            NetManagerDetour.Deploy();
        }
 /// <summary>
 /// Called when mod is created.
 /// </summary>
 /// <param name="loading">The loading.</param>
 public override void OnCreated(ILoading loading)
 {
     Log.Debug(this, "OnCreated", "Base");
     Global.Initialize();
     Log.FlushBuffer();
     base.OnCreated(loading);
 }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (_isReleased)
            {
                var version = GetType().Assembly.GetName().Version;
                Debug.Log(string.Format(Name + ": Version {0}", version));

                if (AssetPath != null && AssetPath != Assets.PATH_NOT_FOUND)
                {
                    _container = new GameObject(Name.Replace(" ", ""));

                    foreach (IModule module in Modules)
                        module.OnCreated(loading);

                    _localizationInstaller = _container.AddInstallerComponent<LocalizationInstaller>();
                    _localizationInstaller.Host = this;

                    _assetsInstaller = _container.AddInstallerComponent<AssetsInstaller>();
                    _assetsInstaller.Host = this;

                    foreach (IModule module in Modules)
                        module.OnInstallingContent();
                }

                _isReleased = false;
            }
        }
 public override void OnCreated(ILoading loading)
 {
     // To overwrite the game defaults which EconomyExtensionBase is used before OnLevelLoaded is called
     sw = Stopwatch.StartNew();
     readFromXML();
     sw.Stop();
     hasLoaded = true;
 }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (Container == null) {
                Container = new GameObject("ElevatedTrainStationTrack").AddComponent<Container>();
            }
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            var allFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
            var method = typeof(AssetEditorMainToolbar).GetMethod("RefreshForIntersection", allFlags);
            redirects.Add(method, RedirectionHelper.RedirectCalls(method, typeof(Tool).GetMethod("RefreshForIntersection", allFlags)));
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (Container == null)
            {
                Container = new GameObject("ExtraTrainStationTracks").AddComponent<Initializer>();
            }
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (m_initializer == null)
            {
                m_initializer = new GameObject("CSL-Traffic Custom Prefabs");
                m_initializer.AddComponent<Initializer>();
            }
        }
Beispiel #9
0
        /// <summary>
        /// 启动程序
        /// </summary>
        public static void Main()
        {
            AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
            AppGlobal.appType     = AppType.Winform;
            AppGlobal.IsSaas      = System.Configuration.ConfigurationManager.AppSettings["IsSaas"] == "true" ? true : false;
            FrmSplash frmSplash = new FrmSplash(Init);

            winfromMain = frmSplash as ILoading;
            System.Windows.Forms.Application.Run(frmSplash);
        }
Beispiel #10
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (m_initializer == null)
            {
                m_initializer = new GameObject("CSL-Traffic Custom Prefabs");
                m_initializer.AddComponent <Initializer>();
            }
        }
Beispiel #11
0
        public override void OnCreated(ILoading loading)
        {
            if ((ToolManager.instance.m_properties.m_mode & ItemClass.Availability.GameAndMap) != ItemClass.Availability.None)
            {
                //if (FindIt.detourGeneratedScrollPanels.value)
                //{
                Redirector <Detours.GeneratedScrollPanelDetour> .Deploy();

                //}
            }
        }
        public void OnCreated(ILoading loading)
        {
            Debug.Log("GrowableOverhaul OnCreated!");

            if (created) return;

            // TODO detect conflicting mods (Building Themes, 81 tiles, etc.)

            Redirect(true);
            created = true;
        }
Beispiel #13
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (Instance == null)
            {
                Instance = this;
            }

            DebugLog.Warning("Created v." + Assembly.GetExecutingAssembly().GetName().Version + " at " + DateTime.Now);
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);
            if (loading.currentMode != AppMode.Game)
            {
                return;
            }
            Redirector <PropToolDetour> .Deploy();

            Redirector <PropInstanceDetour> .Deploy();
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (Container == null)
            {
                Container = new GameObject("TramStationTrack").AddComponent <Initializer>();
            }
            Util.AddLocale("NET", "Tram Station Track", "Tram Station Track", "Tram Station Track");
            Util.AddLocale("NET", "Tram Station Track Sunken", "Tram Station Track Sunken", "Tram Station Track Sunken");
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);
            Redirector <WildlifeSpawnPointAIDetour> .Deploy();

            Redirector <LivestockAIDetour> .Deploy();

            Redirector <WildlifeAIDetour> .Deploy();

            Redirector <PetAIDetour> .Deploy();
        }
 public override void OnCreated(ILoading loading)
 {
     try //So we don't f**k up loading the city
     {
         LoadSprites();
     }
     catch(Exception ex)
     {
         Debug.LogException(ex);
     }
 }
Beispiel #18
0
 public override void OnCreated(ILoading loading)
 {
     try //So we don't f**k up loading the city
     {
         LoadSprites();
     }
     catch (Exception ex)
     {
         LoggerUtils.LogException(ex);
     }
 }
 public void OnCreated(ILoading loading)
 {
     DestroyOld ("DistrictRCIDemand");
     var timer = new Timer (10000); //delays GUI hook so other mods such as Building Themes can do its thing
     timer.Elapsed += (object sender, ElapsedEventArgs e) => {
         HookGUI();
         timer.Enabled = false;
         timer.Dispose();
     };
     timer.Enabled = true;
 }
Beispiel #20
0
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (!IsHooked() || loading.currentMode != AppMode.Game)
     {
         return;
     }
     UserMod.Settings = CustomizeItSettings.Load();
     BuildingInfoHook.OnPostInitialization += OnPostBuildingInit;
     BuildingInfoHook.Deploy();
 }
Beispiel #21
0
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (!IsHooked())
     {
         return;
     }
     PropInfoHook.OnPreInitialization  += OnPrePropInit;
     PropInfoHook.OnPostInitialization += OnPostPropInit;
     PropInfoHook.Deploy();
 }
Beispiel #22
0
        public override void OnCreated(ILoading loading)
        {
            //SelfDestruct.DestructOldInstances(this);

            base.OnCreated(loading);

            ToolMode          = TrafficManagerMode.None;
            Detours           = new List <Detour>();
            DetourInited      = false;
            CustomPathManager = new CustomPathManager();
        }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (loading.currentMode != AppMode.AssetEditor)
     {
         return;
     }
     if (Container == null)
     {
         Container = new GameObject("SubBuildingsEditor").AddComponent <PropInitializer>();
     }
 }
 public override void OnCreated(ILoading loading)
 {
     try //So we don't f**k up loading the city
     {
         LoadSprites();
         Changelog.Instance().DownloadChangelogAsync(OptionsManager.m_workshopId);
     }
     catch(Exception ex)
     {
         Debug.LogException(ex);
     }
 }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            // cancel if Prefab Hook is not installed
            if (!IsHooked()) return;

            ResourceReplacer.instance.OnCreated();

            BuildingInfoHook.OnPreInitialization += ResourceReplacer.instance.ProcessBuilding;
            BuildingInfoHook.Deploy();
        }
Beispiel #26
0
 public override void OnCreated(ILoading loading)
 {
     try
     {
         JsonMapper.RegisterExporter <float>((obj, writer) => writer.Write(Convert.ToDouble(obj)));
         JsonMapper.RegisterImporter <double, float>(input => Convert.ToSingle(input));
     }
     catch (NullReferenceException e)
     {
         LoggerUtils.Log("Failure at jsonmapper!");
     }
 }
Beispiel #27
0
        public void OnCreated(ILoading loading)
        {
            Harmony = HarmonyInstance.Create("com.pachang.enhanceddistrictservices");
            Harmony.PatchAll(Assembly.GetExecutingAssembly());

            if (Settings.disableVehicleCollisionCheck)
            {
                Logger.Log("EnhancedDistrictServicesMod::OnCreated: Enabling new algorithm for unclogging traffic jams near outside connections ...");
                CarAIDisableCollectionCheckPatch.Enable(Harmony);
                CarAITrySpawnPatch.Enable(Harmony);
            }
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (loading.currentMode != AppMode.Game)
            {
                return;
            }
            DataShared.Data = new TransfersStatistics(Options.StorageVersion);
            HarmonyPatches.Apply();
            IsActive = true;
        }
        public void OnCreated(ILoading loading)
        {
            DestroyOld("DistrictRCIDemand");
            var timer = new Timer(10000);              //delays GUI hook so other mods such as Building Themes can do its thing

            timer.Elapsed += (object sender, ElapsedEventArgs e) => {
                HookGUI();
                timer.Enabled = false;
                timer.Dispose();
            };
            timer.Enabled = true;
        }
Beispiel #30
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (forceResName.config.Logging)
            {
                Debug.Log("Reloading config before mapload.");
            }

            Helper.ReloadConfigValues(false, false);
            forceResName.config.Apply();
        }
Beispiel #31
0
        public override void OnCreated(ILoading loading)
        {
            // SelfDestruct.DestructOldInstances(this);
            base.OnCreated(loading);

            Detours            = new List <Detour>();
            RegisteredManagers = new List <ICustomManager>();
            DetourInited       = false;
            CustomPathManager  = new CustomPathManager();

            RegisterCustomManagers();
        }
Beispiel #32
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);
            flagCache = Flags.CollectFlags(false);
            if (!IsHooked())
            {
                return;
            }

            PropInfoHook.OnPreInitialization += OnPrePropInit;
            PropInfoHook.Deploy();
        }
        public override void OnCreated(ILoading loading)
        {
            Logger.logInfo(LOG_BASE, "SeniorCitizenCenterMod Created");
            instance = this;
            base.OnCreated(loading);

            if (this.nursingHomeInitializerObj != null) {
                return;
            }

            this.nursingHomeInitializerObj = new GameObject("SeniorCitizenCenterMod Nursing Homes");
            this.nursingHomeInitializer = this.nursingHomeInitializerObj.AddComponent<NursingHomeInitializer>();
        }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     try
     {
         // Create backup:
         AmericanRoadsignsTool.SaveBackup();
     }
     catch (Exception e)
     {
         DebugUtils.LogException(e);
     }
 }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            debugLog.Clear();

            debugLog.Add("Better Upgrade: Initializing Mod...");

            Detour.PrivateBuildingAIDetour.Deploy();
            Detour.BuildingInfoDetour.Deploy();

            debugLog.Add("Better Upgrade: Mod successfully intialized.");
        }
Beispiel #36
0
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (LoadingManager.instance.m_loadingComplete)
     {
         if (NetPickerTool.instance == null)
         {
             ToolController toolController = ToolsModifierControl.toolController;
             NetPickerTool.instance         = toolController.gameObject.AddComponent <NetPickerTool>();
             NetPickerTool.instance.enabled = false;
         }
     }
 }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     Debug.Log("reloaded");
     Debug.Log(loading.currentMode);
     if (ObjectArrayTool.instance == null)
     {
         Debug.Log("Reload");
         ToolController toolController = GameObject.FindObjectOfType <ToolController>();
         ObjectArrayTool.instance         = toolController.gameObject.AddComponent <ObjectArrayTool>();
         ObjectArrayTool.instance.enabled = false;
     }
 }
Beispiel #38
0
        public override void OnCreated(ILoading loading)
        {
            _harmony = HarmonyInstance.Create("Klyte.SuburbStyler");

            var originalMethod =
                typeof(BuildingAI).GetMethod("RenderProps", BindingFlags.NonPublic | BindingFlags.Instance);
            var prefix  = typeof(BuildingAiRenderPropsPatch).GetMethod("Prefix");
            var postfix = typeof(BuildingAiRenderPropsPatch).GetMethod("Postfix");

            _harmony.Patch(originalMethod, new HarmonyMethod(prefix), new HarmonyMethod(postfix), null);

            BuildingDecorationManager.Ensure();
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);
            if (loading.currentMode == AppMode.Game || loading.currentMode == AppMode.ThemeEditor)
            {
                if (OptionsWrapper <Options> .Options.treeBrush && loading.currentMode == AppMode.Game)
                {
                    Redirector <BeautificationPanelDetour> .Deploy();
                }
                if (OptionsWrapper <Options> .Options.waterTool)
                {
                    Redirector <WaterToolDetour> .Deploy();
                }
            }

            //to allow to work in MapEditor
            if (OptionsWrapper <Options> .Options.treePencil)
            {
                Redirector <TreeToolDetour> .Deploy();
            }
            if (OptionsWrapper <Options> .Options.terrainTool)
            {
                Redirector <TerrainToolDetour> .Deploy();

                Redirector <TerrainPanelDetour> .Deploy();

                Redirector <LandscapingPanelDetour> .Deploy();

                Redirector <LevelHeightOptionPanelDetour> .Deploy();

                Redirector <UndoTerrainOptionPanelDetour> .Deploy();
            }
            Redirector <BrushOptionPanelDetour> .Deploy();

            Util.AddLocale("LANDSCAPING", "Ditch", Mod.translation.GetTranslation("ELT_DITCH_BUTTON"), "");
            Util.AddLocale("LANDSCAPING", "Sand", Mod.translation.GetTranslation("ELT_SAND_BUTTON"),
                           Mod.translation.GetTranslation("ELT_SAND_DESCRIPTION"));
            Util.AddLocale("TERRAIN", "Ditch", Mod.translation.GetTranslation("ELT_DITCH_BUTTON"), "");
            Util.AddLocale("TERRAIN", "Sand", Mod.translation.GetTranslation("ELT_SAND_BUTTON"),
                           Mod.translation.GetTranslation("ELT_SAND_DESCRIPTION"));
            Util.AddLocale("TUTORIAL_ADVISER", "Resource", "Ground Resources Tool", "");
            Util.AddLocale("TUTORIAL_ADVISER", "Water", "Water Tool", "");
            try
            {
                Plugins.Initialize();
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
        public override void OnCreated(ILoading loading)
        {
            Logger.logInfo(LOG_BASE, "DormitoryMod Created");
            instance = this;
            base.OnCreated(loading);

            if (this.dormitoryInitializerObj != null)
            {
                return;
            }

            this.dormitoryInitializerObj = new GameObject("DormitoryMod Dormitories");
            this.dormitoryInitializer    = this.dormitoryInitializerObj.AddComponent <DormitoryInitializer>();
        }
        public override void OnCreated(ILoading loading)
        {
            FieldInfo              pathManagerInstance = typeof(ColossalFramework.Singleton <PathManager>).GetField("sInstance", BindingFlags.Static | BindingFlags.NonPublic);
            PathManager            stockPathManager    = PathManager.instance;
            LaneChangerPathManager lcPathManager       = stockPathManager.gameObject.AddComponent <LaneChangerPathManager>();

            lcPathManager.UpdateWithPathManagerValues(stockPathManager);
            pathManagerInstance.SetValue(null, lcPathManager);
            FastList <ISimulationManager> managers = typeof(SimulationManager).GetField("m_managers", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) as FastList <ISimulationManager>;

            managers.Remove(stockPathManager);
            managers.Add(lcPathManager);
            GameObject.Destroy(stockPathManager, 10f);
        }
Beispiel #42
0
        public void OnCreated(ILoading loading)
        {
            Debug.Log("GrowableOverhaul OnCreated!");

            if (created)
            {
                return;
            }

            // TODO detect conflicting mods (Building Themes, 81 tiles, etc.)

            Redirect(true);
            created = true;
        }
Beispiel #43
0
        public override void OnCreated(ILoading loading)
        {
            if (!isModEnabled)
            {
                isModEnabled = true;
                sw           = Stopwatch.StartNew();

                Redirect(true);
                readFromXML();

                sw.Stop();
                UnityEngine.Debug.Log("WG_HighRiseBan: Successfully loaded in " + sw.ElapsedMilliseconds + " ms.");
            }
        }
Beispiel #44
0
 /// <summary>
 /// As of v1.6 fired When deseralization of all IDataContainers.Deserialize and AfterDeserialize() calls.
 /// in the game have completed. In 1.5 it used to fire earlier it seemed or was at least more deterministic.
 /// </summary>
 /// <param name="loading">the games 'loading' object which doesn't have much use this early</param>
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     try
     {
         if (Mod.DEBUG_LOG_ON)
         {
             Logger.dbgLog("Reloading config before mapload.");
         }
         TFCHelper.ReloadConfigValues(false, false);
     }
     catch (Exception ex)
     { Logger.dbgLog("Error:", ex, true); }
 }
        public override void OnCreated(ILoading loading)
        {
            try //So we don't f**k up loading the city
            {
                LoadSprites();

                CimToolsHandler.CimToolBase.DetailedLogger.Log("Loading mod");
                CimToolsHandler.CimToolBase.Changelog.DownloadChangelog();
                CimToolsHandler.CimToolBase.XMLFileOptions.Load();
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
Beispiel #46
0
        public override void OnCreated(ILoading loading)
        {
            try
            {
                // Storing default values ASAP (before any mods have the time to change values)
                DefaultOptions.StoreAll();

                // Creating a backup
                AdvancedVehicleOptions.SaveBackup();
            }
            catch (Exception e)
            {
                DebugUtils.LogException(e);
            }
        }
Beispiel #47
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (sm_optionsManager != null)
            {
                sm_optionsManager.GetComponent<OptionsManager>().LoadOptions();
            }

            if (m_initializer == null)
            {
                m_initializer = new GameObject("CSL-Traffic Custom Prefabs");
                m_initializer.AddComponent<Initializer>();
            }
        }
Beispiel #48
0
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     try
     {
         if (Mod.DEBUG_LOG_ON) { Helper.dbgLog("Resetting Stats and Reloading config before mapload."); }
         //reset stats between maps.
         // *reload config values again after map load. This should not be problem atm.
         // *So long as we do this before OnLevelLoaded we should be ok;
         Mod.ResetStatValues();
         Mod.ReloadConfigValues(false, false);
     }
     catch (Exception ex)
     { Helper.dbgLog("Error:", ex, true); }
 }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            Debugger.Initialize();

            Debugger.Log("ON_CREATED");
            Debugger.Log("Building Themes: Initializing Mod...");

            PolicyPanelEnabler.Register();

            BuildingThemesManager.instance.Reset();
            BuildingThemesManager.instance.searchBuildingThemeMods();

            BuildingVariationManager.instance.Reset();

            if (BuildingVariationManager.Enabled)
            {
                try { Detour.BuildingInfoDetour.Deploy(); }
                catch (Exception e) { Debugger.LogException(e); }
            }

            try { Detour.BuildingManagerDetour.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.ZoneBlockDetour.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.ImmaterialResourceManagerDetour.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.PrivateBuildingAIDetour<ResidentialBuildingAI>.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.PrivateBuildingAIDetour<CommercialBuildingAI>.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.PrivateBuildingAIDetour<IndustrialBuildingAI>.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.PrivateBuildingAIDetour<OfficeBuildingAI>.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            try { Detour.PoliciesPanelDetour.Deploy(); }
            catch (Exception e) { Debugger.LogException(e); }

            Debugger.Log("Building Themes: Mod successfully intialized.");
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (_isReleased)
            {
                _container = new GameObject(NEXT_OBJECT_NAME);

                _newRoads = _container.AddComponent<NetCollection>();
                _newRoads.name = NEWROADS_NETCOLLECTION;

                _initalizer = _container.AddComponent<ModInitializer>();
                _initalizer.NewRoads = _newRoads;
                _initalizer.InitializationCompleted += InitializationCompleted;

                _isReleased = false;
            }
        }
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            if (_isReleased)
            {
                if (GetPath() != PATH_NOT_FOUND)
                {
                    _container = new GameObject(REX_OBJECT_NAME);

                    _newRoads = _container.AddComponent<NetCollection>();
                    _newRoads.name = NEWROADS_NETCOLLECTION;

                    _initializer = _container.AddComponent<Initializer>();
                    _initializer.InstallationCompleted += InitializationCompleted;
                }

                _isReleased = false;
            }
        }
        public override void OnCreated(ILoading loading)
        {
            // Modify methods which set Building.Width/Building.Length:
            // Those are properties of the Building struct
            // The setters clamp the width and length to 16
            // The modified methods directly modify the m_width and m_length field
            // instead of using the setters
            Detour.BuildingDecorationDetour.Deploy();
            Detour.BuildingManagerDetour.Deploy();

            // Replace getWidthRange/getLengthRange methods of all ploppable BuildingAIs
            // By default these are limiting the asset size to
            // 16x8, 15x9, 14x11, 13x12, 12x13, 11x14, 9x15, 8x16
            // The modified methods return 32x32
            Detour.BuildingAIDetour<CargoStationAI>.Deploy();
            Detour.BuildingAIDetour<CargoHarborAI>.Deploy();
            Detour.BuildingAIDetour<CemeteryAI>.Deploy();
            Detour.BuildingAIDetour<DepotAI>.Deploy();
            Detour.BuildingAIDetour<TransportStationAI>.Deploy();
            Detour.BuildingAIDetour<HarborAI>.Deploy();
            Detour.BuildingAIDetour<FireStationAI>.Deploy();
            Detour.BuildingAIDetour<HospitalAI>.Deploy();
            Detour.BuildingAIDetour<MedicalCenterAI>.Deploy();
            Detour.BuildingAIDetour<LandfillSiteAI>.Deploy();
            Detour.BuildingAIDetour<MonumentAI>.Deploy();
            Detour.BuildingAIDetour<ParkAI>.Deploy();
            Detour.BuildingAIDetour<PoliceStationAI>.Deploy();
            Detour.BuildingAIDetour<PowerPlantAI>.Deploy();
            Detour.BuildingAIDetour<WindTurbineAI>.Deploy();
            Detour.BuildingAIDetour<SchoolAI>.Deploy();
            Detour.BuildingAIDetour<WaterFacilityAI>.Deploy();
            Detour.BuildingAIDetour<HadronColliderAI>.Deploy();
            //Detour.BuildingAIDetour<EdenProjectAI>.Deploy();
            //Detour.BuildingAIDetour<FusionPowerPlantAI>.Deploy();
            //Detour.BuildingAIDetour<DamPowerHouseAI>.Deploy();
            //Detour.BuildingAIDetour<SpaceElevatorAI>.Deploy();

            // This is a buffer that has a length of 16 by default
            // It is used by the game to calculate the ground texture of an asset
            typeof(Building).GetField("TempMask", BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, new ushort[MAX_LENGTH]);
        }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (!IsHooked())
     {
         return;
     }
     switch (loading.currentMode)
     {
         case AppMode.Game:
             NetInfoHook.OnPreInitialization += OnPreInitializationInGame;
             NetInfoHook.Deploy();
             TransportInfoHook.OnPreInitialization += OnPreInitializationTI;
             TransportInfoHook.Deploy();
             Redirector<BulldozeToolDetour>.Deploy();
             Redirector<PublicTransportPanelDetour>.Deploy();
             break;
         case AppMode.MapEditor:
         case AppMode.AssetEditor:
             if (loading.currentMode == AppMode.AssetEditor)
             {
                 NetInfoHook.OnPreInitialization += OnPreInitializationAssetEditor;
                 NetInfoHook.Deploy();
             }
             Redirector<GeneratedGroupPanelDetour>.Deploy();
             Redirector<PublicTransportPanelDetour>.Deploy();
             Redirector<RoadsGroupPanelDetour>.Deploy();
             Redirector<RoadsPanelDetour>.Deploy();
             break;
         case AppMode.ThemeEditor:
             break;
         case AppMode.ScenarioEditor:
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
        /// <summary>
        /// Optional
        /// This function gets called by the game during the loading process when the loading thread gets created.
        /// This happens BEFORE deserialization of the file begins. So while we're not doing anything interesting
        /// here this would be the place to Detour functions that need to be replaced\Detoured before deserialization
        /// begin. Look at Unlimited Trees project for just one example. For basic mods you can wait and do that
        /// during OnLevelLoaded but for those that need to screw with stuff before a map gets loaded just keep
        /// OnCreated in mind.
        /// </summary>
        /// <param name="loading">the games 'loading' object which doesn't have much use this early</param>
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading); //Since we're overriding base object here go run the base objects version first.

            // Try\Catch error handling - I'm assume the reader here knows the basics of this and why it's used in C#
            // However I want to note ALWAYS wrap code that the game is going to call back into in Try\Catches
            // ESPECIALLY above all else in OnCreated OnLevelLoaded OnLevelUnloaded and OnReleased.
            // Colosal order does not have a try\catch around each master call to these of it's own
            // so if your mod shits the bed in one of these call everyone else's mod after you will NOT
            // have these calls invoked.  Unless they're running the Isolated Failures mod of course.

            try
            {
                if (SomeModName.DEBUG_LOG_ON) { Logger.dbgLog("Reloading config before mapload."); }
                // *reload config values again after map load. This should not be problem atm.
                // *So long as we do this before OnLevelLoaded we should be ok;
                // *In theory this allows someone to go make some manual adjustments in your
                //  config file that don't have options screen settings and still let them be used
                //  without the user having to exit the game and come back just to have them get used.
                Helper.ReloadConfigValues(false, false);
            }
            catch (Exception ex)
            { Logger.dbgLog("Error:", ex, true); }
        }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     AssemblyRedirector.Deploy();
 }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     if (!IsHooked())
     {
         return;
     }
     PropInfoHook.OnPreInitialization += OnPrePropInit;
     PropInfoHook.Deploy();
 }
Beispiel #57
0
        public override void OnCreated(ILoading loading)
        {
            base.OnCreated(loading);

            ensureComponents();
        }
 public override void OnCreated(ILoading loading)
 {
     ModLogger.Debug("NoQuestionsAskedLoader created");
 }
 public static void AppMain()
 {
     FrmSplash frmSplash = new FrmSplash(AppGlobal_Init);
     AppGlobal.winfromMain = frmSplash as ILoading;
     Application.Run(frmSplash);
 }
Beispiel #60
0
 public void OnCreated(ILoading loading)
 {
 }