Documentation ¶
Overview ¶
Package builtin 包含了通用游戏相关的接口的内置实现
Index ¶
- Variables
- type Actor
- type Item
- type ItemContainer
- func (slf *ItemContainer[ItemID, Item]) AddItem(item Item, count *huge.Int) (guid int64, err error)
- func (slf *ItemContainer[ItemID, Item]) CheckAllowAdd(item Item, count *huge.Int) error
- func (slf *ItemContainer[ItemID, Item]) CheckDeductItem(guid int64, count *huge.Int) error
- func (slf *ItemContainer[ItemID, Item]) Clear()
- func (slf *ItemContainer[ItemID, Item]) DeductItem(guid int64, count *huge.Int) error
- func (slf *ItemContainer[ItemID, Item]) ExistItem(guid int64) bool
- func (slf *ItemContainer[ItemID, Item]) ExistItemWithID(id ItemID) bool
- func (slf *ItemContainer[ItemID, Item]) GetItem(guid int64) (game.ItemContainerMember[ItemID, Item], error)
- func (slf *ItemContainer[ItemID, Item]) GetItems() []game.ItemContainerMember[ItemID, Item]
- func (slf *ItemContainer[ItemID, Item]) GetItemsFull() []game.ItemContainerMember[ItemID, Item]
- func (slf *ItemContainer[ItemID, Item]) GetItemsMap() map[int64]game.ItemContainerMember[ItemID, Item]
- func (slf *ItemContainer[ItemID, Item]) GetSize() int
- func (slf *ItemContainer[ItemID, Item]) GetSizeLimit() int
- func (slf *ItemContainer[ItemID, Item]) Remove(guid int64)
- func (slf *ItemContainer[ItemID, Item]) RemoveWithID(id ItemID)
- func (slf *ItemContainer[ItemID, Item]) SetExpandSize(size int)
- func (slf *ItemContainer[ItemID, Item]) TransferTo(guid int64, count *huge.Int, target game.ItemContainer[ItemID, Item]) error
- type ItemContainerMember
- type ItemContainerOption
- type Player
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCannotAddNegativeOrZeroItem = errors.New("cannot add items with negative quantities or zero") ErrItemNotExist = errors.New("item not exist") ErrItemInsufficientQuantity = errors.New("item insufficient quantity") ErrItemContainerIsFull = errors.New("item container is full") ErrItemContainerNotExist = errors.New("item container not exist") )
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item[ItemID comparable] struct { // contains filtered or unexported fields }
func NewItem ¶
func NewItem[ItemID comparable](id ItemID) *Item[ItemID]
type ItemContainer ¶
type ItemContainer[ItemID comparable, Item game.Item[ItemID]] struct { // contains filtered or unexported fields }
func NewItemContainer ¶
func NewItemContainer[ItemID comparable, Item game.Item[ItemID]](options ...ItemContainerOption[ItemID, Item]) *ItemContainer[ItemID, Item]
func (*ItemContainer[ItemID, Item]) AddItem ¶
func (slf *ItemContainer[ItemID, Item]) AddItem(item Item, count *huge.Int) (guid int64, err error)
func (*ItemContainer[ItemID, Item]) CheckAllowAdd ¶
func (slf *ItemContainer[ItemID, Item]) CheckAllowAdd(item Item, count *huge.Int) error
func (*ItemContainer[ItemID, Item]) CheckDeductItem ¶
func (slf *ItemContainer[ItemID, Item]) CheckDeductItem(guid int64, count *huge.Int) error
func (*ItemContainer[ItemID, Item]) Clear ¶
func (slf *ItemContainer[ItemID, Item]) Clear()
func (*ItemContainer[ItemID, Item]) DeductItem ¶
func (slf *ItemContainer[ItemID, Item]) DeductItem(guid int64, count *huge.Int) error
func (*ItemContainer[ItemID, Item]) ExistItem ¶
func (slf *ItemContainer[ItemID, Item]) ExistItem(guid int64) bool
func (*ItemContainer[ItemID, Item]) ExistItemWithID ¶
func (slf *ItemContainer[ItemID, Item]) ExistItemWithID(id ItemID) bool
func (*ItemContainer[ItemID, Item]) GetItem ¶
func (slf *ItemContainer[ItemID, Item]) GetItem(guid int64) (game.ItemContainerMember[ItemID, Item], error)
func (*ItemContainer[ItemID, Item]) GetItems ¶
func (slf *ItemContainer[ItemID, Item]) GetItems() []game.ItemContainerMember[ItemID, Item]
func (*ItemContainer[ItemID, Item]) GetItemsFull ¶
func (slf *ItemContainer[ItemID, Item]) GetItemsFull() []game.ItemContainerMember[ItemID, Item]
func (*ItemContainer[ItemID, Item]) GetItemsMap ¶
func (slf *ItemContainer[ItemID, Item]) GetItemsMap() map[int64]game.ItemContainerMember[ItemID, Item]
func (*ItemContainer[ItemID, Item]) GetSize ¶
func (slf *ItemContainer[ItemID, Item]) GetSize() int
func (*ItemContainer[ItemID, Item]) GetSizeLimit ¶
func (slf *ItemContainer[ItemID, Item]) GetSizeLimit() int
func (*ItemContainer[ItemID, Item]) Remove ¶
func (slf *ItemContainer[ItemID, Item]) Remove(guid int64)
func (*ItemContainer[ItemID, Item]) RemoveWithID ¶
func (slf *ItemContainer[ItemID, Item]) RemoveWithID(id ItemID)
func (*ItemContainer[ItemID, Item]) SetExpandSize ¶
func (slf *ItemContainer[ItemID, Item]) SetExpandSize(size int)
func (*ItemContainer[ItemID, Item]) TransferTo ¶
func (slf *ItemContainer[ItemID, Item]) TransferTo(guid int64, count *huge.Int, target game.ItemContainer[ItemID, Item]) error
type ItemContainerMember ¶
type ItemContainerMember[ItemID comparable, I game.Item[ItemID]] struct { // contains filtered or unexported fields }
func NewItemContainerMember ¶
func NewItemContainerMember[ItemID comparable, I game.Item[ItemID]](guid int64, item I) *ItemContainerMember[ItemID, I]
func (*ItemContainerMember[ItemID, I]) GetCount ¶
func (slf *ItemContainerMember[ItemID, I]) GetCount() *huge.Int
func (*ItemContainerMember[ItemID, I]) GetGUID ¶
func (slf *ItemContainerMember[ItemID, I]) GetGUID() int64
func (*ItemContainerMember[ItemID, I]) GetID ¶
func (slf *ItemContainerMember[ItemID, I]) GetID() ItemID
func (*ItemContainerMember[ItemID, I]) GetItem ¶
func (slf *ItemContainerMember[ItemID, I]) GetItem() I
type ItemContainerOption ¶
type ItemContainerOption[ItemID comparable, Item game.Item[ItemID]] func(container *ItemContainer[ItemID, Item])
func WithItemContainerSizeLimit ¶
func WithItemContainerSizeLimit[ItemID comparable, Item game.Item[ItemID]](sizeLimit int) ItemContainerOption[ItemID, Item]
WithItemContainerSizeLimit 通过特定的物品容器非堆叠数量上限创建物品容器
func WithItemContainerStackLimit ¶
func WithItemContainerStackLimit[ItemID comparable, Item game.Item[ItemID]](id ItemID, stackLimit *huge.Int) ItemContainerOption[ItemID, Item]
WithItemContainerStackLimit 通过设置特定物品堆叠数量创建容器
type Player ¶
type Player[ID comparable] struct { // contains filtered or unexported fields }
Player 游戏玩家
Click to show internal directories.
Click to hide internal directories.