Exemplo n.º 1
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();
            }
        }
    }
Exemplo n.º 2
0
    public void RefreshButton()
    {
        SongmapController.Instance.AudioSource.Stop();
        views.Clear();
        playSongButton.gameObject.SetActive(false);
        highscoreButton.gameObject.SetActive(false);
        maps = SongmapController.Instance.GetSongmaps(SongmapController.SongmapSortType.DIFF, SongmapController.SongmapSortDirection.ASC);

        foreach (Transform child in content)
        {
            Destroy(child.gameObject);
            FindObjectOfType <AudioManager>().Play("Refresh");
        }

        foreach (var key in maps.Keys)
        {
            SongmapView view = new SongmapView(ref content, songmapPrefab);
            view.AddParentSongmapView(songmapParentPrefab);
            view.parentSongmapView.title.text = key.ToString();

            foreach (var map in maps[key])
            {
                view.AddSongmapChildView(songmapChildPrefab, map);
            }
            views.Add(view);
            view.ToggleChildren();
        }
    }
Exemplo n.º 3
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();
        }
    }