Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
058712919b
@ -35,26 +35,28 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com
|
|||||||
err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv)
|
err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv)
|
||||||
err = this.LoadConfigure(game_facemod, cfg.NewGameFacemod)
|
err = this.LoadConfigure(game_facemod, cfg.NewGameFacemod)
|
||||||
this._dropMap = make(map[int32][]*cfg.GameDropData, 0)
|
this._dropMap = make(map[int32][]*cfg.GameDropData, 0)
|
||||||
configure.RegisterConfigure(game_drop, cfg.NewGameDrop, func() {
|
configure.RegisterConfigure(game_drop, cfg.NewGameDrop, this.LoadDropData)
|
||||||
if v, err := this.GetConfigure(game_drop); err == nil {
|
|
||||||
if configure, ok := v.(*cfg.GameDrop); ok {
|
|
||||||
this.hlock.Lock()
|
|
||||||
defer this.hlock.Unlock()
|
|
||||||
for _, value := range configure.GetDataList() {
|
|
||||||
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Errorf("get game_pagoda conf err:%v", err)
|
|
||||||
return
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *MCompConfigure) LoadConfigure(name string, fn interface{}) (err error) {
|
||||||
|
return configure.RegisterConfigure(name, fn, nil)
|
||||||
|
}
|
||||||
|
|
||||||
//加载一个配置文件
|
//加载一个配置文件
|
||||||
func (this *MCompConfigure) LoadConfigure(name string, fn interface{}) (err error) {
|
func (this *MCompConfigure) LoadDropData() {
|
||||||
return configure.RegisterConfigure(name, fn, nil)
|
if v, err := this.GetConfigure(game_drop); err == nil {
|
||||||
|
if configure, ok := v.(*cfg.GameDrop); ok {
|
||||||
|
this.hlock.Lock()
|
||||||
|
defer this.hlock.Unlock()
|
||||||
|
for _, value := range configure.GetDataList() {
|
||||||
|
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Errorf("get game_pagoda conf err:%v", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载多个配置文件
|
//加载多个配置文件
|
||||||
|
@ -2,7 +2,6 @@ package gourmet
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
@ -17,7 +16,6 @@ const (
|
|||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
cbase.ModuleCompBase
|
|
||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
_gourmetMap map[int64]*cfg.GameGourmetData
|
_gourmetMap map[int64]*cfg.GameGourmetData
|
||||||
@ -26,7 +24,7 @@ type configureComp struct {
|
|||||||
|
|
||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
|
||||||
this._gourmetMap = make(map[int64]*cfg.GameGourmetData, 0)
|
this._gourmetMap = make(map[int64]*cfg.GameGourmetData, 0)
|
||||||
configure.RegisterConfigure(game_gourmet, cfg.NewGameGourmet, func() {
|
configure.RegisterConfigure(game_gourmet, cfg.NewGameGourmet, func() {
|
||||||
|
@ -2,8 +2,8 @@ package pagoda
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"sync"
|
"sync"
|
||||||
@ -17,14 +17,14 @@ const (
|
|||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
cbase.ModuleCompBase
|
modules.MCompConfigure
|
||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
_pagodaMap map[int64]*cfg.GamePagodaData
|
_pagodaMap map[int64]*cfg.GamePagodaData
|
||||||
}
|
}
|
||||||
|
|
||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||||
//game_pagoda: cfg.NewGame_pagoda,
|
//game_pagoda: cfg.NewGame_pagoda,
|
||||||
game_pagodaseasonreward: cfg.NewGamePagodaSeasonReward,
|
game_pagodaseasonreward: cfg.NewGamePagodaSeasonReward,
|
||||||
|
@ -2,7 +2,6 @@ package smithy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
@ -17,16 +16,14 @@ const (
|
|||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
cbase.ModuleCompBase
|
|
||||||
hlock sync.RWMutex
|
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
|
hlock sync.RWMutex
|
||||||
_smithyMap map[int64]*cfg.GameSmithyData
|
_smithyMap map[int64]*cfg.GameSmithyData
|
||||||
}
|
}
|
||||||
|
|
||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
|
||||||
this._smithyMap = make(map[int64]*cfg.GameSmithyData, 0)
|
this._smithyMap = make(map[int64]*cfg.GameSmithyData, 0)
|
||||||
configure.RegisterConfigure(game_smithy, cfg.NewGameSmithy, func() {
|
configure.RegisterConfigure(game_smithy, cfg.NewGameSmithy, func() {
|
||||||
if v, err := this.GetConfigure(game_smithy); err == nil {
|
if v, err := this.GetConfigure(game_smithy); err == nil {
|
||||||
|
@ -67,6 +67,7 @@ func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
|||||||
costTime int32
|
costTime int32
|
||||||
curTime int32
|
curTime int32
|
||||||
)
|
)
|
||||||
|
|
||||||
mapData := make(map[string]interface{}, 0)
|
mapData := make(map[string]interface{}, 0)
|
||||||
if Smithy.Clang != nil && Smithy.Clang.ETime > 0 {
|
if Smithy.Clang != nil && Smithy.Clang.ETime > 0 {
|
||||||
costTime = int32(time.Now().Unix() - Smithy.Clang.ETime) // 当前过去的时间
|
costTime = int32(time.Now().Unix() - Smithy.Clang.ETime) // 当前过去的时间
|
||||||
@ -103,7 +104,7 @@ func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
|||||||
}
|
}
|
||||||
order.Count--
|
order.Count--
|
||||||
this.module.configure.GetMultipleDropReward(1, _Smithycfg.Drop, Smithy.Items) // 获取掉落奖励
|
this.module.configure.GetMultipleDropReward(1, _Smithycfg.Drop, Smithy.Items) // 获取掉落奖励
|
||||||
|
mapData["items"] = Smithy.Items
|
||||||
if curTime > costTime {
|
if curTime > costTime {
|
||||||
Smithy.OrderCostTime += int32(curTime - costTime)
|
Smithy.OrderCostTime += int32(curTime - costTime)
|
||||||
// 转时间戳
|
// 转时间戳
|
||||||
@ -127,7 +128,13 @@ func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
|||||||
if !bCooking { // 经过计算没有烹饪食物的时候
|
if !bCooking { // 经过计算没有烹饪食物的时候
|
||||||
Smithy.Clang = nil
|
Smithy.Clang = nil
|
||||||
}
|
}
|
||||||
|
sz := make([]*pb.OrderClang, 0)
|
||||||
|
for _, v := range Smithy.Orders {
|
||||||
|
if v.Count != 0 {
|
||||||
|
sz = append(sz, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Smithy.Orders = sz
|
||||||
// 保存信息
|
// 保存信息
|
||||||
mapData["orders"] = Smithy.Orders
|
mapData["orders"] = Smithy.Orders
|
||||||
mapData["orderCostTime"] = Smithy.OrderCostTime
|
mapData["orderCostTime"] = Smithy.OrderCostTime
|
||||||
|
@ -2,7 +2,6 @@ package viking
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
@ -17,7 +16,6 @@ const (
|
|||||||
|
|
||||||
///配置管理基础组件
|
///配置管理基础组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
cbase.ModuleCompBase
|
|
||||||
hlock sync.RWMutex
|
hlock sync.RWMutex
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
_vikingMap map[int64]*cfg.GameVikingBossData
|
_vikingMap map[int64]*cfg.GameVikingBossData
|
||||||
@ -25,7 +23,7 @@ type configureComp struct {
|
|||||||
|
|
||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
|
||||||
this._vikingMap = make(map[int64]*cfg.GameVikingBossData, 0)
|
this._vikingMap = make(map[int64]*cfg.GameVikingBossData, 0)
|
||||||
configure.RegisterConfigure(game_vikingboss, cfg.NewGameVikingBoss, func() {
|
configure.RegisterConfigure(game_vikingboss, cfg.NewGameVikingBoss, func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user