public void openInfo(ushort buildingID) { WorldInfoPanel.HideAllWorldInfoPanels(); var ssds = ServiceSystemDefinition.from(Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID].Info); var ext = ssds.First().GetTransportExtension(); m_buildingIdSelecionado = default(InstanceID); m_ignoreDistrict.isChecked = ext.GetIgnoreDistrict(buildingID); m_buildingIdSelecionado.Building = buildingID; buildingNameField.text = Singleton <BuildingManager> .instance.GetBuildingName(buildingID, default(InstanceID)); var configIdx = ssds.First().toConfigIndex(); String bgIcon = SVMConfigWarehouse.getIconServiceSystem(configIdx); String fgIcon = SVMConfigWarehouse.getFgIconServiceSystem(configIdx); buildingTypeIcon.normalFgSprite = bgIcon; buildingTypeIconFg.spriteName = fgIcon; KlyteCommonsMod.CloseKCPanel(); Show(); EventOnBuildingSelChanged?.Invoke(buildingID); }
private void CreateTitleBar() { SVMUtils.createUIElement(out UILabel titlebar, mainPanel.transform, "SVMListPanel", new Vector4(75, 10, mainPanel.width - 150, 20)); titlebar.autoSize = false; titlebar.text = "Service Vehicles Manager v" + ServiceVehiclesManagerMod.version; titlebar.textAlignment = UIHorizontalAlignment.Center; SVMUtils.createDragHandle(titlebar, KlyteModsPanel.instance.mainPanel); SVMUtils.createUIElement(out UIButton closeButton, mainPanel.transform, "CloseButton", new Vector4(mainPanel.width - 37, 5, 32, 32)); SVMUtils.initButton(closeButton, false, "buttonclose", true); closeButton.hoveredBgSprite = "buttonclosehover"; closeButton.eventClick += (x, y) => { KlyteCommonsMod.CloseKCPanel(); }; SVMUtils.createUIElement(out UISprite logo, mainPanel.transform, "SVMLogo", new Vector4(22, 5f, 32, 32)); logo.atlas = SVMCommonTextureAtlas.instance.atlas; logo.spriteName = "ServiceVehiclesManagerIcon"; SVMUtils.createDragHandle(logo, KlyteModsPanel.instance.mainPanel); }
public override void AwakeBody() { KlyteUtils.doLog("Loading NonKCModsOverrides"); #region Suburb Styler foreach (var typeName in supportedClasses) { var type = Type.GetType(typeName); try { if (type != null) { KlyteUtils.SetPrivateStaticField("GetMainReference", type, new Func <UIComponent>(() => KlyteModsPanel.instance.mainPanel)); KlyteUtils.SetPrivateStaticField("ClosePanel", type, new OnButtonClicked(() => KlyteCommonsMod.CloseKCPanel())); KlyteUtils.SetPrivateStaticField("OpenPanel", type, new OnButtonClicked(() => KlyteModsPanel.instance.OpenAt((ModTab)Enum.Parse(typeof(ModTab), KlyteUtils.RunPrivateStaticMethod <string>(type, "GetEnumName"))))); MethodInfo createPanelOverride = typeof(NonKCModsOverrides).GetMethod("CreateMainPanelOverride", allFlags); AddRedirect(type.GetMethod("CreateMainPanel", allFlags), createPanelOverride); } } catch (Exception e) { KlyteUtils.doErrorLog($"{e.GetType()} detouring {type}: {e.Message}\n{e.StackTrace}"); } } #endregion }
public void OpenAt(ModTab cat) { m_StripMain.selectedIndex = m_StripMain.Find <UIComponent>(cat.ToString())?.zOrder ?? -1; KlyteCommonsMod.OpenKCPanel(); }