This commit is contained in:
liwei1dao 2022-06-27 15:37:51 +08:00
commit e61ca99fec
8 changed files with 139 additions and 83 deletions

27
bin/json/game_com.json Normal file
View File

@ -0,0 +1,27 @@
[
{
"index": "max_hy",
"var": "30",
"intr": "最大好友数"
},
{
"index": "max_getreward",
"var": "10002,99",
"intr": "领取/赠送奖励"
},
{
"index": "max_get",
"var": "30",
"intr": "每日领取/赠送次数"
},
{
"index": "max_char",
"var": "100",
"intr": "聊天最大输入字符数量"
},
{
"index": "max_hmd",
"var": "30",
"intr": "最大黑名单数"
}
]

View File

@ -11,13 +11,14 @@ func (this *Api_Comp) Hero_Check(session comm.IUserSession, req *pb.Hero_Strengt
}
/// 英雄升级
func (this *Api_Comp) HeroLv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) {
func (this *Api_Comp) HeroStrengthenLv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) {
defer func() {
if code == pb.ErrorCode_Success {
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{})
}
}()
this.module.configure_comp.GetHeroConfigure()
return
}

View File

@ -9,7 +9,11 @@ import (
)
const (
game_hero = "game_newhero.json"
game_hero = "game_newhero.json"
game_heroStargrow = "game_heroStargrow.json"
game_heroLevelgrow = "game_heroLevelgrow.json"
game_heroStarup = "game_heroStarup.json"
game_heroLevelup = "game_heroLevelup.json"
)
///配置管理组件
@ -21,6 +25,10 @@ type Configure_Comp struct {
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, options)
this.LoadConfigure(game_hero, cfg.NewGame_newHero)
this.LoadConfigure(game_heroStargrow, cfg.NewGame_heroStargrow)
this.LoadConfigure(game_heroLevelgrow, cfg.NewGame_heroLevelgrow)
this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup)
this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup)
return
}

View File

