接口定义
hulucat edited this page Jan 16, 2016
·
12 revisions
- 请求地址:http://tripwar.hulucat.net/init
- 请求参数:
- 返回结果:
{
"head": {
"code": 200,
"desc": "OK"
},
"body": {
"sid": "a382kdk"
}
}
返回的sid就是sessionid, 用于后续所有的通信
- 请求地址:http://tripwar.hulucat.net/status
- 请求参数:sid
- 返回结果:
{
"head": {
"code": 200,
"desc": "OK"
},
"body": {
"game_state": 1,
"hp": 10,
"mana": 8,
"towers": [
{
"id": 1234,
"faction": 1,
"lat": 112.22,
"lng": 46.22
},
{
"id": 1234,
"faction": 2,
"lat": 112.22,
"lng": 46.22
}
],
"users": [
{
"id": 12343,
"faction": 1,
"name": "Jack",
"total_score": 129292,
"score": 112,
"location_bearing": 33,
"lat": 45.22,
"lng": 106.11,
},
],
"msgs": [
"lalala",
"hehe"
]
}
}
game_state: 0.未开始, 1开始,2结束 hp:血量,0-10 towers:当前周边的地雷 lat, lng:经纬度 users:周边的用户 faction:1,联盟,2部落 name:名字 total_score:他有史以来的的总得分 score:当前游戏场次的得分 location_bearing:经纬度的精确程度 msgs:系统消息,数组,按顺序显示即可
##布雷
- 请求地址:http://tripwar.hulucat.net/build
- 输入参数:sid, lat, lng
- 输出参数:
{
"head": {
"code": 200,
"desc": "OK"
},
"body": {
"tower_id": 12282,
"mana_left": 8
}
}
tower_id:布雷产生的新雷id mana_left:玩家还剩下多少可用的雷
- 请求地址:http://tripwar.hulucat.net/destroy
- 输入参数:sid, tower_id
- 输出参数:
{
"head": {
"code": 200,
"desc": "OK"
},
"body": {
"mana_left": 8
}
}
- 请求地址:http://tripwar.hulucat.net/result
- 输入参数:sid
- 输出结果:
{
"head": {
"code": 200,
"desc": "OK"
},
"body": {
"score_total": 12828282,
"score": 222,
"built": 12,
"destroyed": 1,
"meet": 3
}
}