Documentation ¶
Index ¶
- type LineNode
- func (nd *LineNode) BaseRadius() int
- func (nd *LineNode) CurrtRadius(secondOfNow int) int
- func (nd *LineNode) ExpireTimed(secondOfNow int) bool
- func (nd *LineNode) IncrPerSecond() int
- func (nd *LineNode) InsertTime() int
- func (nd *LineNode) MaxRadius() int
- func (nd *LineNode) MaxWaitTime() int
- func (nd *LineNode) Point() int
- func (nd *LineNode) WaitFull(secondOfNow int) bool
- type LineNodeList
- func (nd *LineNodeList) AddNode(node *LineNode)
- func (nd *LineNodeList) FindNode(find *LineNode) (bool, int)
- func (nd *LineNodeList) Iterator(startIndex int, cursor func(*LineNode, int) bool)
- func (nd *LineNodeList) Len() int
- func (nd *LineNodeList) RemoveNode(node *LineNode) int
- func (nd *LineNodeList) SearchNeighbor(find *LineNode) int
- func (nd *LineNodeList) SearchRange(secondOfNow int, cpoint *LineNode, needNum int) (neighbor []*LineNode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LineNode ¶
type LineNode struct { ExpireTime int //过期截止时间 秒 *(!=0则会判断过期)* //--------- Id int //外部控制的唯一id,主键 NeighborMax int // PLAYER=需要的最多邻居 NeighborMin int // PLAYER=需要的最小邻居 //多种类型|操作数值 SubType int // contains filtered or unexported fields }
func NewLineNode ¶
* 构建线性自扩散的区间节点 point int //中心点 baseRadius int //初始半径 incrPerSecond int //每秒扩散的半径 maxWaitTime int //最大扩散时间 秒 insertTime int //插入时间戳
func (*LineNode) CurrtRadius ¶
根据传入的时间戳(秒),获取当前节点的半径
func (*LineNode) ExpireTimed ¶
根据传入的时间戳(秒),判断是否过期(主要用于房间锁定后或者人数满了)
type LineNodeList ¶
type LineNodeList struct {
// contains filtered or unexported fields
}
func (*LineNodeList) AddNode ¶
func (nd *LineNodeList) AddNode(node *LineNode)
func (*LineNodeList) FindNode ¶
func (nd *LineNodeList) FindNode(find *LineNode) (bool, int)
* 根据节点查找所在列表中的下标(注意:该find节点必须在列表中存在,否则无法查找) bool:是否查找到 int: bool=true 表示真实下标
bool=false 表示可以插入的下标,int=[0,len]
func (*LineNodeList) Iterator ¶
func (nd *LineNodeList) Iterator(startIndex int, cursor func(*LineNode, int) bool)
* 迭代列表中所有节点 startIndex:迭代开始下标 cursor:迭代回调函数
node :元素节点 crtIndex:node所在列表下标 continuz:是否继续迭代
func (*LineNodeList) Len ¶
func (nd *LineNodeList) Len() int
func (*LineNodeList) RemoveNode ¶
func (nd *LineNodeList) RemoveNode(node *LineNode) int
* 移除队列中的子节点,返回移除的节点的下标 -1:没找到,[0,len)
func (*LineNodeList) SearchNeighbor ¶
func (nd *LineNodeList) SearchNeighbor(find *LineNode) int
* 根据节点查找开始遍历的邻居节点下标
func (*LineNodeList) SearchRange ¶
func (nd *LineNodeList) SearchRange(secondOfNow int, cpoint *LineNode, needNum int) (neighbor []*LineNode)
* 迭代列表中所有节点
secondOfNow:当前时间 秒 cpoint:基础元素节点 needNum:最多需要的邻居数(>0表示找出指定所有,<=0有多少找多少) return: neighbor:有交集的邻居节点
Click to show internal directories.
Click to hide internal directories.