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 ¶
- type BroadcastManager
- func (m *BroadcastManager) BroadcastCurrent(source basis.IUserEntity, excludeBlack bool, ...) error
- func (m *BroadcastManager) BroadcastEntity(source basis.IUserEntity, target basis.IEntity, ...) error
- func (m *BroadcastManager) BroadcastUsers(source basis.IUserEntity, targets []string, ...) error
- func (m *BroadcastManager) DisposeManager()
- func (m *BroadcastManager) InitManager()
- func (m *BroadcastManager) NotifyEnvVars(varTarget basis.IEntity, vars encodingx.IKeyValue)
- func (m *BroadcastManager) NotifyUserVars(source basis.IUserEntity, vars encodingx.IKeyValue)
- func (m *BroadcastManager) NotifyUserVarsCurrent(source basis.IUserEntity, vars encodingx.IKeyValue)
- func (m *BroadcastManager) SetAddressProxy(addressProxy netx.IAddressProxy)
- func (m *BroadcastManager) SetLogger(logger logx.ILogger)
- func (m *BroadcastManager) SetNearDistance(distance float64)
- func (m *BroadcastManager) SetSockServer(server netx.ISockServer)
- type EntityManager
- func (m *EntityManager) ChannelIndex() basis.IChannelIndex
- func (m *EntityManager) ConstructWorld(cfg *config.MMOConfig)
- func (m *EntityManager) CreateChannel(chanId string, chanName string) (basis.IChannelEntity, error)
- func (m *EntityManager) CreateRoomAt(roomId string, roomName string, container basis.IEntityContainer) (basis.IRoomEntity, error)
- func (m *EntityManager) CreateTeam(userId string) (basis.ITeamEntity, error)
- func (m *EntityManager) CreateTeamCorps(teamId string) (basis.ITeamCorpsEntity, error)
- func (m *EntityManager) CreateWorld(worldId string, worldName string, asRoot bool) (basis.IWorldEntity, error)
- func (m *EntityManager) CreateZoneAt(zoneId string, zoneName string, container basis.IEntityContainer) (basis.IZoneEntity, error)
- func (m *EntityManager) DisposeManager()
- func (m *EntityManager) GetChannel(chanId string) (basis.IChannelEntity, bool)
- func (m *EntityManager) GetEntity(entityType basis.EntityType, entityId string) (basis.IEntity, bool)
- func (m *EntityManager) GetEntityIndex(entityType basis.EntityType) basis.IEntityIndex
- func (m *EntityManager) GetRoom(roomId string) (basis.IRoomEntity, bool)
- func (m *EntityManager) GetTeam(teamId string) (basis.ITeamEntity, bool)
- func (m *EntityManager) GetTeamCorps(corpsId string) (basis.ITeamCorpsEntity, bool)
- func (m *EntityManager) GetUser(userId string) (basis.IUserEntity, bool)
- func (m *EntityManager) GetZone(zoneId string) (basis.IZoneEntity, bool)
- func (m *EntityManager) InitManager()
- func (m *EntityManager) RoomIndex() basis.IRoomIndex
- func (m *EntityManager) SetLogger(logger logx.ILogger)
- func (m *EntityManager) TeamCorpsIndex() basis.ITeamCorpsIndex
- func (m *EntityManager) TeamIndex() basis.ITeamIndex
- func (m *EntityManager) UserIndex() basis.IUserIndex
- func (m *EntityManager) World() basis.IWorldEntity
- func (m *EntityManager) ZoneIndex() basis.IZoneIndex
- type IBroadcastManager
- type IEntityCreator
- type IEntityGetter
- type IEntityIndexSet
- type IEntityManager
- type IUserManager
- type IVariableManager
- type UserManager
- func (w *UserManager) DisposeManager()
- func (w *UserManager) EnterWorld(user basis.IUserEntity, roomId string) error
- func (w *UserManager) ExitWorld(userId string) error
- func (w *UserManager) InitManager()
- func (m *UserManager) SetLogger(logger logx.ILogger)
- func (w *UserManager) Transfer(userId string, toRoomId string) error
- type VariableManager
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 ¶
type IEntityManager interface { eventx.IEventDispatcher IEntityCreator IEntityGetter IEntityIndexSet basis.IManagerBase World() basis.IWorldEntity ConstructWorld(cfg *config.MMOConfig) }
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)
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)
Click to show internal directories.
Click to hide internal directories.