forked from ifzz/zServer
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ubuntu
committed
Jul 5, 2018
1 parent
030ae09
commit f764a13
Showing
7 changed files
with
56 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local skynet = require "skynet" | ||
local tool = require "tool" | ||
local faci = require "faci.module" | ||
local libsetup = require "libsetup" | ||
local cluster = require "cluster" | ||
|
||
local runconf = require(skynet.getenv("runconfig")) | ||
local local_nodename = skynet.getenv("nodename") | ||
|
||
local module, static = faci.get_module("SceneMgr") | ||
local dispatch = module.dispatch | ||
local forward = module.forward | ||
local event = module.event | ||
|
||
local servconf = runconf.service | ||
|
||
local function get_node_name(scene_id) | ||
local scene_nodes = servconf.scene | ||
assert(type(scene_nodes) == "table") | ||
|
||
local scene_node_num = #servconf.scene | ||
local id = scene_id % scene_node_num + 1 | ||
local node_name = scene_nodes[id] | ||
assert(type(node_name) == "string") | ||
|
||
return node_name | ||
end | ||
|
||
function dispatch.start() | ||
|
||
local scene_conf = libsetup.scene | ||
|
||
for i, v in pairs(scene_conf) do | ||
local node_name = get_node_name(i) | ||
local name = string.format("scene%d", i) | ||
if local_nodename == node_name then | ||
skynet.newservice("scene", "scene", i) | ||
else | ||
local proxy = cluster.proxy(node_name, name) | ||
skynet.name(name, proxy) | ||
end | ||
end | ||
|
||
log.debug("start scene mgr success~~") | ||
|
||
end | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
player.proto |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters