Exemple #1
0
func init() {

	App = &BaseApp{
		Players:    NewPlayerList(),
		Login:      NewLogin(),
		Account:    NewAccount(),
		DbBridge:   NewDbBridge(),
		AreaBridge: NewAreaBridge(),
		Sync:       NewSync(),
		config:     NewConfig(),
		Letter:     NewLetterSystem(),
		tasksystem: task.TaskInst,
		taskLogic:  NewTaskLogic(),
	}

	server.RegisterCallee("role", &RoleCallee{})
	server.RegisterCallee("Player", &Player{})

	server.RegisterHandler("Account", App.Account)
	server.RegisterHandler("MailBox", App.Letter)
	server.RegisterHandler("Task", App.taskLogic)

	server.RegisterRemote("Login", App.Login)
	server.RegisterRemote("DbBridge", App.DbBridge)
	server.RegisterRemote("AreaBridge", App.AreaBridge)
	server.RegisterRemote("Sync", App.Sync)

}
Exemple #2
0
func (self *MysqlDB) InitDB(db string, source string, threads int, entity string, role string, limit int, nameunique bool) error {
	var err error
	self.sql, err = NewConn("mysql", source)
	if err != nil {
		return err
	}

	self.pools = threads
	self.ds = source
	self.dbname = db
	self.limit = limit
	self.nameunique = nameunique
	if !checkDb(entity, role) {
		return errors.New("database need sync")
	}
	self.Account = NewAccount(self.pools)
	self.DBRaw = NewRaw(self.pools)
	server.RegisterRemote("Account", self.Account)
	server.RegisterRemote("Database", self.DBRaw)
	self.Account.Start()
	self.DBRaw.Start()
	log.LogMessage("connect to mysql:", source)
	return nil
}
Exemple #3
0
func (self *MongoDB) InitDB(db string, source string, threads int, entity string, role string, limit int, nameunique bool) error {
	session, err := mgo.Dial(source)
	if err != nil {
		return err
	}
	self.session = session
	self.session.SetMode(mgo.Monotonic, true)
	self.DB = self.session.DB(db)
	self.pools = threads
	self.Account = NewAccount(threads)
	self.Account.Do()
	self.limit = limit
	server.RegisterRemote("Account", self.Account)
	self.CheckDb(entity)
	log.LogMessage("connect to mongodb:", source)
	return nil
}
Exemple #4
0
func init() {
	App = &StatusApp{
		pl: NewPlayerList(),
	}
	server.RegisterRemote("PlayerList", App.pl)
}
Exemple #5
0
func init() {
	App = &AreaMgr{
		Area: NewAreas(),
	}
	server.RegisterRemote("AreaMgr", App.Area)
}
Exemple #6
0
func init() {
	server.RegisterRemote("Session", &Session{})
}