Browse Source

feature:1.有序游戏完成

issu01
Zhangwen 4 months ago
parent
commit
ca141eaf9b
  1. 30
      source/app/task_game.c
  2. 1
      source/app/task_game.h

30
source/app/task_game.c

@ -68,7 +68,6 @@ void L3_task_game_init(void)
_s_task_game.game_info[0].game_supported_oid[4].yes_or_no = 0; _s_task_game.game_info[0].game_supported_oid[4].yes_or_no = 0;
_s_task_game.game_info[0].game_order = 0; _s_task_game.game_info[0].game_order = 0;
_s_task_game.game_info[0].game_order_index = 0;
_s_task_game.game_info[0].game_timeout_seconds = 600; _s_task_game.game_info[0].game_timeout_seconds = 600;
_s_task_game.game_info[0].game_score = 0; _s_task_game.game_info[0].game_score = 0;
@ -78,9 +77,9 @@ void L3_task_game_init(void)
_s_task_game.game_info[1].game_supported_oid[1].oid = 0x3145; _s_task_game.game_info[1].game_supported_oid[1].oid = 0x3145;
_s_task_game.game_info[1].game_supported_oid[2].oid = 0x3146; _s_task_game.game_info[1].game_supported_oid[2].oid = 0x3146;
_s_task_game.game_info[1].game_supported_oid[3].oid = 0x3147; _s_task_game.game_info[1].game_supported_oid[3].oid = 0x3147;
_s_task_game.game_info[1].game_supported_oid[4].oid = 0x3148; _s_task_game.game_info[1].game_supported_oid[4].oid = 0x3149;
_s_task_game.game_info[1].game_supported_oid[5].oid = 0x3149; _s_task_game.game_info[1].game_supported_oid[5].oid = 0x314A;
_s_task_game.game_info[1].game_supported_oid[6].oid = 0x314A; _s_task_game.game_info[1].game_supported_oid[6].oid = 0x314B;
_s_task_game.game_info[1].game_supported_oid[7].oid = 0x314C; _s_task_game.game_info[1].game_supported_oid[7].oid = 0x314C;
_s_task_game.game_info[1].game_supported_oid[8].oid = 0x314D; _s_task_game.game_info[1].game_supported_oid[8].oid = 0x314D;
_s_task_game.game_info[1].game_supported_oid[9].oid = 0x314E; _s_task_game.game_info[1].game_supported_oid[9].oid = 0x314E;
@ -102,7 +101,6 @@ void L3_task_game_init(void)
_s_task_game.game_info[1].game_supported_oid[25].oid = 0x3179; _s_task_game.game_info[1].game_supported_oid[25].oid = 0x3179;
_s_task_game.game_info[1].game_supported_oid[25].yes_or_no = 0; _s_task_game.game_info[1].game_supported_oid[25].yes_or_no = 0;
_s_task_game.game_info[1].game_order = 1; _s_task_game.game_info[1].game_order = 1;
_s_task_game.game_info[1].game_order_index = 0;
_s_task_game.game_info[1].game_timeout_seconds = 600; _s_task_game.game_info[1].game_timeout_seconds = 600;
_s_task_game.game_info[1].game_score = 0; _s_task_game.game_info[1].game_score = 0;
@ -116,7 +114,6 @@ void L3_task_game_init(void)
_s_task_game.game_info[2].game_supported_oid[5].oid = 0x317A; _s_task_game.game_info[2].game_supported_oid[5].oid = 0x317A;
_s_task_game.game_info[2].game_supported_oid[5].yes_or_no = 0; _s_task_game.game_info[2].game_supported_oid[5].yes_or_no = 0;
_s_task_game.game_info[2].game_order = 1; _s_task_game.game_info[2].game_order = 1;
_s_task_game.game_info[2].game_order_index = 0;
_s_task_game.game_info[2].game_timeout_seconds = 600; _s_task_game.game_info[2].game_timeout_seconds = 600;
_s_task_game.game_info[2].game_score = 0; _s_task_game.game_info[2].game_score = 0;
@ -186,17 +183,26 @@ void L3_task_game_handler(S_TASK_GAME *s)
} }
TTSS_Task_step(D_task_GAME_PLAY) TTSS_Task_step(D_task_GAME_PLAY)
U8 i = 0,j = 0; U8 i = 0,j = 0;
U8 has_unhandled_point = 0;
for (i = 0; i < game_supported_oid_max; i++) for (i = 0; i < game_supported_oid_max; i++)
{ {
POINT_INFO* p = &_s_task_game.game_info[_s_task_game.game_info_index].game_supported_oid[i]; GAME_INF* g = &s->game_info[_s_task_game.game_info_index];
POINT_INFO* p = &s->game_info[_s_task_game.game_info_index].game_supported_oid[i];
if (p->oid == 0) if (p->oid == 0)
{ {
break; break;
} }
if (s->read_oid == p->oid) if (s->read_oid != p->oid)
{
if (p->yes_or_no == 1 && p->handled == 0)
{
has_unhandled_point = 1;
}
}
else
{ {
//错误码 //错误码 或者 是正确码有序,但是存在未处理的点
if (p->yes_or_no == 0) if (p->yes_or_no == 0 || (p->yes_or_no == 1 && g->game_order == 1 && has_unhandled_point == 1))
{ {
s->eeror_times++; s->eeror_times++;
L0_uart0_sendstr("eeror_times = "); L0_uart0_sendstr("eeror_times = ");
@ -210,7 +216,7 @@ void L3_task_game_handler(S_TASK_GAME *s)
L2_WT2605B_Broadcast(p->point_audio); L2_WT2605B_Broadcast(p->point_audio);
} }
} }
//正确码 //正确码 并且是(无序的 或者 是有序的没有未处理的点)
else else
{ {
//未处理 //未处理
@ -262,7 +268,7 @@ void L3_task_game_handler(S_TASK_GAME *s)
} }
} }
L2_task_go_Tdelay(D_task_READ_OID,D_Tdelay_2s); L2_task_go_Tdelay(D_task_READ_OID,D_Tdelay_300ms);
TTSS_Task_end(); TTSS_Task_end();

1
source/app/task_game.h

@ -36,7 +36,6 @@ typedef struct game_info
TS_SPEECH_AUDIO* game_audio; //游戏音频 TS_SPEECH_AUDIO* game_audio; //游戏音频
POINT_INFO game_supported_oid[game_supported_oid_max]; //游戏支持的point POINT_INFO game_supported_oid[game_supported_oid_max]; //游戏支持的point
U8 game_order; //游戏顺序 0不排序,1排序 U8 game_order; //游戏顺序 0不排序,1排序
U8 game_order_index; //游戏顺序索引
U16 game_timeout_seconds; //游戏超时时间(秒) U16 game_timeout_seconds; //游戏超时时间(秒)
U16 game_score; //游戏得分 U16 game_score; //游戏得分
}GAME_INF; }GAME_INF;

Loading…
Cancel
Save