public static void SetupGui() { //if(Mod.IsEnabled && Mod.IsGuiEnabled) if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" Setting up Gui panel."); try { parentGuiView = null; parentGuiView = UIView.GetAView(); if (guiPanel == null) { guiPanel = (CSLShowMoreLimitsGUI)parentGuiView.AddUIComponent(typeof(CSLShowMoreLimitsGUI)); if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" GUI Setup."); //guiPanel.Hide(); } isGuiRunning = true; } catch (Exception ex) { Helper.dbgLog("Error: \r\n", ex,true); } }
/// <summary> /// Gets called upon the base UI component's creation. Basically it's the constructor...but not really. /// </summary> public override void Start() { base.Start(); CSLShowMoreLimitsGUI.instance = this; if (Mod.DEBUG_LOG_ON & Mod.DEBUG_LOG_LEVEL > 0) Helper.dbgLog(string.Concat("Attempting to create our display panel. ",DateTime.Now.ToString(DTMilli).ToString())); this.size = new Vector2(WIDTH, HEIGHT); this.backgroundSprite = "MenuPanel"; this.canFocus = true; this.isInteractive = true; this.BringToFront(); this.relativePosition = new Vector3((Loader.parentGuiView.fixedWidth / 2) - 200, (Loader.parentGuiView.fixedHeight / 2) - 350); this.opacity = Mod.config.GuiOpacity; this.cachedName = cacheName; CurrentMode = Singleton<ToolManager>.instance.m_properties.m_mode; /* if (CurrentMode == ItemClass.Availability.MapEditor) { Helper.dbgLog("sdfsfasdfasdfasdfasdfasdfasdf"); UITextureAtlas[] tAtlas; tAtlas = FindObjectsOfType<UITextureAtlas>(); if (tAtlas != null) { for (int i = 0; i < tAtlas.Length; i++) { if (tAtlas[i].name == "Ingame") { this.atlas = tAtlas[i]; Helper.dbgLog("sdfsfa22222222222222222222asdf"); break; } } } } */ //DragHandler m_DragHandler = this.AddUIComponent<UIDragHandle>(); m_DragHandler.target = this; //Title UILabel m_title = this.AddUIComponent<UILabel>(); m_title.text = "Counter and Object Limit Data"; //spaces on purpose m_title.relativePosition = new Vector3(WIDTH / 2 - (m_title.width / 2) - 25f, (HEADER / 2) - (m_title.height / 2)); m_title.textAlignment = UIHorizontalAlignment.Center; //Close Button UIButton m_closeButton = this.AddUIComponent<UIButton>(); m_closeButton.normalBgSprite = "buttonclose"; m_closeButton.hoveredBgSprite = "buttonclosehover"; m_closeButton.pressedBgSprite = "buttonclosepressed"; m_closeButton.relativePosition = new Vector3(WIDTH - 35, 5, 10); m_closeButton.eventClick += (component, eventParam) => { this.Hide(); }; if (!Mod.config.AutoShowOnMapLoad) { this.Hide(); } DoOnStartup(); if (Mod.DEBUG_LOG_ON) Helper.dbgLog(string.Concat("Display panel created. ",DateTime.Now.ToString(DTMilli).ToString())); }