上传代码
This commit is contained in:
parent
c1cdd58324
commit
c5db0bf402
@ -122,6 +122,7 @@ func (this *Room) PlayerHandle(uid string, handle *pb.DColorHandleReq) (err erro
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
this.module.rooms.removeRoom(this.data.Rid)
|
||||
} else {
|
||||
|
||||
if this.currside == 1 {
|
||||
|
@ -48,3 +48,9 @@ func (this *roomsComp) newRoom(data *pb.DBDColorRoom, session []comm.IUserSessio
|
||||
this.lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (this *roomsComp) removeRoom(rid string) {
|
||||
this.lock.Lock()
|
||||
delete(this.rooms, rid)
|
||||
this.lock.Unlock()
|
||||
}
|
||||
|
25
modules/maincity/api_onlinePlayer.go
Normal file
25
modules/maincity/api_onlinePlayer.go
Normal file
@ -0,0 +1,25 @@
|
||||
package maincity
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
func (this *apiComp) OnlinePlayerCheck(session comm.IUserSession, req *pb.MainCityOnlinePlayerReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 查看某一封邮件
|
||||
func (this *apiComp) OnlinePlayer(session comm.IUserSession, req *pb.MainCityOnlinePlayerReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
friends []*pb.BaseUserInfo
|
||||
uids []string
|
||||
)
|
||||
friends = this.module.model.getplayerPos(session.GetUserId())
|
||||
for _, v := range friends {
|
||||
uids = append(uids, v.Uid)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
@ -62,6 +62,7 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
|
||||
red []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
bule []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 6)
|
||||
n int32
|
||||
dan int32
|
||||
leftnum int32
|
||||
)
|
||||
@ -97,13 +98,13 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
|
||||
if leftnum > 0 {
|
||||
if ais, err = this.module.parkourComp.matcheAI(dan, leftnum); err != nil {
|
||||
this.module.Error("matcheAI err!", log.Field{Key: "key", Value: err.Error()})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if len(red) < 3 {
|
||||
red = append(red, ais[0:3-len(red)]...)
|
||||
ais = ais[3-len(red):]
|
||||
n = 3 - int32(len(red))
|
||||
red = append(red, ais[0:n]...)
|
||||
ais = ais[n:]
|
||||
}
|
||||
if len(bule) < 3 {
|
||||
bule = append(bule, ais[0:3-len(bule)]...)
|
||||
|
@ -116,6 +116,93 @@ func (x *MainCitySynchPosPush) GetPos() *DBMainCityPos {
|
||||
return nil
|
||||
}
|
||||
|
||||
//在线用户列表请求
|
||||
type MainCityOnlinePlayerReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *MainCityOnlinePlayerReq) Reset() {
|
||||
*x = MainCityOnlinePlayerReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_maincity_maincity_msg_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MainCityOnlinePlayerReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MainCityOnlinePlayerReq) ProtoMessage() {}
|
||||
|
||||
func (x *MainCityOnlinePlayerReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_maincity_maincity_msg_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MainCityOnlinePlayerReq.ProtoReflect.Descriptor instead.
|
||||
func (*MainCityOnlinePlayerReq) Descriptor() ([]byte, []int) {
|
||||
return file_maincity_maincity_msg_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
//在线用户列表请求
|
||||
type MainCityOnlinePlayerResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uids []string `protobuf:"bytes,1,rep,name=uids,proto3" json:"uids"`
|
||||
}
|
||||
|
||||
func (x *MainCityOnlinePlayerResp) Reset() {
|
||||
*x = MainCityOnlinePlayerResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_maincity_maincity_msg_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MainCityOnlinePlayerResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MainCityOnlinePlayerResp) ProtoMessage() {}
|
||||
|
||||
func (x *MainCityOnlinePlayerResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_maincity_maincity_msg_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MainCityOnlinePlayerResp.ProtoReflect.Descriptor instead.
|
||||
func (*MainCityOnlinePlayerResp) Descriptor() ([]byte, []int) {
|
||||
return file_maincity_maincity_msg_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *MainCityOnlinePlayerResp) GetUids() []string {
|
||||
if x != nil {
|
||||
return x.Uids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_maincity_maincity_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_maincity_maincity_msg_proto_rawDesc = []byte{
|
||||
@ -129,8 +216,13 @@ var file_maincity_maincity_msg_proto_rawDesc = []byte{
|
||||
0x70, 0x6f, 0x73, 0x22, 0x38, 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x53,
|
||||
0x79, 0x6e, 0x63, 0x68, 0x50, 0x6f, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x20, 0x0a, 0x03, 0x70,
|
||||
0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69,
|
||||
0x6e, 0x43, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x73, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6e, 0x43, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x73, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x22, 0x19, 0x0a,
|
||||
0x17, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50,
|
||||
0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x22, 0x2e, 0x0a, 0x18, 0x4d, 0x61, 0x69, 0x6e,
|
||||
0x43, 0x69, 0x74, 0x79, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x09, 0x52, 0x04, 0x75, 0x69, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -145,15 +237,17 @@ func file_maincity_maincity_msg_proto_rawDescGZIP() []byte {
|
||||
return file_maincity_maincity_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_maincity_maincity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_maincity_maincity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_maincity_maincity_msg_proto_goTypes = []interface{}{
|
||||
(*MainCitySynchPosPeek)(nil), // 0: MainCitySynchPosPeek
|
||||
(*MainCitySynchPosPush)(nil), // 1: MainCitySynchPosPush
|
||||
(*DBMainCityPos)(nil), // 2: DBMainCityPos
|
||||
(*MainCityOnlinePlayerReq)(nil), // 2: MainCityOnlinePlayerReq
|
||||
(*MainCityOnlinePlayerResp)(nil), // 3: MainCityOnlinePlayerResp
|
||||
(*DBMainCityPos)(nil), // 4: DBMainCityPos
|
||||
}
|
||||
var file_maincity_maincity_msg_proto_depIdxs = []int32{
|
||||
2, // 0: MainCitySynchPosPeek.pos:type_name -> DBMainCityPos
|
||||
2, // 1: MainCitySynchPosPush.pos:type_name -> DBMainCityPos
|
||||
4, // 0: MainCitySynchPosPeek.pos:type_name -> DBMainCityPos
|
||||
4, // 1: MainCitySynchPosPush.pos:type_name -> DBMainCityPos
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
@ -192,6 +286,30 @@ func file_maincity_maincity_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_maincity_maincity_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MainCityOnlinePlayerReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_maincity_maincity_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MainCityOnlinePlayerResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -199,7 +317,7 @@ func file_maincity_maincity_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_maincity_maincity_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user