mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 11:31:59 +08:00
0d7c5c8f56
* move `cocos/core/scene-graph` to `cocos/scene-graph` * move some files in `cocos/core/components` to `cocos/scene-graph`: - component.ts - component-event-handler.ts - component-event-handler-schema.ts * move some files in `cocos/core/components` to `cocos/misc`: - missing-script.ts - model-renderer.ts - renderer.ts - camera-component.ts * move `cocos/core/components/system.ts` to ``cocos/core/system.ts``
118 lines
2.9 KiB
TypeScript
118 lines
2.9 KiB
TypeScript
import { ccclass, serializable } from 'cc.decorator';
|
|
import { EditorExtendable } from '../../core/data/editor-extendable';
|
|
import type { Node } from '../../scene-graph';
|
|
import { CLASS_NAME_PREFIX_ANIM } from '../define';
|
|
|
|
@ccclass(`${CLASS_NAME_PREFIX_ANIM}EmbeddedPlayer`)
|
|
export class EmbeddedPlayer extends EditorExtendable {
|
|
/**
|
|
* @en
|
|
* Begin time, in seconds.
|
|
* @zh
|
|
* 开始时间,以秒为单位。
|
|
*/
|
|
@serializable
|
|
public begin = 0.0;
|
|
|
|
/**
|
|
* @en
|
|
* End time, in seconds.
|
|
* @zh
|
|
* 结束时间,以秒为单位。
|
|
*/
|
|
@serializable
|
|
public end = 0.0;
|
|
|
|
/**
|
|
* @en
|
|
* Whether the speed of this embedded player should be reconciled with the host animation clip.
|
|
* @zh
|
|
* 子区域的播放速度是否应和宿主动画剪辑保持一致。
|
|
*/
|
|
@serializable
|
|
public reconciledSpeed = false;
|
|
|
|
/**
|
|
* @en
|
|
* Player of the embedded player.
|
|
* @zh
|
|
* 子区域的播放器。
|
|
*/
|
|
@serializable
|
|
public playable: EmbeddedPlayable | null = null;
|
|
}
|
|
|
|
export abstract class EmbeddedPlayable {
|
|
/**
|
|
* @en
|
|
* Instantiates this sub region.
|
|
* @zh
|
|
* 实例化此子区域。
|
|
* @param root The root node of animation context.
|
|
* @internal
|
|
*/
|
|
public abstract instantiate(root: Node): EmbeddedPlayableState | null;
|
|
}
|
|
|
|
export abstract class EmbeddedPlayableState {
|
|
constructor (randomAccess: boolean) {
|
|
this._randomAccess = randomAccess;
|
|
}
|
|
|
|
/**
|
|
* @zh
|
|
* 是否可以随意调整此播放器到任何时间。
|
|
* @en
|
|
* Indicates if this player can be adjusted to any time.
|
|
*/
|
|
public get randomAccess () {
|
|
return this._randomAccess;
|
|
}
|
|
|
|
/**
|
|
* @zh
|
|
* 销毁此播放器。
|
|
* @zh
|
|
* Destroys this player state.
|
|
*/
|
|
public abstract destroy (): void;
|
|
|
|
/**
|
|
* @zh
|
|
* 该方法在此播放器开始播放时触发。
|
|
* @en
|
|
* This method is called when this player gets to play.
|
|
*/
|
|
public abstract play(): void;
|
|
|
|
/**
|
|
* @zh
|
|
* 该方法在此播放器暂停播放时触发。
|
|
* @en
|
|
* This method is called when this player pauses.
|
|
*/
|
|
public abstract pause(): void;
|
|
|
|
/**
|
|
* @zh
|
|
* 该方法在此播放器结束播放时触发,或在宿主动画剪辑本身停止播放时触发。
|
|
* @en
|
|
* This method is called when this player ends its playback, and is called when the host animation clip is stopped.
|
|
*/
|
|
public abstract stop(): void;
|
|
|
|
/**
|
|
* @zh
|
|
* 如果 [[`EmbeddedPlayer.reconciledSpeed`]] 为 `true`,则在宿主的播放速度改变时触发。
|
|
* @en
|
|
* If [[`EmbeddedPlayer.reconciledSpeed`]] is `true`, is called when the host changes its speed.
|
|
* @param speed The speed.
|
|
*/
|
|
public abstract setSpeed(speed: number): void;
|
|
|
|
public setTime (_time: number) {
|
|
}
|
|
|
|
private declare _randomAccess: boolean;
|
|
}
|