上传星座图代码
This commit is contained in:
parent
9b3edaaec2
commit
e10371942e
@ -64,6 +64,7 @@ const (
|
|||||||
ModuleLibrary core.M_Modules = "library" //藏书馆
|
ModuleLibrary core.M_Modules = "library" //藏书馆
|
||||||
ModuleArena core.M_Modules = "arena" //竞技场
|
ModuleArena core.M_Modules = "arena" //竞技场
|
||||||
ModuleTroll core.M_Modules = "troll" //巨怪商队
|
ModuleTroll core.M_Modules = "troll" //巨怪商队
|
||||||
|
ModuleConstellation core.M_Modules = "constellation" //星座图
|
||||||
//ModuleFetter core.M_Modules = "herofetter" //好友模块
|
//ModuleFetter core.M_Modules = "herofetter" //好友模块
|
||||||
)
|
)
|
||||||
|
|
||||||
|
30
modules/constellation/api.go
Normal file
30
modules/constellation/api.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package constellation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
API
|
||||||
|
*/
|
||||||
|
type apiComp struct {
|
||||||
|
modules.MCompGate
|
||||||
|
service base.IRPCXService
|
||||||
|
module *Constellation
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.MCompGate.Init(service, module, comp, options)
|
||||||
|
this.module = module.(*Constellation)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) Start() (err error) {
|
||||||
|
err = this.MCompGate.Start()
|
||||||
|
return
|
||||||
|
}
|
29
modules/constellation/module.go
Normal file
29
modules/constellation/module.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package constellation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
模块名:星座图
|
||||||
|
描述:全局属性增幅器
|
||||||
|
开发:李伟
|
||||||
|
*/
|
||||||
|
func NewModule() core.IModule {
|
||||||
|
m := new(Constellation)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constellation struct {
|
||||||
|
modules.ModuleBase
|
||||||
|
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
|
||||||
|
options *Options
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块名
|
||||||
|
func (this *Constellation) GetType() core.M_Modules {
|
||||||
|
return comm.ModuleChat
|
||||||
|
}
|
40
modules/constellation/options.go
Normal file
40
modules/constellation/options.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package constellation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/lego/utils/mapstructure"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
IOptions interface {
|
||||||
|
modules.IOptions
|
||||||
|
}
|
||||||
|
Options struct {
|
||||||
|
modules.Options
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (this *Options) GetDebug() bool {
|
||||||
|
return this.Debug
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Options) GetLog() log.ILogger {
|
||||||
|
return this.Log
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
||||||
|
if settings != nil {
|
||||||
|
if err = mapstructure.Decode(settings, &this.Options); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = mapstructure.Decode(settings, this); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.Log = log.NewTurnlog(true, log.Clone("", 4)); this.Log == nil {
|
||||||
|
err = errors.New("log is nil")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user