social

package
v0.0.0-...-3945403 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

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 GetGuildById

func GetGuildById(guildId int64) *Guild

获取本服上的公会

func NewGuild

func NewGuild(guildLoadData *pb.GuildLoadData) *Guild

func (*Guild) BroadcastClientPacket

func (this *Guild) BroadcastClientPacket(message proto.Message)

广播公会消息,直接发给客户端 this server -> other server -> client

func (*Guild) BroadcastPlayerPacket

func (this *Guild) BroadcastPlayerPacket(message proto.Message)

广播公会消息 this server -> other server -> player

func (*Guild) GetBaseInfo

func (g *Guild) GetBaseInfo() *GuildBaseInfo

func (*Guild) GetJoinRequests

func (g *Guild) GetJoinRequests() *GuildJoinRequests

func (*Guild) GetMember

func (this *Guild) GetMember(playerId int64) *pb.GuildMemberData

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

type Hook

type Hook struct {
}

func (*Hook) OnApplicationExit

func (h *Hook) OnApplicationExit()

服务器关闭回调

func (*Hook) OnApplicationInit

func (h *Hook) OnApplicationInit(initArg interface{})

服务器初始化回调

func (*Hook) OnRegisterServerHandler

func (h *Hook) OnRegisterServerHandler(arg any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL