Documentation ¶
Overview ¶
常用于管理游戏背包、技能列表的容器 适用于手游、页游等多种类型 适用于格子类BOX容器 线程安全、适用于大并发场景 version 1.0 beta by koangel email: jackliu100@gmail.com 2017/12/10
一款带锁的列表 version 1.0 beta by koangel email: jackliu100@gmail.com 2017/12/10
定时执行函数的的数据容器 version 1.0 beta by koangel email: jackliu100@gmail.com 2021/01/09
计算一个周期内数据是多少,超过这个周期会直接清理数据 主要用于统计、限制以及周期性的内存计算 version 1.0 beta by koangel email: jackliu100@gmail.com 2021/01/09
Index ¶
- Constants
- func GetHostIndex(key string, maxCount int) int
- type ExecProc
- type ItemBox
- func (b *ItemBox) Array() []ItemElement
- func (b *ItemBox) EmptyGird() (col, row int)
- func (b *ItemBox) EmptyGrid() int
- func (b *ItemBox) FromBinary(src []byte) error
- func (b *ItemBox) GridCount() int
- func (b *ItemBox) Init()
- func (b *ItemBox) IsFull() bool
- func (b *ItemBox) ItemCount() int
- func (b *ItemBox) Move(sc, sr, dc, dr int) error
- func (b *ItemBox) Peek(col, row int) (item *ItemElement, err error)
- func (b *ItemBox) PeekInfo(col, row int) (info interface{}, err error)
- func (b *ItemBox) PeekValue(col, row int) (val interface{}, err error)
- func (b *ItemBox) Push(item, info interface{}) (err error, ri *ItemElement)
- func (b *ItemBox) PushAndSwap(col, row int, item, info interface{}) error
- func (b *ItemBox) PushCell(col, row int, item, info interface{}) (err error, ri *ItemElement)
- func (b *ItemBox) Range(fn func(val *ItemElement) bool)
- func (b *ItemBox) Remove(col, row int) error
- func (b *ItemBox) Reverse(fn func(val *ItemElement) bool)
- func (b *ItemBox) SetFormatter(foramtter formatter.ItemFormatter)
- func (b *ItemBox) Sort(fn func(av, bv interface{}) bool)
- func (b *ItemBox) SwapElement(se, de *ItemElement) error
- func (b *ItemBox) ToBinary() (data []byte, err error)
- type ItemElement
- type LimitAarray
- type SList
- func (sc *SList) Back() interface{}
- func (sc *SList) Clear()
- func (sc *SList) First() interface{}
- func (sc *SList) Len() int
- func (sc *SList) Push(item interface{})
- func (sc *SList) Range(fn func(i interface{}) bool)
- func (sc *SList) Remove(fn func(i interface{}) bool)
- func (sc *SList) RemoveRanges(fn func(i interface{}) bool)
- func (sc *SList) ReverseRange(fn func(i interface{}) bool)
- func (sc *SList) Search(fn func(i interface{}) bool) (interface{}, bool)
- func (sc *SList) Sort(fn func(a, b interface{}) bool)
- type SStatMap
- type TickLimit
- type TickWriter
- type TimeGroup
Constants ¶
View Source
const ( Inventory = iota Wear Skill )
View Source
const (
EmptyGrid = "grid is empty..."
)
Variables ¶
This section is empty.
Functions ¶
func GetHostIndex ¶
Types ¶
type ItemBox ¶
type ItemBox struct { // 标记属于谁,可以是任意类型 Owner interface{} // 标记类型(建议自己定义),例如 Inventory,wear,skill Type int // contains filtered or unexported fields }
func (*ItemBox) Array ¶
func (b *ItemBox) Array() []ItemElement
会产生数据COPY,如果需要组织数据包,请尽量避免使用该函数 仅仅打包已存在数据,空格不会打包
func (*ItemBox) FromBinary ¶
func (*ItemBox) Push ¶
func (b *ItemBox) Push(item, info interface{}) (err error, ri *ItemElement)
背包操作函数 暂不提供批量压入 自动压入到空格位置
func (*ItemBox) PushAndSwap ¶
该格子存在道具那么把该格子道具放入一个空格子,如果没有没空格子,则返回失败
func (*ItemBox) PushCell ¶
func (b *ItemBox) PushCell(col, row int, item, info interface{}) (err error, ri *ItemElement)
格子存在则放入其他格子并返回元素,没有空格子则返回失败
func (*ItemBox) SetFormatter ¶
func (b *ItemBox) SetFormatter(foramtter formatter.ItemFormatter)
func (*ItemBox) SwapElement ¶
func (b *ItemBox) SwapElement(se, de *ItemElement) error
type ItemElement ¶
type ItemElement struct {
// contains filtered or unexported fields
}
func (*ItemElement) Column ¶
func (e *ItemElement) Column() int
func (*ItemElement) IsEmpty ¶
func (e *ItemElement) IsEmpty() bool
func (*ItemElement) Position ¶
func (e *ItemElement) Position() int
func (*ItemElement) Remove ¶
func (e *ItemElement) Remove()
func (*ItemElement) Row ¶
func (e *ItemElement) Row() int
func (*ItemElement) SetValue ¶
func (e *ItemElement) SetValue(value, info interface{})
func (*ItemElement) Value ¶
func (e *ItemElement) Value() (value, info interface{})
type LimitAarray ¶
type LimitAarray struct {
// contains filtered or unexported fields
}
2021/01/09 新增高性能的容器,LimitArray,采用数组切片完成计算,效率极高
func NewLA ¶
func NewLA(lc int, key string) *LimitAarray
func (*LimitAarray) Add ¶
func (l *LimitAarray) Add(val interface{})
func (*LimitAarray) Array ¶
func (l *LimitAarray) Array() []interface{}
func (*LimitAarray) Clear ¶
func (l *LimitAarray) Clear()
func (*LimitAarray) Foreach ¶
func (l *LimitAarray) Foreach(fn func(n interface{}))
func (*LimitAarray) Len ¶
func (l *LimitAarray) Len() int
func (*LimitAarray) Name ¶
func (l *LimitAarray) Name() string
func (*LimitAarray) RevForeach ¶
func (l *LimitAarray) RevForeach(fn func(n interface{}))
type SList ¶
type SList struct {
// contains filtered or unexported fields
}
func (*SList) RemoveRanges ¶
func (*SList) ReverseRange ¶
type SStatMap ¶
type SStatMap struct {
// contains filtered or unexported fields
}
func NewStatMap ¶
func NewStatMap() *SStatMap
type TickLimit ¶
type TickLimit struct { Cli interface{} DebugPrint bool // contains filtered or unexported fields }
func NewTickerLimit ¶
type TickWriter ¶
返回true 则自动清理数据 如果返回false则不清理
type TimeGroup ¶
type TimeGroup struct {
// contains filtered or unexported fields
}
func NewTimeGroup ¶
func (*TimeGroup) AddLimitMap ¶
func (*TimeGroup) ClearMemory ¶
func (t *TimeGroup) ClearMemory()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.