public static void EndColliding(/*ulong[] ___m_collidingSegments1*/) { StackTrace stackTrace = new StackTrace(); ToolController targetInstance = Singleton <ToolManager> .instance.m_properties; if (stackTrace.GetFrame(1).GetMethod().Name == "SimulationStep") { ulong[] ___m_collidingSegments1 = typeof(ToolController).GetField("m_collidingSegments1", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(targetInstance) as ulong[]; //UnityEngine.Debug.Log("EndColliding caller: " + stackTrace.GetFrame(2).GetMethod().GetUnderlyingType() + " " + stackTrace.GetFrame(2).GetMethod().Name + " " + ", count: " + CollidingSegments.Count); CollidingSegments.Clear(); foreach (int segment in NetUtil.SegmentsFromMask(___m_collidingSegments1)) { CollidingSegments.Add((ushort)segment); } CollidingSegmentsCache2 = CollidingSegments.ToArray(); } Redirector <ToolControllerDetour> .Revert(); targetInstance.EndColliding(); Redirector <ToolControllerDetour> .Deploy(); //UnityEngine.Debug.Log("EndColliding: " + CollidingSegmentsCache2.Length); }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); _updater = null; LateBuildUpQueue.Clear(); InstallAssets(); if (Container == null) { Container = new GameObject("MetroOverhaul").AddComponent <Initializer>(); Container.AppMode = loading.currentMode; } if (loading.currentMode == AppMode.AssetEditor) { Redirector <RoadsGroupPanelDetour> .Deploy(); } if (loading.currentMode == AppMode.Game) { Redirector <DepotAIDetour> .Deploy(); if (OptionsWrapper <Options> .Options.improvedMetroTrainAi) { Redirector <MetroTrainAIDetour> .Deploy(); } if (OptionsWrapper <Options> .Options.improvedPassengerTrainAi) { Redirector <PassengerTrainAIDetour> .Deploy(); } } }
public void Initialize() { Util.AddLocale("TUTORIAL_ADVISER", "Surface", "Surface Tool", ""); Redirector <SurfacePanelDetour> .Deploy(); Redirector <TerrainManagerDetour> .Deploy(); }
public static void Init() { if (Utils.IsModActive(1764208250)) { UnityEngine.Debug.LogWarning("More Vehicles is enabled, applying compatibility workaround"); MaxVehicleCount = ushort.MaxValue + 1; } else { UnityEngine.Debug.Log("More Vehicles is not enabled"); MaxVehicleCount = VehicleManager.MAX_VEHICLE_COUNT; } if (VehicleManagerMod._isDeployed) { return; } if (!VehicleManagerMod.TryLoadData(out VehicleManagerMod.m_cachedVehicleData)) { Utils.Log((object)"Loading default vehicle data."); } Redirector <VehicleManagerMod> .Deploy(); SerializableDataExtension.instance.EventSaveData += new SerializableDataExtension.SaveDataEventHandler(VehicleManagerMod.OnSaveData); VehicleManagerMod._isDeployed = true; }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); if (mode != LoadMode.LoadAsset && mode != LoadMode.NewAsset) { Reset(); Redirector <PropManagerDetour> .Revert(); Redirector <TreeManagerDetour> .Revert(); return; } if (initialized) { return; } Container.SetupPropColors(); Redirector <BuildingDecorationDetour> .Deploy(); Redirector <PropManagerDetour> .Deploy(); Redirector <TreeManagerDetour> .Deploy(); Redirector <AssetEditorChirpPanelDetour> .Deploy(); Redirector <DecorationPropertiesPanelDetour> .Deploy(); SubBuildingsEnablerFormat.InitializeBuildingsWithSubBuildings(); UIView.GetAView().AddUIComponent(typeof(Panel)); initialized = true; }
public static void Init() { if (!TransportLineMod.TryLoadData(out TransportLineMod._lineData)) { Utils.Log((object)"Loading default transport line data."); NetManager instance1 = Singleton <NetManager> .instance; TransportManager instance2 = Singleton <TransportManager> .instance; int length = instance2.m_lines.m_buffer.Length; for (ushort index = 0; index < length; ++index) { if (instance2.m_lines.m_buffer[index].Complete) { TransportLineMod._lineData[index].TargetVehicleCount = TransportLineMod.CountLineActiveVehicles(index); } else { TransportLineMod._lineData[index].TargetVehicleCount = OptionsWrapper <Settings> .Options.DefaultVehicleCount; } TransportLineMod._lineData[index].BudgetControl = OptionsWrapper <Settings> .Options.BudgetControl; TransportLineMod._lineData[index].Depot = TransportLineMod.GetClosestDepot((ushort)index, instance1.m_nodes.m_buffer[(int)instance2.m_lines.m_buffer[index].GetStop(0)].m_position); TransportLineMod._lineData[index].Unbunching = OptionsWrapper <Settings> .Options.Unbunching; } } SerializableDataExtension.instance.EventSaveData += new SerializableDataExtension.SaveDataEventHandler(TransportLineMod.OnSaveData); Redirector <TransportLineMod> .Deploy(); TransportLineMod._init = true; }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Redirector <NetAIDetour> .Deploy(); Redirector <ShipPathAIDetour> .Deploy(); }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Redirector <NaturalResourceManagerDetour> .Deploy(); StatsUpdated = false; OriginalFactor = OptionsWrapper <Options> .Options.factor; }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); if (EuroBuildingsUnlocker.debug) { UnityEngine.Debug.Log("EuroBuildingsUnlocker - OnCreated"); } Levels.CheckIfWinterUnlockerEnabled(); if (_bootstrapped) { if (EuroBuildingsUnlocker.debug) { UnityEngine.Debug.Log("EuroBuildingsUnlocker - Mod has been already bootstrapped"); } return; } Levels.ResetNativeLevel(); SceneManagerDetour.Deploy(); AsyncOperationDetour.Deploy(); Redirector <BuildingCollectionDetour> .Deploy(); Redirector <PropCollectionDetour> .Deploy(); Redirector <NetCollectionDetour> .Deploy(); Redirector <CitizenCollectionDetour> .Deploy(); Redirector <VehicleCollectionDetour> .Deploy(); Redirector <EventCollectionDetour> .Deploy(); Redirector <TransportCollectionDetour> .Deploy(); Redirector <EffectCollectionDetour> .Deploy(); Redirector <MilestoneCollectionDetour> .Deploy(); Redirector <ItemClassCollectionDetour> .Deploy(); Redirector <TreeCollectionDetour> .Deploy(); Redirector <DistrictPolicyCollectionDetour> .Deploy(); Redirector <BuildingCommonCollectionDetour> .Deploy(); Redirector <LoadingManagerDetour> .Deploy(); Redirector <RadioContentCollectionDetour> .Deploy(); Redirector <RadioChannelCollectionDetour> .Deploy(); Redirector <DisasterCollectionDetour> .Deploy(); LoadingManagerDetour.addChildrenToBuiltinStyleHook = null; _bootstrapped = true; }
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 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); Redirector <WildlifeSpawnPointAIDetour> .Deploy(); Redirector <LivestockAIDetour> .Deploy(); Redirector <WildlifeAIDetour> .Deploy(); Redirector <PetAIDetour> .Deploy(); }
protected override void Awake() { this.m_levelMaterial = new Material(Shader.Find("Custom/Overlay/WaterLevel")); this.m_sourceMaterial = new Material(Shader.Find("Custom/Tools/WaterSource")); m_sourceMaterial.color = new Color(48.0f / 255.0f, 140.0f / 255, 1.0f, 54.0f / 255.0f); this.m_sourceMesh = Util.Load <Mesh>("Cylinder01"); Redirector <WaterToolDetour> .Revert(); base.Awake(); Redirector <WaterToolDetour> .Deploy(); }
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); } }
private static void Bootstrap() { Redirector <OptionsGraphicsPanelDetour> .Deploy(); var panel = Object.FindObjectOfType <OptionsGraphicsPanel>(); if (panel == null) { return; } OptionsGraphicsPanelDetour.InitAspectRatios(panel); OptionsGraphicsPanelDetour.InitResolutions(panel); OptionsGraphicsPanelDetour.InitDisplayModes(panel); }
public static void Init() { if (VehicleManagerMod._isDeployed) { return; } if (!VehicleManagerMod.TryLoadData(out VehicleManagerMod.m_cachedVehicleData)) { Utils.Log((object)"Loading default vehicle data."); } Redirector <VehicleManagerMod> .Deploy(); SerializableDataExtension.instance.EventSaveData += new SerializableDataExtension.SaveDataEventHandler(VehicleManagerMod.OnSaveData); VehicleManagerMod._isDeployed = true; }
private void Patch() { if (!IsModEnabled(593588108UL, "Prop & Tree Anarchy")) { if (Harmony == null) { Harmony = HarmonyInstance.Create(HarmonyID); Harmony.PatchAll(Assembly.GetExecutingAssembly()); } } if (!IsModEnabled(1873351912UL, "Tree Precision")) { Redirector <PositionDetour> .Deploy(); } }
public static void ChangeDeployState(bool state) { if (!Util.IsGameMode()) { return; } if (state) { Redirector <PassengerTrainAIDetour> .Deploy(); } else { Redirector <PassengerTrainAIDetour> .Revert(); } }
/// <summary> /// Sets up our redirects of our replacement methods. /// </summary> public static void Setup() { if (IsSetupActive) { return; } try { Redirector <LimitBuildingDecoration> .Deploy(); Redirector <LimitNaturalResourceManager> .Deploy(); Redirector <LimitTreeTool> .Deploy(); Redirector <LimitTreeManager> .Deploy(); Redirector <LimitTreeManager.Data> .Deploy(); Redirector <LimitCommonBuildingAI> .Deploy(); Redirector <LimitDisasterHelpers> .Deploy(); Redirector <LimitFireCopterAI> .Deploy(); Redirector <LimitForestFireAI> .Deploy(); //If windoverride enabled, otherwise don't. if (OptionsWrapper <Configuration> .Options.UseNoWindEffects) { Redirector <LimitWeatherManager> .Deploy(); } IsSetupActive = true; if (OptionsWrapper <Configuration> .Options.IsLoggingEnabled()) { Logger.dbgLog("Redirected calls completed."); } } catch (Exception exception1) { Logger.dbgLog("Setup error:", exception1, true); } }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Redirector <AssetImporterThumbnailsDetour> .Deploy(); }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Redirector <TransportStationAIDetour> .Deploy(); }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewGameFromScenario) { return; } inGame = true; try { Utils.Log((object)$"Begin init version: {version}"); this.ReleaseUnusedCitizenUnits(); UIView objectOfType = UnityEngine.Object.FindObjectOfType <UIView>(); if ((UnityEngine.Object)objectOfType != (UnityEngine.Object)null) { this._iptGameObject = new GameObject("IptGameObject"); this._iptGameObject.transform.parent = objectOfType.transform; this._iptGameObject.AddComponent <SimHelper>(); this._iptGameObject.AddComponent <LineWatcher>(); this._worldInfoPanel = new GameObject("PublicTransportStopWorldInfoPanel"); this._worldInfoPanel.transform.parent = objectOfType.transform; this._worldInfoPanel.AddComponent <PublicTransportStopWorldInfoPanel>(); NetManagerMod.Init(); VehicleManagerMod.Init(); Redirector <BusAIDetour> .Deploy(); Redirector <PassengerTrainAIDetour> .Deploy(); Redirector <PassengerShipAIDetour> .Deploy(); Redirector <PassengerPlaneAIDetour> .Deploy(); Redirector <PassengerFerryAIDetour> .Deploy(); Redirector <PassengerBlimpAIDetour> .Deploy(); Redirector <TramAIDetour> .Deploy(); Redirector <CommonBuildingAIReverseDetour> .Deploy(); Redirector <PublicTransportStopButtonDetour> .Deploy(); Redirector <PublicTransportVehicleButtonDetour> .Deploy(); Redirector <PublicTransportWorldInfoPanelDetour> .Deploy(); BuildingExtension.Init(); LineWatcher.instance.Init(); TransportLineMod.Init(); VehiclePrefabs.Init(); SerializableDataExtension.instance.Loaded = true; LocaleModifier.Init(); this._iptGameObject.AddComponent <VehicleEditor>(); this._iptGameObject.AddComponent <PanelExtenderLine>(); this._iptGameObject.AddComponent <PanelExtenderVehicle>(); this._iptGameObject.AddComponent <PanelExtenderCityService>(); Utils.Log((object)"Loading done!"); } else { Utils.LogError((object)"UIView not found, aborting!"); } } catch (Exception ex) { Utils.LogError((object)("Error during initialization, IPT disables itself." + System.Environment.NewLine + "Please try again without any other mod." + System.Environment.NewLine + "Please upload your log file and post the link here if that didn't help:" + System.Environment.NewLine + "http://steamcommunity.com/workshop/filedetails/discussion/424106600/615086038663282271/" + System.Environment.NewLine + ex.Message + System.Environment.NewLine + (object)ex.InnerException + System.Environment.NewLine + ex.StackTrace)); this.Deinit(); } }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); Redirector <TransportToolDetour> .Deploy(); }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); Redirector <BuildingManagerDetour> .Deploy(); }
public void Start() { try { m_netTool = GameObject.FindObjectsOfType <NetTool>().Where(x => x.GetType() == typeof(NetTool)).FirstOrDefault(); if (m_netTool == null) { DebugUtils.Log("Net Tool not found"); enabled = false; return; } bendingPrefabs.Clear(); int count = PrefabCollection <NetInfo> .PrefabCount(); for (uint i = 0; i < count; i++) { NetInfo prefab = PrefabCollection <NetInfo> .GetPrefab(i); if (prefab != null) { if (prefab.m_enableBendingSegments) { bendingPrefabs.Add(prefab); } } } Redirector <NetInfoDetour> .Deploy(); collision = (ToolManager.instance.m_properties.m_mode & ItemClass.Availability.AssetEditor) == ItemClass.Availability.None; if (chirperAtlasAnarchy == null) { LoadChirperAtlas(); } chirperButton = UIView.GetAView().FindUIComponent <UIButton>("Zone"); if (m_panel == null) { m_tries = 0; m_panel = UIView.GetAView().AddUIComponent(typeof(OptionsPanel)) as OptionsPanel; } else { m_panel.m_anarchy.isChecked = false; m_panel.m_bending.isChecked = true; m_panel.m_snapping.isChecked = true; m_panel.m_collision.isChecked = collision; } DebugUtils.Log("Initialized"); } catch (Exception e) { DebugUtils.Log("Start failed"); DebugUtils.LogException(e); enabled = false; } }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewGameFromScenario) { return; } inGame = true; try { Utils.Log((object)$"IPT2: Begin init version: {version}"); this.ReleaseUnusedCitizenUnits(); UIView objectOfType = UnityEngine.Object.FindObjectOfType <UIView>(); if ((UnityEngine.Object)objectOfType != (UnityEngine.Object)null) { this._iptGameObject = new GameObject("IptGameObject"); this._iptGameObject.transform.parent = objectOfType.transform; this._iptGameObject.AddComponent <SimHelper>(); this._iptGameObject.AddComponent <LineWatcher>(); this._worldInfoPanel = new GameObject("PublicTransportStopWorldInfoPanel"); this._worldInfoPanel.transform.parent = objectOfType.transform; this._worldInfoPanel.AddComponent <PublicTransportStopWorldInfoPanel>(); CachedNodeData.Init(); int maxVehicleCount; if (Utils.IsModActive(1764208250)) { UnityEngine.Debug.LogWarning("IPT2: More Vehicles is enabled, applying compatibility workaround"); maxVehicleCount = ushort.MaxValue + 1; } else { UnityEngine.Debug.Log("IPT2: More Vehicles is not enabled"); maxVehicleCount = VehicleManager.MAX_VEHICLE_COUNT; } CachedVehicleData.Init(maxVehicleCount); LoadPassengersPatch.Apply(); UnloadPassengersPatch.Apply(); DepotAIPatch.Apply(); NetManagerPatch.Apply(); VehicleManagerPatch.Apply(); PublicTransportLineVehicleModelSelectorRefreshPatch.Apply(); Redirector <BusAIDetour> .Deploy(); Redirector <TrolleybusAIDetour> .Deploy(); Redirector <PassengerTrainAIDetour> .Deploy(); Redirector <PassengerShipAIDetour> .Deploy(); Redirector <PassengerPlaneAIDetour> .Deploy(); Redirector <PassengerFerryAIDetour> .Deploy(); Redirector <PassengerBlimpAIDetour> .Deploy(); Redirector <PassengerHelicopterAIDetour> .Deploy(); Redirector <TramAIDetour> .Deploy(); Redirector <CommonBuildingAIReverseDetour> .Deploy(); Redirector <PublicTransportStopButtonDetour> .Deploy(); Redirector <PublicTransportVehicleButtonDetour> .Deploy(); Redirector <PublicTransportWorldInfoPanelDetour> .Deploy(); BuildingExtension.Init(); LineWatcher.instance.Init(); CachedTransportLineData.Init(); Redirector <TransportLineDetour> .Deploy(); TransportLineSimulationStepPatch.Apply(); TransportLineGetLineVehiclePatch.Apply(); VehiclePrefabs.Init(); SerializableDataExtension.instance.Loaded = true; LocaleModifier.Init(); this._iptGameObject.AddComponent <VehicleEditor>(); this._iptGameObject.AddComponent <PanelExtenderLine>(); this._iptGameObject.AddComponent <PanelExtenderVehicle>(); this._iptGameObject.AddComponent <PanelExtenderCityService>(); Utils.Log((object)"Loading done!"); } else { Utils.LogError((object)"UIView not found, aborting!"); } } catch (Exception ex) { Utils.LogError((object)("IPT2: Error during initialization, IPT disables itself." + System.Environment.NewLine + "Please try again without any other mod." + System.Environment.NewLine + "Please upload your log file and post the link here if that didn't help:" + System.Environment.NewLine + "http://steamcommunity.com/workshop/filedetails/discussion/424106600/615086038663282271/" + System.Environment.NewLine + ex.Message + System.Environment.NewLine + (object)ex.InnerException + System.Environment.NewLine + ex.StackTrace)); this.Deinit(); } }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Redirector <PropInstanceDetour> .Deploy(); }
public Mod() { Redirector <WorkshopModUploadPanelDetour> .Deploy(); Redirector <PackageEntryDetour> .Deploy(); }
public override void OnCreated(ILoading loading) { base.OnCreated(loading); Debugger.Initialize(); Debugger.Log("ON_CREATED"); Debugger.Log("Building Themes: Initializing Mod..."); try { PolicyPanelEnabler.Register(); BuildingThemesManager.instance.Reset(); BuildingVariationManager.instance.Reset(); UpdateConfig(); try { Redirector <BuildingManagerDetour> .Deploy(); Debugger.Log("Building Themes: BuildingManager Methods detoured!"); } catch (Exception e) { Debugger.LogException(e); } try { Redirector <DistrictManagerDetour> .Deploy(); Debugger.Log("Building Themes: DistrictManager Methods detoured!"); } catch (Exception e) { Debugger.LogException(e); } try { Redirector <ZoneBlockDetour> .Deploy(); Debugger.Log("Building Themes: ZoneBlock Methods detoured!"); ZoneBlockDetour.SetUp(); } 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); } try { Redirector <DistrictWorldInfoPanelDetour> .Deploy(); Debugger.Log("Building Themes: DistrictWorldInfoPanel Methods detoured!"); } catch (Exception e) { Debugger.LogException(e); } Debugger.Log("Building Themes: Mod successfully intialized."); } catch (Exception e) { Debugger.LogException(e); } }