-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgameslgserver.go
44 lines (35 loc) · 983 Bytes
/
gameslgserver.go
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
38
39
40
41
42
43
44
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/gameslg"
"github.com/llr104/LiFrame/server/gameutils"
"github.com/llr104/LiFrame/utils"
"os"
)
func main() {
defaultXlsxDir := "conf/xlsx"
if len(os.Args) == 3 {
utils.GlobalObject.Load(os.Args[1])
defaultXlsxDir = os.Args[2]
}else if len(os.Args) == 2{
utils.GlobalObject.Load(os.Args[1])
}else{
utils.GlobalObject.Load("conf/gameslg.json")
}
gameslg.Init(defaultXlsxDir)
s := liNet.NewServer()
s.AddRouter(&gameutils.STS)
s.AddRouter(&gameslg.Enter)
s.AddRouter(&gameslg.CreateRole)
s.AddRouter(&gameslg.MainCity)
s.AddRouter(&gameslg.NPC)
s.AddRouter(&gameslg.WorldMap)
s.SetOnConnStart(gameutils.ClientConnStart)
s.SetOnConnStop(gameutils.ClientConnStop)
app.SetShutDownFunc(gameutils.ShutDown)
app.SetServer(s)
go app.MasterClient(proto.ServerTypeGame)
s.Running()
}