manager

package
v0.0.0-...-eba1a7b Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Created by xuzhuoxi on 2019-03-15. @author xuzhuoxi

Created by xuzhuoxi on 2019-03-15. @author xuzhuoxi

Created by xuzhuoxi on 2019-03-15. @author xuzhuoxi

Created by xuzhuoxi on 2019-03-16. @author xuzhuoxi

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastManager

type BroadcastManager struct {
	// contains filtered or unexported fields
}

func NewBroadcastManager

func NewBroadcastManager(entityMgr IEntityManager, sockServer netx.ISockServer, addressProxy netx.IAddressProxy) *BroadcastManager

func (*BroadcastManager) BroadcastCurrent

func (m *BroadcastManager) BroadcastCurrent(source basis.IUserEntity, excludeBlack bool, handler func(entity basis.IUserEntity)) error

func (*BroadcastManager) BroadcastEntity

func (m *BroadcastManager) BroadcastEntity(source basis.IUserEntity, target basis.IEntity, handler func(entity basis.IUserEntity)) error

func (*BroadcastManager) BroadcastUsers

func (m *BroadcastManager) BroadcastUsers(source basis.IUserEntity, targets []string, handler func(entity basis.IUserEntity)) error

func (*BroadcastManager) DisposeManager

func (m *BroadcastManager) DisposeManager()

func (*BroadcastManager) InitManager

func (m *BroadcastManager) InitManager()

func (*BroadcastManager) NotifyEnvVars

func (m *BroadcastManager) NotifyEnvVars(varTarget basis.IEntity, vars encodingx.IKeyValue)

func (*BroadcastManager) NotifyUserVars

func (m *BroadcastManager) NotifyUserVars(source basis.IUserEntity, vars encodingx.IKeyValue)

func (*BroadcastManager) NotifyUserVarsCurrent

func (m *BroadcastManager) NotifyUserVarsCurrent(source basis.IUserEntity, vars encodingx.IKeyValue)

func (*BroadcastManager) SetAddressProxy

func (m *BroadcastManager) SetAddressProxy(addressProxy netx.IAddressProxy)

func (*BroadcastManager) SetLogger

func (m *BroadcastManager) SetLogger(logger logx.ILogger)

func (*BroadcastManager) SetNearDistance

func (m *BroadcastManager) SetNearDistance(distance float64)

func (*BroadcastManager) SetSockServer

func (m *BroadcastManager) SetSockServer(server netx.ISockServer)

type EntityManager

type EntityManager struct {
	eventx.EventDispatcher
	// contains filtered or unexported fields
}

func (*EntityManager) ChannelIndex

func (m *EntityManager) ChannelIndex() basis.IChannelIndex

func (*EntityManager) ConstructWorld

func (m *EntityManager) ConstructWorld(cfg *config.MMOConfig)

func (*EntityManager) CreateChannel

func (m *EntityManager) CreateChannel(chanId string, chanName string) (basis.IChannelEntity, error)

func (*EntityManager) CreateRoomAt

func (m *EntityManager) CreateRoomAt(roomId string, roomName string, container basis.IEntityContainer) (basis.IRoomEntity, error)

func (*EntityManager) CreateTeam

func (m *EntityManager) CreateTeam(userId string) (basis.ITeamEntity, error)

func (*EntityManager) CreateTeamCorps

func (m *EntityManager) CreateTeamCorps(teamId string) (basis.ITeamCorpsEntity, error)

func (*EntityManager) CreateWorld

func (m *EntityManager) CreateWorld(worldId string, worldName string, asRoot bool) (basis.IWorldEntity, error)

func (*EntityManager) CreateZoneAt

func (m *EntityManager) CreateZoneAt(zoneId string, zoneName string, container basis.IEntityContainer) (basis.IZoneEntity, error)

func (*EntityManager) DisposeManager

func (m *EntityManager) DisposeManager()

func (*EntityManager) GetChannel

func (m *EntityManager) GetChannel(chanId string) (basis.IChannelEntity, bool)

func (*EntityManager) GetEntity

func (m *EntityManager) GetEntity(entityType basis.EntityType, entityId string) (basis.IEntity, bool)

func (*EntityManager) GetEntityIndex

func (m *EntityManager) GetEntityIndex(entityType basis.EntityType) basis.IEntityIndex

func (*EntityManager) GetRoom

func (m *EntityManager) GetRoom(roomId string) (basis.IRoomEntity, bool)

func (*EntityManager) GetTeam

func (m *EntityManager) GetTeam(teamId string) (basis.ITeamEntity, bool)

func (*EntityManager) GetTeamCorps

func (m *EntityManager) GetTeamCorps(corpsId string) (basis.ITeamCorpsEntity, bool)

func (*EntityManager) GetUser

func (m *EntityManager) GetUser(userId string) (basis.IUserEntity, bool)

func (*EntityManager) GetZone

func (m *EntityManager) GetZone(zoneId string) (basis.IZoneEntity, bool)

func (*EntityManager) InitManager

func (m *EntityManager) InitManager()

func (*EntityManager) RoomIndex

func (m *EntityManager) RoomIndex() basis.IRoomIndex

func (*EntityManager) SetLogger

func (m *EntityManager) SetLogger(logger logx.ILogger)

func (*EntityManager) TeamCorpsIndex

func (m *EntityManager) TeamCorpsIndex() basis.ITeamCorpsIndex

func (*EntityManager) TeamIndex

func (m *EntityManager) TeamIndex() basis.ITeamIndex

func (*EntityManager) UserIndex

func (m *EntityManager) UserIndex() basis.IUserIndex

