package entertainment import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" ) func NewModule() core.IModule { m := new(Entertainment) return m } type Entertainment struct { modules.ModuleBase service base.IRPCXService api *apiComp configure *configureComp model *modelComp gameMgr *gameMgrComp //room *Room match *matchComp } // 模块名 func (this *Entertainment) GetType() core.M_Modules { return comm.ModuleEntertainment } // 模块初始化接口 注册用户创建角色事件 func (this *Entertainment) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { if err = this.ModuleBase.Init(service, module, options); err != nil { return } this.service = service.(base.IRPCXService) return } // 装备组件 func (this *Entertainment) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.model = this.RegisterComp(new(modelComp)).(*modelComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.gameMgr = this.RegisterComp(new(gameMgrComp)).(*gameMgrComp) //this.room = this.RegisterComp(new(Room)).(*Room) this.match = this.RegisterComp(new(matchComp)).(*matchComp) } func (this *Entertainment) Start() (err error) { if err = this.ModuleBase.Start(); err != nil { return } return } func (this *Entertainment) BroadcastRoomMsg(uids ...string) { this.SendMsgToUsers(string(this.GetType()), "message", &pb.EntertainStartGamePush{ User1: &pb.PlayerData{}, User2: &pb.PlayerData{}, Mpadata: &pb.MapData{}, Power: "", Round: 0, }, uids...) }