UNPKG

dragonbones-runtime

Version:

the tools to build dragonbones file for diffrent framework

131 lines (128 loc) 4.54 kB
/** * The MIT License (MIT) * * Copyright (c) 2012-2017 DragonBones team and other contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace dragonBones { /** * @inheritDoc */ export class HiloArmatureDisplay extends Hilo.Container implements IArmatureProxy { /** * @private */ public debugDraw: boolean = false; private _debugDraw: boolean = false; private _armature: Armature = null as any; /** * @inheritDoc */ public dbInit(armature: Armature): void { this._armature = armature; } /** * @inheritDoc */ public dbClear(): void { this._armature = null as any; } /** * @private */ public dbUpdate(): void { const drawed = DragonBones.debugDraw || this.debugDraw; if (drawed || this._debugDraw) { } else { } } /** * @inheritDoc */ public dispose(disposeProxy: boolean = true): void { // tslint:disable-next-line:no-unused-expression disposeProxy; if (this._armature !== null) { this._armature.dispose(); this._armature = null as any; } } /** * @private */ public dispatchDBEvent(type: EventStringType, eventObject: EventObject): void { this.fire(type, eventObject); } /** * @inheritDoc */ public hasDBEventListener(type: EventStringType): boolean { const listeners = (this as any)._listeners; // return listeners && type in listeners; } /** * Hilo can not support listener target. * @inheritDoc */ public addDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void { // tslint:disable-next-line:no-unused-expression target; this.on(type, listener, false); } /** * Hilo can not support listener target. * @inheritDoc */ public removeDBEventListener(type: EventStringType, listener: (event: EventObject) => void, target: any): void { // tslint:disable-next-line:no-unused-expression target; this.off(type, listener); } /** * @inheritDoc */ public get armature(): Armature { return this._armature; } /** * @inheritDoc */ public get animation(): Animation { return this._armature.animation; } /** * @inheritDoc */ public hasEvent(type: EventStringType): boolean { return this.hasDBEventListener(type); } /** * @inheritDoc */ public addEvent(type: EventStringType, listener: (event: EventObject) => void, target: any): void { this.addDBEventListener(type, listener, target); } /** * @inheritDoc */ public removeEvent(type: EventStringType, listener: (event: EventObject) => void, target: any): void { this.removeDBEventListener(type, listener, target); } } }