dragonbones-pixijs
Version:
DragonBones runtime for pixi v8
357 lines (356 loc) • 11.6 kB
TypeScript
import { BaseObject } from "../core/BaseObject";
import { BlendMode } from "../core/DragonBones";
import { ColorTransform } from "../geom/ColorTransform";
import { Matrix } from "../geom/Matrix";
import { SlotData } from "../model/ArmatureData";
import { BoundingBoxData } from "../model/BoundingBoxData";
import { DisplayData, GeometryData } from "../model/DisplayData";
import { TextureData } from "../model/TextureAtlasData";
import { Armature } from "./Armature";
import { Bone } from "./Bone";
import { TransformObject } from "./TransformObject";
/**
* @private
*/
export declare class DisplayFrame extends BaseObject {
static toString(): string;
rawDisplayData: DisplayData | null;
displayData: DisplayData | null;
textureData: TextureData | null;
display: any | Armature | null;
readonly deformVertices: Array<number>;
protected _onClear(): void;
updateDeformVertices(): void;
getGeometryData(): GeometryData | null;
getBoundingBox(): BoundingBoxData | null;
getTextureData(): TextureData | null;
}
/**
* - The slot attached to the armature, controls the display status and properties of the display object.
* A bone can contain multiple slots.
* A slot can contain multiple display objects, displaying only one of the display objects at a time,
* but you can toggle the display object into frame animation while the animation is playing.
* The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
* and a custom other display object.
* @see dragonBones.Armature
* @see dragonBones.Bone
* @see dragonBones.SlotData
* @version DragonBones 3.0
* @language en_US
*/
export declare abstract class Slot extends TransformObject {
/**
* - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
* @default null
* @see dragonBones.AnimationState#displayControl
* @see dragonBones.AnimationState#name
* @see dragonBones.AnimationState#group
* @version DragonBones 4.5
* @language en_US
*/
displayController: string | null;
protected _displayDataDirty: boolean;
protected _displayDirty: boolean;
protected _geometryDirty: boolean;
protected _textureDirty: boolean;
protected _visibleDirty: boolean;
protected _blendModeDirty: boolean;
protected _zOrderDirty: boolean;
/**
* @internal
*/
_colorDirty: boolean;
/**
* @internal
*/
_verticesDirty: boolean;
protected _transformDirty: boolean;
protected _visible: boolean;
protected _blendMode: BlendMode;
protected _displayIndex: number;
protected _animationDisplayIndex: number;
protected _cachedFrameIndex: number;
/**
* @internal
*/
_zOrder: number;
/**
* @internal
*/
_zIndex: number;
/**
* @internal
*/
_pivotX: number;
/**
* @internal
*/
_pivotY: number;
protected readonly _localMatrix: Matrix;
/**
* @internal
*/
readonly _colorTransform: ColorTransform;
/**
* @internal
*/
readonly _displayFrames: Array<DisplayFrame>;
/**
* @internal
*/
readonly _geometryBones: Array<Bone | null>;
/**
* @internal
*/
_slotData: SlotData;
/**
* @internal
*/
_displayFrame: DisplayFrame | null;
/**
* @internal
*/
_geometryData: GeometryData | null;
protected _boundingBoxData: BoundingBoxData | null;
protected _textureData: TextureData | null;
protected _rawDisplay: any;
protected _meshDisplay: any;
protected _display: any | null;
protected _childArmature: Armature | null;
/**
* @private
*/
protected _parent: Bone;
/**
* @internal
*/
_cachedFrameIndices: Array<number> | null;
protected _onClear(): void;
protected abstract _initDisplay(value: any, isRetain: boolean): void;
protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
protected abstract _onUpdateDisplay(): void;
protected abstract _addDisplay(): void;
protected abstract _replaceDisplay(value: any): void;
protected abstract _removeDisplay(): void;
protected abstract _updateZOrder(): void;
/**
* @internal
*/
abstract _updateVisible(): void;
protected abstract _updateBlendMode(): void;
protected abstract _updateColor(): void;
protected abstract _updateFrame(): void;
protected abstract _updateMesh(): void;
protected abstract _updateTransform(): void;
protected abstract _identityTransform(): void;
protected _hasDisplay(display: any): boolean;
/**
* @internal
*/
_isBonesUpdate(): boolean;
/**
* @internal
*/
_updateAlpha(): void;
protected _updateDisplayData(): void;
protected _updateDisplay(): void;
protected _updateGlobalTransformMatrix(isCache: boolean): void;
/**
* @internal
*/
_setDisplayIndex(value: number, isAnimation?: boolean): void;
/**
* @internal
*/
_setZOrder(value: number): boolean;
/**
* @internal
*/
_setColor(value: ColorTransform): boolean;
/**
* @internal
*/
init(slotData: SlotData, armatureValue: Armature, rawDisplay: any, meshDisplay: any): void;
/**
* @internal
*/
update(cacheFrameIndex: number): void;
/**
* - Forces the slot to update the state of the display object in the next frame.
* @version DragonBones 4.5
* @language en_US
*/
invalidUpdate(): void;
/**
* @private
*/
updateTransformAndMatrix(): void;
/**
* @private
*/
replaceRawDisplayData(displayData: DisplayData | null, index?: number): void;
/**
* @private
*/
replaceDisplayData(displayData: DisplayData | null, index?: number): void;
/**
* @private
*/
replaceTextureData(textureData: TextureData | null, index?: number): void;
/**
* @private
*/
replaceDisplay(value: any | Armature | null, index?: number): void;
/**
* - Check whether a specific point is inside a custom bounding box in the slot.
* The coordinate system of the point is the inner coordinate system of the armature.
* Custom bounding boxes need to be customized in Dragonbones Pro.
* @param x - The horizontal coordinate of the point.
* @param y - The vertical coordinate of the point.
* @version DragonBones 5.0
* @language en_US
*/
containsPoint(x: number, y: number): boolean;
/**
* - Check whether a specific segment intersects a custom bounding box for the slot.
* The coordinate system of the segment and intersection is the inner coordinate system of the armature.
* Custom bounding boxes need to be customized in Dragonbones Pro.
* @param xA - The horizontal coordinate of the beginning of the segment.
* @param yA - The vertical coordinate of the beginning of the segment.
* @param xB - The horizontal coordinate of the end point of the segment.
* @param yB - The vertical coordinate of the end point of the segment.
* @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
* @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
* @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
* @returns Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections]
* @version DragonBones 5.0
* @language en_US
*/
intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
x: number;
y: number;
} | null, intersectionPointB?: {
x: number;
y: number;
} | null, normalRadians?: {
x: number;
y: number;
} | null): number;
/**
* @private
*/
getDisplayFrameAt(index: number): DisplayFrame;
/**
* - The visible of slot's display object.
* @default true
* @version DragonBones 5.6
* @language en_US
*/
/**
* - 插槽的显示对象的可见。
* @default true
* @version DragonBones 5.6
* @language zh_CN
*/
get visible(): boolean;
set visible(value: boolean);
/**
* @private
*/
get displayFrameCount(): number;
set displayFrameCount(value: number);
/**
* - The index of the display object displayed in the display list.
* @example
* <pre>
* let slot = armature.getSlot("weapon");
* slot.displayIndex = 3;
* slot.displayController = "none";
* </pre>
* @version DragonBones 4.5
* @language en_US
*/
get displayIndex(): number;
set displayIndex(value: number);
/**
* - The slot name.
* @see dragonBones.SlotData#name
* @version DragonBones 3.0
* @language en_US
*/
get name(): string;
/**
* - Contains a display list of display objects or child armatures.
* @version DragonBones 3.0
* @language en_US
*/
get displayList(): Array<any>;
set displayList(value: Array<any>);
/**
* - The slot data.
* @see dragonBones.SlotData
* @version DragonBones 4.5
* @language en_US
*/
get slotData(): SlotData;
/**
* - The custom bounding box data for the slot at current time.
* @version DragonBones 5.0
* @language en_US
*/
get boundingBoxData(): BoundingBoxData | null;
/**
* @private
*/
get rawDisplay(): any;
/**
* @private
*/
get meshDisplay(): any;
/**
* - The display object that the slot displays at this time.
* @example
* <pre>
* let slot = armature.getSlot("text");
* slot.display = new yourEngine.TextField();
* </pre>
* @version DragonBones 3.0
* @language en_US
*/
get display(): any;
set display(value: any);
/**
* - The child armature that the slot displayed at current time.
* @example
* <pre>
* let slot = armature.getSlot("weapon");
* let prevChildArmature = slot.childArmature;
* if (prevChildArmature) {
* prevChildArmature.dispose();
* }
* slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
* </pre>
* @version DragonBones 3.0
* @language en_US
*/
get childArmature(): Armature | null;
set childArmature(value: Armature | null);
/**
* - The parent bone to which it belongs.
* @version DragonBones 3.0
* @language en_US
*/
get parent(): Bone;
/**
* - Deprecated, please refer to {@link #display}.
* @deprecated
* @language en_US
*/
getDisplay(): any;
/**
* - Deprecated, please refer to {@link #display}.
* @deprecated
* @language en_US
*/
setDisplay(value: any): void;
}