main.lua 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. local skynet = require "skynet"
  2. require "skynet.manager"
  3. local cluster = require "skynet.cluster"
  4. local logger = require "logger"
  5. skynet.start(function()
  6. logger.info("game start")
  7. local daemon = skynet.getenv("daemon")
  8. if not daemon then
  9. skynet.newservice("console")
  10. end
  11. skynet.newservice("debug_console",
  12. "127.0.0.1",
  13. assert(option.console_port))
  14. -- skynet.newservice("protoloader")
  15. local snowflake = skynet.newservice("snowflake")
  16. skynet.call(snowflake, "lua", "start")
  17. skynet.newservice("webserver")
  18. -- skynet.newservice("https_client") -- 新版本skynet 代https访问
  19. if option.cluster then
  20. cluster.reload(option.cluster)
  21. if option.cluster.address then
  22. cluster.open("address")
  23. end
  24. if option.cluster.log then
  25. cluster.proxy("log", "logserver")
  26. end
  27. end
  28. local loginserver = skynet.newservice("loginserver")
  29. local log = skynet.newservice("log")
  30. local mq = skynet.newservice("mq")
  31. local assetcenter = skynet.newservice("assetcenter")
  32. local namecenter = skynet.newservice("namecenter")
  33. local usercenter = skynet.newservice("usercenter")
  34. local mailbox = skynet.newservice("mailbox")
  35. local recharge = skynet.newservice("recharge")
  36. local ws_watchdog = skynet.newservice("ws_watchdog")
  37. -- local quest = skynet.newservice("quest")
  38. -- local gift = skynet.newservice("gift")
  39. -- local rankinglist = skynet.newservice("rankinglist")
  40. -- local act_rankinglist = skynet.newservice("act_rankinglist")
  41. -- local relic_manual = skynet.newservice("relic_manual")
  42. -- local activitytime = skynet.newservice("activitytime")
  43. -- local itemavg = skynet.newservice("itemavg")
  44. -- local statistics = skynet.newservice("statistics")
  45. -- local watchdog = skynet.newservice("watchdog")
  46. skynet.call(loginserver, "lua", "start")
  47. skynet.call(log, "lua", "start")
  48. skynet.call(mq, "lua", "start")
  49. skynet.call(assetcenter, "lua", "start")
  50. skynet.call(namecenter, "lua", "start")
  51. skynet.call(usercenter, "lua", "start")
  52. skynet.call(mailbox, "lua", "start")
  53. skynet.call(recharge, "lua", "start")
  54. -- skynet.call(quest, "lua", "start")
  55. -- skynet.call(gift, "lua", "start")
  56. -- skynet.call(rankinglist, "lua", "start")
  57. -- skynet.call(act_rankinglist, "lua", "start")
  58. -- skynet.call(activitytime, "lua", "start")
  59. -- skynet.call(itemavg, "lua", "start")
  60. -- skynet.call(statistics, "lua", "start")
  61. -- skynet.call(relic_manual, "lua", "start")
  62. -- skynet.call(watchdog, "lua", "start", {
  63. -- port = option.game_port,
  64. -- maxclient = option.max_client,
  65. -- nodelay = true,
  66. -- })
  67. skynet.call(ws_watchdog, "lua", "start", {
  68. port = option.game_port,
  69. maxclient = option.max_client,
  70. nodelay = true,
  71. protocol = "ws",
  72. })
  73. skynet.exit()
  74. end)