Skip to content

API / PixiSlot

类: PixiSlot ​

定义于: pixi/PixiSlot.ts:38

PixiJS 插槽。

继承 ​

构造函数 ​

构造函数 ​

ts
new PixiSlot(): PixiSlot;

返回 ​

PixiSlot

继承自 ​

Slot.constructor

属性 ​

_alpha ​

ts
_alpha: number;

定义于: armature/TransformObject.ts:78

Internal

继承自 ​

Slot._alpha


_armature ​

ts
_armature: Armature;

定义于: armature/TransformObject.ts:86

Internal

继承自 ​

Slot._armature


_cachedFrameIndices ​

ts
_cachedFrameIndices: number[];

定义于: armature/Slot.ts:255

Internal

继承自 ​

Slot._cachedFrameIndices


_colorDirty ​

ts
_colorDirty: boolean;

定义于: armature/Slot.ts:190

Internal

继承自 ​

Slot._colorDirty


_colorTransform ​

ts
readonly _colorTransform: ColorTransform;

定义于: armature/Slot.ts:221

Internal

继承自 ​

Slot._colorTransform


_displayFrame ​

ts
_displayFrame: DisplayFrame;

定义于: armature/Slot.ts:237

Internal

继承自 ​

Slot._displayFrame


_displayFrames ​

ts
readonly _displayFrames: DisplayFrame[] = [];

定义于: armature/Slot.ts:225

Internal

继承自 ​

Slot._displayFrames


_geometryBones ​

ts
readonly _geometryBones: Bone[] = [];

定义于: armature/Slot.ts:229

Internal

继承自 ​

Slot._geometryBones


_geometryData ​

ts
_geometryData: GeometryData;

定义于: armature/Slot.ts:241

Internal

继承自 ​

Slot._geometryData


_globalAlpha ​

ts
_globalAlpha: number;

定义于: armature/TransformObject.ts:82

Internal

继承自 ​

Slot._globalAlpha


_pivotX ​

ts
_pivotX: number;

定义于: armature/Slot.ts:212

Internal

继承自 ​

Slot._pivotX


_pivotY ​

ts
_pivotY: number;

定义于: armature/Slot.ts:216

Internal

继承自 ​

Slot._pivotY


_slotData ​

ts
_slotData: SlotData;

定义于: armature/Slot.ts:233

Internal

继承自 ​

Slot._slotData


_verticesDirty ​

ts
_verticesDirty: boolean;

定义于: armature/Slot.ts:194

Internal

继承自 ​

Slot._verticesDirty


_zIndex ​

ts
_zIndex: number;

定义于: armature/Slot.ts:208

Internal

继承自 ​

Slot._zIndex


_zOrder ​

ts
_zOrder: number;

定义于: armature/Slot.ts:204

Internal

继承自 ​

Slot._zOrder


displayController ​

ts
displayController: string;

定义于: armature/Slot.ts:179

显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。

默认值 ​

ts
null

继承自 ​

Slot.displayController


global ​

ts
readonly global: Transform;

定义于: armature/TransformObject.ts:56

相对于骨架坐标系的变换。

继承自 ​

Slot.global


globalTransformMatrix ​

ts
readonly globalTransformMatrix: Matrix;

定义于: armature/TransformObject.ts:47

相对于骨架坐标系的矩阵。

继承自 ​

Slot.globalTransformMatrix


hashCode ​

ts
readonly hashCode: number;

定义于: core/BaseObject.ts:156

分配给此实例的唯一标识号。

继承自 ​

Slot.hashCode


offset ​

ts
readonly offset: Transform;

定义于: armature/TransformObject.ts:65

相对于骨架或父骨骼坐标系的偏移变换。

继承自 ​

Slot.offset

访问器 ​

armature ​

Getter 签名 ​

ts
get armature(): Armature;

定义于: armature/TransformObject.ts:129

所属的骨架。

返回 ​

Armature

继承自 ​

Slot.armature


boundingBoxData ​

Getter 签名 ​

ts
get boundingBoxData(): BoundingBoxData;

定义于: armature/Slot.ts:1156

插槽此时的自定义包围盒数据。

返回 ​

BoundingBoxData

继承自 ​

Slot.boundingBoxData


childArmature ​

Getter 签名 ​

ts
get childArmature(): Armature;

定义于: armature/Slot.ts:1215

插槽此时显示的子骨架。 注意,被替换的对象或子骨架并不会被回收,根据语言和引擎的不同,需要额外处理。

示例 ​
ts
    let slot = armature.getSlot("weapon");
    let prevChildArmature = slot.childArmature;
    if (prevChildArmature) {
        prevChildArmature.dispose();
    }
    slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
