void Communication_Service() { char Ostr[120]="\0"; char chardata[10]; float Data=0; float temp=0; uint8_t temp_nm[12]; uint8_t i=0,j=0; if(Flag_Rx2End) { Flag_Rx2End=0; Communicate(); } // if(T05_4>=2)//此处为数据输出间隔 0.5*4=2S // { // T05_4=0; // // strcat(Ostr,"\r\n"); // Uart_send_string(Ostr); // // // } // } }
int GetTime() { sprintf(msg_send, "query_time"); strcpy(msg_receive, Communicate(msg_send)); int current_time; sscanf(msg_receive, "%d", ¤t_time); return current_time; }
const Status *GetStatus() { sprintf(msg_send, "query_status %d", -1); strcpy(msg_receive, Communicate(msg_send)); LoadPlayerStatus(msg_receive); return &STATUS_; }
const Map *GetMap() { sprintf(msg_send, "query_map"); strcpy(msg_receive, Communicate(msg_send)); LoadMapInfo(msg_receive); return &MAP_; }
void UseSkill(SkillType skill, int user_id, int target_id, Position des) { // 选手并不需要使用这个方法 sprintf(msg_send, "use_skill %d %d %d %.10f %.10f %.10f", skill, user_id, target_id, des.x, des.y, des.z); Communicate(msg_send); }
void PAUSE() { sprintf(msg_send, "pause"); Communicate(msg_send); }
void UpgradeSkill(int user_id, SkillType skill) { sprintf(msg_send, "upgrade_skill %d %d", skill, user_id); Communicate(msg_send); }
void Move(int user_id, Speed speed) { sprintf(msg_send, "move %d %.10f %.10f %.10f", user_id, speed.x, speed.y, speed.z); Communicate(msg_send); }