Documentation ¶
Index ¶
- Constants
- func Startup(scenes string)
- type BlockInfo
- func (b *BlockInfo) FindPath(sx, sy, ex, ey int32) (path [][]int32, block, turn int, err error)
- func (b *BlockInfo) GetBlockTable() [][]int32
- func (b *BlockInfo) GetHeight() uint32
- func (b *BlockInfo) GetRandomXY(rect shape.Rect, cnt int) (shape.Coord, shape.Coord, error)
- func (b *BlockInfo) GetWidth() uint32
- func (b *BlockInfo) IsWalkable(i, j int32) bool
- func (b *BlockInfo) ReadFrom(bytebuffer *bytes.Buffer) error
- type Buffer
- type Entity
- func (e *Entity) Destroy()
- func (e *Entity) GetEntityType() int
- func (e *Entity) GetID() int64
- func (e *Entity) GetPos() shape.Vector3
- func (e *Entity) GetScene() *Scene
- func (e *Entity) GetUUID() string
- func (e *Entity) IsDestroyed() bool
- func (e *Entity) PushTask(task scheduler.Task)
- func (e *Entity) SetPos(x, y, z shape.Coord)
- func (e *Entity) ToString() string
- type Hero
- func (h *Hero) AttackAction()
- func (h *Hero) AttackTarget(targetId int64) error
- func (h *Hero) BeenAttacked(damage int64) (int, error)
- func (h *Hero) Broadcast(route string, msg interface{}, includeSelf bool)
- func (h *Hero) CanAttackTarget(target IEntity) bool
- func (m *Hero) CanSee(target IEntity) bool
- func (h *Hero) Destroy()
- func (h *Hero) DestroyWithoutSession()
- func (h *Hero) Die()
- func (h *Hero) GetAttack() int64
- func (m *Hero) GetBuffers() []*object.BufferObject
- func (m *Hero) GetCanSeeMeViewList() map[string]IMovableEntity
- func (h *Hero) GetData() *object.HeroObject
- func (h *Hero) GetDefense() int64
- func (h *Hero) GetID() int64
- func (h *Hero) GetState() constants2.ActionState
- func (h *Hero) GetUID() int64
- func (m *Hero) GetViewList() map[string]IMovableEntity
- func (m *Hero) GetViewRange() (int, int)
- func (m *Hero) GetViewRect() shape.Rect
- func (h *Hero) Idle()
- func (m *Hero) IsInViewList(target IMovableEntity) bool
- func (h *Hero) IsOffline() bool
- func (h *Hero) MoveByPaths(targetx, targety, targetz int, paths [][]int32) error
- func (h *Hero) MoveStop(x, y, z shape.Coord) error
- func (h *Hero) Run()
- func (h *Hero) SendMsg(route string, msg interface{})
- func (h *Hero) SetPos(x, y, z shape.Coord)
- func (h *Hero) SetState(state constants2.ActionState)
- func (h *Hero) SetViewRange(width int, height int)
- func (h *Hero) ToString() string
- func (h *Hero) Walk()
- type IAiManager
- type IAoiManager
- type IEntity
- type IMovableEntity
- type Monster
- func (m *Monster) AttackAction()
- func (m *Monster) Broadcast(route string, msg interface{})
- func (m *Monster) CanAttackTarget(target IEntity) bool
- func (m *Monster) CanSee(target IEntity) bool
- func (m *Monster) Chase()
- func (m *Monster) Destroy()
- func (m *Monster) Die()
- func (m *Monster) Escape()
- func (m *Monster) GetBuffers() []*object.BufferObject
- func (m *Monster) GetCanAttackPos(target IEntity, offset int) (v shape.Vector3, err error)
- func (m *Monster) GetCanSeeMeViewList() map[string]IMovableEntity
- func (m *Monster) GetCanUseSpell(spellType int) *object.SpellObject
- func (m *Monster) GetData() *object.MonsterObject
- func (m *Monster) GetMovableRect() shape.Rect
- func (m *Monster) GetState() constants.ActionState
- func (m *Monster) GetViewList() map[string]IMovableEntity
- func (m *Monster) GetViewRange() (int, int)
- func (m *Monster) GetViewRect() shape.Rect
- func (m *Monster) Idle()
- func (m *Monster) IsInAttackRange(x, y shape.Coord) bool
- func (m *Monster) IsInSpellAttackRange(spell *object.SpellObject, x, y shape.Coord) bool
- func (m *Monster) IsInViewList(target IMovableEntity) bool
- func (m *Monster) IsNpc() bool
- func (m *Monster) MoveByPaths(paths [][]int32) error
- func (m *Monster) MoveTo(x, y, z shape.Coord) error
- func (m *Monster) Run()
- func (m *Monster) SetAiData(aimgr IAiManager)
- func (m *Monster) SetMovableRect(rect shape.Rect)
- func (m *Monster) SetPos(x, y, z shape.Coord)
- func (m *Monster) SetPreparePaths(p *path.SerialPaths)
- func (m *Monster) SetSceneMonsterConfig(cfg *model.SceneMonsterConfig)
- func (m *Monster) SetSpells(spells []*object.SpellObject)
- func (m *Monster) SetState(state constants.ActionState)
- func (m *Monster) SetViewRange(width int, height int)
- func (m *Monster) SpellAttack(spell *object.SpellObject, target IMovableEntity) error
- func (m *Monster) Stop()
- func (m *Monster) ToString() string
- func (m *Monster) Walk()
- type PathFinder
- type Scene
- func (s *Scene) CreateSpellEntity(caster IMovableEntity, spell *object.SpellObject, target IMovableEntity) *SpellEntity
- func (s *Scene) FindPath(sx, sy, ex, ey shape.Coord) ([][]int32, error)
- func (s *Scene) GetHeight() uint32
- func (s *Scene) GetRandomXY(rect shape.Rect, cnt int) (shape.Coord, shape.Coord, error)
- func (s *Scene) GetSceneData() *SceneData
- func (s *Scene) GetSceneId() int
- func (s *Scene) GetWidth() uint32
- func (s *Scene) IsWalkable(x, y shape.Coord) bool
- func (s *Scene) PushTask(task scheduler.Task)
- func (s *Scene) Stop()
- type SceneData
- type SceneManager
- func (manager *SceneManager) AfterInit()
- func (manager *SceneManager) Attack(s *session.Session, req *protocol.AttackRequest) error
- func (manager *SceneManager) DynamicResetMonsters(s *session.Session, req *protocol.DynamicResetMonstersRequest) error
- func (manager *SceneManager) GetScene(sceneId int) *Scene
- func (manager *SceneManager) HeroEnterScene(s *session.Session, req *protocol.HeroEnterSceneRequest) error
- func (manager *SceneManager) HeroLeaveScene(s *session.Session, req *protocol.HeroLeaveSceneRequest) error
- func (manager *SceneManager) HeroMove(s *session.Session, req *protocol.HeroMoveRequest) error
- func (manager *SceneManager) HeroMoveStop(s *session.Session, req *protocol.HeroMoveStopRequest) error
- func (manager *SceneManager) HeroSetViewRange(s *session.Session, req *protocol.HeroSetViewRangeRequest) error
- func (manager *SceneManager) RecordingVoice(s *session.Session, msg *protocol.RecordingVoice) error
- func (manager *SceneManager) SceneInfo(s *session.Session, req *protocol.SceneInfoRequest) error
- func (manager *SceneManager) TextMessage(s *session.Session, msg *protocol.TextMessageRequest) error
- func (manager *SceneManager) VoiceMessage(s *session.Session, msg []byte) error
- type SpellEntity
- func (m *SpellEntity) CanSee(target IEntity) bool
- func (e *SpellEntity) Destroy()
- func (m *SpellEntity) GetBuffers() []*object.BufferObject
- func (m *SpellEntity) GetCanSeeMeViewList() map[string]IMovableEntity
- func (m *SpellEntity) GetViewList() map[string]IMovableEntity
- func (m *SpellEntity) GetViewRange() (int, int)
- func (m *SpellEntity) GetViewRect() shape.Rect
- func (m *SpellEntity) IsInViewList(target IMovableEntity) bool
- func (e *SpellEntity) SetPos(x, y, z shape.Coord)
- func (e *SpellEntity) SetTarget(target IMovableEntity)
- func (e *SpellEntity) SetTargetPos(target shape.Vector3)
- func (m *SpellEntity) SetViewRange(width int, height int)
Constants ¶
View Source
const (
SCENE_CHAN_BUFFER_SIZE = 2048
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockInfo ¶
type BlockInfo struct {
// contains filtered or unexported fields
}
二维格子数据
func NewBlockInfo ¶
func NewBlockInfo() *BlockInfo
func (*BlockInfo) GetBlockTable ¶
func (*BlockInfo) GetRandomXY ¶
func (*BlockInfo) IsWalkable ¶
type Buffer ¶
type Buffer struct { *object.BufferObject // contains filtered or unexported fields }
func (*Buffer) Add ¶
func (buf *Buffer) Add(state *model.BufferState)
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func (*Entity) GetEntityType ¶
func (*Entity) IsDestroyed ¶
type Hero ¶
type Hero struct { *object.HeroObject // contains filtered or unexported fields }
func (*Hero) AttackAction ¶
func (h *Hero) AttackAction()
func (*Hero) AttackTarget ¶
func (*Hero) CanAttackTarget ¶
func (*Hero) DestroyWithoutSession ¶
func (h *Hero) DestroyWithoutSession()
func (*Hero) GetBuffers ¶
func (m *Hero) GetBuffers() []*object.BufferObject
func (*Hero) GetCanSeeMeViewList ¶
func (m *Hero) GetCanSeeMeViewList() map[string]IMovableEntity
func (*Hero) GetData ¶
func (h *Hero) GetData() *object.HeroObject
func (*Hero) GetDefense ¶
func (*Hero) GetState ¶
func (h *Hero) GetState() constants2.ActionState
func (*Hero) GetViewList ¶
func (m *Hero) GetViewList() map[string]IMovableEntity
func (*Hero) GetViewRange ¶
func (*Hero) GetViewRect ¶
func (*Hero) IsInViewList ¶
func (m *Hero) IsInViewList(target IMovableEntity) bool
func (*Hero) MoveByPaths ¶
前端移动到目标位置
func (*Hero) SetViewRange ¶
type IAiManager ¶
type IAiManager interface { GetAiData() interface{} GetOwner() IMovableEntity // contains filtered or unexported methods }
type IAoiManager ¶
type IAoiManager interface { Enter(entity IMovableEntity) Leave(entity IMovableEntity) Moved(entity IMovableEntity, oldX, oldY shape.Coord) }
type IMovableEntity ¶
type IMovableEntity interface { IEntity GetViewList() map[string]IMovableEntity GetCanSeeMeViewList() map[string]IMovableEntity GetViewRect() shape.Rect SetViewRange(int, int) GetViewRange() (int, int) CanSee(target IEntity) bool IsInViewList(target IMovableEntity) bool // contains filtered or unexported methods }
type Monster ¶
type Monster struct { *object.MonsterObject // contains filtered or unexported fields }
func (*Monster) AttackAction ¶
func (m *Monster) AttackAction()
func (*Monster) CanAttackTarget ¶
func (*Monster) GetBuffers ¶
func (m *Monster) GetBuffers() []*object.BufferObject
func (*Monster) GetCanAttackPos ¶
返回对目标点的可攻击位置
func (*Monster) GetCanSeeMeViewList ¶
func (m *Monster) GetCanSeeMeViewList() map[string]IMovableEntity
func (*Monster) GetCanUseSpell ¶
func (m *Monster) GetCanUseSpell(spellType int) *object.SpellObject
func (*Monster) GetData ¶
func (m *Monster) GetData() *object.MonsterObject
func (*Monster) GetMovableRect ¶
func (*Monster) GetState ¶
func (m *Monster) GetState() constants.ActionState
func (*Monster) GetViewList ¶
func (m *Monster) GetViewList() map[string]IMovableEntity
func (*Monster) GetViewRange ¶
func (*Monster) GetViewRect ¶
func (*Monster) IsInSpellAttackRange ¶
func (*Monster) IsInViewList ¶
func (m *Monster) IsInViewList(target IMovableEntity) bool
func (*Monster) MoveByPaths ¶
func (*Monster) SetAiData ¶
func (m *Monster) SetAiData(aimgr IAiManager)
func (*Monster) SetMovableRect ¶
func (*Monster) SetPreparePaths ¶
func (m *Monster) SetPreparePaths(p *path.SerialPaths)
func (*Monster) SetSceneMonsterConfig ¶
func (m *Monster) SetSceneMonsterConfig(cfg *model.SceneMonsterConfig)
func (*Monster) SetSpells ¶
func (m *Monster) SetSpells(spells []*object.SpellObject)
func (*Monster) SetViewRange ¶
func (*Monster) SpellAttack ¶
func (m *Monster) SpellAttack(spell *object.SpellObject, target IMovableEntity) error
type PathFinder ¶
type PathFinder struct {
// contains filtered or unexported fields
}
这个非线程安全,需要单线程一个执行
func NewPathFinder ¶
func NewPathFinder(grids [][]int32) *PathFinder
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
func (*Scene) CreateSpellEntity ¶
func (s *Scene) CreateSpellEntity(caster IMovableEntity, spell *object.SpellObject, target IMovableEntity) *SpellEntity
func (*Scene) GetRandomXY ¶
func (*Scene) GetSceneData ¶
func (*Scene) GetSceneId ¶
type SceneManager ¶
func NewSceneManager ¶
func NewSceneManager() *SceneManager
func (*SceneManager) AfterInit ¶
func (manager *SceneManager) AfterInit()
func (*SceneManager) Attack ¶
func (manager *SceneManager) Attack(s *session.Session, req *protocol.AttackRequest) error
func (*SceneManager) DynamicResetMonsters ¶
func (manager *SceneManager) DynamicResetMonsters(s *session.Session, req *protocol.DynamicResetMonstersRequest) error
动态重置怪物
func (*SceneManager) GetScene ¶
func (manager *SceneManager) GetScene(sceneId int) *Scene
func (*SceneManager) HeroEnterScene ¶
func (manager *SceneManager) HeroEnterScene(s *session.Session, req *protocol.HeroEnterSceneRequest) error
func (*SceneManager) HeroLeaveScene ¶
func (manager *SceneManager) HeroLeaveScene(s *session.Session, req *protocol.HeroLeaveSceneRequest) error
func (*SceneManager) HeroMove ¶
func (manager *SceneManager) HeroMove(s *session.Session, req *protocol.HeroMoveRequest) error
func (*SceneManager) HeroMoveStop ¶
func (manager *SceneManager) HeroMoveStop(s *session.Session, req *protocol.HeroMoveStopRequest) error
func (*SceneManager) HeroSetViewRange ¶
func (manager *SceneManager) HeroSetViewRange(s *session.Session, req *protocol.HeroSetViewRangeRequest) error
func (*SceneManager) RecordingVoice ¶
func (manager *SceneManager) RecordingVoice(s *session.Session, msg *protocol.RecordingVoice) error
玩家录制完语音
func (*SceneManager) SceneInfo ¶
func (manager *SceneManager) SceneInfo(s *session.Session, req *protocol.SceneInfoRequest) error
func (*SceneManager) TextMessage ¶
func (manager *SceneManager) TextMessage(s *session.Session, msg *protocol.TextMessageRequest) error
玩家文字消息
func (*SceneManager) VoiceMessage ¶
func (manager *SceneManager) VoiceMessage(s *session.Session, msg []byte) error
玩家语音消息
type SpellEntity ¶
type SpellEntity struct { *object.SpellObject // contains filtered or unexported fields }
func NewSpellEntity ¶
func NewSpellEntity(spellObject *object.SpellObject, caster IMovableEntity) *SpellEntity
func (*SpellEntity) Destroy ¶
func (e *SpellEntity) Destroy()
func (*SpellEntity) GetBuffers ¶
func (m *SpellEntity) GetBuffers() []*object.BufferObject
func (*SpellEntity) GetCanSeeMeViewList ¶
func (m *SpellEntity) GetCanSeeMeViewList() map[string]IMovableEntity
func (*SpellEntity) GetViewList ¶
func (m *SpellEntity) GetViewList() map[string]IMovableEntity
func (*SpellEntity) GetViewRange ¶
func (*SpellEntity) GetViewRect ¶
func (*SpellEntity) IsInViewList ¶
func (m *SpellEntity) IsInViewList(target IMovableEntity) bool
func (*SpellEntity) SetPos ¶
func (e *SpellEntity) SetPos(x, y, z shape.Coord)
func (*SpellEntity) SetTarget ¶
func (e *SpellEntity) SetTarget(target IMovableEntity)
需要在添加到场景内之前执行
func (*SpellEntity) SetTargetPos ¶
func (e *SpellEntity) SetTargetPos(target shape.Vector3)
需要在添加到场景内之前执行
func (*SpellEntity) SetViewRange ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.