func (*EntityManager) World

func (m *EntityManager) World() basis.IWorldEntity

func (*EntityManager) ZoneIndex

func (m *EntityManager) ZoneIndex() basis.IZoneIndex

type IBroadcastManager

type IBroadcastManager interface {
	basis.IManagerBase
	netx.ISockServerSetter
	netx.IAddressProxySetter

	//广播整个实体
	//target为环境实体
	//source可以为nil,当不为nil时会进行黑名单过滤,和本身过滤
	BroadcastEntity(source basis.IUserEntity, target basis.IEntity, handler func(entity basis.IUserEntity)) error
	//广播部分用户
	//targets为用户实体IUserEntity的UID集合
	//source可以为nil,当不为nil时会进行黑名单过滤,和本身过滤
	BroadcastUsers(source basis.IUserEntity, targets []string, handler func(entity basis.IUserEntity)) error
	//设置附近值
	SetNearDistance(distance float64)
	//广播当前用户所在区域
	//source不能为nil
	BroadcastCurrent(source basis.IUserEntity, excludeBlack bool, handler func(entity basis.IUserEntity)) error

	//环境实体变量更新
	NotifyEnvVars(varTarget basis.IEntity, vars encodingx.IKeyValue)
	//用户实体变量更新
	NotifyUserVars(source basis.IUserEntity, vars encodingx.IKeyValue)
	//用户实体变量更新
	NotifyUserVarsCurrent(source basis.IUserEntity, vars encodingx.IKeyValue)
}

func NewIBroadcastManager

func NewIBroadcastManager(entityMgr IEntityManager, sockServer netx.ISockServer, addressProxy netx.IAddressProxy) IBroadcastManager

type IEntityCreator

type IEntityCreator interface {
	//构造世界
	CreateWorld(worldId string, worldName string, asRoot bool) (basis.IWorldEntity, error)
	//构造区域
	CreateZoneAt(zoneId string, zoneName string, container basis.IEntityContainer) (basis.IZoneEntity, error)
	//构造房间
	CreateRoomAt(roomId string, roomName string, container basis.IEntityContainer) (basis.IRoomEntity, error)

	//创建队伍
	CreateTeam(userId string) (basis.ITeamEntity, error)
	//创建团队
	CreateTeamCorps(teamId string) (basis.ITeamCorpsEntity, error)
	//构造频道
	CreateChannel(chanId string, chanName string) (basis.IChannelEntity, error)
}

type IEntityGetter

type IEntityGetter interface {
	//获取区域实例
	GetZone(zoneId string) (basis.IZoneEntity, bool)
	//获取房间实例
	GetRoom(roomId string) (basis.IRoomEntity, bool)
	//获取用户实例
	GetUser(userId string) (basis.IUserEntity, bool)
	//获取队伍实例
	GetTeam(teamId string) (basis.ITeamEntity, bool)
	//获取队伍实例
	GetTeamCorps(corpsId string) (basis.ITeamCorpsEntity, bool)
	//获取频道实例
	GetChannel(chanId string) (basis.IChannelEntity, bool)
	//获取实例
	GetEntity(entityType basis.EntityType, entityId string) (basis.IEntity, bool)
}

type IEntityIndexSet

type IEntityIndexSet interface {
	ZoneIndex() basis.IZoneIndex
	RoomIndex() basis.IRoomIndex
	UserIndex() basis.IUserIndex
	TeamIndex() basis.ITeamIndex
	TeamCorpsIndex() basis.ITeamCorpsIndex
	ChannelIndex() basis.IChannelIndex
	GetEntityIndex(entityType basis.EntityType) basis.IEntityIndex
}

type IEntityManager

func NewEntityManager

func NewEntityManager() IEntityManager

func NewIEntityManager

func NewIEntityManager() IEntityManager

type IUserManager

type IUserManager interface {
	basis.IManagerBase
	//加入世界
	EnterWorld(user basis.IUserEntity, roomId string) error
	//离开世界
	ExitWorld(userId string) error
	//在世界转移
	Transfer(userId string, toRoomId string) error
}

func NewIUserManager

func NewIUserManager(entityMgr IEntityManager) IUserManager

type IVariableManager

type IVariableManager interface {
	basis.IManagerBase
}

func NewIVariableManager

func NewIVariableManager(entityManager IEntityManager, broadcastManager IBroadcastManager) IVariableManager

type UserManager

type UserManager struct {
	// contains filtered or unexported fields
}

func NewUserManager

func NewUserManager(entityMgr IEntityManager) *UserManager

func (*UserManager) DisposeManager

func (w *UserManager) DisposeManager()

func (*UserManager) EnterWorld

func (w *UserManager) EnterWorld(user basis.IUserEntity, roomId string) error

func (*UserManager) ExitWorld

func (w *UserManager) ExitWorld(userId string) error

func (*UserManager) InitManager

func (w *UserManager) InitManager()

func (*UserManager) SetLogger

func (m *UserManager) SetLogger(logger logx.ILogger)

func (*UserManager) Transfer

func (w *UserManager) Transfer(userId string, toRoomId string) error

type VariableManager

type VariableManager struct {
	// contains filtered or unexported fields
}

func NewVariableManager

func NewVariableManager(entityManager IEntityManager, broadcastManager IBroadcastManager) *VariableManager

func (*VariableManager) DisposeManager

func (m *VariableManager) DisposeManager()

func (*VariableManager) InitManager

func (m *VariableManager) InitManager()

func (*VariableManager) SetLogger

func (m *VariableManager) SetLogger(logger logx.ILogger)

Jump to

Keyboard shortcuts

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