返回 ​

Armature

Setter 签名 ​

ts
set childArmature(value: Armature): void;

定义于: armature/Slot.ts:1218

参数 ​
参数类型
valueArmature
返回 ​

void

继承自 ​

Slot.childArmature


display ​

Getter 签名 ​

ts
get display(): any;

定义于: armature/Slot.ts:1183

插槽此时显示的显示对象。

示例 ​
ts
    let slot = armature.getSlot("text");
    slot.display = new yourEngine.TextField();
返回 ​

any

Setter 签名 ​

ts
set display(value: any): void;

定义于: armature/Slot.ts:1186

参数 ​
参数类型
valueany
返回 ​

void

继承自 ​

Slot.display


displayFrameCount ​

Setter 签名 ​

ts
set displayFrameCount(value: number): void;

定义于: armature/Slot.ts:1067

参数 ​
参数类型
valuenumber
返回 ​

void

继承自 ​

Slot.displayFrameCount


displayIndex ​

Getter 签名 ​

ts
get displayIndex(): number;

定义于: armature/Slot.ts:1098

此时显示的显示对象在显示列表中的索引。

示例 ​
ts
    let slot = armature.getSlot("weapon");
    slot.displayIndex = 3;
    slot.displayController = "none";
返回 ​

number

Setter 签名 ​

ts
set displayIndex(value: number): void;

定义于: armature/Slot.ts:1101

参数 ​
参数类型
valuenumber
返回 ​

void

继承自 ​

Slot.displayIndex


displayList ​

Getter 签名 ​

ts
get displayList(): any[];

定义于: armature/Slot.ts:1123

包含显示对象或子骨架的显示列表。

返回 ​

any[]

Setter 签名 ​

ts
set displayList(value: any[]): void;

定义于: armature/Slot.ts:1131

参数 ​
参数类型
valueany[]
返回 ​

void

继承自 ​

Slot.displayList


name ​

Getter 签名 ​

ts
get name(): string;

定义于: armature/Slot.ts:1113

插槽名称。

返回 ​

string

继承自 ​

Slot.name


parent ​

Getter 签名 ​

ts
get parent(): Bone;

定义于: armature/Slot.ts:1232

所属的父骨骼。

返回 ​

Bone

继承自 ​

Slot.parent


slotData ​

Getter 签名 ​

ts
get slotData(): SlotData;

定义于: armature/Slot.ts:1146

插槽数据。

返回 ​

SlotData

继承自 ​

Slot.slotData


visible ​

Getter 签名 ​

ts
get visible(): boolean;

定义于: armature/Slot.ts:1050

插槽的显示对象的可见。

默认值 ​
ts
true
返回 ​

boolean

Setter 签名 ​

ts
set visible(value: boolean): void;

定义于: armature/Slot.ts:1053

参数 ​
参数类型
valueboolean
返回 ​

void

继承自 ​

Slot.visible

方法 ​

_isBonesUpdate() ​

ts
_isBonesUpdate(): boolean;

定义于: armature/Slot.ts:358

Internal

返回 ​

boolean

继承自 ​

Slot._isBonesUpdate


_setColor() ​

ts
_setColor(value: ColorTransform): boolean;

定义于: armature/Slot.ts:627

Internal

参数 ​

参数类型
valueColorTransform

返回 ​

boolean

继承自 ​

Slot._setColor


_setDisplayIndex() ​

ts
_setDisplayIndex(value: number, isAnimation: boolean): void;

定义于: armature/Slot.ts:594

Internal

参数 ​

参数类型默认值
valuenumberundefined
isAnimationbooleanfalse

返回 ​

void

继承自 ​

Slot._setDisplayIndex


_setZOrder() ​

ts
_setZOrder(value: number): boolean;

定义于: armature/Slot.ts:614

Internal

参数 ​

参数类型
valuenumber

返回 ​

boolean

继承自 ​

Slot._setZOrder


_updateAlpha() ​

ts
_updateAlpha(): void;

定义于: armature/Slot.ts:370

Internal

返回 ​

void

继承自 ​

Slot._updateAlpha


_updateVisible() ​

ts
_updateVisible(): void;

定义于: pixi/PixiSlot.ts:97

Internal

返回 ​

void

重写了 ​

Slot._updateVisible


containsPoint() ​

ts
containsPoint(x: number, y: number): boolean;

定义于: armature/Slot.ts:933

检查特定点是否在插槽的自定义边界框内。 点的坐标系为骨架内坐标系。 自定义边界框需要在 DragonBones Pro 中自定义。

参数 ​

