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 = "SingleButton"; 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); }
public 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 <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = "PureMOD" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new ButtonAPI.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()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new ButtonAPI.SingleButton(menuName, 5, 5, true, "Back", "Go Back", delegate() { QMStuff.ShowQuickmenuPage(btnQMLoc); }, backbtnTextColor, backbtnBackgroundColor); }