Ejemplo n.º 1
0
        internal void PreviewASM(Assembler asm, string headerLabel, string caption)
        {
            Text = "GBA Music Studio - " + caption;
            bool playing = SongPlayer.State == PlayerState.Playing; // Play new song if one is already playing

            Stop(null, null);
            SongPlayer.SetSong(new M4AASMSong(asm, headerLabel));
            UpdateTrackInfo(playing);
        }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        DrawInspector();

        //Check for mouse events
        if (Event.current.isMouse)
        {
            if (Event.current.type == EventType.mouseDown)
            {
                OnMouseDown(Event.current);
            }
            else if (Event.current.type == EventType.mouseUp)
            {
                OnMouseUp(Event.current);
            }
        }

        //Check for key input events
        if (Event.current.isKey)
        {
            if (Event.current.type == EventType.keyDown)
            {
                OnKeyDown(Event.current);
            }
        }

        if (Event.current.type == EventType.ValidateCommand)
        {
            switch (Event.current.commandName)
            {
            case "UndoRedoPerformed":
                RedrawProgressViewTexture();
                break;
            }
        }


        if (GUI.changed)
        {
            SongData targetData = target as SongData;
            if (targetData.BackgroundTrack != null && SongPlayer.Song != targetData)
            {
                SongPlayer.SetSong(targetData);
                //waveTex = AudioWaveform(SongPlayer.Song.BackgroundTrack, (int)SongViewRect.width, (int)SongViewRect.height, Color.yellow);
            }
        }

        UpdateMetronome();
        RepaintGui();
    }
Ejemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        DrawInspector();

        //判断鼠标点击
        if (Event.current.isMouse)
        {
            if (Event.current.type == EventType.mouseDown)
            {
                OnMouseDown(Event.current);
            }
            else if (Event.current.type == EventType.mouseUp)
            {
                OnMouseUp(Event.current);
            }
        }

        //判断键盘敲击
        if (Event.current.isKey)
        {
            if (Event.current.type == EventType.keyDown)
            {
                OnKeyDown(Event.current);
            }
        }

        if (Event.current.type == EventType.ValidateCommand)
        {
            switch (Event.current.commandName)
            {
            case "UndoRedoPerformed":
                RedrawProgressViewTexture();
                break;
            }
        }

        //对曲谱进行更新
        if (GUI.changed)
        {
            SongData targetData = target as SongData;
            if (targetData.BackgroundTrack != null && SongPlayer.Song != targetData)
            {
                SongPlayer.SetSong(targetData);
            }
        }

        UpdateMetronome();
        RepaintGui();
    }
Ejemplo n.º 4
0
    //按钮激活
    public void StartPlaying(int playlistIndex)
    {
        //属性初始化
        ResetGameStateValues();

        //游戏UI
        SetInGameUserInterfaceVisibility(true);

        //运行歌曲文件
        Player.SetSong(Playlist[playlistIndex]);

        CreateNoteObjects();
        //DragonHP();

        Player.Play();
        StartCoroutine("DisplayCountdown");
    }
Ejemplo n.º 5
0
    protected void OnEnable()
    {
        //Setup object references
        obj_AudioManager = GameObject.Find("AudioManager");

        if (obj_AudioManager == null)
        {
            return;
        }

        SongPlayer = obj_AudioManager.GetComponent <SongPlayer>();
        //MetronomeSource = GameObject.Find( "Metronome" ).audio;

        //Prepare playback
        SongPlayer.SetSong((SongData)target);
        LastMetronomeBeat = -Mathf.Ceil(SongPlayer.Song.AudioStartBeatOffset);

        //waveTex = AudioWaveform(SongPlayer.Song.BackgroundTrack, (int)SongViewRect.width, (int)SongViewRect.height, Color.yellow);
        RedrawProgressViewTexture();
    }
Ejemplo n.º 6
0
    protected void OnEnable()
    {
        //设置对象引用
        GuitarObject = GameObject.Find("Guitar");

        if (GuitarObject == null)
        {
            return;
        }

        SongPlayer = GuitarObject.GetComponent <SongPlayer>();
        //获取音乐
        MetronomeSource = GameObject.Find("Metronome").GetComponent <AudioSource>();

        //初始化
        SongPlayer.SetSong((SongData)target);

        //向上进位取整
        LastMetronomeBeat = -Mathf.Ceil(SongPlayer.Song.AudioStartBeatOffset);


        RedrawProgressViewTexture();
    }
Ejemplo n.º 7
0
        void LoadSong(object sender, EventArgs e)
        {
            APlaylist    mainPlaylist = ROM.Instance.Game.Playlists[0];
            List <ASong> songs        = mainPlaylist.Songs.ToList();
            ASong        song         = songs.SingleOrDefault(s => s.Index == songNumerical.Value);

            if (song != null)
            {
                Text = "GBA Music Studio - " + song.Name;
                songsComboBox.SelectedIndex = songs.IndexOf(song) + 1; // + 1 for the Playlist index
            }
            else
            {
                Text = "GBA Music Studio";
                songsComboBox.SelectedIndex = 0;
            }
            bool playing = SongPlayer.State == PlayerState.Playing; // Play new song if one is already playing

            Stop(null, null);
            SongPlayer.SetSong(ROM.Instance.SongTables[(int)tableNumerical.Value][(int)songNumerical.Value]);
            UpdateTrackInfo(playing);

            MIDIKeyboard.Start();
        }
Ejemplo n.º 8
0
	protected void OnEnable()
	{
		//Setup object references
		GuitarObject = GameObject.Find( "SongSystem" );

		if( GuitarObject == null )
		{
			return;
		}

		SongPlayer = GuitarObject.GetComponent<SongPlayer>();
		//MetronomeSource = GameObject.Find( "Metronome" ).audio;

		//Prepare playback
		SongPlayer.SetSong( (SongData)target );
//		LastMetronomeBeat = -Mathf.Ceil( SongPlayer.Song.AudioStartBeatOffset );
		
		if( actionReadDic != null )
			actionReadDic.Clear();
		if( loopActionReadDic != null )
			loopActionReadDic.Clear();
		actionReadDic = new Dictionary<ActorBase, ActorBase>();
		loopActionReadDic = new Dictionary<ActorBase, ActorBase>();
		

		RedrawProgressViewTexture();
	}
Ejemplo n.º 9
0
 public void SetSongPlayer(SongData songData)
 {
     m_SongPlayer.SetSong(songData);
     m_SongPlayer.Play();
 }