Commit ef066481f37370d8c7834c6a684b0ddd0b5e3c29
1 parent
d79d1182
Exists in
master
提交模拟登陆协议
Showing
2 changed files
with
15 additions
and
9 deletions
Show diff stats
src/WorldTester/logic.go
1 | 1 | package main |
2 | 2 | |
3 | 3 | import ( |
4 | - "WorldTester/conf" | |
5 | 4 | "common/beegomap" |
6 | 5 | "common/logger" |
7 | 6 | // "fmt" |
... | ... | @@ -72,11 +71,9 @@ func Start(roomcount, invertal int) { |
72 | 71 | } |
73 | 72 | |
74 | 73 | func InitAllHost(roomcount int) { |
75 | - for idx, room := range conf.Config.Rooms.RoomItems { | |
76 | - if idx >= roomcount { | |
77 | - return | |
78 | - } | |
79 | - for _, uid := range room.ArrIDs { | |
74 | + for i:=0;i<roomcount;i++ { | |
75 | + | |
76 | + uid := i | |
80 | 77 | conn := getTcpClient(uint32(uid)) |
81 | 78 | var player PlayerInfo |
82 | 79 | player.uid = uint32(uid) |
... | ... | @@ -87,12 +84,20 @@ func InitAllHost(roomcount int) { |
87 | 84 | m_map_club_creater.Set(uint32(uid), &player) |
88 | 85 | log.Println("m_map_players.Set(uint32(uid), &player)-player.isHost:", player.isHost) |
89 | 86 | break |
90 | - } | |
87 | + | |
91 | 88 | } |
92 | 89 | } |
93 | 90 | |
94 | 91 | func HostLogin(interval int) { |
92 | + items := m_map_players.Items() | |
93 | + for _, v := range items { | |
94 | + player := v.(*PlayerInfo) | |
95 | + SendLogin(player) | |
96 | + StartPlayer(player) | |
97 | + time.Sleep(time.Duration(interval)) | |
98 | + | |
95 | 99 | |
100 | + } | |
96 | 101 | } |
97 | 102 | |
98 | 103 | func StartPlayer(player *PlayerInfo) { | ... | ... |
src/WorldTester/main.go
... | ... | @@ -10,7 +10,7 @@ import ( |
10 | 10 | |
11 | 11 | var ( |
12 | 12 | // server_addr = "139.196.215.75:4321" |
13 | - server_addr = "192.168.0.159:50054" | |
13 | + server_addr = "172.21.0.9:30054" | |
14 | 14 | do_trash = false |
15 | 15 | obeserver_count = 0 |
16 | 16 | ) |
... | ... | @@ -44,7 +44,8 @@ func main() { |
44 | 44 | return |
45 | 45 | } |
46 | 46 | |
47 | - //Start(*roomcount, *createinterval) | |
47 | + InitAllHost(1) | |
48 | + HostLogin(1) | |
48 | 49 | // if obeserver_count > 0 { |
49 | 50 | // StartObserver(*createinterval) |
50 | 51 | // } | ... | ... |