Documentation ¶
Index ¶
- Constants
- func AutoRegisterGuildPacketHandler(entity gentity.Entity, methodNamePrefix, protoPackageName string)
- func GuildServerHandlerRegister(handler PacketHandlerRegister)
- func InitGuildStructAndHandler()
- func ParseRoutePacket(mgr *gentity.DistributedEntityMgr, connection Connection, packet Packet, ...) error
- type Guild
- func (this *Guild) BroadcastClientPacket(message proto.Message)
- func (this *Guild) BroadcastPlayerPacket(message proto.Message)
- func (g *Guild) GetBaseInfo() *GuildBaseInfo
- func (g *Guild) GetJoinRequests() *GuildJoinRequests
- func (this *Guild) GetMember(playerId int64) *pb.GuildMemberData
- func (g *Guild) GetMembers() *GuildMembers
- func (this *Guild) RouteClientPacket(guildMessage *GuildMessage, message proto.Message)
- func (this *Guild) RoutePlayerPacket(guildMessage *GuildMessage, cmd any, message proto.Message, ...)
- type GuildBaseInfo
- type GuildHelper
- func (g *GuildHelper) CreateEntity(entityData interface{}) gentity.RoutineEntity
- func (g *GuildHelper) LoadEntity(entityId int64) gentity.RoutineEntity
- func (g *GuildHelper) PacketToRoutePacket(from gentity.Entity, packet Packet, toEntityId int64) Packet
- func (g *GuildHelper) RoutePacketToRoutineMessage(connection Connection, packet Packet, toEntityId int64) interface{}
- func (g *GuildHelper) RouteServerId(entityId int64) int32
- type GuildJoinRequests
- func (this *GuildJoinRequests) Add(joinRequest *pb.GuildJoinRequest)
- func (this *GuildJoinRequests) Get(playerId int64) *pb.GuildJoinRequest
- func (this *GuildJoinRequests) GetGuild() *Guild
- func (this *GuildJoinRequests) HandleGuildJoinAgreeReq(guildMessage *GuildMessage, req *pb.GuildJoinAgreeReq) (*pb.GuildJoinAgreeRes, error)
- func (this *GuildJoinRequests) HandleGuildJoinReq(guildMessage *GuildMessage, req *pb.GuildJoinReq) (*pb.GuildJoinRes, error)
- func (this *GuildJoinRequests) Remove(playerId int64)
- type GuildMembers
- type GuildMessage
- type Hook
Constants ¶
View Source
const (
// 组件名
ComponentNameBaseInfo = "BaseInfo"
)
View Source
const (
// 组件名
ComponentNameJoinRequests = "JoinRequests"
)
View Source
const (
// 组件名
ComponentNameMembers = "Members"
)
Variables ¶
This section is empty.
Functions ¶
func AutoRegisterGuildPacketHandler ¶
func AutoRegisterGuildPacketHandler(entity gentity.Entity, methodNamePrefix, protoPackageName string)
公会的消息回调接口使用了特殊的形式,所以自己写接口注册流程
func GuildServerHandlerRegister ¶
func GuildServerHandlerRegister(handler PacketHandlerRegister)
func InitGuildStructAndHandler ¶
func InitGuildStructAndHandler()
func ParseRoutePacket ¶
func ParseRoutePacket(mgr *gentity.DistributedEntityMgr, connection Connection, packet Packet, toEntityId int64) error
Types ¶
type Guild ¶
type Guild struct {
gentity.BaseRoutineEntity
}
公会
func NewGuild ¶
func NewGuild(guildLoadData *pb.GuildLoadData) *Guild
func (*Guild) BroadcastClientPacket ¶
广播公会消息,直接发给客户端 this server -> other server -> client
func (*Guild) BroadcastPlayerPacket ¶
广播公会消息 this server -> other server -> player
func (*Guild) GetBaseInfo ¶
func (g *Guild) GetBaseInfo() *GuildBaseInfo
func (*Guild) GetJoinRequests ¶
func (g *Guild) GetJoinRequests() *GuildJoinRequests
func (*Guild) GetMembers ¶
func (g *Guild) GetMembers() *GuildMembers
func (*Guild) RouteClientPacket ¶
func (this *Guild) RouteClientPacket(guildMessage *GuildMessage, message proto.Message)
路由玩家消息,直接发给客户端 this server -> other server -> client
func (*Guild) RoutePlayerPacket ¶
func (this *Guild) RoutePlayerPacket(guildMessage *GuildMessage, cmd any, message proto.Message, opts ...game.RouteOption)
路由玩家消息 this server -> other server -> player
type GuildBaseInfo ¶
type GuildBaseInfo struct { gentity.DataComponent Data *pb.GuildInfo `db:"plain"` }
公会基础信息
func (*GuildBaseInfo) GetGuild ¶
func (this *GuildBaseInfo) GetGuild() *Guild
func (*GuildBaseInfo) HandleGuildDataViewReq ¶
func (this *GuildBaseInfo) HandleGuildDataViewReq(guildMessage *GuildMessage, req *pb.GuildDataViewReq) (*pb.GuildDataViewRes, error)
func (*GuildBaseInfo) SetMemberCount ¶
func (this *GuildBaseInfo) SetMemberCount(memberCount int32)
type GuildHelper ¶
type GuildHelper struct { }
DistributedEntityHelper实现
func (*GuildHelper) CreateEntity ¶
func (g *GuildHelper) CreateEntity(entityData interface{}) gentity.RoutineEntity
创建公会实体
func (*GuildHelper) LoadEntity ¶
func (g *GuildHelper) LoadEntity(entityId int64) gentity.RoutineEntity
加载公会实体 加载成功后,开启独立协程
func (*GuildHelper) PacketToRoutePacket ¶
func (g *GuildHelper) PacketToRoutePacket(from gentity.Entity, packet Packet, toEntityId int64) Packet
消息转换成路由消息
func (*GuildHelper) RoutePacketToRoutineMessage ¶
func (g *GuildHelper) RoutePacketToRoutineMessage(connection Connection, packet Packet, toEntityId int64) interface{}
路由消息转换成公会的逻辑消息
func (*GuildHelper) RouteServerId ¶
func (g *GuildHelper) RouteServerId(entityId int64) int32
根据公会id路由到对应的服务器id
type GuildJoinRequests ¶
type GuildJoinRequests struct { *gentity.MapDataComponent[int64, *pb.GuildJoinRequest] `db:""` }
公会加入请求
func (*GuildJoinRequests) Add ¶
func (this *GuildJoinRequests) Add(joinRequest *pb.GuildJoinRequest)
func (*GuildJoinRequests) Get ¶
func (this *GuildJoinRequests) Get(playerId int64) *pb.GuildJoinRequest
func (*GuildJoinRequests) GetGuild ¶
func (this *GuildJoinRequests) GetGuild() *Guild
func (*GuildJoinRequests) HandleGuildJoinAgreeReq ¶
func (this *GuildJoinRequests) HandleGuildJoinAgreeReq(guildMessage *GuildMessage, req *pb.GuildJoinAgreeReq) (*pb.GuildJoinAgreeRes, error)
公会管理员处理申请者的入会申请
func (*GuildJoinRequests) HandleGuildJoinReq ¶
func (this *GuildJoinRequests) HandleGuildJoinReq(guildMessage *GuildMessage, req *pb.GuildJoinReq) (*pb.GuildJoinRes, error)
加入公会请求
func (*GuildJoinRequests) Remove ¶
func (this *GuildJoinRequests) Remove(playerId int64)
type GuildMembers ¶
type GuildMembers struct { *gentity.MapDataComponent[int64, *pb.GuildMemberData] `db:"plain"` }
公会成员数据
func (*GuildMembers) Add ¶
func (this *GuildMembers) Add(member *pb.GuildMemberData)
func (*GuildMembers) Get ¶
func (this *GuildMembers) Get(playerId int64) *pb.GuildMemberData
func (*GuildMembers) GetGuild ¶
func (this *GuildMembers) GetGuild() *Guild
func (*GuildMembers) Remove ¶
func (this *GuildMembers) Remove(playerId int64)
type GuildMessage ¶
type GuildMessage struct {
// contains filtered or unexported fields
}
requestPacket->route to guild->convert packet to guildMessage-->guild.PushMessage
Click to show internal directories.
Click to hide internal directories.