Documentation ¶
Index ¶
- func CalculateBonusFactor(x float64, a IBonus, useFactor, useMultiplier, useBonus bool) (y float64)
- func ParseKey(key string) (kind, id string)
- type A
- type Array
- func (s *Array) Dispose()
- func (s *Array) RefBool(field int) bool
- func (s *Array) RefFloat(field int) float64
- func (s *Array) RefInt(field int) int
- func (s *Array) RefLength() int
- func (s *Array) RefObject(index int) (r IObject)
- func (s *Array) RefSourceData() []interface{}
- func (s *Array) RefString(index int) (val string)
- func (s *Array) RefUint(index int) (val uint)
- type Bonus
- func (b Bonus) Bonus() float64
- func (a *Bonus) Combine(b IBonus)
- func (b *Bonus) Factor() float64
- func (b *Bonus) Key() string
- func (b Bonus) Multiplier() float64
- func (b *Bonus) SetBonus(val float64) *Bonus
- func (b *Bonus) SetFactor(val float64) *Bonus
- func (b *Bonus) SetKey(val string) *Bonus
- func (b *Bonus) SetMultiplier(val float64) *Bonus
- func (a *Bonus) Valid() bool
- type IArray
- type IBonus
- type IModify
- type IObject
- type IPool
- type IRoot
- type M
- type Object
- func (s *Object) Dispose()
- func (s *Object) GetArrayFloatModify() (r []float64)
- func (s *Object) GetMapFloat() (r map[string]float64)
- func (s *Object) GetMapFloatModify() (r map[string]float64)
- func (s *Object) MapKeyOf(conf func(item interface{}) bool) string
- func (s *Object) RefArray(field string) (r IArray)
- func (s *Object) RefBool(field string) bool
- func (s *Object) RefClassCreator(field string, creator func(object IObject) IObject)
- func (s *Object) RefClassName() string
- func (s *Object) RefFloat64(field string) float64
- func (s *Object) RefInt(field string) int
- func (s *Object) RefIsNil() bool
- func (s *Object) RefKeys() (r []string)
- func (s *Object) RefLength() int
- func (s *Object) RefMap(field string) (r IObject)
- func (s *Object) RefObject(field string) (r IObject)
- func (s *Object) RefSource(field string) interface{}
- func (s *Object) RefSourceData() (origin map[string]interface{})
- func (s *Object) RefString(field string) (val string)
- func (s *Object) RefUint(field string) (val uint)
- func (s *Object) SetRuntimeBool(field string, val bool)
- func (s *Object) SetRuntimeFloat(field string, val float64)
- func (s *Object) SetRuntimeInt(field string, val int)
- func (s *Object) SetRuntimeString(field string, val string)
- func (s *Object) ToArrayString() (r []string)
- func (s *Object) ToMapString() (r map[string]string)
- type Pool
- func (p *Pool) AddBonus(val IBonus, version int)
- func (p *Pool) AddModify(val IModify, version int)
- func (p *Pool) IsPropChanged(key string, version int) bool
- func (p *Pool) RemoveBonus(val IBonus, version int)
- func (p *Pool) RemoveModify(val IModify, version int)
- func (p *Pool) SetVersion(key string, version int)
- type PoolList
- func (p *PoolList) Dispose()
- func (p *PoolList) GetNewPropBool(key string, val bool) (r bool)
- func (p *PoolList) GetNewPropFloat(key string, val float64) (r float64)
- func (p *PoolList) GetNewPropInt(key string, val int) (r int)
- func (p *PoolList) GetNewestVersion() int
- func (p *PoolList) IsPropChanged(key string) bool
- func (p *PoolList) SetHost(pool *Pool)
- func (p *PoolList) SetNewestVersionCreator(val func() int)
- func (p *PoolList) SetRoot(pool *Pool)
- type Root
- func (s *Root) GetPools() *PoolList
- func (s *Root) RefClassId() string
- func (s *Root) RefClassKey() string
- func (s *Root) RefClassKind() string
- func (s *Root) RefData() map[string]interface{}
- func (s *Root) RefDispose()
- func (s *Root) RefReset()
- func (s *Root) RefResetVersion()
- func (s *Root) Source() *Source
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateBonusFactor ¶
y = x * (1 + Factor)* Multiplier + Bonus
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
修正对象 如果需要在运行时,替换源的数据,可通过设置runtime实现
type Bonus ¶
type Bonus struct {
// contains filtered or unexported fields
}
func NewBonusAll ¶
func (Bonus) Multiplier ¶
func (*Bonus) SetMultiplier ¶
type IObject ¶
type IObject interface { RefSourceData() map[string]interface{} RefSource(field string) interface{} RefInt(field string) (val int) RefUint(field string) (val uint) RefFloat64(field string) (val float64) RefString(field string) (val string) RefBool(field string) (val bool) RefMap(field string) (r IObject) RefObject(field string) (r IObject) RefArray(field string) (r IArray) RefIsNil() bool RefKeys() (r []string) RefLength() int RefClassCreator(field string, creator func(object IObject) IObject) SetRuntimeFloat(field string, val float64) SetRuntimeInt(field string, val int) SetRuntimeBool(field string, val bool) SetRuntimeString(field string, val string) }
type IPool ¶
type IPool interface { // 属性是否发生了变化 IsPropChanged(key string, version int) bool GetNewPropInt(key string, val int) (r int, ver int) GetNewPropStruct(key string) (r map[string]interface{}, ver int) GetNewPropFloat(key string, val int) (r map[string]interface{}, ver int) GetNewPropBool(key string, val bool) (r bool, ver int) }
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
修正对象 如果需要在运行时,替换源的数据,可通过设置runtime实现
func (*Object) GetMapFloat ¶
func (*Object) GetMapFloatModify ¶
func (*Object) RefClassCreator ¶
func (*Object) RefClassName ¶
func (*Object) RefSourceData ¶
RefSourceData 获取原始数据 可通过 mapx.Int(origin, fieldName)获取指定内容的值
func (*Object) SetRuntimeBool ¶
func (*Object) SetRuntimeFloat ¶
SetRuntimeFloat 运行时修改的数据, 用于直接替换掉origin数据, 再进行池修正 用于已知目标的情况下使用, 可提高运行效率, 例如初始化时, 为目标单位赋予初值 注: 需要注意设置的类型
func (*Object) SetRuntimeInt ¶
func (*Object) SetRuntimeString ¶
type Pool ¶
type Pool struct { // Parent *Pool // key=结构/属性 // 例如=CUnit/Vital/Life/Max或 CEffectDamage/Amount BonusList map[string]listx.List // ModifyList map[string]listx.List // contains filtered or unexported fields }
func (*Pool) RemoveBonus ¶
func (*Pool) RemoveModify ¶
type PoolList ¶
type PoolList struct {
// contains filtered or unexported fields
}
func NewPoolList ¶
func NewPoolList() (obj *PoolList)
func (*PoolList) GetNewPropFloat ¶
func (*PoolList) GetNewestVersion ¶
func (*PoolList) IsPropChanged ¶
func (*PoolList) SetNewestVersionCreator ¶
type Root ¶
type Root struct {
*Object
}
func (*Root) RefClassId ¶
func (*Root) RefClassKey ¶
func (*Root) RefClassKind ¶
func (*Root) RefDispose ¶
func (s *Root) RefDispose()
func (*Root) RefResetVersion ¶
func (s *Root) RefResetVersion()
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
数据源 通常加载后,数据源不可变,作为配置文件的映射 采用数据源的目的是为了避免数据的克隆影响性能,毕竟需要修正的地方有限
func NewSourceWith ¶
func (*Source) SetClassId ¶
Click to show internal directories.
Click to hide internal directories.