1 Star 0 Fork 0

桐子将你军 / Robot-battle-platform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

服务器通信规范

服务器消息下发

表 1 消息JSON包参数

参数名 类型 必填 说明
messageType string 表示消息的类型,
"0":错误反馈,"1":游戏开始,"2":时间到导致游戏结束,"3":机器人出界导致游戏结束,
"4":转发对手消息,"5":发送排名信息,"6":机器人被击毁导致游戏结束
payload object 若messageType=="4",则此项必填,此项作为对手消息负载;
若messageType=="5",则此项必填,此项作为排行榜内容;

表 2 messageType=="5" 时的 payload

参数名 类型 必填 说明
rankingList array(对象数组) 存放所有用户的积分信息

表 3 rankingList 元素内容

参数名 类型 必填 说明
username string 用户注册的名字
rank string 排名名次
integaral number 对应的积分
{
  "messageType":"0"
}

{
  "messageType":"4",
  "payload":{
    "skill":"1"//索敌
  }
}

// 服务器结算广播排行榜信息
{
  "messageType":"5",
  "payload":{
    "rankingList ":[
        {
            "username":"roland",
            "rank":"1",
            "integaral":23.4
        },
        {
            "username":"steve",
            "rank":"2",
            "integaral":12.34
        }
    ]
  }
}

应用端消息上报

表 1 消息JSON包参数

参数名 类型 必填 说明
carName string 小车名字,也就是核心模块的蓝牙名
messageType string 表示消息的类型,
"0":错误反馈,"1":玩家准备信号,"2":玩家释放技能,"3":游戏结算积分上报,"4":自身被击毁
payload object 若messageType=="2",则此项必填,此项作为通知对手自身使用的技能
若messageType=="3",则此项必填,此项作为上报的积分信息
username string 用户注册的名字

表 2 messageType=="3" 时的 payload

参数名 类型 必填 说明
integaral number 计算后的积分
{
  "carName":"Ranld",
  "messageType":"1",
  "username":"xxx"
}

{
  "carName":"Ranld",
  "messageType":"2",
  "payload":{
    "skill":"1"
  },
  "username":"xxx"
}
// APP收到服务器游戏结束的广播后,计算积分并上报给服务器
{
  "carName":"Ranld",
  "messageType":"3",
  "payload":{
    "integaral":12.3
  },
  "username":"roland"
}
MIT License Copyright (c) 2024 桐子将你军 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

null~~~~~~ 展开 收起
C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Roland665/robot-battle-platform.git
git@gitee.com:Roland665/robot-battle-platform.git
Roland665
robot-battle-platform
Robot-battle-platform
master

搜索帮助