public void DrawGUI() { GUIStyle smallButton = GUI.skin.GetStyle("smallButton"); if (page == 0) { if (GUILayout.Button("Music")) { page = 1; } if (GUILayout.Button("Back", smallButton)) { menu.SetPage(MenuPage.None); } } if (page == 1) { // music GUILayout.Space(10); scroll = GUILayout.BeginScrollView(scroll); GUIStyle style = new GUIStyle(GUI.skin.GetStyle("SmallButtonOdd")) { fontSize = 14, alignment = TextAnchor.MiddleRight }; GUIStyle styleText = new GUIStyle(GUI.skin.GetStyle("LabelOdd")) { wordWrap = true, fontSize = 14, alignment = TextAnchor.MiddleLeft }; if (GameSettings.userPlaylist.Count > 0) { GUILayout.Label("My music", new GUIStyle(GUI.skin.label) { wordWrap = true, fontSize = 18 }); foreach (ExternalSong s in GameSettings.userPlaylist.ToArray()) { GUILayout.Space(1); GUILayout.BeginHorizontal(); GUILayout.Label(s.song.name, styleText); if (GUILayout.Button("Remove", style, GUILayout.MaxWidth(style.CalcSize(new GUIContent("Remove")).x), GUILayout.ExpandHeight(true))) { s.Dispose(); GameSettings.userPlaylist.Remove(s); } GUILayout.EndHorizontal(); GUILayout.Space(1); } GUILayout.Space(10); } GUILayout.Label("Inbuilt music", new GUIStyle(GUI.skin.label) { wordWrap = true, fontSize = 18 }); foreach (Song s in Global.playlist) { GUILayout.Space(1); GUILayout.BeginHorizontal(); style = new GUIStyle(GUI.skin.GetStyle(s.enabled ? "SmallButtonOdd" : "SmallButtonDisabled")) { fontSize = 14, alignment = TextAnchor.MiddleRight }; styleText = new GUIStyle(GUI.skin.GetStyle(s.enabled ? "LabelOdd" : "LabelDisabled")) { wordWrap = true, fontSize = 14, alignment = TextAnchor.MiddleLeft }; GUILayout.Label(s.name, styleText); if (s.enabled) { if (GUILayout.Button("Disable", style, GUILayout.MaxWidth(style.CalcSize(new GUIContent("Disable")).x), GUILayout.ExpandHeight(true))) { s.enabled = false; } } else { if (GUILayout.Button("Enable", style, GUILayout.MaxWidth(style.CalcSize(new GUIContent("Disable")).x), GUILayout.ExpandHeight(true))) { s.enabled = true; } } GUILayout.EndHorizontal(); GUILayout.Space(1); } GUILayout.EndScrollView(); GUILayout.Space(10); if (GUILayout.Button("Add", smallButton)) { menu.StartCoroutine(AddMusic()); } if (GUILayout.Button("Back", smallButton)) { page = 0; GameSettings.Save(); } } }