当四个玩家都选择好了人物和位置后,服务器就通知各个玩家进入战场,
告诉玩家进入哪个战场,以及出现的位置等等
至于地图的数据等,可以直接在本地加载,我图个省事,直接从服务器一起发给玩家了
String startXml = "<data>" +
"<Map>1</Map>" +
"<DataMap>" +
"<list>1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1</list>" +
"<list>3,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1</list>" +
"<list>3,3,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1</list>" +
"<list>3,3,3,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,3,3</list>" +
"<list>3,3,3,3,1,1,1,0,0,0,0,1,1,1,1,1,1,3,3,3</list>" +
"<list>3,3,3,3,3,1,1,0,0,0,0,0,1,1,1,1,1,3,3,3</list>" +
"<list>3,3,3,3,3,4,4,4,4,0,0,4,4,4,4,1,1,3,3,3</list>" +
"<list>3,3,3,3,3,4,6,0,0,0,0,0,0,6,4,1,3,3,3,3</list>" +
"<list>3,3,3,3,3,4,6,0,0,0,0,0,0,6,4,1,3,3,3,3</list>" +
"<list>3,3,3,3,0,4,6,0,0,0,0,0,0,0,4,1,3,3,3,3</list>" +
"<list>3,3,3,0,0,0,0,0,0,4,4,0,0,0,4,3,3,3,3,3</list>" +
"<list>3,3,0,0,0,0,0,0,0,5,7,0,0,0,4,3,3,3,3,3</list>" +
"<list>3,0,0,0,0,4,0,0,0,0,0,0,0,0,4,3,3,3,3,3</list>" +
"<list>0,0,0,0,0,4,6,6,0,0,0,0,0,7,4,0,3,3,3,3</list>" +
"<list>0,0,0,0,0,4,4,4,4,0,0,4,4,4,4,0,1,1,3,3</list>" +
"<list>0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3</list>" +
"<list>1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1</list>" +
"<list>1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1</list>" +
"<list>1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1</list>" +
"<list>1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1</list>" +
"</DataMap>" +
"<Our>" +
"<List x@\"9\" y@\"12\" speed@\"" + ourlist.get(0).getSpeed() + "\" username@\"" + ourlist.get(0).getName() + "\">" + ourlist.get(0).getId() + "</List>" +
"<List x@\"10\" y@\"13\" speed@\"" + ourlist.get(1).getSpeed() + "\" username@\"" + ourlist.get(1).getName() + "\">" + ourlist.get(1).getId() + "</List>" +
"</Our>" +
"<Enemy>" +
"<List x@\"8\" y@\"13\" speed@\"" + enemylist.get(0).getSpeed() + "\" username@\"" + enemylist.get(0).getName() + "\">" + enemylist.get(0).getId() + "</List>" +
"<List x@\"11\" y@\"13\" speed@\"" + enemylist.get(1).getSpeed() + "\" username@\"" + enemylist.get(1).getName() + "\">" + enemylist.get(1).getId() + "</List>" +
"</Enemy>" +
"</data>";
bMan.sendToAll("type=start&xml=" + startXml);
因为和服务器通信的时候,字符串中有等号,所以xml数据中的等号先换成了@,到了客户端再换回来
每个用户在接受到start指令后,进入战场
之前的游戏中,一开始就进入战场了,这次只是在进入战场之前,加一些东西而已
画面如下,战场上每个人物上面显示用户名,画面的左上方,显示自己的信息
图片附件:
1.jpg (2010-12-3 09:18, 105.7 K)
图片附件:
2.jpg (2010-12-3 09:18, 106.62 K)
|