ソースを参照

修复game节点分配

neo 1 年間 前
コミット
1d543c74ee
共有4 個のファイルを変更した11 個の追加8 個の削除を含む
  1. 1 1
      common/core/nodeMgr.lua
  2. 3 3
      dev/utils/util_user.lua
  3. 0 4
      nodes/battle/lib/battle.lua
  4. 7 0
      nodes/game/service/srvAgentMgr.lua

+ 1 - 1
common/core/nodeMgr.lua

@@ -113,7 +113,7 @@ function root.broadcast_game_agent(interface, ...)
113 113
 		return
114 114
 	end
115 115
 	for _, v in ipairs(nodeInfoList) do
116
-		root.send(v, ".gameAgentMgr", "broadcastAgent", interface, ...)
116
+		root.send(v, ".srvAgentMgr", "broadcast_agents", interface, ...)
117 117
 	end
118 118
 end
119 119
 

+ 3 - 3
dev/utils/util_user.lua

@@ -117,12 +117,12 @@ function root:user_dispatch_game(uid)
117 117
     if node == nil or is_empty(node.nodename) then
118 118
         return
119 119
     end
120
-    local gameAgentMgr = nodeMgr.query_node_service_addr(node.nodename, ".gameAgentMgr")
121
-    if not gameAgentMgr then
120
+    local srvAgentMgr = nodeMgr.query_node_service_addr(node.nodename, ".srvAgentMgr")
121
+    if not srvAgentMgr then
122 122
         return
123 123
     end
124 124
 
125
-    local ok, gameAgent = nodeMgr.call(node.nodename, gameAgentMgr, "newGameAgent")
125
+    local ok, gameAgent = nodeMgr.call(node.nodename, srvAgentMgr, "user_get_game_agent", uid)
126 126
     if not ok or gameAgent == nil then
127 127
         return
128 128
     end

+ 0 - 4
nodes/battle/lib/battle.lua

@@ -85,10 +85,6 @@ function root:game_player_settle(uid, msg)
85 85
     if uid == nil or is_robot(uid) then
86 86
         return
87 87
     end
88
-    -- ai测试
89
-    if battleAdapt:isAiTestBattle(self.core.battleType) then
90
-        return
91
-    end
92 88
     -- 玩家不在线
93 89
     local nodeInfo = util_user:user_get_cluster_info(uid, "game")
94 90
     if not nodeMgr.is_node_info_valid(nodeInfo) then

+ 7 - 0
nodes/game/service/srvAgentMgr.lua

@@ -92,4 +92,11 @@ function root.print_uid_list()
92 92
 	end
93 93
 end
94 94
 
95
+-- 在线玩家广播消息
96
+function CMD.broadcast_agents(cmd, ...)
97
+	for uid, handle in pairs(mapUid2Agent) do
98
+		pcall(skynet.send, handle, "lua", "doCmd", uid, cmd, ...)
99
+	end
100
+end
101
+
95 102
 baseService.start(root, ".srvAgentMgr", true)