예제 #1
0
    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;
    }
예제 #2
0
    /*
     * 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();
            }
        }
    }
예제 #3
0
    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);
    }
예제 #4
0
    /*
     * 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);
            }
        }
    }
예제 #5
0
    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();
        }
    }