@ -20,61 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PropertyType int32
const (
PropertyType_Hp PropertyType = 0 //血量
PropertyType_Atk PropertyType = 1 //攻击
PropertyType_Def PropertyType = 2 //防御
PropertyType_Speed PropertyType = 3 //速度
PropertyType_Crit PropertyType = 4 //暴击
)
// Enum value maps for PropertyType.
var (
PropertyType_name = map[int32]string{
0: "Hp",
1: "Atk",
2: "Def",
3: "Speed",
4: "Crit",
}
PropertyType_value = map[string]int32{
"Hp": 0,
"Atk": 1,
"Def": 2,
"Speed": 3,
"Crit": 4,
}
)
func (x PropertyType) Enum() *PropertyType {
p := new(PropertyType)
*p = x
return p
}
func (x PropertyType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (PropertyType) Descriptor() protoreflect.EnumDescriptor {
return file_hero_hero_db_proto_enumTypes[0].Descriptor()
}
func (PropertyType) Type() protoreflect.EnumType {
return &file_hero_hero_db_proto_enumTypes[0]
}
func (x PropertyType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use PropertyType.Descriptor instead.
func (PropertyType) EnumDescriptor() ([]byte, []int) {
return file_hero_hero_db_proto_rawDescGZIP(), []int{0}
}
type SkillData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -398,12 +343,8 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x3d,
0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06,
0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12,
0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65,
0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -418,21 +359,19 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte {
return file_hero_hero_db_proto_rawDescData
}
var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_hero_hero_db_proto_goTypes = []interface{}{
(PropertyType)(0), // 0: PropertyType
(*SkillData)(nil), // 1: SkillData
(*DB_HeroData)(nil), // 2: DB_HeroData
nil, // 3: DB_HeroData.PropertyEntry
nil, // 4: DB_HeroData.AddPropertyEntry
nil, // 5: DB_HeroData.EnergyEntry
(*SkillData)(nil), // 0: SkillData
(*DB_HeroData)(nil), // 1: DB_HeroData
nil, // 2: DB_HeroData.PropertyEntry
nil, // 3: DB_HeroData.AddPropertyEntry
nil, // 4: DB_HeroData.EnergyEntry
}
var file_hero_hero_db_proto_depIdxs = []int32{
1, // 0: DB_HeroData.normalSkill:type_name -> SkillData
3, // 1: DB_HeroData.property:type_name -> DB_HeroData.PropertyEntry
4, // 2: DB_HeroData.addProperty:type_name -> DB_HeroData.AddPropertyEntry
5, // 3: DB_HeroData.energy:type_name -> DB_HeroData.EnergyEntry
0, // 0: DB_HeroData.normalSkill:type_name -> SkillData
2, // 1: DB_HeroData.property:type_name -> DB_HeroData.PropertyEntry
3, // 2: DB_HeroData.addProperty:type_name -> DB_HeroData.AddPropertyEntry
4, // 3: DB_HeroData.energy:type_name -> DB_HeroData.EnergyEntry
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
@ -476,14 +415,13 @@ func file_hero_hero_db_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_hero_hero_db_proto_rawDesc,
NumEnums: 1,
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_hero_hero_db_proto_goTypes,
DependencyIndexes: file_hero_hero_db_proto_depIdxs,
EnumInfos: file_hero_hero_db_proto_enumTypes,
MessageInfos: file_hero_hero_db_proto_msgTypes,
}.Build()
File_hero_hero_db_proto = out.File

View File

@ -1,13 +1,13 @@
syntax = "proto3";
option go_package = ".;pb";
enum PropertyType{
Hp = 0; //
Atk = 1; //
Def = 2; //
Speed = 3; //
Crit = 4; //
}
// enum PropertyType{
// Hp = 0; //
// Atk = 1; //
// Def = 2; //
// Speed = 3; //
// Crit = 4; //
// }
message SkillData{
int32 skillID = 1;

View File

@ -3,6 +3,7 @@ package configure
import (
"fmt"
"go_dreamfactory/lego/sys/log"
cfg "go_dreamfactory/sys/configure/structs"
"io/fs"
"io/ioutil"
"os"
@ -44,8 +45,17 @@ type Configure struct {
fileinfos map[string]*FileInfo
}
const (
game_com = "game_com.json"
)
func (this *Configure) init() (err error) {
this.RegisterConfigure(game_com, cfg.NewGame_com)
// _data := this.configure[game_com]
// if _da, ok := _data.(*cfg.Game_com).GetDataMap()["max_char"]; ok {
// log.Debugf("%b==%v", ok, _da.Var)
// }
return
}
@ -62,6 +72,7 @@ func (this *Configure) Start() (err error) {
}
}
}()
return
}
func (this *Configure) Stop() (err error) {

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type Game_com struct {
_dataMap map[string]*Game_gameComData
_dataList []*Game_gameComData
}
func NewGame_com(_buf []map[string]interface{}) (*Game_com, error) {
_dataList := make([]*Game_gameComData, 0, len(_buf))
dataMap := make(map[string]*Game_gameComData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_gameComData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Index] = _v
}
}
return &Game_com{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_com) GetDataMap() map[string]*Game_gameComData {
return table._dataMap
}
func (table *Game_com) GetDataList() []*Game_gameComData {
return table._dataList
}
func (table *Game_com) Get(key string) *Game_gameComData {
return table._dataMap[key]
}

View File

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type Game_gameComData struct {
Index string
Var string
Intr string
}
func (Game_gameComData) GetTypeId() int {
return -1518519171
}
func NewGame_gameComData(_buf map[string]interface{}) (_v *Game_gameComData, err error) {
_v = &Game_gameComData{}
{ var _ok_ bool; if _v.Index, _ok_ = _buf["index"].(string); !_ok_ { err = errors.New("index error"); return } }
{ var _ok_ bool; if _v.Var, _ok_ = _buf["var"].(string); !_ok_ { err = errors.New("var error"); return } }
{ var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } }
return
}