diff --git a/README.md b/README.md index 3e903eb..687c33a 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,15 @@ The subcommands are ``list``, ``play`` and ``stop``. | Subcommands | Parameters | Examples | Explanation | | ----------- | ------------------------------------------------------------- | --------------- | ----------------------------------------------------------------- | | list | None | /mpm list | Get song index | -| play | song index, optional: loop count, optional: progress bar type | /mpm play 1 3 1 | play song (index 1, loop 3 times, use actionbar to show progress) | +| play | song index, optional: loop count, optional: progress bar type | /mpm play 1 3 1 | play song (index 1, loop 3 times, use bossbar to show progress) | | stop | none | /mpm stop | stop play | Progress bar type: -0: bossbar -1: actionbar -2: not displayed +0: not displayed +1: bossbar +2: actionbar: JUKEBOX_POPUP +3: actionbar: POPUP +4: actionbar: TIP Note: Before playing music, please use ``/mpm list`` to get the music list first. You can also use the ``/mpm`` command inside the game to see how to use it diff --git a/README_ZH.md b/README_ZH.md index 8ba8e27..0038224 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -21,13 +21,15 @@ NBS音乐文件请放置到``plugins\MediaPlayer\nbs``文件夹中 | 子命令 | 参数 | 示例 | 解释 | | ------ | ------------------------------------------ | --------------- | -------------------------------------------------- | | list | 无 | /mpm list | 获取歌曲索引 | -| play | 歌曲索引,可选:循环次数,可选:进度条类型 | /mpm play 1 3 1 | 播放歌曲(索引为1, 循环3次,使用actionbar显示进度) | +| play | 歌曲索引,可选:循环次数,可选:进度条类型 | /mpm play 1 3 1 | 播放歌曲(索引为1, 循环3次,使用bossbar显示进度) | | stop | 无 | /mpm stop | 停止播放 | 进度条类型: -0: bossbar -1: actionbar -2: 不显示 +0: 不显示 +1: bossbar +2: actionbar: JUKEBOX_POPUP +3: actionbar: POPUP +4: actionbar: TIP 注意:在播放音乐之前,请先使用``/mpm list``来获取音乐列表。 具体使用方法,也可以在游戏内使用``/mpm``命令查看 diff --git a/include/mediaplayer/music_player.h b/include/mediaplayer/music_player.h index 39fe046..6de9fe5 100644 --- a/include/mediaplayer/music_player.h +++ b/include/mediaplayer/music_player.h @@ -32,8 +32,11 @@ static const char *BUILTIN_INSTRUMENT[NUM_NOTES] = { }; enum music_bar_type { + MUSIC_BAR_TYPE_NOT_DISPLAY, MUSIC_BAR_TYPE_BOSS_BAR, - MUSIC_BAR_TYPE_ACTION_BAR + MUSIC_BAR_TYPE_ACTION_BAR_JUKEBOX_POPUP, + MUSIC_BAR_TYPE_ACTION_BAR_POPUP, + MUSIC_BAR_TYPE_ACTION_BAR_TIP }; struct note_queue_node { diff --git a/src/music_player.c b/src/music_player.c index 1bbb2d5..918bcc2 100644 --- a/src/music_player.c +++ b/src/music_player.c @@ -207,13 +207,21 @@ void set_music_bar(struct player *player, struct music_queue_node *node) total_time_sec); switch (node->music_bar_type) { + case MUSIC_BAR_TYPE_NOT_DISPLAY: + break; case MUSIC_BAR_TYPE_BOSS_BAR: send_boss_event_packet(player, msg, passed_rate, BOSS_BAR_HIDE); send_boss_event_packet(player, msg, passed_rate, BOSS_BAR_DISPLAY); break; - case MUSIC_BAR_TYPE_ACTION_BAR: + case MUSIC_BAR_TYPE_ACTION_BAR_JUKEBOX_POPUP: send_text_packet(player, TEXT_TYPE_JUKEBOX_POPUP, msg); break; + case MUSIC_BAR_TYPE_ACTION_BAR_POPUP: + send_text_packet(player, TEXT_TYPE_POPUP, msg); + break; + case MUSIC_BAR_TYPE_ACTION_BAR_TIP: + send_text_packet(player, TEXT_TYPE_TIP, msg); + break; default: break; }