参数类型描述
xnumber点的水平坐标。
ynumber点的垂直坐标。

返回 ​

boolean

继承自 ​

Slot.containsPoint


getDisplay() ​

ts
getDisplay(): any;

定义于: armature/Slot.ts:1243

已废弃,请参考 #display。

返回 ​

any

已被弃用 ​

继承自 ​

Slot.getDisplay


init() ​

ts
init(
   slotData: SlotData, 
   armatureValue: Armature, 
   rawDisplay: any, 
   meshDisplay: any): void;

定义于: armature/Slot.ts:635

Internal

参数 ​

参数类型
slotDataSlotData
armatureValueArmature
rawDisplayany
meshDisplayany

返回 ​

void

继承自 ​

Slot.init


intersectsSegment() ​

ts
intersectsSegment(
   xA: number, 
   yA: number, 
   xB: number, 
   yB: number, 
   intersectionPointA: object, 
   intersectionPointB: object, 
   normalRadians: object): number;

定义于: armature/Slot.ts:981

检查特定线段是否与插槽的自定义边界框相交。 线段和交点的坐标系均为骨架内坐标系。 自定义边界框需要在 DragonBones Pro 中自定义。

参数 ​

参数类型默认值描述
xAnumberundefined线段起点的水平坐标。
yAnumberundefined线段起点的垂直坐标。
xBnumberundefined线段终点的水平坐标。
yBnumberundefined线段终点的垂直坐标。
intersectionPointA{ x: number; y: number; }null线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
intersectionPointA.xnumberundefined-
intersectionPointA.ynumberundefined-
intersectionPointB{ x: number; y: number; }null线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
intersectionPointB.xnumberundefined-
intersectionPointB.ynumberundefined-
normalRadians{ x: number; y: number; }null交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
normalRadians.xnumberundefined-
normalRadians.ynumberundefined-

返回 ​

number

相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]

继承自 ​

Slot.intersectsSegment


invalidUpdate() ​

ts
invalidUpdate(): void;

定义于: armature/Slot.ts:788

强制插槽在下一帧更新显示对象的状态。

返回 ​

void

继承自 ​

Slot.invalidUpdate


returnToPool() ​

ts
returnToPool(): void;

定义于: core/BaseObject.ts:167

清除该实例的所有数据并将其返还对象池。

返回 ​

void

继承自 ​

Slot.returnToPool


setDisplay() ​

ts
setDisplay(value: any): void;

定义于: armature/Slot.ts:1253

已废弃,请参考 #display。

参数 ​

参数类型
valueany

返回 ​

void

已被弃用 ​

继承自 ​

Slot.setDisplay


update() ​

ts
update(cacheFrameIndex: number): void;

定义于: armature/Slot.ts:674

Internal

参数 ​

参数类型
cacheFrameIndexnumber

返回 ​

void

继承自 ​

Slot.update


updateGlobalTransform() ​

ts
updateGlobalTransform(): void;

定义于: armature/TransformObject.ts:116

出于性能的考虑,骨骼或插槽的 #global 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。 使用此方法可以保证访问到 #global 属性中正确的旋转或缩放。

返回 ​

void

示例 ​

ts
    bone.updateGlobalTransform();
    let rotation = bone.global.rotation;

继承自 ​

Slot.updateGlobalTransform


borrowObject() ​

ts
static borrowObject<T>(objectConstructor: () => T): T;

定义于: core/BaseObject.ts:136

从对象池中获取特定类的实例。

类型参数 ​

类型参数
T extends BaseObject

参数 ​

参数类型描述
objectConstructor() => T特定的类。

返回 ​

T

继承自 ​

Slot.borrowObject


clearPool() ​

ts
static clearPool(objectConstructor: typeof BaseObject): void;

定义于: core/BaseObject.ts:111

清除特定对象池的缓存实例。

参数 ​

参数类型默认值描述
objectConstructortypeof BaseObjectnull特定的类。 (不设置则清除所有缓存的实例)

返回 ​

void

继承自 ​

Slot.clearPool


setMaxCount() ​

ts
static setMaxCount(objectConstructor: typeof BaseObject, maxCount: number): void;

定义于: core/BaseObject.ts:72

设置特定对象池的最大缓存数量。

参数 ​

参数类型描述
objectConstructortypeof BaseObject特定的类。 (不设置则设置所有对象池的最大缓存数量)
maxCountnumber最大缓存数量。

返回 ​

void

继承自 ​

Slot.setMaxCount


toString() ​

ts
static toString(): string;

定义于: pixi/PixiSlot.ts:39

返回 ​

string

重写了 ​

Slot.toString

Released under the MIT License.