internal static void Setup() { var servicePanel = (UIPanel)UIView.library.Get("CityServiceWorldInfoPanel"); statsHookedPanel = servicePanel?.Find <UIPanel>("Right"); if (servicePanel == null || statsHookedPanel == null) { if (Options.debugEnabled) { Debug.LogError("TransferInfo: Hooking.Setup - Hooking targets have to be checked"); } return; } #if DEBUG Debug.Log("TransferInfo: Hooking.Setup - CityServiceWorldInfoPanel.Right panel found"); #endif displayStatisticsHandler = (sender, e) => { //todo: update PanelHook with additional check functionality ushort buildingID = WorldInfoPanel.GetCurrentInstanceID().Building; if (buildingID != 0 && BuildingManager.instance.m_buildings.m_buffer[buildingID].Info.m_buildingAI is CargoStationAI) { //note: temporary disable own panel //Loader.TransfersStatisticsPanel.Show(); Loader.OrigCargoInfoPanel.Show(); } }; if (!HookManager.IsHooked(displayStatisticsHandler, statsHookedPanel)) { HookManager.AddHook(displayStatisticsHandler, statsHookedPanel, displayStatisticsMsg, BuildingChecker); } var vehicleInfoPanel = (UIPanel)UIView.library.Get("CityServiceVehicleWorldInfoPanel"); vehiclePanel = vehicleInfoPanel?.Find <UIPanel>("Panel"); if (vehiclePanel == null) { if (Options.debugEnabled) { Debug.LogError("TransferInfo: Hooking.Setup - Hooking targets have to be checked"); } return; } #if DEBUG Debug.Log("TransferInfo: Hooking.Setup - CityServiceVehicleWorldInfoPanel.Panel panel found"); #endif displayCragoChartHandler = (sender, e) => { Loader.CarriedCargoPanel.Show(); }; if (!HookManager.IsHooked(displayCragoChartHandler, vehiclePanel)) { HookManager.AddHook(displayCragoChartHandler, vehiclePanel, displayCargoChartMsg, VehicleChecker); } }