public UIMainButton CreatMainButton() { UIView view = UIView.GetAView(); Vector2 screenResolution = view.GetScreenResolution(); UIMainButton mainButton = (UIMainButton)view.AddUIComponent(typeof(UIMainButton)); mainButton.absolutePosition = new Vector3(Settings.mainButtonX * screenResolution.x / 1920f, Settings.mainButtonY * screenResolution.y / 1080f);// advisorButton.absolutePosition + new Vector3(advisorButton.width, 0); mainButton.name = "YetAnotherToolbarMainButton"; mainButton.tooltip = "Yet Another Toolbar"; mainButton.isInteractive = true; mainButton.size = new Vector2(34, 34); mainButton.isVisible = !Settings.hideMainButton; mainButton.atlas = YetAnotherToolbar.atlas; if (!Settings.expanded) { mainButton.normalFgSprite = mainButton.expandSprite; } else { mainButton.normalFgSprite = mainButton.collapseSprite; } mainButton.eventClicked += (c, p) => { if (Settings.expanded) { Settings.expanded = false; XMLUtils.SaveSettings(); Collapse(); mainButton.normalFgSprite = mainButton.expandSprite; } else { Settings.expanded = true; XMLUtils.SaveSettings(); Expand(); mainButton.normalFgSprite = mainButton.collapseSprite; } }; return(mainButton); }
public void Start() { try { if (mainButton == null) { tsContainer = GameObject.Find("TSContainer").GetComponent <UITabContainer>(); thumbnailBar = UIView.Find <UISlicedSprite>("ThumbnailBar"); mainTS = UIView.Find <UITabstrip>("MainToolstrip"); tsBar = UIView.Find <UISlicedSprite>("TSBar"); infoPanel = UIView.Find <UIPanel>("InfoPanel"); pauseOutline = GameObject.Find("PauseOutline")?.GetComponent <UIComponent>(); if (pauseOutline != null) { pauseOutlineOriginalSize = pauseOutline.size; } isFindItEnabled = IsAssemblyEnabled("findit"); if (isFindItEnabled) { Debugging.Message($"Found enabled mod: findit. Yet Another Toolbar layout patch will be applied"); } isRICOEnabled = IsAssemblyEnabled("ploppablerico"); if (isRICOEnabled) { Debugging.Message($"Found enabled mod: ploppablerico. Yet Another Toolbar layout patch will be applied"); bool result = DrawPloppablePanelPatch.ApplyPatch(Patcher.harmonyInstance); if (result) { Debugging.Message($"Found enabled mod: ploppablerico. Yet Another Toolbar scale patch applied"); } } originalTSPosX = mainTS.relativePosition.x; originalScreenSize = UIView.GetAView().GetScreenResolution(); //UIMultiStateButton advisorButton = view.FindUIComponent<UIMultiStateButton>("AdvisorButton"); // Set Advisor Button and filter panel visiblity SetAdvisorButtonVisibility(); // SetFilterPanelsVisibility(); // Create main button mainButton = CreatMainButton(); // check UUI isUUIEnabled = IsAssemblyEnabled("unifieduimod"); if (isUUIEnabled && Settings.integrateMainButtonUUI) { UUIIntegration.AttachMainButton(); Debugging.Message($"Found enabled mod: unifieduimod. Yet Another Toolbar main button UUI integration applied"); } } } catch (Exception ex) { Debugging.Message("Start() - " + ex.Message); } }