public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Nullable <Color> btnBackgroundColor = null, Nullable <Color> btnTextColor = null, Nullable <Color> backbtnBackgroundColor = null, Nullable <Color> backbtnTextColor = null) { Transform menu = UnityEngine.Object.Instantiate <Transform>(QuickMenuStuff.GetQuickMenuInstance().transform.Find("CameraMenu"), QuickMenuStuff.GetQuickMenuInstance().transform); menuName = "CustomMenu" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, delegate() { QuickMenuStuff.ShowQuickmenuPage(menuName); }, btnToolTip, btnBackgroundColor, btnTextColor); IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform btnEnum = (Transform)obj; if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new QMSingleButton(this, 4, 2, "Back", delegate() { QuickMenuStuff.ShowQuickmenuPage(btnQMLoc); }, "Go Back", backbtnBackgroundColor, backbtnTextColor); }
public IEnumerator Start() { //Q_RUBYLogo is initially set as a QMSingleButton, so we want to instantiate //a new one with all of the properties that we want Q_RUBYLogo = new QMSingleButton( //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons) //ShortcutMenu -> main quick menu with worlds/avatars //UserInteractMenu -> quick menu when selecting a player "ShortcutMenu", //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button. //x -> positive moves you to the right //y -> positive moves you down 5, -1, //The main text of the button "RUBY", //The action you want the button to do when it is pressed, delegate() { } is a must have delegate() { System.Diagnostics.Process.Start("https://www.vrchaven.com/"); QuickMenuStuff.GetQuickMenuInstance().CloseMenu(); }, //The tooltip of the button (the text on top when hovering over the button) "Client by DubyaDude <3\nClicking here will open a browser to the website.", //First color is background color, second color is text color. If not filled in or set to null, default colors will stay Color.cyan, Color.white ); //Now you have a new button! //This creates a custom sprite for the Q_RUBYLogo button Sprite logoSprite = new Sprite(); using (WWW www = new WWW("https://www.vrchaven.com/img/logo.png")) { yield return(www); logoSprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height), new Vector2(0, 0)); } Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().sprite = logoSprite; Material logoMaterial = new Material(Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().material); logoMaterial.shader = Shader.Find("Unlit/Transparent"); Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().material = logoMaterial; //Q_Functions is initially set as a QMNestedButton, so we want to instantiate //a new one with all of the properties that we want Q_Functions = new QMNestedButton( //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons) //ShortcutMenu -> main quick menu with worlds/avatars //UserInteractMenu -> quick menu when selecting a player "ShortcutMenu", //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button. //x -> positive moves you to the right //y -> positive moves you down 5, 2, //The main text of the nested button "Functions", //The tooltip of the button (the text on top when hovering over the button) "A little bit of extra stuff", //(Nested button) First color is background color, second color is text color. If not filled in or set to null, default colors will stay Color.cyan, Color.white, //(Back button in nested page) First color is background color, second color is text color. If not filled in or set to null, default colors will stay Color.cyan, Color.yellow ); //Moves the back button one to the right for more room Q_Functions.getBackButton().setLocation(2, 0); //Q_F_Gain is initially set as a QMToggleButton, so we want to instantiate //a new one with all of the properties that we want Q_F_Gain = new QMToggleButton( //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons) //ShortcutMenu -> main quick menu with worlds/avatars //UserInteractMenu -> quick menu when selecting a player Q_Functions, //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button. //x -> positive moves you to the right //y -> positive moves you down 1, 0, //The text for the 'on' position of the button "Max Gain", //The 'on' action of the button delegate() { Console.WriteLine("Max Gain"); }, //The text for the 'off' position of the button "Normal Gain", //The 'off' action of the button delegate() { Console.WriteLine("Normal Gain"); }, //The tooltip of the button (the text on top when hovering over the button) "Volume to the MAXIMUM!", //First color is background color, second color is text color. If not filled in or set to null, default colors will stay Color.cyan, Color.white ); }