优化整理
This commit is contained in:
parent
31dcfe1f2d
commit
9d978515fb
@ -365,20 +365,3 @@ func (this *configureComp) GetConsumeTaskData() (conf []*cfg.GameConsumeTaskData
|
||||
|
||||
return
|
||||
}
|
||||
func (this *configureComp) GetGamePlaySkillByTouch(skilltouch int32) (conf *cfg.GamePlayerSkillData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_playerskill); err == nil {
|
||||
if configure, ok := v.(*cfg.GamePlayerSkill); ok {
|
||||
for _, v := range configure.GetDataList() {
|
||||
if v.Skilltouch == skilltouch {
|
||||
conf = v
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_playerskill, skilltouch)
|
||||
return
|
||||
}
|
||||
|
@ -230,6 +230,7 @@ func (this *Entertainment) CreateRoom(sessions []comm.IUserSession, rulesStr str
|
||||
Lv: red.Lv,
|
||||
},
|
||||
Cardid: rules.Card1,
|
||||
Skill: rules.Skill1,
|
||||
}
|
||||
p2 = &pb.PlayerData{
|
||||
Userinfo: &pb.BaseUserInfo{
|
||||
@ -243,6 +244,7 @@ func (this *Entertainment) CreateRoom(sessions []comm.IUserSession, rulesStr str
|
||||
Lv: blue.Lv,
|
||||
},
|
||||
Cardid: rules.Card2,
|
||||
Skill: rules.Skill2,
|
||||
}
|
||||
|
||||
if room, err = this.gameMgr.CreateRoomByType(p1, p2, rules.RoomType); err != nil {
|
||||
|
@ -149,13 +149,13 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
color = 2
|
||||
curPlayer = this.player2
|
||||
}
|
||||
if req.Itype == 1 { //释放技能
|
||||
if req.Itype == "cardskill" { //释放技能
|
||||
if errdata = this.UserSkillUp(color, req.Curid); errdata != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
} else if req.Itype > 0 { //玩家卡牌技能
|
||||
if conf, err := this.module.configure.GetGamePlaySkillByTouch(req.Itype); err != nil {
|
||||
} else if req.Itype != "swap" { //玩家卡牌技能
|
||||
if conf, err := this.module.configure.GetGamePlaySkill(req.Itype); err == nil {
|
||||
if curPlayer.Skill[conf.Key] <= 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_EntertainNoSkillCard, // 技能卡不足
|
||||
@ -171,7 +171,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
|
||||
return
|
||||
}
|
||||
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
|
||||
if req.Itype == "swap" && req.Curid == 0 && req.Targetid == 0 {
|
||||
if this.curPower == this.player1.Userinfo.Uid {
|
||||
this.NexPower = this.player2.Userinfo.Uid
|
||||
this.player2.Ps = 2
|
||||
@ -810,7 +810,7 @@ func (this *Room) AutoOperator(uid string) {
|
||||
Round: this.round,
|
||||
User1: this.player1,
|
||||
User2: this.player2,
|
||||
Itype: 0,
|
||||
Itype: "swap",
|
||||
Curid: oid1,
|
||||
Targetid: oid2,
|
||||
}, this.szSession...); err != nil {
|
||||
@ -913,7 +913,7 @@ func (this *Room) UserSkillUp(color int32, curid int32) (errdata *pb.ErrorData)
|
||||
Round: this.round,
|
||||
User1: this.player1,
|
||||
User2: this.player2,
|
||||
Itype: 1,
|
||||
Itype: "cardskill",
|
||||
Curid: oid1,
|
||||
Targetid: oid2,
|
||||
}, this.szSession...); err != nil {
|
||||
@ -1009,7 +1009,7 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid s
|
||||
Round: this.round,
|
||||
User1: this.player1,
|
||||
User2: this.player2,
|
||||
Itype: conf.Skilltouch,
|
||||
Itype: conf.Key,
|
||||
Curid: oid1,
|
||||
Targetid: oid2,
|
||||
}, this.szSession...); err != nil {
|
||||
|
@ -409,7 +409,7 @@ type EntertainOperatorReq struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` // 房间id
|
||||
Itype int32 `protobuf:"varint,2,opt,name=itype,proto3" json:"itype"` // 操作类型 0 默认交换元素 1 卡片技能
|
||||
Itype string `protobuf:"bytes,2,opt,name=itype,proto3" json:"itype"` // 操作类型 "swap" 默认交换元素 "cardskill" 卡片技能 playerskill 传对应的key
|
||||
Curid int32 `protobuf:"varint,3,opt,name=curid,proto3" json:"curid"` // 当前key
|
||||
Targetid int32 `protobuf:"varint,4,opt,name=targetid,proto3" json:"targetid"` // 目标key
|
||||
}
|
||||
@ -453,11 +453,11 @@ func (x *EntertainOperatorReq) GetRoomid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EntertainOperatorReq) GetItype() int32 {
|
||||
func (x *EntertainOperatorReq) GetItype() string {
|
||||
if x != nil {
|
||||
return x.Itype
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EntertainOperatorReq) GetCurid() int32 {
|
||||
@ -535,7 +535,7 @@ type EntertainOperatorRstPush struct {
|
||||
Round int32 `protobuf:"varint,5,opt,name=round,proto3" json:"round"` // 轮数
|
||||
User1 *PlayerData `protobuf:"bytes,6,opt,name=user1,proto3" json:"user1"` // 玩家数据也需要同步
|
||||
User2 *PlayerData `protobuf:"bytes,7,opt,name=user2,proto3" json:"user2"`
|
||||
Itype int32 `protobuf:"varint,8,opt,name=itype,proto3" json:"itype"` // 操作类型 0 默认交换元素
|
||||
Itype string `protobuf:"bytes,8,opt,name=itype,proto3" json:"itype"` // 操作类型 0 默认交换元素
|
||||
Curid int32 `protobuf:"varint,9,opt,name=curid,proto3" json:"curid"` // 当前key
|
||||
Targetid int32 `protobuf:"varint,10,opt,name=targetid,proto3" json:"targetid"` // 目标key
|
||||
}
|
||||
@ -621,11 +621,11 @@ func (x *EntertainOperatorRstPush) GetUser2() *PlayerData {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *EntertainOperatorRstPush) GetItype() int32 {
|
||||
func (x *EntertainOperatorRstPush) GetItype() string {
|
||||
if x != nil {
|
||||
return x.Itype
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EntertainOperatorRstPush) GetCurid() int32 {
|
||||
@ -2673,7 +2673,7 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{
|
||||
0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70,
|
||||
0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
@ -2695,7 +2695,7 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{
|
||||
0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72,
|
||||
0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
|
||||
0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x69,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70,
|
||||
0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
|
@ -659,7 +659,7 @@ type DBHeroDrawRecord struct {
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
HeroId []string `protobuf:"bytes,3,rep,name=heroId,proto3" json:"heroId"` // 英雄ID
|
||||
Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池
|
||||
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"`
|
||||
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"` // 抽卡时间
|
||||
}
|
||||
|
||||
func (x *DBHeroDrawRecord) Reset() {
|
||||
|
Loading…
Reference in New Issue
Block a user