public async void FetchMapLeaderBoards(SongmapChildView child) { var list = await Mongo.Instance.GetLeaderBoards(child.songmap.GetSongmapName()); LeaderBoardManager.Instance.MapName = child.title.text; LeaderBoardManager.Instance.Leaderboards = list; }
/* * Fired when one of the songmap titles has been clicked. Expands its actual songmaps if not open, else hides them. * Also plays the maps audio while children are expanded */ public void OnSongmapParentClick(Text title) { playSongButton.gameObject.SetActive(false); highscoreButton.gameObject.SetActive(false); if (selectedChildView != null && selectedChildView.gameObject != null) { selectedChildView.gameObject.GetComponent <Image>().color = UNSELECTED_COLOR; } foreach (var view in views) { if (view.parentSongmapView.title.text == title.text) { if (view.ToggleChildren()) { selectedView = view; FindObjectOfType <AudioManager>().Play("Click"); FindObjectOfType <AudioManager>().Pause("MenuMusic"); SongmapController.Instance.PlaySongmapAudio(maps[title.text][0]); } else { FindObjectOfType <AudioManager>().Play("Click"); SongmapController.Instance.AudioSource.Stop(); selectedView = null; selectedChildView = null; } } else if (view.HasExpandedChildren()) { view.ToggleChildren(); } } }
public void AddSongmapChildView(GameObject childPrefab, Songmap map) { GameObject obj = MonoBehaviour.Instantiate(childPrefab); SongmapChildView childView = new SongmapChildView(obj, map); childView.gameObject.transform.SetParent(gameObject.transform, false); childView.gameObject.SetActive(true); songmapChildViews.Add(childView); }
/* * Fired when songmap title has been expanded and its child has been pressed. Will selected the given children, set play button active and high light the selection. */ public void OnSongmapClick(Text difficulty) { foreach (var child in selectedView.songmapChildViews) { if (child.difficulty.text == difficulty.text) { if (selectedChildView != null && selectedChildView.gameObject != null) { selectedChildView.gameObject.GetComponent <Image>().color = UNSELECTED_COLOR; } selectedChildView = child; child.gameObject.GetComponent <Image>().color = SELECTED_COLOR; FindObjectOfType <AudioManager>().Play("Click"); playSongButton.gameObject.SetActive(true); } } }
private void ResetSongSelectionView() { foreach (var view in views) { view.ToggleChildren(false); } selectedView = null; if (selectedChildView != null) { selectedChildView.gameObject.GetComponent <Image>().color = UNSELECTED_COLOR; } selectedChildView = null; playSongButton.gameObject.SetActive(false); if (SongmapController.Instance.AudioSource.isPlaying) { SongmapController.Instance.AudioSource.Stop(); } }