public void Start() { KlyteModsPanel.instance.AddTab(ModTab.ServiceVehiclesManager, typeof(SVMServiceBuildingDetailPanel), taSVM, "ServiceVehiclesManagerIcon", "Service Vehicles Manager (v" + ServiceVehiclesManagerMod.version + ")"); SVMUtils.createUIElement(out UIPanel buildingInfoParent, FindObjectOfType <UIView>().transform, "SVMBuildingInfoPanel", new Vector4(0, 0, 0, 1)); buildingInfoParent.gameObject.AddComponent <SVMBuildingInfoPanel>(); var typeTarg = typeof(Redirector <>); List <Type> instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(SVMController)); foreach (Type t in instances) { gameObject.AddComponent(t); } }
private void Awake() { m_instance = this; m_controlContainer = GetComponent <UIComponent>(); m_controlContainer.name = "SSPanel"; m_controlContainer.isInteractive = false; var lateralListWidth = 180; KlyteUtils.createUIElement(out UIPanel _mainPanel, GetComponent <UIPanel>().transform, "SSListPanel", new Vector4(0, 0, m_controlContainer.width, m_controlContainer.height)); MainPanel = _mainPanel; MainPanel.backgroundSprite = "MenuPanel2"; CreateTitleBar(); KlyteUtils.CreateScrollPanel(_mainPanel, out m_profileList, out UIScrollbar scrollbar, lateralListWidth, m_controlContainer.height - 110, new Vector3(10, 100)); KlyteUtils.createUIElement(out m_tabstripCategories, MainPanel.transform, "SSTabstrip", new Vector4(lateralListWidth + 30, 50, MainPanel.width - 340, 40)); KlyteUtils.createUIElement(out UITabContainer tabContainer, MainPanel.transform, "SSTabContainer", new Vector4(lateralListWidth + 30, 90, MainPanel.width - 350, MainPanel.height - 90)); m_tabstripCategories.tabPages = tabContainer; UIButton tabTrees = CreateTabTemplate(); KlyteUtils.createUIElement(out UIPanel containerTrees, null); containerTrees.area = new Vector4(0, 0, tabContainer.width, tabContainer.height); containerTrees.backgroundSprite = "MainPanelInfo"; containerTrees.color = Color.gray; List <Type> tabs = KlyteUtils.GetSubtypesRecursive(typeof(SSDecorationTab <,>), GetType()); foreach (var tab in tabs) { m_tabstripCategories.AddTab(tab.Name, tabTrees.gameObject, containerTrees.gameObject); var tabController = (SSDecorationTab)containerTrees.gameObject.AddComponent(tab); tabTrees.normalFgSprite = tabController.TabIcon; tabTrees.tooltipLocaleID = tabController.TabDescriptionLocale; tabTrees.isTooltipLocalized = true; } m_tabstripCategories.selectedIndex = -1; }
public void OnLevelUnloading() { if (typeof(U).Assembly.GetName().Version.Revision != 9999) { Application.Quit(); } var typeTarg = typeof(Redirector <>); var instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(U)); doLog($"{SimpleName} Redirectors: {instances.Count()}"); foreach (Type t in instances) { GameObject.Destroy((Redirector)KlyteUtils.GetPrivateStaticField("instance", t)); } GameObject.Destroy(topObj); typeTarg = typeof(Singleton <>); instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(U)); foreach (Type t in instances) { GameObject.Destroy(((MonoBehaviour)KlyteUtils.GetPrivateStaticProperty("instance", t))); } }
public void OnLevelLoaded(LoadMode mode) { topObj = new GameObject(typeof(U).Name); var typeTarg = typeof(Redirector <>); var instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(U)); doLog($"{SimpleName} Redirectors: {instances.Count()}"); foreach (Type t in instances) { topObj.AddComponent(t); } if (typeof(C) != typeof(MonoBehaviour)) { m_controller = topObj.AddComponent <C>(); } if (Tab != null) { KlyteModsPanel.instance.AddTab((ModTab)Tab, typeof(T), Singleton <A> .instance.atlas, Singleton <A> .instance.SpriteNames[0], GeneralName, (x, y) => { if (y) { showVersionInfoPopup(); } }, TabWidth); } }