Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
aff72fa398
@ -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) {
|
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)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.TableName = comm.TableDailytask
|
this.TableName = comm.TableAchieve
|
||||||
this.module = module.(*Achieve)
|
this.module = module.(*Achieve)
|
||||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
@ -43,6 +43,6 @@ func (this *apiComp) Handle(session comm.IUserSession, req *pb.CanineRabbitHandl
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "handle", &pb.DColorHandleResp{})
|
session.SendMsg(string(this.module.GetType()), "handle", &pb.CanineRabbitHandleResp{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
48
modules/caninerabbit/api_loadcomplete.go
Normal file
48
modules/caninerabbit/api_loadcomplete.go
Normal file
@ -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
|
||||||
|
}
|
@ -43,6 +43,6 @@ func (this *apiComp) Win(session comm.IUserSession, req *pb.CanineRabbitWinReq)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "handle", &pb.DColorHandleResp{})
|
session.SendMsg(string(this.module.GetType()), "win", &pb.CanineRabbitWinResp{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,8 @@ func (this *CanineRabbit) CreateRoom(sessions []comm.IUserSession, rulesStr stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
if room, err = this.rooms.newRoom(&pb.DBCanineRabbitRoom{
|
if room, err = this.rooms.newRoom(&pb.DBCanineRabbitRoom{
|
||||||
Rid: roomid,
|
Rid: roomid,
|
||||||
|
Rules: rules,
|
||||||
Red: &pb.DBCanineRabbitRoomPlayer{
|
Red: &pb.DBCanineRabbitRoomPlayer{
|
||||||
Info: comm.GetUserBaseInfo(red),
|
Info: comm.GetUserBaseInfo(red),
|
||||||
Ctype: redtype,
|
Ctype: redtype,
|
||||||
|
@ -65,12 +65,7 @@ func (this *Room) PlayerLoadEnd(uid string) (err error) {
|
|||||||
|
|
||||||
//玩家操作
|
//玩家操作
|
||||||
func (this *Room) PlayerHandle(uid string, handle *pb.CanineRabbitHandleReq) (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 == uid {
|
||||||
if this.currside == this.data.Red.Info.Uid {
|
if this.currside == this.data.Red.Info.Uid {
|
||||||
this.currside = this.data.Blue.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!")
|
err = fmt.Errorf("It's not you who shoot!")
|
||||||
return
|
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{
|
if err = this.Broadcast("gamehandle", &pb.CanineRabbitGameHandlePush{
|
||||||
Roomid: this.data.Rid,
|
Roomid: this.data.Rid,
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
|
@ -121,7 +121,7 @@ func (this *configureComp) getGameBuzkashiQteLv(time float32) (configure *cfg.Ga
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
for _, v := range v.(*cfg.GameBuzkashiQteLv).GetDataList() {
|
for _, v := range v.(*cfg.GameBuzkashiQteLv).GetDataList() {
|
||||||
if time < v.Time {
|
if time <= v.Time {
|
||||||
configure = v
|
configure = v
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,8 @@ type DBUser struct {
|
|||||||
CurSkin string `protobuf:"bytes,34,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //默认皮肤
|
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"` //默认动作
|
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"` //默认背景
|
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"`)区域
|
Area string `protobuf:"bytes,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"`)渠道
|
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"`)版本号
|
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"`)版本名
|
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"` //储蓄
|
Deposit int64 `protobuf:"varint,42,opt,name=deposit,proto3" json:"deposit" bson:"deposit"` //储蓄
|
||||||
@ -441,18 +441,18 @@ func (x *DBUser) GetCurBg() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUser) GetArea() int32 {
|
func (x *DBUser) GetArea() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Area
|
return x.Area
|
||||||
}
|
}
|
||||||
return 0
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUser) GetChannel() int32 {
|
func (x *DBUser) GetChannel() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Channel
|
return x.Channel
|
||||||
}
|
}
|
||||||
return 0
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUser) GetVcode() int32 {
|
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,
|
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,
|
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,
|
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,
|
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, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e,
|
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,
|
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,
|
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,
|
0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
|
@ -26,12 +26,12 @@ type UserLoginReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"` //账号
|
Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"` //账号
|
||||||
Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid"` //区服编号
|
Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid"` //区服编号
|
||||||
Area int32 `protobuf:"varint,3,opt,name=area,proto3" json:"area"` //区域
|
Area string `protobuf:"bytes,3,opt,name=area,proto3" json:"area"` //区域
|
||||||
Channel int32 `protobuf:"varint,4,opt,name=channel,proto3" json:"channel"` //渠道
|
Channel string `protobuf:"bytes,4,opt,name=channel,proto3" json:"channel"` //渠道
|
||||||
Vcode int32 `protobuf:"varint,5,opt,name=vcode,proto3" json:"vcode"` //版本号
|
Vcode int32 `protobuf:"varint,5,opt,name=vcode,proto3" json:"vcode"` //版本号
|
||||||
Vname string `protobuf:"bytes,6,opt,name=vname,proto3" json:"vname"` //版本名
|
Vname string `protobuf:"bytes,6,opt,name=vname,proto3" json:"vname"` //版本名
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserLoginReq) Reset() {
|
func (x *UserLoginReq) Reset() {
|
||||||
@ -80,18 +80,18 @@ func (x *UserLoginReq) GetSid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserLoginReq) GetArea() int32 {
|
func (x *UserLoginReq) GetArea() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Area
|
return x.Area
|
||||||
}
|
}
|
||||||
return 0
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserLoginReq) GetChannel() int32 {
|
func (x *UserLoginReq) GetChannel() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Channel
|
return x.Channel
|
||||||
}
|
}
|
||||||
return 0
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserLoginReq) GetVcode() int32 {
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x18, 0x55,
|
||||||
|
Loading…
Reference in New Issue
Block a user