GM模块提供接口
This commit is contained in:
parent
c20099a715
commit
d50ed5dac7
@ -62,6 +62,7 @@ const (
|
|||||||
ModuleLinestory core.M_Modules = "linestory" //支线剧情
|
ModuleLinestory core.M_Modules = "linestory" //支线剧情
|
||||||
ModuleBattle core.M_Modules = "battle" //战斗
|
ModuleBattle core.M_Modules = "battle" //战斗
|
||||||
ModuleLibrary core.M_Modules = "library" //
|
ModuleLibrary core.M_Modules = "library" //
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//数据表名定义处
|
//数据表名定义处
|
||||||
|
@ -157,4 +157,7 @@ type (
|
|||||||
//校验战报
|
//校验战报
|
||||||
CheckBattleReport(session IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool)
|
CheckBattleReport(session IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool)
|
||||||
}
|
}
|
||||||
|
IGm interface {
|
||||||
|
CreateCmd(session IUserSession, cmd string) (code pb.ErrorCode)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -4,6 +4,10 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -38,3 +42,33 @@ func (this *GM) OnInstallComp() {
|
|||||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorCode) {
|
||||||
|
keys := strings.Split(cmd, ":")
|
||||||
|
if len(keys) == 2 {
|
||||||
|
if keys[0] == "bingo" {
|
||||||
|
datas := strings.Split(keys[1], ",")
|
||||||
|
if len(datas) == 3 {
|
||||||
|
num, err := strconv.Atoi(datas[2])
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
code = this.DispenseRes(session, []*cfg.Gameatn{ // 添加资源
|
||||||
|
{
|
||||||
|
A: datas[0],
|
||||||
|
T: datas[1],
|
||||||
|
N: int32(num),
|
||||||
|
},
|
||||||
|
}, true)
|
||||||
|
if code == pb.ErrorCode_Success { // 成功直接返回
|
||||||
|
session.SendMsg(string(this.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
session.SendMsg(string(this.GetType()), "cmd", &pb.GMCmdResp{IsSucc: false})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -96,6 +96,7 @@ func (this *ModuleBase) Start() (err error) {
|
|||||||
if module, err = this.service.GetModule(comm.ModuleSys); err != nil {
|
if module, err = this.service.GetModule(comm.ModuleSys); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ModuleSys = module.(comm.ISys)
|
this.ModuleSys = module.(comm.ISys)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user