private void initButton(int btnXLocation, int btnYLocation, bool btnHalf, string btnText, System.Action <bool> btnAction, string btnToolTip, Color?btnBackgroundColor = null, Color?btnTextColorOn = null, bool state = false, Color?btnTextColorOff = null) { btnType = "ToggleButton"; button = Object.Instantiate(QMStuff.SingleButtonTemplate(), QMStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true); initShift[0] = -1; initShift[1] = 0; SetLocation(btnXLocation, btnYLocation, btnHalf); SetButtonText(btnText); SetToolTip(btnToolTip); SetAction(btnAction, (Color)btnTextColorOn, (Color)btnTextColorOff); if (btnBackgroundColor != null) { SetBackgroundColor((Color)btnBackgroundColor); } else { OrigBackground = button.GetComponentInChildren <Image>().color; } m_State = state; if (state) { SetTextColor((Color)btnTextColorOn); } else { SetTextColor((Color)btnTextColorOff); } SetActive(true); }
private void initButton(int btnXLocation, int btnYLocation, bool btnHalf, string btnText, string btnToolTip, System.Action action = null, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null) { btnType = "NestedButton"; Transform menu = Object.Instantiate(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = "PureMOD" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new SingleButton(btnQMLoc, btnXLocation, btnYLocation, btnHalf, btnText, btnToolTip, delegate() { if (action != null) { action.Invoke(); } QMStuff.ShowQuickmenuPage(menuName); }, btnBackgroundColor, btnTextColor); Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { GameObject.Destroy(enumerator.Current.Cast <Transform>()?.gameObject); } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new SingleButton(menuName, 5, 5, true, "Back", "Go Back", delegate() { QMStuff.ShowQuickmenuPage(btnQMLoc); }, backbtnTextColor, backbtnBackgroundColor); }