示例#1
0
    public void OpenPanel(Musician musician, BandMemberUI bandMemberUI)
    {
        this.gameObject.SetActive(true);


        for (int i = 0; i < _moveActionButtons.Length; i++)
        {
            Button button = _moveActionButtons[i];

            if (i >= musician.GetMusicActions().Count)
            {
                button.gameObject.SetActive(false);
                break;
            }
            button.gameObject.SetActive(true);

            MusicAction musicAction = musician.GetMusicActions()[i];


            button.onClick.RemoveAllListeners();
            button.onClick.AddListener(() => moveBegin(musician, musicAction, bandMemberUI));

            Text buttonText = button.transform.Find("Text").GetComponent <Text>();
            buttonText.text = $"{musicAction.Name} ({musicAction.RoundsToCooldown})";

            _musicianName.text = musician.Name + "'s moves:";
        }
    }
示例#2
0
 private void moveBegin(Musician musician, MusicAction musicAction, BandMemberUI bandMemberUI)
 {
     musician.CurrentAction = musicAction;
     bandMemberUI.UpdateAction();
 }