forked from llr104/LiFrame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworldserver.go
More file actions
37 lines (28 loc) · 703 Bytes
/
worldserver.go
File metadata and controls
37 lines (28 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/llr104/LiFrame/core/liNet"
"github.com/llr104/LiFrame/proto"
"github.com/llr104/LiFrame/server/app"
"github.com/llr104/LiFrame/server/db"
"github.com/llr104/LiFrame/server/world"
"github.com/llr104/LiFrame/utils"
"os"
)
func main() {
if len(os.Args) > 1 {
cfgPath := os.Args[1]
utils.GlobalObject.Load(cfgPath)
}else{
utils.GlobalObject.Load("conf/world.json")
}
db.Init()
s := liNet.NewServer()
s.AddRouter(&world.STS)
s.AddRouter(&world.Enter)
s.SetOnConnStart(world.ClientConnStart)
s.SetOnConnStop(world.ClientConnStop)
app.SetServer(s)
app.SetShutDownFunc(world.ShutDown)
go app.MasterClient(proto.ServerTypeWorld)
s.Running()
}