Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area[ID comparable, AreaInfo any] struct { // contains filtered or unexported fields }
Area 编排区域
func (*Area[ID, AreaInfo]) GetAreaInfo ¶
func (slf *Area[ID, AreaInfo]) GetAreaInfo() AreaInfo
GetAreaInfo 获取编排区域的信息
type AreaConstraintHandle ¶
type AreaEvaluateHandle ¶
type AreaEvaluateHandle[ID comparable, AreaInfo any] func(areaInfo AreaInfo, items map[ID]Item[ID]) float64
type AreaOption ¶
type AreaOption[ID comparable, AreaInfo any] func(area *Area[ID, AreaInfo])
AreaOption 编排区域选项
func WithAreaConstraint ¶
func WithAreaConstraint[ID comparable, AreaInfo any](constraint AreaConstraintHandle[ID, AreaInfo]) AreaOption[ID, AreaInfo]
WithAreaConstraint 设置编排区域的约束条件
- 该约束用于判断一个成员是否可以被添加到该编排区域中
func WithAreaEvaluate ¶
func WithAreaEvaluate[ID comparable, AreaInfo any](evaluate AreaEvaluateHandle[ID, AreaInfo]) AreaOption[ID, AreaInfo]
WithAreaEvaluate 设置编排区域的评估函数
- 该评估函数将影响成员被编入区域的优先级
type Arrangement ¶
type Arrangement[ID comparable, AreaInfo any] struct { // contains filtered or unexported fields }
Arrangement 用于针对多条数据进行合理编排的数据结构
- 我不知道这个数据结构的具体用途,但是我觉得这个数据结构应该是有用的
- 目前我能想到的用途只有我的过往经历:排课
- 如果是在游戏领域,或许适用于多人小队匹配编排等类似情况
func NewArrangement ¶
func NewArrangement[ID comparable, AreaInfo any](options ...Option[ID, AreaInfo]) *Arrangement[ID, AreaInfo]
NewArrangement 创建一个新的编排
func (*Arrangement[ID, AreaInfo]) AddArea ¶
func (slf *Arrangement[ID, AreaInfo]) AddArea(areaInfo AreaInfo, options ...AreaOption[ID, AreaInfo])
AddArea 添加一个编排区域
func (*Arrangement[ID, AreaInfo]) AddItem ¶
func (slf *Arrangement[ID, AreaInfo]) AddItem(item Item[ID])
AddItem 添加一个成员
type Item ¶
type Item[ID comparable] interface { // GetID 获取成员的唯一标识 GetID() ID // Equal 比较两个成员是否相等 Equal(item Item[ID]) bool }
Item 编排成员
type ItemFixedAreaHandle ¶
type ItemOption ¶
type ItemOption[ID comparable, AreaInfo any] func(arrangement *Arrangement[ID, AreaInfo], item Item[ID])
ItemOption 编排成员选项
func WithItemFixed ¶
func WithItemFixed[ID comparable, AreaInfo any](matcher ItemFixedAreaHandle[AreaInfo]) ItemOption[ID, AreaInfo]
WithItemFixed 设置成员的固定编排区域
func WithItemPriority ¶
func WithItemPriority[ID comparable, AreaInfo any](priority ItemPriorityHandle[ID, AreaInfo]) ItemOption[ID, AreaInfo]
WithItemPriority 设置成员的优先级
type ItemPriorityHandle ¶
type ItemPriorityHandle[ID comparable, AreaInfo any] func(areaInfo AreaInfo, item Item[ID]) float64
type Option ¶
type Option[ID comparable, AreaInfo any] func(arrangement *Arrangement[ID, AreaInfo])
Option 编排选项
Click to show internal directories.
Click to hide internal directories.