diff --git a/modules/achieve/model.go b/modules/achieve/model.go index 9e51f2f0a..655284e5a 100644 --- a/modules/achieve/model.go +++ b/modules/achieve/model.go @@ -19,7 +19,7 @@ type modelComp struct { func (this *modelComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompModel.Init(service, module, comp, options) - this.TableName = comm.TableDailytask + this.TableName = comm.TableAchieve this.module = module.(*Achieve) this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, diff --git a/modules/caninerabbit/api_handle.go b/modules/caninerabbit/api_handle.go index 3ea94bd0d..8032a9064 100644 --- a/modules/caninerabbit/api_handle.go +++ b/modules/caninerabbit/api_handle.go @@ -43,6 +43,6 @@ func (this *apiComp) Handle(session comm.IUserSession, req *pb.CanineRabbitHandl } return } - session.SendMsg(string(this.module.GetType()), "handle", &pb.DColorHandleResp{}) + session.SendMsg(string(this.module.GetType()), "handle", &pb.CanineRabbitHandleResp{}) return } diff --git a/modules/caninerabbit/api_loadcomplete.go b/modules/caninerabbit/api_loadcomplete.go new file mode 100644 index 000000000..04e544156 --- /dev/null +++ b/modules/caninerabbit/api_loadcomplete.go @@ -0,0 +1,48 @@ +package caninerabbit + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +//接受切磋 +func (this *apiComp) LoadCompleteCheck(session comm.IUserSession, req *pb.CanineRabbitLoadCompleteReq) (errdata *pb.ErrorData) { + if req.Roomid == "" { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + } + return +} + +func (this *apiComp) LoadComplete(session comm.IUserSession, req *pb.CanineRabbitLoadCompleteReq) (errdata *pb.ErrorData) { + var ( + room *Room + err error + ) + + if errdata = this.LoadCompleteCheck(session, req); errdata != nil { + return + } + + if room, err = this.module.rooms.queryRoom(req.Roomid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.String(), + Message: err.Error(), + } + return + } + + if err = room.PlayerLoadEnd(session.GetUserId()); errdata != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.String(), + Message: err.Error(), + } + return + } + session.SendMsg(string(this.module.GetType()), "loadcomplete", &pb.CanineRabbitLoadCompleteResp{Roomid: req.Roomid, Issucc: true}) + return +} diff --git a/modules/caninerabbit/api_win.go b/modules/caninerabbit/api_win.go index 0ae0bef7e..f7d284f88 100644 --- a/modules/caninerabbit/api_win.go +++ b/modules/caninerabbit/api_win.go @@ -43,6 +43,6 @@ func (this *apiComp) Win(session comm.IUserSession, req *pb.CanineRabbitWinReq) } return } - session.SendMsg(string(this.module.GetType()), "handle", &pb.DColorHandleResp{}) + session.SendMsg(string(this.module.GetType()), "win", &pb.CanineRabbitWinResp{}) return } diff --git a/modules/caninerabbit/module.go b/modules/caninerabbit/module.go index 5f530b599..7e0c57e22 100644 --- a/modules/caninerabbit/module.go +++ b/modules/caninerabbit/module.go @@ -124,7 +124,8 @@ func (this *CanineRabbit) CreateRoom(sessions []comm.IUserSession, rulesStr stri } if room, err = this.rooms.newRoom(&pb.DBCanineRabbitRoom{ - Rid: roomid, + Rid: roomid, + Rules: rules, Red: &pb.DBCanineRabbitRoomPlayer{ Info: comm.GetUserBaseInfo(red), Ctype: redtype, diff --git a/modules/caninerabbit/room.go b/modules/caninerabbit/room.go index 3fc1c3218..9d27b8686 100644 --- a/modules/caninerabbit/room.go +++ b/modules/caninerabbit/room.go @@ -65,12 +65,7 @@ func (this *Room) PlayerLoadEnd(uid string) (err error) { //玩家操作 func (this *Room) PlayerHandle(uid string, handle *pb.CanineRabbitHandleReq) (err error) { - for _, v := range this.data.Chess { - if v.Id == handle.Chess.Id { - v.X = handle.Chess.X - v.Y = handle.Chess.Y - } - } + if this.currside == uid { if this.currside == this.data.Red.Info.Uid { this.currside = this.data.Blue.Info.Uid @@ -81,6 +76,12 @@ func (this *Room) PlayerHandle(uid string, handle *pb.CanineRabbitHandleReq) (er err = fmt.Errorf("It's not you who shoot!") return } + for _, v := range this.data.Chess { + if v.Id == handle.Chess.Id { + v.X = handle.Chess.X + v.Y = handle.Chess.Y + } + } if err = this.Broadcast("gamehandle", &pb.CanineRabbitGameHandlePush{ Roomid: this.data.Rid, Uid: uid, diff --git a/modules/parkour/configure.go b/modules/parkour/configure.go index 3f1f77b32..d6b87ba38 100644 --- a/modules/parkour/configure.go +++ b/modules/parkour/configure.go @@ -121,7 +121,7 @@ func (this *configureComp) getGameBuzkashiQteLv(time float32) (configure *cfg.Ga return } else { for _, v := range v.(*cfg.GameBuzkashiQteLv).GetDataList() { - if time < v.Time { + if time <= v.Time { configure = v return } diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go index 09dbba509..9c9248a3d 100644 --- a/pb/user_db.pb.go +++ b/pb/user_db.pb.go @@ -148,8 +148,8 @@ type DBUser struct { CurSkin string `protobuf:"bytes,34,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //默认皮肤 CurAction string `protobuf:"bytes,35,opt,name=curAction,proto3" json:"curAction" bson:"curAction"` //默认动作 CurBg string `protobuf:"bytes,36,opt,name=curBg,proto3" json:"curBg" bson:"curBg"` //默认背景 - Area int32 `protobuf:"varint,37,opt,name=area,proto3" json:"area"` //@go_tags(`bson:"area"`)区域 - Channel int32 `protobuf:"varint,38,opt,name=channel,proto3" json:"channel"` //@go_tags(`bson:"channel"`)渠道 + Area string `protobuf:"bytes,37,opt,name=area,proto3" json:"area"` //@go_tags(`bson:"area"`)区域 + Channel string `protobuf:"bytes,38,opt,name=channel,proto3" json:"channel"` //@go_tags(`bson:"channel"`)渠道 Vcode int32 `protobuf:"varint,39,opt,name=vcode,proto3" json:"vcode"` //@go_tags(`bson:"vcode"`)版本号 Vname string `protobuf:"bytes,40,opt,name=vname,proto3" json:"vname"` //@go_tags(`bson:"vname"`)版本名 Deposit int64 `protobuf:"varint,42,opt,name=deposit,proto3" json:"deposit" bson:"deposit"` //储蓄 @@ -441,18 +441,18 @@ func (x *DBUser) GetCurBg() string { return "" } -func (x *DBUser) GetArea() int32 { +func (x *DBUser) GetArea() string { if x != nil { return x.Area } - return 0 + return "" } -func (x *DBUser) GetChannel() int32 { +func (x *DBUser) GetChannel() string { if x != nil { return x.Channel } - return 0 + return "" } func (x *DBUser) GetVcode() int32 { @@ -920,8 +920,8 @@ var file_user_user_db_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x75, 0x72, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x42, 0x67, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x75, 0x72, 0x42, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x25, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x26, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x26, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x27, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x12, diff --git a/pb/user_msg.pb.go b/pb/user_msg.pb.go index 5ffa8d232..03139bae4 100644 --- a/pb/user_msg.pb.go +++ b/pb/user_msg.pb.go @@ -26,12 +26,12 @@ type UserLoginReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"` //账号 - Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid"` //区服编号 - Area int32 `protobuf:"varint,3,opt,name=area,proto3" json:"area"` //区域 - Channel int32 `protobuf:"varint,4,opt,name=channel,proto3" json:"channel"` //渠道 - Vcode int32 `protobuf:"varint,5,opt,name=vcode,proto3" json:"vcode"` //版本号 - Vname string `protobuf:"bytes,6,opt,name=vname,proto3" json:"vname"` //版本名 + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"` //账号 + Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid"` //区服编号 + Area string `protobuf:"bytes,3,opt,name=area,proto3" json:"area"` //区域 + Channel string `protobuf:"bytes,4,opt,name=channel,proto3" json:"channel"` //渠道 + Vcode int32 `protobuf:"varint,5,opt,name=vcode,proto3" json:"vcode"` //版本号 + Vname string `protobuf:"bytes,6,opt,name=vname,proto3" json:"vname"` //版本名 } func (x *UserLoginReq) Reset() { @@ -80,18 +80,18 @@ func (x *UserLoginReq) GetSid() string { return "" } -func (x *UserLoginReq) GetArea() int32 { +func (x *UserLoginReq) GetArea() string { if x != nil { return x.Area } - return 0 + return "" } -func (x *UserLoginReq) GetChannel() int32 { +func (x *UserLoginReq) GetChannel() string { if x != nil { return x.Channel } - return 0 + return "" } func (x *UserLoginReq) GetVcode() int32 { @@ -3721,9 +3721,9 @@ var file_user_user_msg_proto_rawDesc = []byte{ 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x18, 0x55,