fix:编辑器文件导入. add:example,runtime
This commit is contained in:
		
							
								
								
									
										195
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										195
									
								
								README.md
									
									
									
									
									
								
							@@ -2,21 +2,92 @@
 | 
			
		||||
一个用于Cocos Creator的可视化动画状态机编辑器。<br/>
 | 
			
		||||
编辑器地址:https://leeyip.github.io/cocos-animator/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 目录
 | 
			
		||||
- [前言](#preface)
 | 
			
		||||
- [项目结构](#project)
 | 
			
		||||
- [状态机编辑器](#editor)
 | 
			
		||||
    - [总览](#editor1)
 | 
			
		||||
    - [状态机视图](#editor2)
 | 
			
		||||
    - [Parameters](#editor3)
 | 
			
		||||
    - [Inspector](#editor4)
 | 
			
		||||
    - [数据导入与导出](#editor5)
 | 
			
		||||
    - [导出的数据格式](#json)
 | 
			
		||||
- [Runtime](#runtime)
 | 
			
		||||
- [Example](#example)
 | 
			
		||||
- [注意点](#warning)
 | 
			
		||||
- [参考资料](#reference)
 | 
			
		||||
 | 
			
		||||
## 前言
 | 
			
		||||
 | 
			
		||||
## 使用
 | 
			
		||||
## <a id="preface"></a>前言
 | 
			
		||||
当动画数量较多且转换规则复杂的时候,手动编写代码去处理转换逻辑会非常痛苦。用过Unity的话,都知道Unity的Animator Controller能可视化地编辑状态机,在一定程度上减轻了手写逻辑的痛苦,但是Cocos Creator目前没有提供这种便利的工具,于是便有了这个项目。<br/>
 | 
			
		||||
动手之前,在网上看到已经有人做了一个这种工具<sup>[[1]](#reference1)</sup>,但离我想要的效果差了一点,以及runtime的实现也有一些问题,同时我也希望能随时根据需求自由更改功能,于是便用Cocos Creator另写了一个状态机编辑器,runtime的实现也在他的基础上进行了修改。
 | 
			
		||||
 | 
			
		||||
## 注意点
 | 
			
		||||
- 参数名、子状态机名、状态名都不可重名
 | 
			
		||||
- trigger与Unity中trigger逻辑相同;autoTrigger与trigger类似,但每次状态机内部逻辑更新之后都会自动reset
 | 
			
		||||
- 状态机组件update会优先执行,添加了@executionOrder(-1000) 
 | 
			
		||||
- 当transition未勾选hasExitTime以及没有添加任何condition时,transition会被忽略
 | 
			
		||||
- Parameters和Inspector两个界面如果内容超出,使用鼠标滚轮滚动,因为为了防止与拖拽行为产生冲突,触摸事件已被屏蔽
 | 
			
		||||
 | 
			
		||||
## 数据格式
 | 
			
		||||
### 1. 编辑器工程数据格式
 | 
			
		||||
## <a id="project"></a>项目结构
 | 
			
		||||
- animator-editor:状态机编辑器项目源码,使用CocosCreator2.2.2实现
 | 
			
		||||
- animator-runtime:解析状态机的runtime源码,里面两个目录分别用于CocosCreator2.x的项目与3.0项目
 | 
			
		||||
- examples:用CocosCreator2.2.2与3.0rc写的简单例子
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## <a id="editor"></a>状态机编辑器
 | 
			
		||||
操作基本和Unity Animator类似</br>
 | 
			
		||||
 | 
			
		||||
#### <a id="editor1"></a>**总览**</br>
 | 
			
		||||
编辑器界面分为三个部分
 | 
			
		||||
</br>
 | 
			
		||||
- 左侧用于编辑状态机参数,参数分为number、boolean、trigger、auto trigger四种类型。
 | 
			
		||||
- 中间用于编辑状态、子状态机以及状态之间的连线关系,上侧的导航栏用于表示当视图状态机的层级关系,BaseLayer为根状态机。
 | 
			
		||||
- 右侧用于编辑状态与状态转换连线的数据。
 | 
			
		||||
 | 
			
		||||
#### <a id="editor2"></a>**状态机视图**</br>
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
</br>
 | 
			
		||||
- 操作方式:
 | 
			
		||||
    - 鼠标滚轮可缩放以及拖动视图
 | 
			
		||||
    - 鼠标右键空白处可选择生成状态或子状态机节点
 | 
			
		||||
    - 鼠标右键状态可选择生成状态转换连线、设置默认状态、删除
 | 
			
		||||
    - 鼠标左键按住状态拖动到状态机上出现加号,即可将状态丢入状态机内
 | 
			
		||||
    - 鼠标右键子状态机可选择删除
 | 
			
		||||
    - 鼠标双击子状态机可进入子状态机视图
 | 
			
		||||
    - 鼠标左键选中状态、子状态机、连线时均可用delete键删除
 | 
			
		||||
    - 鼠标左键可以拉伸调节Parameters和Inspector两个界面宽度
 | 
			
		||||
    - 有上下双向箭头的地方是可拖拽排序的列表
 | 
			
		||||
- 状态:用矩形表示,橙色为默认状态,是整个状态机运行的入口。AnyState是一种殊的状态,用于指代任意状态,仅能由AnyState将连线指向其余状态,无法将连线指向AnyState。
 | 
			
		||||
- 子状态机:用六边形表示,内部包含默认状态则显示为橙色,名字中带有(up)的状态机为当前视图的父状态机。
 | 
			
		||||
 | 
			
		||||
#### <a id="editor3"></a>**Parameters**</br>
 | 
			
		||||
用于编辑状态机参数,可填写初始值表示状态机开始运行时的参数状态
 | 
			
		||||
- **number** 数字输入框
 | 
			
		||||
- **boolean** 方形勾选框
 | 
			
		||||
- **trigger** 圆形勾选框,与Unity中trigger表现一致,内部是一个boolean,在满足包含trigger条件的状态转换时会自动resetTrigger
 | 
			
		||||
- **auto trigger** 菱形勾选框,在满足状态转换时以及每帧状态机逻辑更新时都会自动reset为false
 | 
			
		||||
 | 
			
		||||
#### <a id="editor4"></a>**Inspector**</br>
 | 
			
		||||
用于编辑状态以及连线数据</br>
 | 
			
		||||
- **Name**--状态/状态机名</br>
 | 
			
		||||
- **Motion**--状态对应的动画名</br>
 | 
			
		||||
- **Speed**--动画播放速度</br>
 | 
			
		||||
- **Multiplier**--动画播放速度混合的number类型参数</br>
 | 
			
		||||
- **Loop**--动画是否循环播放</br>
 | 
			
		||||
- **Transitions**(连线数据):
 | 
			
		||||
    - 记录状态间的转换关系(当前状态->目标状态)
 | 
			
		||||
    - **优先级**:同一个状态有多个transition的情况下,优先满足哪一个就先转向对应的目标状态,若同时满足多个transition,则以列表中从上往下的排序决定优先级(选中状态时才可以拖拽排序)
 | 
			
		||||
    - **Has Exit Time**打勾则表示会等待动画播放结束才能转向下一状态
 | 
			
		||||
    - **Conditions**(转换条件):所有条件都是逻辑与的关系,必须同时满足所选择的逻辑关系(若勾选了Has Exit Time,还需等待动画播放完毕)才能转向下一状态
 | 
			
		||||
 | 
			
		||||
#### <a id="editor5"></a>**数据导入与导出**
 | 
			
		||||
- 导出数据
 | 
			
		||||
    - **ctrl+s**--导出状态机编辑器工程文件(此文件记录了编辑器与runtime所需的所有数据,此文件必须保存好)
 | 
			
		||||
    - **ctrl+e**--仅导出runtime所需的数据文件
 | 
			
		||||
- 导入数据
 | 
			
		||||
    - 将ctrl+s所保存文件拖入状态机编辑器内将还原整个状态机视图
 | 
			
		||||
    - cocos creator的animation文件、spine的json文件、dragonbones的json文件均可拖入状态机编辑器内自动生成对应的状态节点
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
#### <a id="json"></a>导出的数据格式
 | 
			
		||||
- 状态机编辑器工程数据格式
 | 
			
		||||
```
 | 
			
		||||
{
 | 
			
		||||
    /** 编辑器版本号 */
 | 
			
		||||
@@ -120,7 +191,7 @@
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 2. runtime解析所需的数据格式
 | 
			
		||||
- runtime解析所需的数据格式
 | 
			
		||||
```
 | 
			
		||||
{
 | 
			
		||||
    parameters: [
 | 
			
		||||
@@ -170,3 +241,105 @@
 | 
			
		||||
    ];
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## <a id="runtime"></a>Runtime
 | 
			
		||||
只要将对应版本的runtime整个文件夹丢入项目中即可使用。</br>
 | 
			
		||||
core中是runtime的核心实现,而AnimatorAnimation、AnimatorSpine、AnimatorDragonBones、AnimatorCustomization是用于与节点绑定的cc.Component脚本,分别用于不同类型的动画。</br>
 | 
			
		||||
- **Animator脚本组件 API**
 | 
			
		||||
    - **onInit** 手动初始化状态机
 | 
			
		||||
    - **manualUpdate** 手动调用更新
 | 
			
		||||
    - **setBool** 设置boolean类型参数的值
 | 
			
		||||
    - **getBool** 获取boolean类型参数的值
 | 
			
		||||
    - **setNumber** 设置number类型参数的值
 | 
			
		||||
    - **getNumber** 获取number类型参数的值
 | 
			
		||||
    - **setTrigger** 设置trigger类型参数的值
 | 
			
		||||
    - **resetTrigger** 重置trigger类型参数的值
 | 
			
		||||
    - **autoTrigger** 设置autoTrigger类型参数的值
 | 
			
		||||
    - **play** 无视条件直接跳转状态
 | 
			
		||||
    - **curStateName** 当前状态名
 | 
			
		||||
    - **curStateMotion** 当前动画名
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## <a id="example"></a>Example
 | 
			
		||||
</br>
 | 
			
		||||
- **AssetRawUrl** 拖入状态机编辑器导出的文件(两种文件均可,但ctrl+e导出的文件更小)
 | 
			
		||||
- **PlayOnStart** 如果勾选则自动初始化状态机,否则需要主动调用onInit去初始化
 | 
			
		||||
- **AutoUpdate** 如果勾选则自动每帧更新状态机逻辑,否则需要主动调用manualUpdate去更新
 | 
			
		||||
 | 
			
		||||
#### 绑定脚本后只需要在对应的点设置参数值,就可以靠参数去驱动状态机进行状态转换了
 | 
			
		||||
```
 | 
			
		||||
this.Animator.setNumber('speed', this.speed);
 | 
			
		||||
this.Animator.setTrigger('hit');
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 执行以下操作时必须取消勾选PlayOnStart,主动调用onInit去初始化,onInit可传入0-3个不同类型的参数,传参不需要区分先后顺序
 | 
			
		||||
1. 如果需要每个状态都有单独的逻辑回调(onEntry、onUpdate、onExit)
 | 
			
		||||
```
 | 
			
		||||
// 单个状态的逻辑控制类
 | 
			
		||||
export default class SheepIdle extends AnimatorStateLogic {
 | 
			
		||||
    public onEntry() {
 | 
			
		||||
        cc.log('idle entry');
 | 
			
		||||
    }
 | 
			
		||||
    public onUpdate() {
 | 
			
		||||
        cc.log('idle update');
 | 
			
		||||
    }
 | 
			
		||||
    public onExit() {
 | 
			
		||||
        cc.log('idle exit');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
```
 | 
			
		||||
let map: Map<string, AnimatorStateLogic> = new Map();
 | 
			
		||||
map.set('sheep_idle', new SheepIdle());
 | 
			
		||||
map.set('sheep_run', new SheepRun());
 | 
			
		||||
map.set('sheep_hit', new SheepHit(this));
 | 
			
		||||
this.Animator.onInit(map);
 | 
			
		||||
```
 | 
			
		||||
2. 如果需要监听状态切换
 | 
			
		||||
```
 | 
			
		||||
this.Animator.onInit((fromState: string, toState: string) => {
 | 
			
		||||
    cc.log(`state change: ${fromState} -> ${toState}`);
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
3. 如果使用自定义的方式播放动画(AnimatorCustomization)
 | 
			
		||||
```
 | 
			
		||||
/**
 | 
			
		||||
 * 自定义控制动画播放的接口
 | 
			
		||||
 */
 | 
			
		||||
export interface AnimationPlayer {
 | 
			
		||||
    /** 设置动画播放结束的回调 */
 | 
			
		||||
    setFinishedCallback(callback: () => void, target: any): void;
 | 
			
		||||
    /** 播放动画 */
 | 
			
		||||
    playAnimation(animName: string, loop: boolean): void;
 | 
			
		||||
    /** 缩放动画播放速率 */
 | 
			
		||||
    scaleTime(scale: number): void;
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
```
 | 
			
		||||
this.Animator.onInit(AnimationPlayer);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### 如果需要使用spine在不同的trackindex播放动画,可以用AnimatorSpine和AnimatorSpineSecondary挂在同一个spine节点上实现并行状态机
 | 
			
		||||
</br>
 | 
			
		||||
AnimatorSpine为主状态机,trackindex为0,负责播放walk、run、jump三个动画</br>
 | 
			
		||||
AnimatorSpineSecondary为次状态机,trackindex为1,负责播放shoot动画</br>
 | 
			
		||||
编辑好两个不同的状态机,运行时便可将实现播放别的动画的同时开枪</br>
 | 
			
		||||
</br>
 | 
			
		||||
**ps:但实际项目中如果需要使用并行状态机往往比这会复杂很多,很可能需要你自行修改runtime的实现**
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## <a id="warning"></a>注意点
 | 
			
		||||
#### 首先,虽然名为动画状态机,但实际上把动画剥离开,仅仅用作一个纯粹的逻辑上的状态机也是没有问题的,只需要编辑状态机时不填入动画名(Motion),然后调用onInit传入逻辑控制参数即可。
 | 
			
		||||
- 参数名、子状态机名、状态名都不可重名
 | 
			
		||||
- 目前不支持状态转向自身
 | 
			
		||||
- Parameters和Inspector两个界面如果内容超出,请使用鼠标滚轮滚动,因为为了防止与拖拽行为产生冲突,触摸事件已被屏蔽
 | 
			
		||||
- 当未勾选Has Exit Time以及没有添加任何condition时,此transition会被忽略
 | 
			
		||||
- 状态机组件添加了@executionOrder(-1000) 
 | 
			
		||||
- spine的动画播放速度完全由主状态机控制
 | 
			
		||||
- 由于cocos中spine的setCompleteListener内部实现问题,每次调用会直接覆盖之前的回调,所以如果需要监听动画播完,请使用AnimatorSpine中addCompleteListener等api
 | 
			
		||||
- 目前不支持动画混合,例如调用spine的setMix会影响动画结束(Has Exit Time)的判定,所以如果需要做spine、dragonbones、cocos animation这些动画混合都需要自行处理
 | 
			
		||||
 | 
			
		||||
## <a id="reference"></a>参考资料
 | 
			
		||||
1. <a id="reference1"></a>https://blog.csdn.net/vikingsc2007_1/article/details/81070029
 | 
			
		||||
2. https://docs.unity3d.com/2018.4/Documentation/Manual/AnimatorControllers.html
 | 
			
		||||
 
 | 
			
		||||
@@ -553,14 +553,32 @@ export default class FsmCtr extends cc.Component {
 | 
			
		||||
     * 导入cocos animation文件
 | 
			
		||||
     */
 | 
			
		||||
    public importAnim(animData: any) {
 | 
			
		||||
        let x = Tool.randFloat(-this.MachineLayer.node.x - 100, -this.MachineLayer.node.x + 100);
 | 
			
		||||
        let y = Tool.randFloat(-this.MachineLayer.node.y - 100, -this.MachineLayer.node.y + 100);
 | 
			
		||||
        let unitState = this.MachineLayer.createState(cc.v2(x, y));
 | 
			
		||||
        let state: State = unitState.state;
 | 
			
		||||
        state.name = animData._name;
 | 
			
		||||
        state.motion = animData._name;
 | 
			
		||||
        state.speed = animData.speed;
 | 
			
		||||
        state.loop = animData.wrapMode === cc.WrapMode.Loop;
 | 
			
		||||
        if (animData instanceof Array) {
 | 
			
		||||
            // 3.0 anim文件
 | 
			
		||||
            animData.forEach((data) => {
 | 
			
		||||
                if (!data.hasOwnProperty('_name')) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                let x = Tool.randFloat(-this.MachineLayer.node.x - 100, -this.MachineLayer.node.x + 100);
 | 
			
		||||
                let y = Tool.randFloat(-this.MachineLayer.node.y - 100, -this.MachineLayer.node.y + 100);
 | 
			
		||||
                let unitState = this.MachineLayer.createState(cc.v2(x, y));
 | 
			
		||||
                let state: State = unitState.state;
 | 
			
		||||
                state.name = data._name;
 | 
			
		||||
                state.motion = data._name;
 | 
			
		||||
                state.speed = data.speed;
 | 
			
		||||
                state.loop = data.wrapMode === cc.WrapMode.Loop;
 | 
			
		||||
            });
 | 
			
		||||
        } else {
 | 
			
		||||
            // 2.x anim文件
 | 
			
		||||
            let x = Tool.randFloat(-this.MachineLayer.node.x - 100, -this.MachineLayer.node.x + 100);
 | 
			
		||||
            let y = Tool.randFloat(-this.MachineLayer.node.y - 100, -this.MachineLayer.node.y + 100);
 | 
			
		||||
            let unitState = this.MachineLayer.createState(cc.v2(x, y));
 | 
			
		||||
            let state: State = unitState.state;
 | 
			
		||||
            state.name = animData._name;
 | 
			
		||||
            state.motion = animData._name;
 | 
			
		||||
            state.speed = animData.speed;
 | 
			
		||||
            state.loop = animData.wrapMode === cc.WrapMode.Loop;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ export default class Main extends cc.Component {
 | 
			
		||||
                this.resetEditor();
 | 
			
		||||
                this._editor.Parameters.import(data.parameters);
 | 
			
		||||
                this._editor.Fsm.importProject(data);
 | 
			
		||||
            } else if (data.skeleton && data.animations) {
 | 
			
		||||
            } else if (data.animations) {
 | 
			
		||||
                // 读取spine文件
 | 
			
		||||
                this._editor.Fsm.improtSpine(data);
 | 
			
		||||
            } else if (data.armature) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,29 +0,0 @@
 | 
			
		||||
// import AnimatorBase from "./lib/AnimatorBase";
 | 
			
		||||
 | 
			
		||||
// const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
// /** DragonBones状态机组件 */
 | 
			
		||||
// @ccclass
 | 
			
		||||
// @requireComponent(dragonBones.ArmatureDisplay)
 | 
			
		||||
// export default class AnimatorDragonBones extends AnimatorBase {
 | 
			
		||||
// 	/** DragonBones组件 */
 | 
			
		||||
// 	private _dragonBones: dragonBones.ArmatureDisplay = null;
 | 
			
		||||
 | 
			
		||||
// 	protected start() {
 | 
			
		||||
// 		this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
 | 
			
		||||
// 		if (this.AssetRawUrl !== null) {
 | 
			
		||||
// 			this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
// 		}
 | 
			
		||||
 | 
			
		||||
// 		this._dragonBones.addEventListener(dragonBones.EventObject.COMPLETE, this.onAnimFinished, this);
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	public playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
// 		this._dragonBones.playAnimation(animName, loop ? 0 : -1);
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	public scaleTime(scale: number) {
 | 
			
		||||
// 		if (scale > 0)
 | 
			
		||||
// 			this._dragonBones.timeScale = scale;
 | 
			
		||||
// 	}
 | 
			
		||||
// }
 | 
			
		||||
@@ -1,45 +0,0 @@
 | 
			
		||||
// import AnimatorBase from "./lib/AnimatorBase";
 | 
			
		||||
 | 
			
		||||
// const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
// /** Spine状态机组件 */
 | 
			
		||||
// @ccclass
 | 
			
		||||
// @requireComponent(sp.Skeleton)
 | 
			
		||||
// export default class AnimatorSpine extends AnimatorBase {
 | 
			
		||||
// 	spine: sp.Skeleton = null;
 | 
			
		||||
// 	listeners: Array<Function>;
 | 
			
		||||
 | 
			
		||||
// 	protected start(): void {
 | 
			
		||||
// 		this.listeners = new Array<Function>();
 | 
			
		||||
// 		this.spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
// 		if (this.AssetRawUrl !== null) {
 | 
			
		||||
// 			this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
// 		}
 | 
			
		||||
 | 
			
		||||
// 		this.spine.setCompleteListener(this.spineAniStateEvent.bind(this));
 | 
			
		||||
// 		this.spine.setEventListener(this.spineAniEvent.bind(this));
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	private spineAniStateEvent(obj, trackIndex, type, event, loopCount): void {
 | 
			
		||||
// 		this._animatorController.onAnimationComplete();
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	private spineAniEvent(track, event): void {
 | 
			
		||||
// 		for (let i = 0; i < this.listeners.length; i++) {
 | 
			
		||||
// 			this.listeners[i](track, event);
 | 
			
		||||
// 		}
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	public addEventListener(cb: Function): void {
 | 
			
		||||
// 		this.listeners.push(cb);
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	public playAnimation(aniName: string, loop: boolean): void {
 | 
			
		||||
// 		this.spine.setAnimation(0, aniName, loop);
 | 
			
		||||
// 	}
 | 
			
		||||
 | 
			
		||||
// 	public scaleTime(scale: number): void {
 | 
			
		||||
// 		if (scale > 0)
 | 
			
		||||
// 			this.spine.timeScale = scale;
 | 
			
		||||
// 	}
 | 
			
		||||
// }
 | 
			
		||||
@@ -1,26 +1,31 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** Animation状态机组件 */
 | 
			
		||||
/** 
 | 
			
		||||
 * Cocos Animation状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(cc.Animation)
 | 
			
		||||
export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
    /** Animation组件 */
 | 
			
		||||
    private _animation: cc.Animation = null;
 | 
			
		||||
    /** 当前的动画实例 */
 | 
			
		||||
    private _animState: cc.AnimationState = null;
 | 
			
		||||
    /** 记录初始的wrapmode */
 | 
			
		||||
    private _wrapModeMap: Map<cc.AnimationState, cc.WrapMode> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected onLoad() {
 | 
			
		||||
        if (!this.PlayOnLoad || this._hasInit) {
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(cc.Animation);
 | 
			
		||||
        this._animation.on("finished", this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on("lastframe", this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
@@ -35,7 +40,7 @@ export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnLoad || this._hasInit) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
@@ -43,8 +48,8 @@ export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(cc.Animation);
 | 
			
		||||
        this._animation.on("finished", this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on("lastframe", this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
@@ -58,8 +63,18 @@ export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (!animName) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._animState = this._animation.play(animName);
 | 
			
		||||
        this._animState.wrapMode = loop ? cc.WrapMode.Loop : cc.WrapMode.Default;
 | 
			
		||||
        if (!this._animState) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!this._wrapModeMap.has(this._animState)) {
 | 
			
		||||
            this._wrapModeMap.set(this._animState, this._animState.wrapMode);
 | 
			
		||||
        }
 | 
			
		||||
        this._animState.wrapMode = loop ? cc.WrapMode.Loop : this._wrapModeMap.get(this._animState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -68,7 +83,8 @@ export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (scale > 0 && this._animState)
 | 
			
		||||
        if (this._animState) {
 | 
			
		||||
            this._animState.speed = scale;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +1,18 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 纸娃娃系统状态机组件 */
 | 
			
		||||
/** 
 | 
			
		||||
 * 自定义动画控制的状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
export default class AnimatorAvatar extends AnimatorBase {
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
export default class AnimatorCustomization extends AnimatorBase {
 | 
			
		||||
    /** 此组件必须主动调用onInit初始化 */
 | 
			
		||||
    @property({ override: true, visible: false })
 | 
			
		||||
    protected PlayOnStart: boolean = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
@@ -33,7 +40,7 @@ export default class AnimatorAvatar extends AnimatorBase {
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (this._animationPlayer) {
 | 
			
		||||
        if (this._animationPlayer && animName) {
 | 
			
		||||
            this._animationPlayer.playAnimation(animName, loop);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
							
								
								
									
										71
									
								
								animator-runtime/animator2.x/AnimatorDragonBones.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								animator-runtime/animator2.x/AnimatorDragonBones.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * DragonBones状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(dragonBones.ArmatureDisplay)
 | 
			
		||||
export default class AnimatorDragonBones extends AnimatorBase {
 | 
			
		||||
    /** DragonBones组件 */
 | 
			
		||||
    private _dragonBones: dragonBones.ArmatureDisplay = null;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
 | 
			
		||||
        this._dragonBones.addEventListener(dragonBones.EventObject.COMPLETE, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
 | 
			
		||||
        this._dragonBones.addEventListener(dragonBones.EventObject.COMPLETE, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        animName && this._dragonBones.playAnimation(animName, loop ? 0 : -1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        this._dragonBones.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										120
									
								
								animator-runtime/animator2.x/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								animator-runtime/animator2.x/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,120 @@
 | 
			
		||||
import AnimatorSpineSecondary from "./AnimatorSpineSecondary";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(主状态机),trackIndex为0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpine extends AnimatorBase {
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null;
 | 
			
		||||
    /** 动画完成的回调 */
 | 
			
		||||
    private _completeListenerMap: Map<(entry?: any) => void, any> = new Map();
 | 
			
		||||
    /** 次状态机注册的回调 */
 | 
			
		||||
    private _secondaryListenerMap: Map<(entry?: any) => void, AnimatorSpineSecondary> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private onSpineComplete(entry: any) {
 | 
			
		||||
        entry.trackIndex === 0 && this.onAnimFinished();
 | 
			
		||||
        this._completeListenerMap.forEach((target, cb) => { target ? cb.call(target, entry) : cb(entry); });
 | 
			
		||||
        this._secondaryListenerMap.forEach((target, cb) => { entry.trackIndex === target.TrackIndex && cb.call(target, entry); });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(0, animName, loop);
 | 
			
		||||
        } else {
 | 
			
		||||
            this._spine.clearTrack(0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        this._spine.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册次状态机动画结束的回调(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public addSecondaryListener(cb: (entry?: any) => void, target: AnimatorSpineSecondary) {
 | 
			
		||||
        this._secondaryListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册动画完成时的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     * @param target 调用回调的this对象
 | 
			
		||||
     */
 | 
			
		||||
    public addCompleteListener(cb: (entry?: any) => void, target: any = null) {
 | 
			
		||||
        if (this._completeListenerMap.has(cb)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._completeListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注销动画完成的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     */
 | 
			
		||||
    public removeCompleteListener(cb: (entry?: any) => void) {
 | 
			
		||||
        this._completeListenerMap.delete(cb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 清空动画完成的监听
 | 
			
		||||
     */
 | 
			
		||||
    public clearCompleteListener() {
 | 
			
		||||
        this._completeListenerMap.clear;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										72
									
								
								animator-runtime/animator2.x/AnimatorSpineSecondary.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								animator-runtime/animator2.x/AnimatorSpineSecondary.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
import AnimatorSpine from "./AnimatorSpine";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(次状态机),同一节点可添加多个,用于在不同track中播放动画,trackIndex必须大于0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpineSecondary extends AnimatorBase {
 | 
			
		||||
    @property({ tooltip: CC_DEV && '动画播放的trackIndex,必须大于0' }) TrackIndex: number = 1;
 | 
			
		||||
 | 
			
		||||
    /** 主状态机 */
 | 
			
		||||
    private _main: AnimatorSpine = null;
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine);
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine);
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(this.TrackIndex, animName, loop); 
 | 
			
		||||
         } else {
 | 
			
		||||
             this._spine.clearTrack(this.TrackIndex);
 | 
			
		||||
         }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -9,7 +9,7 @@ const { ccclass, property, executionOrder } = cc._decorator;
 | 
			
		||||
 */
 | 
			
		||||
export interface AnimationPlayer {
 | 
			
		||||
    /** 设置动画播放结束的回调 */
 | 
			
		||||
    setFinishedCallback(callback: (event: cc.Event.EventCustom) => void, target?: any): void;
 | 
			
		||||
    setFinishedCallback(callback: () => void, target: any): void;
 | 
			
		||||
    /** 播放动画 */
 | 
			
		||||
    playAnimation(animName: string, loop: boolean): void;
 | 
			
		||||
    /** 缩放动画播放速率 */
 | 
			
		||||
@@ -25,8 +25,8 @@ export default class AnimatorBase extends cc.Component {
 | 
			
		||||
    @property({ type: cc.JsonAsset, tooltip: CC_DEV && '状态机json文件' })
 | 
			
		||||
    protected AssetRawUrl: cc.JsonAsset = null;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: CC_DEV && '是否在onLoad中自动启动状态机' })
 | 
			
		||||
    protected PlayOnLoad: boolean = true;
 | 
			
		||||
    @property({ tooltip: CC_DEV && '是否在start中自动启动状态机' })
 | 
			
		||||
    protected PlayOnStart: boolean = true;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: CC_DEV && '是否在update中自动触发状态机逻辑更新' })
 | 
			
		||||
    protected AutoUpdate: boolean = true;
 | 
			
		||||
@@ -43,10 +43,11 @@ export default class AnimatorBase extends cc.Component {
 | 
			
		||||
    /** 自定义的动画播放控制器 */
 | 
			
		||||
    protected _animationPlayer: AnimationPlayer = null;
 | 
			
		||||
 | 
			
		||||
    /** 当前状态名 */
 | 
			
		||||
    public get curStateName(): string {
 | 
			
		||||
        return this._ac.curState.name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 当前动画名 */
 | 
			
		||||
    public get curStateMotion(): string {
 | 
			
		||||
        return this._ac.curState.motion;
 | 
			
		||||
    }
 | 
			
		||||
@@ -150,9 +151,7 @@ export default class AnimatorBase extends cc.Component {
 | 
			
		||||
     * 状态切换时的逻辑(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public onStateChange(fromState: AnimatorState, toState: AnimatorState) {
 | 
			
		||||
        if (toState.motion && toState.motion !== "") {
 | 
			
		||||
            this.playAnimation(toState.motion, toState.loop);
 | 
			
		||||
        }
 | 
			
		||||
        this.playAnimation(toState.motion, toState.loop);
 | 
			
		||||
 | 
			
		||||
        let fromStateName = fromState ? fromState.name : '';
 | 
			
		||||
 | 
			
		||||
@@ -77,6 +77,7 @@ export default class AnimatorController {
 | 
			
		||||
    public onAnimationComplete() {
 | 
			
		||||
        this.animComplete = true;
 | 
			
		||||
        this.animCompleteState = this._curState;
 | 
			
		||||
        // cc.log(`animation complete: ${this._curState.name}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -36,7 +36,7 @@ export default class AnimatorState {
 | 
			
		||||
 | 
			
		||||
        for (let i = 0; i < data.transitions.length; i++) {
 | 
			
		||||
            let transition: AnimatorTransition = new AnimatorTransition(data.transitions[i], ac);
 | 
			
		||||
            transition.isValid && this._transitions.push(transition);
 | 
			
		||||
            transition.isValid() && this._transitions.push(transition);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -2,9 +2,6 @@
 | 
			
		||||
 * 状态逻辑基类
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorStateLogic {
 | 
			
		||||
    constructor() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 进入状态时调用
 | 
			
		||||
     * @virtual
 | 
			
		||||
							
								
								
									
										92
									
								
								animator-runtime/animator3.x/AnimatorAnimation.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								animator-runtime/animator3.x/AnimatorAnimation.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
			
		||||
import { Animation, AnimationState, _decorator, __private } from "cc";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Cocos Animation状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(Animation)
 | 
			
		||||
export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
    /** Animation组件 */
 | 
			
		||||
    private _animation: Animation = null!;
 | 
			
		||||
    /** 当前的动画实例 */
 | 
			
		||||
    private _animState: AnimationState = null!;
 | 
			
		||||
    /** 记录初始的wrapmode */
 | 
			
		||||
    private _wrapModeMap: Map<AnimationState, number> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(Animation)!;
 | 
			
		||||
        this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(Animation)!;
 | 
			
		||||
        this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (!animName) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._animation.play(animName);
 | 
			
		||||
        this._animState = this._animation.getState(animName);
 | 
			
		||||
        if (!this._animState) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!this._wrapModeMap.has(this._animState)) {
 | 
			
		||||
            this._wrapModeMap.set(this._animState, this._animState.wrapMode);
 | 
			
		||||
        }
 | 
			
		||||
        this._animState.wrapMode = loop ? 2 : this._wrapModeMap.get(this._animState)!;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (this._animState) {
 | 
			
		||||
            this._animState.speed = scale;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								animator-runtime/animator3.x/AnimatorCustomization.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								animator-runtime/animator3.x/AnimatorCustomization.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
import { _decorator } from "cc";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * 自定义动画控制的状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
export default class AnimatorCustomization extends AnimatorBase {
 | 
			
		||||
    /** 此组件必须主动调用onInit初始化 */
 | 
			
		||||
    @property({ override: true, visible: false })
 | 
			
		||||
    protected PlayOnStart: boolean = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (this._animationPlayer && animName) {
 | 
			
		||||
            this._animationPlayer.playAnimation(animName, loop);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (this._animationPlayer) {
 | 
			
		||||
            this._animationPlayer.scaleTime(scale);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										74
									
								
								animator-runtime/animator3.x/AnimatorDragonBones.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								animator-runtime/animator3.x/AnimatorDragonBones.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
import { dragonBones, _decorator } from "cc";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * DragonBones状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(dragonBones.ArmatureDisplay)
 | 
			
		||||
export default class AnimatorDragonBones extends AnimatorBase {
 | 
			
		||||
    /** DragonBones组件 */
 | 
			
		||||
    private _dragonBones: dragonBones.ArmatureDisplay = null!;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay)!;
 | 
			
		||||
        this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay)!;
 | 
			
		||||
        this._dragonBones.addEventListener('complete', this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName)
 | 
			
		||||
            this._dragonBones.playAnimation(animName, loop ? 0 : -1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (scale > 0)
 | 
			
		||||
            this._dragonBones.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										122
									
								
								animator-runtime/animator3.x/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								animator-runtime/animator3.x/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,122 @@
 | 
			
		||||
import { sp, _decorator } from "cc";
 | 
			
		||||
import AnimatorSpineSecondary from "./AnimatorSpineSecondary";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(主状态机),trackIndex为0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpine extends AnimatorBase {
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null!;
 | 
			
		||||
    /** 动画完成的回调 */
 | 
			
		||||
    private _completeListenerMap: Map<(entry?: any) => void, any> = new Map();
 | 
			
		||||
    /** 次状态机注册的回调 */
 | 
			
		||||
    private _secondaryListenerMap: Map<(entry?: any) => void, AnimatorSpineSecondary> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton)!;
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton)!;
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private onSpineComplete(entry: any) {
 | 
			
		||||
        entry.trackIndex === 0 && this.onAnimFinished();
 | 
			
		||||
        this._completeListenerMap.forEach((target, cb) => { target ? cb.call(target, entry) : cb(entry); });
 | 
			
		||||
        this._secondaryListenerMap.forEach((target, cb) => { entry.trackIndex === target.TrackIndex && cb.call(target, entry); });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(0, animName, loop);
 | 
			
		||||
        } else {
 | 
			
		||||
            this._spine.clearTrack(0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (scale > 0)
 | 
			
		||||
            this._spine.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册次状态机动画结束的回调(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public addSecondaryListener(cb: (entry?: any) => void, target: AnimatorSpineSecondary) {
 | 
			
		||||
        this._secondaryListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册动画完成时的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     * @param target 调用回调的this对象
 | 
			
		||||
     */
 | 
			
		||||
    public addCompleteListener(cb: (entry?: any) => void, target: any = null) {
 | 
			
		||||
        if (this._completeListenerMap.has(cb)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._completeListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注销动画完成的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     */
 | 
			
		||||
    public removeCompleteListener(cb: (entry?: any) => void) {
 | 
			
		||||
        this._completeListenerMap.delete(cb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 清空动画完成的监听
 | 
			
		||||
     */
 | 
			
		||||
    public clearCompleteListener() {
 | 
			
		||||
        this._completeListenerMap.clear;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										73
									
								
								animator-runtime/animator3.x/AnimatorSpineSecondary.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								animator-runtime/animator3.x/AnimatorSpineSecondary.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
import { sp, _decorator } from "cc";
 | 
			
		||||
import AnimatorSpine from "./AnimatorSpine";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent } = _decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(次状态机),同一节点可添加多个,用于在不同track中播放动画,trackIndex必须大于0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpineSecondary extends AnimatorBase {
 | 
			
		||||
    @property({ tooltip: '动画播放的trackIndex,必须大于0' }) TrackIndex: number = 1;
 | 
			
		||||
 | 
			
		||||
    /** 主状态机 */
 | 
			
		||||
    private _main: AnimatorSpine = null!;
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null!;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton)!;
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine)!;
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton)!;
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine)!;
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(this.TrackIndex, animName, loop);
 | 
			
		||||
        } else {
 | 
			
		||||
            this._spine.clearTrack(this.TrackIndex);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										228
									
								
								animator-runtime/animator3.x/core/AnimatorBase.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										228
									
								
								animator-runtime/animator3.x/core/AnimatorBase.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,228 @@
 | 
			
		||||
import { Component, JsonAsset, _decorator } from 'cc';
 | 
			
		||||
import AnimatorController from "./AnimatorController";
 | 
			
		||||
import AnimatorState from "./AnimatorState";
 | 
			
		||||
import AnimatorStateLogic from "./AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, executionOrder } = _decorator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 自定义控制动画播放的接口
 | 
			
		||||
 */
 | 
			
		||||
export interface AnimationPlayer {
 | 
			
		||||
    /** 设置动画播放结束的回调 */
 | 
			
		||||
    setFinishedCallback(callback: () => void, target: any): void;
 | 
			
		||||
    /** 播放动画 */
 | 
			
		||||
    playAnimation(animName: string, loop: boolean): void;
 | 
			
		||||
    /** 缩放动画播放速率 */
 | 
			
		||||
    scaleTime(scale: number): void;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态机组件基类 优先执行生命周期
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@executionOrder(-1000)
 | 
			
		||||
export default class AnimatorBase extends Component {
 | 
			
		||||
    @property({ type: JsonAsset, tooltip: '状态机json文件' })
 | 
			
		||||
    protected AssetRawUrl: JsonAsset = null!;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: '是否在start中自动启动状态机' })
 | 
			
		||||
    protected PlayOnStart: boolean = true;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: '是否在update中自动触发状态机逻辑更新' })
 | 
			
		||||
    protected AutoUpdate: boolean = true;
 | 
			
		||||
 | 
			
		||||
    /** 是否初始化 */
 | 
			
		||||
    protected _hasInit: boolean = false;
 | 
			
		||||
    /** 状态机控制 */
 | 
			
		||||
    protected _ac: AnimatorController = null!;
 | 
			
		||||
 | 
			
		||||
    /** 各个状态逻辑控制,key为状态名 */
 | 
			
		||||
    protected _stateLogicMap: Map<string, AnimatorStateLogic> = null!;
 | 
			
		||||
    /** 状态切换时的回调 */
 | 
			
		||||
    protected _onStateChangeCall: (fromState: string, toState: string) => void = null!;
 | 
			
		||||
    /** 自定义的动画播放控制器 */
 | 
			
		||||
    protected _animationPlayer: AnimationPlayer = null!;
 | 
			
		||||
 | 
			
		||||
    /** 当前状态名 */
 | 
			
		||||
    public get curStateName(): string {
 | 
			
		||||
        return this._ac.curState.name;
 | 
			
		||||
    }
 | 
			
		||||
    /** 当前动画名 */
 | 
			
		||||
    public get curStateMotion(): string {
 | 
			
		||||
        return this._ac.curState.motion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @virtual
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 处理初始化参数
 | 
			
		||||
     */
 | 
			
		||||
    protected initArgs(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        args.forEach((arg) => {
 | 
			
		||||
            if (!arg) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (typeof arg === 'function') {
 | 
			
		||||
                this._onStateChangeCall = arg;
 | 
			
		||||
            } else if (typeof arg === 'object') {
 | 
			
		||||
                if (arg instanceof Map) {
 | 
			
		||||
                    this._stateLogicMap = arg;
 | 
			
		||||
                } else {
 | 
			
		||||
                    this._animationPlayer = arg;
 | 
			
		||||
                    this._animationPlayer.setFinishedCallback(this.onAnimFinished, this);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private updateAnimator() {
 | 
			
		||||
        // 混合当前动画播放速度
 | 
			
		||||
        let playSpeed = this._ac.curState.speed;
 | 
			
		||||
        if (this._ac.curState.multi) {
 | 
			
		||||
            playSpeed *= this._ac.params.getNumber(this._ac.curState.multi) || 1;
 | 
			
		||||
        }
 | 
			
		||||
        this.scaleTime(playSpeed);
 | 
			
		||||
 | 
			
		||||
        // 更新AnimatorStateLogic
 | 
			
		||||
        if (this._stateLogicMap) {
 | 
			
		||||
            let curLogic = this._stateLogicMap.get(this._ac.curState.name);
 | 
			
		||||
            curLogic && curLogic.onUpdate();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 更新状态机逻辑
 | 
			
		||||
        this._ac.updateAnimator();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected update() {
 | 
			
		||||
        if (this._hasInit && this.AutoUpdate) {
 | 
			
		||||
            this.updateAnimator();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动调用更新
 | 
			
		||||
     */
 | 
			
		||||
    public manualUpdate() {
 | 
			
		||||
        if (this._hasInit && !this.AutoUpdate) {
 | 
			
		||||
            this.updateAnimator();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 解析状态机json文件
 | 
			
		||||
     */
 | 
			
		||||
    protected initJson(json: any) {
 | 
			
		||||
        this._ac = new AnimatorController(this, json);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 动画结束的回调
 | 
			
		||||
     */
 | 
			
		||||
    protected onAnimFinished() {
 | 
			
		||||
        this._ac.onAnimationComplete();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @virtual
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @virtual
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 
 | 
			
		||||
     * 状态切换时的逻辑(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public onStateChange(fromState: AnimatorState, toState: AnimatorState) {
 | 
			
		||||
        this.playAnimation(toState.motion, toState.loop);
 | 
			
		||||
 | 
			
		||||
        let fromStateName = fromState ? fromState.name : '';
 | 
			
		||||
 | 
			
		||||
        if (this._stateLogicMap) {
 | 
			
		||||
            let fromLogic = this._stateLogicMap.get(fromStateName);
 | 
			
		||||
            fromLogic && fromLogic.onExit();
 | 
			
		||||
            let toLogic = this._stateLogicMap.get(toState.name);
 | 
			
		||||
            toLogic && toLogic.onEntry();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._onStateChangeCall && this._onStateChangeCall(fromStateName, toState.name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置boolean类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setBool(key: string, value: boolean) {
 | 
			
		||||
        this._ac.params.setBool(key, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取boolean类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public getBool(key: string): boolean {
 | 
			
		||||
        return this._ac.params.getBool(key) !== 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置number类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setNumber(key: string, value: number) {
 | 
			
		||||
        this._ac.params.setNumber(key, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取number类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public getNumber(key: string): number {
 | 
			
		||||
        return this._ac.params.getNumber(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置trigger类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setTrigger(key: string) {
 | 
			
		||||
        this._ac.params.setTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 重置trigger类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public resetTrigger(key: string) {
 | 
			
		||||
        this._ac.params.resetTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置autoTrigger类型参数的值(autoTrigger类型参数不需要主动reset,每次状态机更新结束后会自动reset)
 | 
			
		||||
     */
 | 
			
		||||
    public autoTrigger(key: string) {
 | 
			
		||||
        this._ac.params.autoTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 无视条件直接跳转状态
 | 
			
		||||
     * @param 状态名
 | 
			
		||||
     */
 | 
			
		||||
    public play(stateName: string) {
 | 
			
		||||
        if (!this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._ac.play(stateName);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										82
									
								
								animator-runtime/animator3.x/core/AnimatorCondition.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								animator-runtime/animator3.x/core/AnimatorCondition.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
import { error } from "cc";
 | 
			
		||||
import AnimatorController from "./AnimatorController";
 | 
			
		||||
 | 
			
		||||
/** 参数类型 */
 | 
			
		||||
export enum ParamType {
 | 
			
		||||
    COMPLETE = 0,
 | 
			
		||||
    BOOLEAN = 1,
 | 
			
		||||
    NUMBER = 2,
 | 
			
		||||
    TRIGGER = 3,
 | 
			
		||||
    AUTO_TRIGGER = 4
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 逻辑类型 */
 | 
			
		||||
export enum LogicType {
 | 
			
		||||
    EQUAL = 0,
 | 
			
		||||
    NOTEQUAL = 1,
 | 
			
		||||
    GREATER = 2,
 | 
			
		||||
    LESS = 3,
 | 
			
		||||
    GREATER_EQUAL = 4,
 | 
			
		||||
    LESS_EQUAL = 5
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 单项条件
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorCondition {
 | 
			
		||||
    private _ac: AnimatorController;
 | 
			
		||||
    /** 此条件对应的参数名 */
 | 
			
		||||
    private _param: string = "";
 | 
			
		||||
    /** 此条件对应的值 */
 | 
			
		||||
    private _value: number = 0;
 | 
			
		||||
    /** 此条件与值比较的逻辑 */
 | 
			
		||||
    private _logic: LogicType = LogicType.EQUAL;
 | 
			
		||||
 | 
			
		||||
    constructor(data: any, ac: AnimatorController) {
 | 
			
		||||
        this._ac = ac;
 | 
			
		||||
        this._param = data.param;
 | 
			
		||||
        this._value = data.value;
 | 
			
		||||
        this._logic = data.logic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getParamName() {
 | 
			
		||||
        return this._param;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getParamType(): ParamType {
 | 
			
		||||
        return this._ac.params.getParamType(this._param);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 判断此条件是否满足 */
 | 
			
		||||
    public check(): boolean {
 | 
			
		||||
        let type: ParamType = this.getParamType();
 | 
			
		||||
        if (type === ParamType.BOOLEAN) {
 | 
			
		||||
            return this._ac.params.getBool(this._param) === this._value;
 | 
			
		||||
        } else if (type === ParamType.NUMBER) {
 | 
			
		||||
            let value: number = this._ac.params.getNumber(this._param);
 | 
			
		||||
            switch (this._logic) {
 | 
			
		||||
                case LogicType.EQUAL:
 | 
			
		||||
                    return value === this._value;
 | 
			
		||||
                case LogicType.NOTEQUAL:
 | 
			
		||||
                    return value !== this._value;
 | 
			
		||||
                case LogicType.GREATER:
 | 
			
		||||
                    return value > this._value;
 | 
			
		||||
                case LogicType.LESS:
 | 
			
		||||
                    return value < this._value;
 | 
			
		||||
                case LogicType.GREATER_EQUAL:
 | 
			
		||||
                    return value >= this._value;
 | 
			
		||||
                case LogicType.LESS_EQUAL:
 | 
			
		||||
                    return value <= this._value;
 | 
			
		||||
                default:
 | 
			
		||||
                    return false;
 | 
			
		||||
            }
 | 
			
		||||
        } else if (type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
            return this._ac.params.getAutoTrigger(this._param) !== 0;
 | 
			
		||||
        } else if (type === ParamType.TRIGGER) {
 | 
			
		||||
            return this._ac.params.getTrigger(this._param) !== 0;
 | 
			
		||||
        } else {
 | 
			
		||||
            error(`[AnimatorCondition.check] 错误的type: ${type}`);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										119
									
								
								animator-runtime/animator3.x/core/AnimatorController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								animator-runtime/animator3.x/core/AnimatorController.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
import { error } from "cc";
 | 
			
		||||
import AnimatorBase from "./AnimatorBase";
 | 
			
		||||
import AnimatorParams from "./AnimatorParams";
 | 
			
		||||
import AnimatorState from "./AnimatorState";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态机控制类
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorController {
 | 
			
		||||
    private _jsonData: any = null;
 | 
			
		||||
    private _animator: AnimatorBase = null!;
 | 
			
		||||
 | 
			
		||||
    private _params: AnimatorParams = null!;
 | 
			
		||||
    private _states: Map<string, AnimatorState> = null!;
 | 
			
		||||
    private _anyState: AnimatorState = null!;
 | 
			
		||||
    private _curState: AnimatorState = null!;
 | 
			
		||||
 | 
			
		||||
    /** 状态切换次数 */
 | 
			
		||||
    private _changeCount: number = 0;
 | 
			
		||||
    /** 对应animComplete的状态 */
 | 
			
		||||
    public animCompleteState: AnimatorState = null!;
 | 
			
		||||
    /** 动画播放完毕的标记 */
 | 
			
		||||
    public animComplete: boolean = false;
 | 
			
		||||
    /** 当前运行的状态 */
 | 
			
		||||
    public get curState(): AnimatorState { return this._curState; }
 | 
			
		||||
    public get params(): AnimatorParams { return this._params; }
 | 
			
		||||
 | 
			
		||||
    constructor(player: AnimatorBase, json: any) {
 | 
			
		||||
        this._animator = player;
 | 
			
		||||
        this._jsonData = json;
 | 
			
		||||
        this._states = new Map<string, AnimatorState>();
 | 
			
		||||
        this._params = new AnimatorParams(json.parameters);
 | 
			
		||||
        this.init(json);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 初始化状态机所有动画状态
 | 
			
		||||
     */
 | 
			
		||||
    private init(json: any) {
 | 
			
		||||
        if (json.states.length <= 0) {
 | 
			
		||||
            error(`[AnimatorController.init] 状态机json错误`);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let defaultState: string = json.defaultState;
 | 
			
		||||
        this._anyState = new AnimatorState(json.anyState, this);
 | 
			
		||||
        for (let i = 0; i < json.states.length; i++) {
 | 
			
		||||
            let state: AnimatorState = new AnimatorState(json.states[i], this);
 | 
			
		||||
            this._states.set(state.name, state);
 | 
			
		||||
        }
 | 
			
		||||
        this.changeState(defaultState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private updateState() {
 | 
			
		||||
        this._curState.checkAndTrans();
 | 
			
		||||
        if (this._curState !== this._anyState && this._anyState !== null) {
 | 
			
		||||
            this._anyState.checkAndTrans();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新状态机逻辑
 | 
			
		||||
     */
 | 
			
		||||
    public updateAnimator() {
 | 
			
		||||
        // 重置计数
 | 
			
		||||
        this._changeCount = 0;
 | 
			
		||||
 | 
			
		||||
        this.updateState();
 | 
			
		||||
 | 
			
		||||
        // 重置动画完成标记
 | 
			
		||||
        if (this.animComplete && this.animCompleteState.loop) {
 | 
			
		||||
            this.animComplete = false;
 | 
			
		||||
        }
 | 
			
		||||
        // 重置autoTrigger
 | 
			
		||||
        this.params.resetAllAutoTrigger();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public onAnimationComplete() {
 | 
			
		||||
        this.animComplete = true;
 | 
			
		||||
        this.animCompleteState = this._curState;
 | 
			
		||||
        // cc.log(`animation complete: ${this._curState.name}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 无视条件直接跳转状态
 | 
			
		||||
     * @param 状态名
 | 
			
		||||
     */
 | 
			
		||||
    public play(stateName: string) {
 | 
			
		||||
        if (!this._states.has(stateName) || this._curState.name === stateName) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 重置动画完成标记
 | 
			
		||||
        this.animComplete = false;
 | 
			
		||||
        this.changeState(stateName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 切换动画状态
 | 
			
		||||
     */
 | 
			
		||||
    public changeState(stateName: string) {
 | 
			
		||||
        this._changeCount++;
 | 
			
		||||
        if (this._changeCount > 1000) {
 | 
			
		||||
            error('[AnimatorController.changeState] error: 状态切换递归调用超过1000次,transition设置可能出错!');
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this._states.has(stateName) && (this._curState === null || this._curState.name !== stateName)) {
 | 
			
		||||
            let oldState = this._curState;
 | 
			
		||||
            this._curState = this._states.get(stateName)!;
 | 
			
		||||
 | 
			
		||||
            this._animator.onStateChange(oldState, this._curState);
 | 
			
		||||
 | 
			
		||||
            this.updateState();
 | 
			
		||||
        } else {
 | 
			
		||||
            error(`[AnimatorController.changeState] error state: ${stateName}`);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										121
									
								
								animator-runtime/animator3.x/core/AnimatorParams.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								animator-runtime/animator3.x/core/AnimatorParams.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,121 @@
 | 
			
		||||
import { ParamType } from "./AnimatorCondition";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 参数结构
 | 
			
		||||
 */
 | 
			
		||||
interface Param {
 | 
			
		||||
    type: ParamType;
 | 
			
		||||
    value: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态机参数
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorParams {
 | 
			
		||||
    private _paramMap: Map<string, Param> = new Map();
 | 
			
		||||
 | 
			
		||||
    constructor(dataArr: any[]) {
 | 
			
		||||
        dataArr.forEach((data: any) => {
 | 
			
		||||
            let param: Param = {
 | 
			
		||||
                type: data.type,
 | 
			
		||||
                value: data.init
 | 
			
		||||
            };
 | 
			
		||||
            this._paramMap.set(data.param, param);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getParamType(key: string): ParamType {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param) {
 | 
			
		||||
            return param.type;
 | 
			
		||||
        } else {
 | 
			
		||||
            return null!;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public setNumber(key: string, value: number) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.NUMBER) {
 | 
			
		||||
            param.value = value;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public setBool(key: string, value: boolean) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.BOOLEAN) {
 | 
			
		||||
            param.value = value ? 1 : 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public setTrigger(key: string) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.TRIGGER) {
 | 
			
		||||
            param.value = 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public resetTrigger(key: string) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.TRIGGER) {
 | 
			
		||||
            param.value = 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public autoTrigger(key: string) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
            param.value = 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public resetAutoTrigger(key: string) {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
            param.value = 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public resetAllAutoTrigger() {
 | 
			
		||||
        this._paramMap.forEach((param: Param, key: string) => {
 | 
			
		||||
            if (param.type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
                param.value = 0;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getNumber(key: string): number {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.NUMBER) {
 | 
			
		||||
            return param.value;
 | 
			
		||||
        } else {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getBool(key: string): number {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.BOOLEAN) {
 | 
			
		||||
            return param.value;
 | 
			
		||||
        } else {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getTrigger(key: string): number {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.TRIGGER) {
 | 
			
		||||
            return param.value;
 | 
			
		||||
        } else {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public getAutoTrigger(key: string): number {
 | 
			
		||||
        let param: Param = this._paramMap.get(key)!;
 | 
			
		||||
        if (param && param.type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
            return param.value;
 | 
			
		||||
        } else {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										55
									
								
								animator-runtime/animator3.x/core/AnimatorState.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								animator-runtime/animator3.x/core/AnimatorState.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
import AnimatorController from "./AnimatorController";
 | 
			
		||||
import AnimatorTransition from "./AnimatorTransition";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态管理类
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorState {
 | 
			
		||||
    private _name: string = "";
 | 
			
		||||
    private _motion: string = "";
 | 
			
		||||
    private _loop: boolean = false;
 | 
			
		||||
    private _speed: number = 1;
 | 
			
		||||
    private _multi: string = "";
 | 
			
		||||
 | 
			
		||||
    private _transitions: AnimatorTransition[] = [];
 | 
			
		||||
    private _ac: AnimatorController = null!;
 | 
			
		||||
 | 
			
		||||
    /** 状态名 */
 | 
			
		||||
    public get name() { return this._name; }
 | 
			
		||||
    /** 动画名 */
 | 
			
		||||
    public get motion() { return this._motion; }
 | 
			
		||||
    /** 动画是否循环播放 */
 | 
			
		||||
    public get loop() { return this._loop; }
 | 
			
		||||
    /** 动画播放速度 */
 | 
			
		||||
    public get speed() { return this._speed; }
 | 
			
		||||
    /** 动画播放速度的混合参数 */
 | 
			
		||||
    public get multi() { return this._multi; }
 | 
			
		||||
 | 
			
		||||
    constructor(data: any, ac: AnimatorController) {
 | 
			
		||||
        this._name = data.state;
 | 
			
		||||
        this._motion = data.motion || '';
 | 
			
		||||
        this._loop = data.loop || false;
 | 
			
		||||
        this._speed = data.speed || 1;
 | 
			
		||||
        this._multi = data.multiplier || '';
 | 
			
		||||
 | 
			
		||||
        this._ac = ac;
 | 
			
		||||
 | 
			
		||||
        for (let i = 0; i < data.transitions.length; i++) {
 | 
			
		||||
            let transition: AnimatorTransition = new AnimatorTransition(data.transitions[i], ac);
 | 
			
		||||
            transition.isValid() && this._transitions.push(transition);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断各个分支是否满足条件,满足则转换状态
 | 
			
		||||
     */
 | 
			
		||||
    public checkAndTrans() {
 | 
			
		||||
        for (let i = 0; i < this._transitions.length; i++) {
 | 
			
		||||
            let transition: AnimatorTransition = this._transitions[i];
 | 
			
		||||
            if (transition && transition.check()) {
 | 
			
		||||
                transition.doTrans();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								animator-runtime/animator3.x/core/AnimatorStateLogic.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								animator-runtime/animator3.x/core/AnimatorStateLogic.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 状态逻辑基类
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorStateLogic {
 | 
			
		||||
    /**
 | 
			
		||||
     * 进入状态时调用
 | 
			
		||||
     * @virtual
 | 
			
		||||
     */
 | 
			
		||||
    public onEntry() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 每次状态机逻辑更新时调用
 | 
			
		||||
     * @virtual
 | 
			
		||||
     */
 | 
			
		||||
    public onUpdate() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 离开状态时调用
 | 
			
		||||
     * @virtual
 | 
			
		||||
     */
 | 
			
		||||
    public onExit() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										71
									
								
								animator-runtime/animator3.x/core/AnimatorTransition.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								animator-runtime/animator3.x/core/AnimatorTransition.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,71 @@
 | 
			
		||||
import AnimatorCondition, { ParamType } from "./AnimatorCondition";
 | 
			
		||||
import AnimatorController from "./AnimatorController";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态过渡类
 | 
			
		||||
 */
 | 
			
		||||
export default class AnimatorTransition {
 | 
			
		||||
    private _toStateName: string = '';
 | 
			
		||||
    private _hasExitTime: boolean = false;
 | 
			
		||||
    private _conditions: AnimatorCondition[] = [];
 | 
			
		||||
    private _ac: AnimatorController = null!;
 | 
			
		||||
 | 
			
		||||
    constructor(data: any, ac: AnimatorController) {
 | 
			
		||||
        this._toStateName = data.toState;
 | 
			
		||||
        this._hasExitTime = data.hasExitTime;
 | 
			
		||||
        this._ac = ac;
 | 
			
		||||
        for (let i = 0; i < data.conditions.length; i++) {
 | 
			
		||||
            let condition: AnimatorCondition = new AnimatorCondition(data.conditions[i], ac);
 | 
			
		||||
            this._conditions.push(condition);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回该transition是否有效,当未勾选hasExitTime以及没有添加任何condition时此transition无效并忽略
 | 
			
		||||
     */
 | 
			
		||||
    public isValid(): boolean {
 | 
			
		||||
        return this._hasExitTime || this._conditions.length > 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断是否满足所有转换条件
 | 
			
		||||
     */
 | 
			
		||||
    public check(): boolean {
 | 
			
		||||
        if (this._toStateName === this._ac.curState.name) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this._hasExitTime && (this._ac.curState !== this._ac.animCompleteState || !this._ac.animComplete)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (let i = 0; i < this._conditions.length; i++) {
 | 
			
		||||
            if (!this._conditions[i].check()) {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 转换状态
 | 
			
		||||
     */
 | 
			
		||||
    public doTrans() {
 | 
			
		||||
        // 满足条件时重置动画播完标记
 | 
			
		||||
        if (this._hasExitTime) {
 | 
			
		||||
            this._ac.animComplete = false;
 | 
			
		||||
        }
 | 
			
		||||
        // 满足状态转换条件时重置trigger和autoTrigger
 | 
			
		||||
        for (let i = 0; i < this._conditions.length; i++) {
 | 
			
		||||
            let type = this._conditions[i].getParamType();
 | 
			
		||||
            let name = this._conditions[i].getParamName();
 | 
			
		||||
            if (type === ParamType.TRIGGER) {
 | 
			
		||||
                this._ac.params.resetTrigger(name);
 | 
			
		||||
            } else if (type === ParamType.AUTO_TRIGGER) {
 | 
			
		||||
                this._ac.params.resetAutoTrigger(name);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._ac.changeState(this._toStateName);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										53
									
								
								examples/example2-2-2/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								examples/example2-2-2/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# Fireball Projects
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
/library/
 | 
			
		||||
/temp/
 | 
			
		||||
/local/
 | 
			
		||||
/build/
 | 
			
		||||
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# npm files
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
npm-debug.log
 | 
			
		||||
node_modules/
 | 
			
		||||
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# Logs and databases
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
*.log
 | 
			
		||||
*.sql
 | 
			
		||||
*.sqlite
 | 
			
		||||
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# files for debugger
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
*.sln
 | 
			
		||||
*.csproj
 | 
			
		||||
*.pidb
 | 
			
		||||
*.unityproj
 | 
			
		||||
*.suo
 | 
			
		||||
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# OS generated files
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
.DS_Store
 | 
			
		||||
ehthumbs.db
 | 
			
		||||
Thumbs.db
 | 
			
		||||
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
# WebStorm files
 | 
			
		||||
#/////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
.idea/
 | 
			
		||||
 | 
			
		||||
#//////////////////////////
 | 
			
		||||
# VS Code files
 | 
			
		||||
#//////////////////////////
 | 
			
		||||
 | 
			
		||||
.vscode/
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/res.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/res.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "6f7a4dfa-6f65-4255-aed8-4a2902f84601",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/res/animation.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/res/animation.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "a835cdc7-50a5-416b-8090-4f35d54dfc78",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"animator":"1.0.0","mainStateMachine":{"layerPos":[-68.23754226233478,-21.050174637417967],"layerScale":1.2000000000000002,"anyStatePos":[-300,300],"subStates":["sheep_hit","sheep_idle","sheep_run"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"sheep_idle","anyState":{"transitions":[{"toState":"sheep_hit","hasExitTime":false,"conditions":[{"param":"hit","value":0,"logic":0}]}]},"states":[{"position":[210,60],"upStateMachine":"BaseLayer","state":"sheep_hit","motion":"sheep_hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"sheep_idle","hasExitTime":true,"conditions":[]}]},{"position":[-240,60],"upStateMachine":"BaseLayer","state":"sheep_idle","motion":"sheep_idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_run","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2}]}]},{"position":[-240,-120],"upStateMachine":"BaseLayer","state":"sheep_run","motion":"sheep_run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"hit","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "43806a1f-7be5-4bf1-9477-95e699fea019",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"defaultState":"sheep_idle","anyState":{"transitions":[{"toState":"sheep_hit","hasExitTime":false,"conditions":[{"param":"hit","value":0,"logic":0}]}]},"states":[{"state":"sheep_hit","motion":"sheep_hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"sheep_idle","hasExitTime":true,"conditions":[]}]},{"state":"sheep_idle","motion":"sheep_idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_run","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2}]}]},{"state":"sheep_run","motion":"sheep_run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"sheep_idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"hit","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "eafb4a36-50c1-4417-b90a-234e6a57e0ba",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										191
									
								
								examples/example2-2-2/assets/res/animation/sheep.plist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								examples/example2-2-2/assets/res/animation/sheep.plist
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,191 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
    <dict>
 | 
			
		||||
        <key>frames</key>
 | 
			
		||||
        <dict>
 | 
			
		||||
            <key>sheep_down_0.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{2,2},{224,87}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{0,-25}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{2,61},{224,87}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_down_1.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{326,367},{152,103}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-6,-8}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{32,36},{152,103}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_down_2.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{2,335},{166,105}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-7,-3}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{24,30},{166,105}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_jump_0.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{326,472},{144,151}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-10,0}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <true/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{32,4},{144,151}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_jump_1.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{170,351},{154,131}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-13,2}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{24,12},{154,131}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_jump_2.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{348,260},{160,105}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-10,4}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{24,23},{160,105}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_jump_3.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{2,442},{152,115}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-12,-2}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{26,24},{152,115}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_jump_4.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{360,119},{148,139}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-12,-2}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{28,12},{148,139}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_run_0.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{178,236},{168,113}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-4,0}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{26,23},{168,113}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_run_1.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{182,119},{176,115}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{1,2}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{27,20},{176,115}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_run_2.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{228,2},{178,115}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{1,11}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{26,11},{178,115}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_run_3.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{2,91},{178,113}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{2,1}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{27,22},{178,113}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
            <key>sheep_touch_0.png</key>
 | 
			
		||||
            <dict>
 | 
			
		||||
                <key>frame</key>
 | 
			
		||||
                <string>{{2,206},{174,127}}</string>
 | 
			
		||||
                <key>offset</key>
 | 
			
		||||
                <string>{-5,16}</string>
 | 
			
		||||
                <key>rotated</key>
 | 
			
		||||
                <false/>
 | 
			
		||||
                <key>sourceColorRect</key>
 | 
			
		||||
                <string>{{22,0},{174,127}}</string>
 | 
			
		||||
                <key>sourceSize</key>
 | 
			
		||||
                <string>{228,159}</string>
 | 
			
		||||
            </dict>
 | 
			
		||||
        </dict>
 | 
			
		||||
        <key>metadata</key>
 | 
			
		||||
        <dict>
 | 
			
		||||
            <key>format</key>
 | 
			
		||||
            <integer>2</integer>
 | 
			
		||||
            <key>realTextureFileName</key>
 | 
			
		||||
            <string>sheep.png</string>
 | 
			
		||||
            <key>size</key>
 | 
			
		||||
            <string>{512,1024}</string>
 | 
			
		||||
            <key>smartupdate</key>
 | 
			
		||||
            <string>$TexturePacker:SmartUpdate:a7b82875050232ffbd24deccd7e379b7:847cb78fe45f863139518baf3831526a:13084b924613a7ef2ca9c6df3339651b$</string>
 | 
			
		||||
            <key>textureFileName</key>
 | 
			
		||||
            <string>sheep.png</string>
 | 
			
		||||
        </dict>
 | 
			
		||||
    </dict>
 | 
			
		||||
</plist>
 | 
			
		||||
							
								
								
									
										298
									
								
								examples/example2-2-2/assets/res/animation/sheep.plist.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										298
									
								
								examples/example2-2-2/assets/res/animation/sheep.plist.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,298 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.4",
 | 
			
		||||
  "uuid": "679478cf-f911-402f-9ad6-75649317cc25",
 | 
			
		||||
  "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
  "size": {
 | 
			
		||||
    "width": 512,
 | 
			
		||||
    "height": 1024
 | 
			
		||||
  },
 | 
			
		||||
  "type": "Texture Packer",
 | 
			
		||||
  "subMetas": {
 | 
			
		||||
    "sheep_down_0.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "19964863-36eb-437c-92e1-edff001c640b",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 0,
 | 
			
		||||
      "offsetY": -25,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 2,
 | 
			
		||||
      "width": 224,
 | 
			
		||||
      "height": 87,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_down_1.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "d3dc5491-96af-489a-bd07-94fb66a4d390",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -6,
 | 
			
		||||
      "offsetY": -8,
 | 
			
		||||
      "trimX": 326,
 | 
			
		||||
      "trimY": 367,
 | 
			
		||||
      "width": 152,
 | 
			
		||||
      "height": 103,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_down_2.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "36311098-60f7-4dbd-823f-d4b65bba51ac",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -7,
 | 
			
		||||
      "offsetY": -3,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 335,
 | 
			
		||||
      "width": 166,
 | 
			
		||||
      "height": 105,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_jump_0.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "f99dcc0a-21fe-4a8b-83d4-ae2c6086f2bb",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": true,
 | 
			
		||||
      "offsetX": -10,
 | 
			
		||||
      "offsetY": 0,
 | 
			
		||||
      "trimX": 326,
 | 
			
		||||
      "trimY": 472,
 | 
			
		||||
      "width": 144,
 | 
			
		||||
      "height": 151,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_jump_1.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "b0f22f00-acd5-4281-8237-5a5537be01eb",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -13,
 | 
			
		||||
      "offsetY": 2,
 | 
			
		||||
      "trimX": 170,
 | 
			
		||||
      "trimY": 351,
 | 
			
		||||
      "width": 154,
 | 
			
		||||
      "height": 131,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_jump_2.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "bea82e28-c68e-469e-8a2e-f960bfd6fd83",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -10,
 | 
			
		||||
      "offsetY": 4,
 | 
			
		||||
      "trimX": 348,
 | 
			
		||||
      "trimY": 260,
 | 
			
		||||
      "width": 160,
 | 
			
		||||
      "height": 105,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_jump_3.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "13d1ac9b-9adb-4bc2-94ea-6d5cc86c4576",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -12,
 | 
			
		||||
      "offsetY": -2,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 442,
 | 
			
		||||
      "width": 152,
 | 
			
		||||
      "height": 115,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_jump_4.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "4a35b378-ad2b-46cd-ae2a-52e34773b1e9",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -12,
 | 
			
		||||
      "offsetY": -2,
 | 
			
		||||
      "trimX": 360,
 | 
			
		||||
      "trimY": 119,
 | 
			
		||||
      "width": 148,
 | 
			
		||||
      "height": 139,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_run_0.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "b483caae-e5fd-4067-ac76-bd2b7227af39",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -4,
 | 
			
		||||
      "offsetY": 0,
 | 
			
		||||
      "trimX": 178,
 | 
			
		||||
      "trimY": 236,
 | 
			
		||||
      "width": 168,
 | 
			
		||||
      "height": 113,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_run_1.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "641ca71a-5ade-4f52-a845-9105b17e0d85",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 1,
 | 
			
		||||
      "offsetY": 2,
 | 
			
		||||
      "trimX": 182,
 | 
			
		||||
      "trimY": 119,
 | 
			
		||||
      "width": 176,
 | 
			
		||||
      "height": 115,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_run_2.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "d98cc8d8-8bc1-48e1-a8c1-941df564e02c",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 1,
 | 
			
		||||
      "offsetY": 11,
 | 
			
		||||
      "trimX": 228,
 | 
			
		||||
      "trimY": 2,
 | 
			
		||||
      "width": 178,
 | 
			
		||||
      "height": 115,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_run_3.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "237ec4a7-7729-43d5-90d2-1e5b629aad69",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 2,
 | 
			
		||||
      "offsetY": 1,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 91,
 | 
			
		||||
      "width": 178,
 | 
			
		||||
      "height": 113,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    },
 | 
			
		||||
    "sheep_touch_0.png": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "5d309671-90b5-42bd-b193-4aee80a602d1",
 | 
			
		||||
      "rawTextureUuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -5,
 | 
			
		||||
      "offsetY": 16,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 206,
 | 
			
		||||
      "width": 174,
 | 
			
		||||
      "height": 127,
 | 
			
		||||
      "rawWidth": 228,
 | 
			
		||||
      "rawHeight": 159,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "spriteType": "normal",
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/animation/sheep.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/animation/sheep.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 250 KiB  | 
							
								
								
									
										12
									
								
								examples/example2-2-2/assets/res/animation/sheep.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								examples/example2-2-2/assets/res/animation/sheep.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.3.3",
 | 
			
		||||
  "uuid": "a82bf3f7-5244-411c-b8dc-7b800b3bab3c",
 | 
			
		||||
  "type": "raw",
 | 
			
		||||
  "wrapMode": "clamp",
 | 
			
		||||
  "filterMode": "bilinear",
 | 
			
		||||
  "premultiplyAlpha": false,
 | 
			
		||||
  "genMipmaps": false,
 | 
			
		||||
  "packable": true,
 | 
			
		||||
  "platformSettings": {},
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								examples/example2-2-2/assets/res/animation/sheep_hit.anim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								examples/example2-2-2/assets/res/animation/sheep_hit.anim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
{
 | 
			
		||||
  "__type__": "cc.AnimationClip",
 | 
			
		||||
  "_name": "sheep_hit",
 | 
			
		||||
  "_objFlags": 0,
 | 
			
		||||
  "_native": "",
 | 
			
		||||
  "_duration": 0.5166666666666667,
 | 
			
		||||
  "sample": 60,
 | 
			
		||||
  "speed": 1,
 | 
			
		||||
  "wrapMode": 1,
 | 
			
		||||
  "curveData": {
 | 
			
		||||
    "comps": {
 | 
			
		||||
      "cc.Sprite": {
 | 
			
		||||
        "spriteFrame": [
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "5d309671-90b5-42bd-b193-4aee80a602d1"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.16666666666666666,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "19964863-36eb-437c-92e1-edff001c640b"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.3333333333333333,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "d3dc5491-96af-489a-bd07-94fb66a4d390"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.5,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "36311098-60f7-4dbd-823f-d4b65bba51ac"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "events": []
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.1.0",
 | 
			
		||||
  "uuid": "24d1963d-df84-4647-9b79-6d34ae17a827",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								examples/example2-2-2/assets/res/animation/sheep_idle.anim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								examples/example2-2-2/assets/res/animation/sheep_idle.anim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
{
 | 
			
		||||
  "__type__": "cc.AnimationClip",
 | 
			
		||||
  "_name": "sheep_idle",
 | 
			
		||||
  "_objFlags": 0,
 | 
			
		||||
  "_native": "",
 | 
			
		||||
  "_duration": 0.016666666666666666,
 | 
			
		||||
  "sample": 60,
 | 
			
		||||
  "speed": 1,
 | 
			
		||||
  "wrapMode": 2,
 | 
			
		||||
  "curveData": {
 | 
			
		||||
    "comps": {
 | 
			
		||||
      "cc.Sprite": {
 | 
			
		||||
        "spriteFrame": [
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "36311098-60f7-4dbd-823f-d4b65bba51ac"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "events": []
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.1.0",
 | 
			
		||||
  "uuid": "1a1afca2-6657-476f-a923-411df0b0333d",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								examples/example2-2-2/assets/res/animation/sheep_run.anim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								examples/example2-2-2/assets/res/animation/sheep_run.anim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
{
 | 
			
		||||
  "__type__": "cc.AnimationClip",
 | 
			
		||||
  "_name": "sheep_run",
 | 
			
		||||
  "_objFlags": 0,
 | 
			
		||||
  "_native": "",
 | 
			
		||||
  "_duration": 0.4,
 | 
			
		||||
  "sample": 10,
 | 
			
		||||
  "speed": 1,
 | 
			
		||||
  "wrapMode": 2,
 | 
			
		||||
  "curveData": {
 | 
			
		||||
    "comps": {
 | 
			
		||||
      "cc.Sprite": {
 | 
			
		||||
        "spriteFrame": [
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "b483caae-e5fd-4067-ac76-bd2b7227af39"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.1,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "641ca71a-5ade-4f52-a845-9105b17e0d85"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.2,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "d98cc8d8-8bc1-48e1-a8c1-941df564e02c"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "frame": 0.3,
 | 
			
		||||
            "value": {
 | 
			
		||||
              "__uuid__": "237ec4a7-7729-43d5-90d2-1e5b629aad69"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "props": {}
 | 
			
		||||
  },
 | 
			
		||||
  "events": []
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.1.0",
 | 
			
		||||
  "uuid": "365c3f76-afc4-4db0-ad85-ddb95fa6d4b9",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/res/customization.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/res/customization.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "ffc0c320-212e-4b05-bd56-ca4301c2b20f",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"animator":"1.0.0","mainStateMachine":{"layerPos":[0,0],"layerScale":1,"anyStatePos":[-300,300],"subStates":["idle","move1","move2"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"idle","anyState":{"transitions":[]},"states":[{"position":[-270,0],"upStateMachine":"BaseLayer","state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"move1","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"position":[210,0],"upStateMachine":"BaseLayer","state":"move1","motion":"move1","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"move2","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"position":[-270,-270],"upStateMachine":"BaseLayer","state":"move2","motion":"move2","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]}],"parameters":[{"param":"next","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "95d0a313-ebec-4f2b-8e99-38ae9ecc31ac",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"defaultState":"idle","anyState":{"transitions":[]},"states":[{"state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"move1","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"state":"move1","motion":"move1","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"move2","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"state":"move2","motion":"move2","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":true,"conditions":[{"param":"next","value":0,"logic":0}]}]}],"parameters":[{"param":"next","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "3b43599a-fb1d-45ae-a605-d120f985812e",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/res/dragonBones.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/res/dragonBones.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "4cfae3f8-1706-46d3-826d-203c1b0735b7",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"animator":"1.0.0","mainStateMachine":{"layerPos":[0,0],"layerScale":1,"anyStatePos":[-300,300],"subStates":["idle","walk","aim","hit"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"idle","anyState":{"transitions":[]},"states":[{"position":[-300,60],"upStateMachine":"BaseLayer","state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"walk","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"position":[120,60],"upStateMachine":"BaseLayer","state":"walk","motion":"walk","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"hit","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"position":[-300,-210],"upStateMachine":"BaseLayer","state":"aim","motion":"aim","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"position":[120,-210],"upStateMachine":"BaseLayer","state":"hit","motion":"hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"aim","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]}],"parameters":[{"param":"next","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "701555ab-955e-4125-883e-48e627b3745f",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"defaultState":"idle","anyState":{"transitions":[]},"states":[{"state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"walk","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"state":"walk","motion":"walk","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"hit","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"state":"aim","motion":"aim","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]},{"state":"hit","motion":"hit","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"aim","hasExitTime":false,"conditions":[{"param":"next","value":0,"logic":0}]}]}],"parameters":[{"param":"next","type":3,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "91924927-4ae8-4f46-b31f-53f35fd76b42",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"imagePath":"mecha_1502b_tex.png","width":512,"SubTexture":[{"width":74,"y":93,"height":20,"name":"bullet_01_f/bullet_01","x":307},{"width":48,"y":1,"height":38,"name":"fire_effect_01_f/fireEffect","x":212},{"width":180,"y":430,"height":52,"name":"flame_01_f/ba_bu_flame1","x":1},{"frameX":-2,"frameHeight":234,"y":1,"frameY":0,"frameWidth":86,"width":81,"height":233,"name":"flame_01_f/bbb","x":1},{"width":44,"y":1,"height":39,"name":"mecha_1502b_folder/shouder_l_0","x":319},{"width":29,"y":77,"height":106,"name":"mecha_1502b_folder/foot_l_0","x":434},{"width":50,"y":185,"height":32,"name":"mecha_1502b_folder/thigh_1_l_0","x":434},{"width":122,"y":177,"height":46,"name":"mecha_1502b_folder/calf_l","x":84},{"width":101,"y":118,"height":57,"name":"mecha_1502b_folder/thigh_l","x":84},{"width":41,"y":77,"height":65,"name":"mecha_1502b_folder/pelvis","x":465},{"width":89,"y":236,"height":192,"name":"mecha_1502b_folder/chest","x":1},{"width":29,"y":77,"height":109,"name":"mecha_1502b_folder/foot_r","x":403},{"width":55,"y":1,"height":32,"name":"mecha_1502b_folder/thigh_1_r_1","x":262},{"width":126,"y":1,"height":52,"name":"mecha_1502b_folder/calf_r","x":84},{"width":103,"y":55,"height":61,"name":"mecha_1502b_folder/thigh_r","x":84},{"width":43,"y":144,"height":39,"name":"mecha_1502b_folder/shouder_r_1","x":465},{"width":116,"y":55,"height":44,"name":"weapon_1502b_folder/back_l","x":189},{"frameX":0,"frameHeight":36,"y":39,"frameY":0,"frameWidth":94,"width":93,"height":36,"name":"weapon_1502b_folder/image/paoguan_0002","x":403},{"width":94,"y":1,"height":36,"name":"weapon_1502b_folder/image/paoguan_0001","x":403},{"width":94,"y":55,"height":36,"name":"weapon_1502b_folder/image/paoguan_0003","x":307},{"width":121,"y":118,"height":45,"name":"weapon_1502b_folder/back_r","x":187}],"height":512,"name":"mecha_1502b"}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "2793a939-cf7f-4a69-bc16-d2ed790b67d5",
 | 
			
		||||
  "atlasJson": "{\"imagePath\":\"mecha_1502b_tex.png\",\"width\":512,\"SubTexture\":[{\"width\":74,\"y\":93,\"height\":20,\"name\":\"bullet_01_f/bullet_01\",\"x\":307},{\"width\":48,\"y\":1,\"height\":38,\"name\":\"fire_effect_01_f/fireEffect\",\"x\":212},{\"width\":180,\"y\":430,\"height\":52,\"name\":\"flame_01_f/ba_bu_flame1\",\"x\":1},{\"frameX\":-2,\"frameHeight\":234,\"y\":1,\"frameY\":0,\"frameWidth\":86,\"width\":81,\"height\":233,\"name\":\"flame_01_f/bbb\",\"x\":1},{\"width\":44,\"y\":1,\"height\":39,\"name\":\"mecha_1502b_folder/shouder_l_0\",\"x\":319},{\"width\":29,\"y\":77,\"height\":106,\"name\":\"mecha_1502b_folder/foot_l_0\",\"x\":434},{\"width\":50,\"y\":185,\"height\":32,\"name\":\"mecha_1502b_folder/thigh_1_l_0\",\"x\":434},{\"width\":122,\"y\":177,\"height\":46,\"name\":\"mecha_1502b_folder/calf_l\",\"x\":84},{\"width\":101,\"y\":118,\"height\":57,\"name\":\"mecha_1502b_folder/thigh_l\",\"x\":84},{\"width\":41,\"y\":77,\"height\":65,\"name\":\"mecha_1502b_folder/pelvis\",\"x\":465},{\"width\":89,\"y\":236,\"height\":192,\"name\":\"mecha_1502b_folder/chest\",\"x\":1},{\"width\":29,\"y\":77,\"height\":109,\"name\":\"mecha_1502b_folder/foot_r\",\"x\":403},{\"width\":55,\"y\":1,\"height\":32,\"name\":\"mecha_1502b_folder/thigh_1_r_1\",\"x\":262},{\"width\":126,\"y\":1,\"height\":52,\"name\":\"mecha_1502b_folder/calf_r\",\"x\":84},{\"width\":103,\"y\":55,\"height\":61,\"name\":\"mecha_1502b_folder/thigh_r\",\"x\":84},{\"width\":43,\"y\":144,\"height\":39,\"name\":\"mecha_1502b_folder/shouder_r_1\",\"x\":465},{\"width\":116,\"y\":55,\"height\":44,\"name\":\"weapon_1502b_folder/back_l\",\"x\":189},{\"frameX\":0,\"frameHeight\":36,\"y\":39,\"frameY\":0,\"frameWidth\":94,\"width\":93,\"height\":36,\"name\":\"weapon_1502b_folder/image/paoguan_0002\",\"x\":403},{\"width\":94,\"y\":1,\"height\":36,\"name\":\"weapon_1502b_folder/image/paoguan_0001\",\"x\":403},{\"width\":94,\"y\":55,\"height\":36,\"name\":\"weapon_1502b_folder/image/paoguan_0003\",\"x\":307},{\"width\":121,\"y\":118,\"height\":45,\"name\":\"weapon_1502b_folder/back_r\",\"x\":187}],\"height\":512,\"name\":\"mecha_1502b\"}",
 | 
			
		||||
  "texture": "f9d4e201-c14a-4876-bd8b-e1233a3f5fd8",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/dragonBones/mecha_1502b_tex.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/dragonBones/mecha_1502b_tex.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 186 KiB  | 
@@ -0,0 +1,34 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.3.3",
 | 
			
		||||
  "uuid": "f9d4e201-c14a-4876-bd8b-e1233a3f5fd8",
 | 
			
		||||
  "type": "sprite",
 | 
			
		||||
  "wrapMode": "clamp",
 | 
			
		||||
  "filterMode": "bilinear",
 | 
			
		||||
  "premultiplyAlpha": false,
 | 
			
		||||
  "genMipmaps": false,
 | 
			
		||||
  "packable": true,
 | 
			
		||||
  "platformSettings": {},
 | 
			
		||||
  "subMetas": {
 | 
			
		||||
    "mecha_1502b_tex": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "3e01bc7c-f1ec-4149-ab81-644d53e7e85b",
 | 
			
		||||
      "rawTextureUuid": "f9d4e201-c14a-4876-bd8b-e1233a3f5fd8",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -1.5,
 | 
			
		||||
      "offsetY": 14.5,
 | 
			
		||||
      "trimX": 1,
 | 
			
		||||
      "trimY": 1,
 | 
			
		||||
      "width": 507,
 | 
			
		||||
      "height": 481,
 | 
			
		||||
      "rawWidth": 512,
 | 
			
		||||
      "rawHeight": 512,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/res/spine.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/res/spine.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "b4fb9513-fb6d-4bb2-8b12-be957a6ad7cd",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"animator":"1.0.0","mainStateMachine":{"layerPos":[-39.57449196272348,57.1601385080676],"layerScale":1.4000000000000004,"anyStatePos":[-300,300],"subStates":["idle","walk","run","jump"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"idle","anyState":{"transitions":[]},"states":[{"position":[-270,60],"upStateMachine":"BaseLayer","state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"walk","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2},{"param":"speed","value":2,"logic":3}]},{"toState":"run","hasExitTime":false,"conditions":[{"param":"speed","value":2,"logic":4}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"position":[210,60],"upStateMachine":"BaseLayer","state":"walk","motion":"walk","speed":1,"multiplier":"speed","loop":true,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]},{"toState":"run","hasExitTime":false,"conditions":[{"param":"speed","value":2,"logic":4}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"position":[-270,-150],"upStateMachine":"BaseLayer","state":"run","motion":"run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]},{"toState":"walk","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2},{"param":"speed","value":2,"logic":3}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"position":[210,-270],"upStateMachine":"BaseLayer","state":"jump","motion":"jump","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"jump","type":4,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "acf936e0-be76-4a88-8fa5-98391c31cbc1",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"animator":"1.0.0","mainStateMachine":{"layerPos":[0,0],"layerScale":1,"anyStatePos":[-300,300],"subStates":["empty","shoot"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"empty","anyState":{"transitions":[]},"states":[{"position":[-300,-60],"upStateMachine":"BaseLayer","state":"empty","motion":"","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"shoot","hasExitTime":false,"conditions":[{"param":"shoot","value":0,"logic":0}]}]},{"position":[150,-60],"upStateMachine":"BaseLayer","state":"shoot","motion":"shoot","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"empty","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"shoot","type":4,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "b9fbc4bb-a022-4927-8824-edf4bd30b556",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"defaultState":"idle","anyState":{"transitions":[]},"states":[{"state":"idle","motion":"idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"walk","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2},{"param":"speed","value":2,"logic":3}]},{"toState":"run","hasExitTime":false,"conditions":[{"param":"speed","value":2,"logic":4}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"state":"walk","motion":"walk","speed":1,"multiplier":"speed","loop":true,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]},{"toState":"run","hasExitTime":false,"conditions":[{"param":"speed","value":2,"logic":4}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"state":"run","motion":"run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"idle","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":0}]},{"toState":"walk","hasExitTime":false,"conditions":[{"param":"speed","value":0,"logic":2},{"param":"speed","value":2,"logic":3}]},{"toState":"jump","hasExitTime":false,"conditions":[{"param":"jump","value":0,"logic":0}]}]},{"state":"jump","motion":"jump","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"idle","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"speed","type":2,"init":0},{"param":"jump","type":4,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "a4c4a817-2577-4c9b-94dc-bc6fe12a8ce8",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
{"defaultState":"empty","anyState":{"transitions":[]},"states":[{"state":"empty","motion":"","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"shoot","hasExitTime":false,"conditions":[{"param":"shoot","value":0,"logic":0}]}]},{"state":"shoot","motion":"shoot","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"empty","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"shoot","type":4,"init":0}]}
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.0",
 | 
			
		||||
  "uuid": "b58f7a9d-68b5-440f-896f-ef2d0359382d",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2412
									
								
								examples/example2-2-2/assets/res/spine/spineboy.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2412
									
								
								examples/example2-2-2/assets/res/spine/spineboy.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.2",
 | 
			
		||||
  "uuid": "a5e3714e-7870-4b3a-acf6-1e78ec8b90df",
 | 
			
		||||
  "textures": [
 | 
			
		||||
    "1fca40dd-d252-4f6e-9a11-904e370eab6b"
 | 
			
		||||
  ],
 | 
			
		||||
  "scale": 1,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/spine/spineboy.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								examples/example2-2-2/assets/res/spine/spineboy.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 215 KiB  | 
							
								
								
									
										34
									
								
								examples/example2-2-2/assets/res/spine/spineboy.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								examples/example2-2-2/assets/res/spine/spineboy.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.3.3",
 | 
			
		||||
  "uuid": "1fca40dd-d252-4f6e-9a11-904e370eab6b",
 | 
			
		||||
  "type": "sprite",
 | 
			
		||||
  "wrapMode": "clamp",
 | 
			
		||||
  "filterMode": "bilinear",
 | 
			
		||||
  "premultiplyAlpha": false,
 | 
			
		||||
  "genMipmaps": false,
 | 
			
		||||
  "packable": true,
 | 
			
		||||
  "platformSettings": {},
 | 
			
		||||
  "subMetas": {
 | 
			
		||||
    "spineboy": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "0a9b7c82-adbe-47bb-b9ea-9ef63db25f91",
 | 
			
		||||
      "rawTextureUuid": "1fca40dd-d252-4f6e-9a11-904e370eab6b",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": -11,
 | 
			
		||||
      "offsetY": 6,
 | 
			
		||||
      "trimX": 2,
 | 
			
		||||
      "trimY": 2,
 | 
			
		||||
      "width": 998,
 | 
			
		||||
      "height": 240,
 | 
			
		||||
      "rawWidth": 1024,
 | 
			
		||||
      "rawHeight": 256,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										195
									
								
								examples/example2-2-2/assets/res/spine/spineboy.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								examples/example2-2-2/assets/res/spine/spineboy.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,195 @@
 | 
			
		||||
 | 
			
		||||
spineboy.png
 | 
			
		||||
size:1024,256
 | 
			
		||||
format: RGBA8888
 | 
			
		||||
filter: Linear,Linear
 | 
			
		||||
repeat: none
 | 
			
		||||
eye_indifferent
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 389, 5
 | 
			
		||||
  size: 56, 53
 | 
			
		||||
  orig: 56, 53
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
eye_surprised
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 580, 34
 | 
			
		||||
  size: 56, 53
 | 
			
		||||
  orig: 56, 53
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_bracer
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 732, 85
 | 
			
		||||
  size: 35, 48
 | 
			
		||||
  orig: 35, 48
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_fist_closed
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 556, 91
 | 
			
		||||
  size: 45, 49
 | 
			
		||||
  orig: 45, 49
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_fist_open
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 668, 32
 | 
			
		||||
  size: 52, 52
 | 
			
		||||
  orig: 52, 52
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_foot
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 924, 201
 | 
			
		||||
  size: 76, 41
 | 
			
		||||
  orig: 76, 41
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_foot_bend1
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 845, 200
 | 
			
		||||
  size: 77, 42
 | 
			
		||||
  orig: 77, 42
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_foot_bend2
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 778, 186
 | 
			
		||||
  size: 65, 56
 | 
			
		||||
  orig: 65, 56
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_shin
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 444, 91
 | 
			
		||||
  size: 49, 110
 | 
			
		||||
  orig: 49, 110
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_thigh
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 603, 89
 | 
			
		||||
  size: 29, 67
 | 
			
		||||
  orig: 29, 67
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
front_upper_arm
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 672, 86
 | 
			
		||||
  size: 32, 58
 | 
			
		||||
  orig: 32, 58
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
goggles
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 444, 142
 | 
			
		||||
  size: 157, 100
 | 
			
		||||
  orig: 157, 100
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
gun
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 603, 120
 | 
			
		||||
  size: 126, 122
 | 
			
		||||
  orig: 126, 122
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
head
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 279, 63
 | 
			
		||||
  size: 163, 179
 | 
			
		||||
  orig: 163, 179
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
mouth_grind
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 845, 163
 | 
			
		||||
  size: 56, 35
 | 
			
		||||
  orig: 56, 35
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
mouth_oooo
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 842, 126
 | 
			
		||||
  size: 56, 35
 | 
			
		||||
  orig: 56, 35
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
mouth_smile
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 769, 97
 | 
			
		||||
  size: 56, 35
 | 
			
		||||
  orig: 56, 35
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
muzzle
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 2, 2
 | 
			
		||||
  size: 275, 240
 | 
			
		||||
  orig: 277, 240
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
neck
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 903, 173
 | 
			
		||||
  size: 22, 25
 | 
			
		||||
  orig: 22, 25
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_bracer
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 722, 40
 | 
			
		||||
  size: 34, 43
 | 
			
		||||
  orig: 34, 43
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_foot
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 444, 11
 | 
			
		||||
  size: 68, 36
 | 
			
		||||
  orig: 68, 36
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_foot_bend1
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 444, 49
 | 
			
		||||
  size: 70, 40
 | 
			
		||||
  orig: 70, 40
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_foot_bend2
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 778, 134
 | 
			
		||||
  size: 62, 50
 | 
			
		||||
  orig: 62, 50
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_shin
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 731, 135
 | 
			
		||||
  size: 45, 107
 | 
			
		||||
  orig: 45, 107
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_thigh
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 516, 50
 | 
			
		||||
  size: 39, 62
 | 
			
		||||
  orig: 39, 62
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
rear_upper_arm
 | 
			
		||||
  rotate: false
 | 
			
		||||
  xy: 638, 35
 | 
			
		||||
  size: 28, 52
 | 
			
		||||
  orig: 28, 52
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
torso
 | 
			
		||||
  rotate: true
 | 
			
		||||
  xy: 279, 2
 | 
			
		||||
  size: 59, 108
 | 
			
		||||
  orig: 59, 108
 | 
			
		||||
  offset: 0, 0
 | 
			
		||||
  index: -1
 | 
			
		||||
							
								
								
									
										5
									
								
								examples/example2-2-2/assets/res/spine/spineboy.txt.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								examples/example2-2-2/assets/res/spine/spineboy.txt.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.0.0",
 | 
			
		||||
  "uuid": "24a83a5f-48eb-40c4-ad22-95385682e0e3",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/scene.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/scene.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "8316e976-8f63-47fd-a5b5-dc10fc684312",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										595
									
								
								examples/example2-2-2/assets/scene/Animation.fire
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										595
									
								
								examples/example2-2-2/assets/scene/Animation.fire
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,595 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.SceneAsset",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_native": "",
 | 
			
		||||
    "scene": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Scene",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": null,
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 2
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_is3DNode": true,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "autoReleaseAssets": false,
 | 
			
		||||
    "_id": "43925b6c-075e-4466-a3fe-582378320bbe"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Canvas",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 3
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 5
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 7
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 9
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 13
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 14
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        960,
 | 
			
		||||
        540,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "2fnzhYDDhH+o7heymIpQap"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Main Camera",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 4
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        337.9122923544306,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "43gdsY9DVP862c3LIKCc7W"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Camera",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 3
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_cullingMask": 4294967295,
 | 
			
		||||
    "_clearFlags": 7,
 | 
			
		||||
    "_backgroundColor": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 0,
 | 
			
		||||
      "g": 0,
 | 
			
		||||
      "b": 0,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_depth": -1,
 | 
			
		||||
    "_zoomRatio": 1,
 | 
			
		||||
    "_targetTexture": null,
 | 
			
		||||
    "_fov": 60,
 | 
			
		||||
    "_orthoSize": 10,
 | 
			
		||||
    "_nearClip": 1,
 | 
			
		||||
    "_farClip": 4096,
 | 
			
		||||
    "_ortho": true,
 | 
			
		||||
    "_rect": {
 | 
			
		||||
      "__type__": "cc.Rect",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "width": 1,
 | 
			
		||||
      "height": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_renderStages": 1,
 | 
			
		||||
    "_alignWithScreen": true,
 | 
			
		||||
    "_id": "e6yEYF90pEMLeXgxk4Hbv7"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "info",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 6
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 803.59,
 | 
			
		||||
      "height": 144.64
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        -420.862,
 | 
			
		||||
        361.941,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "3eZbpCz5pET7+Ec/nts+Ya"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Label",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_useOriginalSize": false,
 | 
			
		||||
    "_string": "按左右键移动\n按k键播放hit动画并打断移动",
 | 
			
		||||
    "_N$string": "按左右键移动\n按k键播放hit动画并打断移动",
 | 
			
		||||
    "_fontSize": 64,
 | 
			
		||||
    "_lineHeight": 64,
 | 
			
		||||
    "_enableWrapText": true,
 | 
			
		||||
    "_N$file": null,
 | 
			
		||||
    "_isSystemFontUsed": true,
 | 
			
		||||
    "_spacingX": 0,
 | 
			
		||||
    "_batchAsBitmap": false,
 | 
			
		||||
    "_N$horizontalAlign": 0,
 | 
			
		||||
    "_N$verticalAlign": 1,
 | 
			
		||||
    "_N$fontFamily": "Arial",
 | 
			
		||||
    "_N$overflow": 0,
 | 
			
		||||
    "_N$cacheMode": 0,
 | 
			
		||||
    "_id": "35W5Duu3dAdauEtS3SXEYi"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "ground",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 8
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 46,
 | 
			
		||||
      "g": 82,
 | 
			
		||||
      "b": 66,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 2000,
 | 
			
		||||
      "height": 100
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        -54,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "d87kkEe1lKWbWHA8Dfo51E"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Sprite",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 7
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_srcBlendFactor": 770,
 | 
			
		||||
    "_dstBlendFactor": 771,
 | 
			
		||||
    "_spriteFrame": {
 | 
			
		||||
      "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
 | 
			
		||||
    },
 | 
			
		||||
    "_type": 0,
 | 
			
		||||
    "_sizeMode": 0,
 | 
			
		||||
    "_fillType": 0,
 | 
			
		||||
    "_fillCenter": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_fillStart": 0,
 | 
			
		||||
    "_fillRange": 0,
 | 
			
		||||
    "_isTrimmedMode": true,
 | 
			
		||||
    "_atlas": null,
 | 
			
		||||
    "_id": "78u7U+C3dGX4ApD1E5oUnD"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Sheep",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 10
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 11
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 12
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 166,
 | 
			
		||||
      "height": 105
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "3dMop0lcpB5ap16Dr3NLeE"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Sprite",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 9
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_srcBlendFactor": 770,
 | 
			
		||||
    "_dstBlendFactor": 771,
 | 
			
		||||
    "_spriteFrame": {
 | 
			
		||||
      "__uuid__": "36311098-60f7-4dbd-823f-d4b65bba51ac"
 | 
			
		||||
    },
 | 
			
		||||
    "_type": 0,
 | 
			
		||||
    "_sizeMode": 1,
 | 
			
		||||
    "_fillType": 0,
 | 
			
		||||
    "_fillCenter": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_fillStart": 0,
 | 
			
		||||
    "_fillRange": 0,
 | 
			
		||||
    "_isTrimmedMode": true,
 | 
			
		||||
    "_atlas": {
 | 
			
		||||
      "__uuid__": "679478cf-f911-402f-9ad6-75649317cc25"
 | 
			
		||||
    },
 | 
			
		||||
    "_id": "52DYKxWtBARbHB0VzsEalX"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Animation",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 9
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_defaultClip": null,
 | 
			
		||||
    "_clips": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "24d1963d-df84-4647-9b79-6d34ae17a827"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "1a1afca2-6657-476f-a923-411df0b0333d"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "365c3f76-afc4-4db0-ad85-ddb95fa6d4b9"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "playOnLoad": false,
 | 
			
		||||
    "_id": "bcKYZj9ulE2ZcRFn31cVCb"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "c0eccTRS2tFf5D/vabVUToc",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 9
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "AssetRawUrl": {
 | 
			
		||||
      "__uuid__": "eafb4a36-50c1-4417-b90a-234e6a57e0ba"
 | 
			
		||||
    },
 | 
			
		||||
    "PlayOnStart": false,
 | 
			
		||||
    "AutoUpdate": false,
 | 
			
		||||
    "_id": "90GlQw+UVPg6vmrtIrndbK"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Canvas",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_designResolution": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_fitWidth": false,
 | 
			
		||||
    "_fitHeight": true,
 | 
			
		||||
    "_id": "b0j7FPe5BMD7397xVWjcMb"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "14db7VUlFRDOKSHFQUjRZrK",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "Animator": {
 | 
			
		||||
      "__id__": 12
 | 
			
		||||
    },
 | 
			
		||||
    "_id": "96DtkQX15IyIGmoidkuOSP"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/scene/Animation.fire.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/scene/Animation.fire.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.5",
 | 
			
		||||
  "uuid": "43925b6c-075e-4466-a3fe-582378320bbe",
 | 
			
		||||
  "asyncLoadAssets": false,
 | 
			
		||||
  "autoReleaseAssets": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										470
									
								
								examples/example2-2-2/assets/scene/Customization.fire
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										470
									
								
								examples/example2-2-2/assets/scene/Customization.fire
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,470 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.SceneAsset",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_native": "",
 | 
			
		||||
    "scene": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Scene",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": null,
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 2
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_is3DNode": true,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "autoReleaseAssets": false,
 | 
			
		||||
    "_id": "a01bf096-4001-4a1b-b287-3be7f71862ad"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Canvas",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 3
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 5
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 8
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 10
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 11
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        960,
 | 
			
		||||
        540,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "d0tqW3ByxFQblWu45a5GMA"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Main Camera",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 4
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        337.9122923544306,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "f6PBTeImtJBrZZicL5UNin"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Camera",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 3
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_cullingMask": 4294967295,
 | 
			
		||||
    "_clearFlags": 7,
 | 
			
		||||
    "_backgroundColor": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 0,
 | 
			
		||||
      "g": 0,
 | 
			
		||||
      "b": 0,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_depth": -1,
 | 
			
		||||
    "_zoomRatio": 1,
 | 
			
		||||
    "_targetTexture": null,
 | 
			
		||||
    "_fov": 60,
 | 
			
		||||
    "_orthoSize": 10,
 | 
			
		||||
    "_nearClip": 1,
 | 
			
		||||
    "_farClip": 4096,
 | 
			
		||||
    "_ortho": true,
 | 
			
		||||
    "_rect": {
 | 
			
		||||
      "__type__": "cc.Rect",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "width": 1,
 | 
			
		||||
      "height": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_renderStages": 1,
 | 
			
		||||
    "_alignWithScreen": true,
 | 
			
		||||
    "_id": "784UbtpBhE8YVW8qhcwfo0"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Cube",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 6
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 7
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 70,
 | 
			
		||||
      "g": 76,
 | 
			
		||||
      "b": 211,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 100,
 | 
			
		||||
      "height": 100
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "5cOhQEACpJgLkRzD51Zo6f"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Sprite",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_srcBlendFactor": 770,
 | 
			
		||||
    "_dstBlendFactor": 771,
 | 
			
		||||
    "_spriteFrame": {
 | 
			
		||||
      "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
 | 
			
		||||
    },
 | 
			
		||||
    "_type": 0,
 | 
			
		||||
    "_sizeMode": 0,
 | 
			
		||||
    "_fillType": 0,
 | 
			
		||||
    "_fillCenter": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_fillStart": 0,
 | 
			
		||||
    "_fillRange": 0,
 | 
			
		||||
    "_isTrimmedMode": true,
 | 
			
		||||
    "_atlas": null,
 | 
			
		||||
    "_id": "eespuLqxNGRpNueW2q1ld2"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "0e26fCq18dIn7sZ8VOtyCEI",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "AssetRawUrl": {
 | 
			
		||||
      "__uuid__": "3b43599a-fb1d-45ae-a605-d120f985812e"
 | 
			
		||||
    },
 | 
			
		||||
    "PlayOnStart": false,
 | 
			
		||||
    "AutoUpdate": true,
 | 
			
		||||
    "_id": "830b6JiVVO1a5RD1IPhTi/"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "info",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 9
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 704,
 | 
			
		||||
      "height": 80.64
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        370,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "a2NKS5XO1NLY25vI/h3MUm"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Label",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 8
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_useOriginalSize": false,
 | 
			
		||||
    "_string": "点击屏幕切换下一个动画",
 | 
			
		||||
    "_N$string": "点击屏幕切换下一个动画",
 | 
			
		||||
    "_fontSize": 64,
 | 
			
		||||
    "_lineHeight": 64,
 | 
			
		||||
    "_enableWrapText": true,
 | 
			
		||||
    "_N$file": null,
 | 
			
		||||
    "_isSystemFontUsed": true,
 | 
			
		||||
    "_spacingX": 0,
 | 
			
		||||
    "_batchAsBitmap": false,
 | 
			
		||||
    "_N$horizontalAlign": 0,
 | 
			
		||||
    "_N$verticalAlign": 1,
 | 
			
		||||
    "_N$fontFamily": "Arial",
 | 
			
		||||
    "_N$overflow": 0,
 | 
			
		||||
    "_N$cacheMode": 0,
 | 
			
		||||
    "_id": "33HOdXuw5GCZEeeYon3hwb"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Canvas",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_designResolution": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_fitWidth": false,
 | 
			
		||||
    "_fitHeight": true,
 | 
			
		||||
    "_id": "7eneme19dEhLmAPLWqwLPL"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "4ecb8kn8zpIM5/7jjjBGTaH",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "Cube": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_id": "b6SV1vk9xEn7LSuSSI2+OU"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.5",
 | 
			
		||||
  "uuid": "a01bf096-4001-4a1b-b287-3be7f71862ad",
 | 
			
		||||
  "asyncLoadAssets": false,
 | 
			
		||||
  "autoReleaseAssets": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										478
									
								
								examples/example2-2-2/assets/scene/DragonBones.fire
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										478
									
								
								examples/example2-2-2/assets/scene/DragonBones.fire
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,478 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.SceneAsset",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_native": "",
 | 
			
		||||
    "scene": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Scene",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": null,
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 2
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_is3DNode": true,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "autoReleaseAssets": false,
 | 
			
		||||
    "_id": "cbce07d4-8ebb-45af-ba6a-92f10c90e44f"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Canvas",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 3
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 5
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 8
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 10
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 11
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        960,
 | 
			
		||||
        540,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "5c+lnLk7hCQZukqeDKipf+"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Main Camera",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 4
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        337.7446708008789,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "d7b9QRh1BKx5jCW9RrYHW0"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Camera",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 3
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_cullingMask": 4294967295,
 | 
			
		||||
    "_clearFlags": 7,
 | 
			
		||||
    "_backgroundColor": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 0,
 | 
			
		||||
      "g": 0,
 | 
			
		||||
      "b": 0,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_depth": -1,
 | 
			
		||||
    "_zoomRatio": 1,
 | 
			
		||||
    "_targetTexture": null,
 | 
			
		||||
    "_fov": 60,
 | 
			
		||||
    "_orthoSize": 10,
 | 
			
		||||
    "_nearClip": 1,
 | 
			
		||||
    "_farClip": 4096,
 | 
			
		||||
    "_ortho": true,
 | 
			
		||||
    "_rect": {
 | 
			
		||||
      "__type__": "cc.Rect",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "width": 1,
 | 
			
		||||
      "height": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_renderStages": 1,
 | 
			
		||||
    "_alignWithScreen": true,
 | 
			
		||||
    "_id": "37RyO+zC5GTZLa2IsKhgNL"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "mecha_1502b_ske",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 6
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 7
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "eeAw6eZqlNwZTeXKWdTh+P"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "dragonBones.ArmatureDisplay",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_armatureName": "mecha_1502b",
 | 
			
		||||
    "_animationName": "aim",
 | 
			
		||||
    "_preCacheMode": 0,
 | 
			
		||||
    "_cacheMode": 0,
 | 
			
		||||
    "playTimes": -1,
 | 
			
		||||
    "premultipliedAlpha": false,
 | 
			
		||||
    "_armatureKey": "26b72df2-3334-455b-964e-db6847774e64#2793a939-cf7f-4a69-bc16-d2ed790b67d5",
 | 
			
		||||
    "_accTime": 0,
 | 
			
		||||
    "_playCount": 0,
 | 
			
		||||
    "_frameCache": null,
 | 
			
		||||
    "_curFrame": null,
 | 
			
		||||
    "_playing": false,
 | 
			
		||||
    "_armatureCache": null,
 | 
			
		||||
    "_N$dragonAsset": {
 | 
			
		||||
      "__uuid__": "26b72df2-3334-455b-964e-db6847774e64"
 | 
			
		||||
    },
 | 
			
		||||
    "_N$dragonAtlasAsset": {
 | 
			
		||||
      "__uuid__": "2793a939-cf7f-4a69-bc16-d2ed790b67d5"
 | 
			
		||||
    },
 | 
			
		||||
    "_N$_defaultArmatureIndex": 3,
 | 
			
		||||
    "_N$_animationIndex": 15,
 | 
			
		||||
    "_N$_defaultCacheMode": 0,
 | 
			
		||||
    "_N$timeScale": 1,
 | 
			
		||||
    "_N$debugBones": false,
 | 
			
		||||
    "_N$enableBatch": false,
 | 
			
		||||
    "_id": "8cFD32P/NCD5mKdL318w+z"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "fa0001DMAlCzZ/hkmySCXhc",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "AssetRawUrl": {
 | 
			
		||||
      "__uuid__": "91924927-4ae8-4f46-b31f-53f35fd76b42"
 | 
			
		||||
    },
 | 
			
		||||
    "PlayOnLoad": true,
 | 
			
		||||
    "AutoUpdate": true,
 | 
			
		||||
    "_id": "f5wzpMVrdIf4wgL6YT0+2k"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "info",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 9
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 512,
 | 
			
		||||
      "height": 80.64
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        300,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "5bZkQ6BzBCHo9L9EDDs74A"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Label",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 8
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_useOriginalSize": false,
 | 
			
		||||
    "_string": "点击屏幕切换动画",
 | 
			
		||||
    "_N$string": "点击屏幕切换动画",
 | 
			
		||||
    "_fontSize": 64,
 | 
			
		||||
    "_lineHeight": 64,
 | 
			
		||||
    "_enableWrapText": true,
 | 
			
		||||
    "_N$file": null,
 | 
			
		||||
    "_isSystemFontUsed": true,
 | 
			
		||||
    "_spacingX": 0,
 | 
			
		||||
    "_batchAsBitmap": false,
 | 
			
		||||
    "_N$horizontalAlign": 0,
 | 
			
		||||
    "_N$verticalAlign": 1,
 | 
			
		||||
    "_N$fontFamily": "Arial",
 | 
			
		||||
    "_N$overflow": 0,
 | 
			
		||||
    "_N$cacheMode": 0,
 | 
			
		||||
    "_id": "c1stylrVVKr5f5NPTO84fM"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Canvas",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_designResolution": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_fitWidth": false,
 | 
			
		||||
    "_fitHeight": true,
 | 
			
		||||
    "_id": "06kiZkyIJLQartAZWv1j7+"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "46c5f3rR99BdL/g8jPFTaRb",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "Animator": {
 | 
			
		||||
      "__id__": 7
 | 
			
		||||
    },
 | 
			
		||||
    "_id": "dfU81p/IlBBo2G+QzZ1cZX"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/scene/DragonBones.fire.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/scene/DragonBones.fire.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.5",
 | 
			
		||||
  "uuid": "cbce07d4-8ebb-45af-ba6a-92f10c90e44f",
 | 
			
		||||
  "asyncLoadAssets": false,
 | 
			
		||||
  "autoReleaseAssets": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										499
									
								
								examples/example2-2-2/assets/scene/Spine.fire
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										499
									
								
								examples/example2-2-2/assets/scene/Spine.fire
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,499 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.SceneAsset",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_native": "",
 | 
			
		||||
    "scene": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Scene",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": null,
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 2
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_is3DNode": true,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "autoReleaseAssets": false,
 | 
			
		||||
    "_id": "e2a4478a-d1d7-4049-b006-7be03ae32f62"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Canvas",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 3
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 5
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 7
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 11
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 12
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        960,
 | 
			
		||||
        540,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "d5PbdupI9MzIYanN2n/w4y"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "Main Camera",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 4
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        337.7446577905061,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "65BAnD7nZMmJKEjmCkaJQs"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Camera",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 3
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_cullingMask": 4294967295,
 | 
			
		||||
    "_clearFlags": 7,
 | 
			
		||||
    "_backgroundColor": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 0,
 | 
			
		||||
      "g": 0,
 | 
			
		||||
      "b": 0,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_depth": -1,
 | 
			
		||||
    "_zoomRatio": 1,
 | 
			
		||||
    "_targetTexture": null,
 | 
			
		||||
    "_fov": 60,
 | 
			
		||||
    "_orthoSize": 10,
 | 
			
		||||
    "_nearClip": 1,
 | 
			
		||||
    "_farClip": 4096,
 | 
			
		||||
    "_ortho": true,
 | 
			
		||||
    "_rect": {
 | 
			
		||||
      "__type__": "cc.Rect",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "width": 1,
 | 
			
		||||
      "height": 1
 | 
			
		||||
    },
 | 
			
		||||
    "_renderStages": 1,
 | 
			
		||||
    "_alignWithScreen": true,
 | 
			
		||||
    "_id": "09SCmtIJRIzZZ0xtzRd0bY"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "info",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 6
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1287.16,
 | 
			
		||||
      "height": 272.64
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        -253.473,
 | 
			
		||||
        359.87,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "cbTvNdZQVNJZX19d6T2q5U"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Label",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 5
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_useOriginalSize": false,
 | 
			
		||||
    "_string": "按以下按键播放动画\n左右方向键(按住加速,松开减速):walk、run\n空格键:jump\nk:shoot",
 | 
			
		||||
    "_N$string": "按以下按键播放动画\n左右方向键(按住加速,松开减速):walk、run\n空格键:jump\nk:shoot",
 | 
			
		||||
    "_fontSize": 64,
 | 
			
		||||
    "_lineHeight": 64,
 | 
			
		||||
    "_enableWrapText": true,
 | 
			
		||||
    "_N$file": null,
 | 
			
		||||
    "_isSystemFontUsed": true,
 | 
			
		||||
    "_spacingX": 0,
 | 
			
		||||
    "_batchAsBitmap": false,
 | 
			
		||||
    "_N$horizontalAlign": 0,
 | 
			
		||||
    "_N$verticalAlign": 1,
 | 
			
		||||
    "_N$fontFamily": "Arial",
 | 
			
		||||
    "_N$overflow": 0,
 | 
			
		||||
    "_N$cacheMode": 0,
 | 
			
		||||
    "_id": "82cLjGOzJIEa8lq21IafRj"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Node",
 | 
			
		||||
    "_name": "spineboy",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "_parent": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_children": [],
 | 
			
		||||
    "_active": true,
 | 
			
		||||
    "_components": [
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 8
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 9
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "__id__": 10
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "_prefab": null,
 | 
			
		||||
    "_opacity": 255,
 | 
			
		||||
    "_color": {
 | 
			
		||||
      "__type__": "cc.Color",
 | 
			
		||||
      "r": 255,
 | 
			
		||||
      "g": 255,
 | 
			
		||||
      "b": 255,
 | 
			
		||||
      "a": 255
 | 
			
		||||
    },
 | 
			
		||||
    "_contentSize": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 0,
 | 
			
		||||
      "height": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_anchorPoint": {
 | 
			
		||||
      "__type__": "cc.Vec2",
 | 
			
		||||
      "x": 0.5,
 | 
			
		||||
      "y": 0.5
 | 
			
		||||
    },
 | 
			
		||||
    "_trs": {
 | 
			
		||||
      "__type__": "TypedArray",
 | 
			
		||||
      "ctor": "Float64Array",
 | 
			
		||||
      "array": [
 | 
			
		||||
        0,
 | 
			
		||||
        -360,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        0,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1,
 | 
			
		||||
        1
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "_eulerAngles": {
 | 
			
		||||
      "__type__": "cc.Vec3",
 | 
			
		||||
      "x": 0,
 | 
			
		||||
      "y": 0,
 | 
			
		||||
      "z": 0
 | 
			
		||||
    },
 | 
			
		||||
    "_skewX": 0,
 | 
			
		||||
    "_skewY": 0,
 | 
			
		||||
    "_is3DNode": false,
 | 
			
		||||
    "_groupIndex": 0,
 | 
			
		||||
    "groupIndex": 0,
 | 
			
		||||
    "_id": "e8lexkq8dMNab6Z9MEI/ky"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "sp.Skeleton",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 7
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_materials": [
 | 
			
		||||
      {
 | 
			
		||||
        "__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "paused": false,
 | 
			
		||||
    "defaultSkin": "",
 | 
			
		||||
    "defaultAnimation": "",
 | 
			
		||||
    "_preCacheMode": 0,
 | 
			
		||||
    "_cacheMode": 0,
 | 
			
		||||
    "loop": true,
 | 
			
		||||
    "premultipliedAlpha": true,
 | 
			
		||||
    "timeScale": 1,
 | 
			
		||||
    "_accTime": 0,
 | 
			
		||||
    "_playCount": 0,
 | 
			
		||||
    "_frameCache": null,
 | 
			
		||||
    "_curFrame": null,
 | 
			
		||||
    "_skeletonCache": null,
 | 
			
		||||
    "_animationName": "",
 | 
			
		||||
    "_animationQueue": [],
 | 
			
		||||
    "_headAniInfo": null,
 | 
			
		||||
    "_playTimes": 0,
 | 
			
		||||
    "_isAniComplete": true,
 | 
			
		||||
    "_N$skeletonData": {
 | 
			
		||||
      "__uuid__": "a5e3714e-7870-4b3a-acf6-1e78ec8b90df"
 | 
			
		||||
    },
 | 
			
		||||
    "_N$_defaultCacheMode": 0,
 | 
			
		||||
    "_N$debugSlots": false,
 | 
			
		||||
    "_N$debugBones": false,
 | 
			
		||||
    "_N$debugMesh": false,
 | 
			
		||||
    "_N$useTint": false,
 | 
			
		||||
    "_N$enableBatch": false,
 | 
			
		||||
    "_id": "c1Za9Hx3BKeo0Xf6wRH0tz"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "81397AkbwFD5Izg7F0yY1/D",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 7
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "AssetRawUrl": {
 | 
			
		||||
      "__uuid__": "a4c4a817-2577-4c9b-94dc-bc6fe12a8ce8"
 | 
			
		||||
    },
 | 
			
		||||
    "PlayOnStart": false,
 | 
			
		||||
    "AutoUpdate": true,
 | 
			
		||||
    "_id": "b60UaHdkdFbZ6yfl+H0Phm"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "32504xevahNAblXzax6Zdkv",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 7
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "AssetRawUrl": {
 | 
			
		||||
      "__uuid__": "b58f7a9d-68b5-440f-896f-ef2d0359382d"
 | 
			
		||||
    },
 | 
			
		||||
    "PlayOnStart": true,
 | 
			
		||||
    "AutoUpdate": true,
 | 
			
		||||
    "TrackIndex": 1,
 | 
			
		||||
    "_id": "47ianh+1pHcbo7nNb/aYiV"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "cc.Canvas",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "_designResolution": {
 | 
			
		||||
      "__type__": "cc.Size",
 | 
			
		||||
      "width": 1920,
 | 
			
		||||
      "height": 1080
 | 
			
		||||
    },
 | 
			
		||||
    "_fitWidth": false,
 | 
			
		||||
    "_fitHeight": true,
 | 
			
		||||
    "_id": "d3fJPGqCZNr5EcI+Cccf+/"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "__type__": "1810cN/HlpB7LK654rJsVXg",
 | 
			
		||||
    "_name": "",
 | 
			
		||||
    "_objFlags": 0,
 | 
			
		||||
    "node": {
 | 
			
		||||
      "__id__": 2
 | 
			
		||||
    },
 | 
			
		||||
    "_enabled": true,
 | 
			
		||||
    "SpineBoy": {
 | 
			
		||||
      "__id__": 8
 | 
			
		||||
    },
 | 
			
		||||
    "_id": "c6mUGXnhFO9LwZvNL2dzK9"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/scene/Spine.fire.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/scene/Spine.fire.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.5",
 | 
			
		||||
  "uuid": "e2a4478a-d1d7-4049-b006-7be03ae32f62",
 | 
			
		||||
  "asyncLoadAssets": false,
 | 
			
		||||
  "autoReleaseAssets": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/script.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/script.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "fa7b3b8d-41ad-455f-b2c0-c542fc3b9d6c",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/script/animator.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/script/animator.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "1d876d7a-3ee1-4416-a86b-478e7a2291bc",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,90 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Cocos Animation状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(cc.Animation)
 | 
			
		||||
export default class AnimatorAnimation extends AnimatorBase {
 | 
			
		||||
    /** Animation组件 */
 | 
			
		||||
    private _animation: cc.Animation = null;
 | 
			
		||||
    /** 当前的动画实例 */
 | 
			
		||||
    private _animState: cc.AnimationState = null;
 | 
			
		||||
    /** 记录初始的wrapmode */
 | 
			
		||||
    private _wrapModeMap: Map<cc.AnimationState, cc.WrapMode> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(cc.Animation);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._animation = this.getComponent(cc.Animation);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.FINISHED, this.onAnimFinished, this);
 | 
			
		||||
        this._animation.on(cc.Animation.EventType.LASTFRAME, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (!animName) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._animState = this._animation.play(animName);
 | 
			
		||||
        if (!this._animState) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!this._wrapModeMap.has(this._animState)) {
 | 
			
		||||
            this._wrapModeMap.set(this._animState, this._animState.wrapMode);
 | 
			
		||||
        }
 | 
			
		||||
        this._animState.wrapMode = loop ? cc.WrapMode.Loop : this._wrapModeMap.get(this._animState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (this._animState) {
 | 
			
		||||
            this._animState.speed = scale;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.5",
 | 
			
		||||
  "uuid": "c0ecc4d1-4b6b-457f-90ff-bda6d5513a1c",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,58 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * 自定义动画控制的状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
export default class AnimatorCustomization extends AnimatorBase {
 | 
			
		||||
    /** 此组件必须主动调用onInit初始化 */
 | 
			
		||||
    @property({ override: true, visible: false })
 | 
			
		||||
    protected PlayOnStart: boolean = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (this._animationPlayer && animName) {
 | 
			
		||||
            this._animationPlayer.playAnimation(animName, loop);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        if (this._animationPlayer) {
 | 
			
		||||
            this._animationPlayer.scaleTime(scale);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.5",
 | 
			
		||||
  "uuid": "0e26f0aa-d7c7-489f-bb19-f153adc82108",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,71 @@
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * DragonBones状态机组件
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(dragonBones.ArmatureDisplay)
 | 
			
		||||
export default class AnimatorDragonBones extends AnimatorBase {
 | 
			
		||||
    /** DragonBones组件 */
 | 
			
		||||
    private _dragonBones: dragonBones.ArmatureDisplay = null;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
 | 
			
		||||
        this._dragonBones.addEventListener(dragonBones.EventObject.COMPLETE, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._dragonBones = this.getComponent(dragonBones.ArmatureDisplay);
 | 
			
		||||
        this._dragonBones.addEventListener(dragonBones.EventObject.COMPLETE, this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        animName && this._dragonBones.playAnimation(animName, loop ? 0 : -1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        this._dragonBones.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.5",
 | 
			
		||||
  "uuid": "fa000d43-3009-42cd-9fe1-926c9209785c",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										120
									
								
								examples/example2-2-2/assets/script/animator/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								examples/example2-2-2/assets/script/animator/AnimatorSpine.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,120 @@
 | 
			
		||||
import AnimatorSpineSecondary from "./AnimatorSpineSecondary";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent, disallowMultiple } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(主状态机),trackIndex为0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@disallowMultiple
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpine extends AnimatorBase {
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null;
 | 
			
		||||
    /** 动画完成的回调 */
 | 
			
		||||
    private _completeListenerMap: Map<(entry?: any) => void, any> = new Map();
 | 
			
		||||
    /** 次状态机注册的回调 */
 | 
			
		||||
    private _secondaryListenerMap: Map<(entry?: any) => void, AnimatorSpineSecondary> = new Map();
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._spine.setCompleteListener(this.onSpineComplete.bind(this));
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private onSpineComplete(entry: any) {
 | 
			
		||||
        entry.trackIndex === 0 && this.onAnimFinished();
 | 
			
		||||
        this._completeListenerMap.forEach((target, cb) => { target ? cb.call(target, entry) : cb(entry); });
 | 
			
		||||
        this._secondaryListenerMap.forEach((target, cb) => { entry.trackIndex === target.TrackIndex && cb.call(target, entry); });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(0, animName, loop);
 | 
			
		||||
        } else {
 | 
			
		||||
            this._spine.clearTrack(0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
        this._spine.timeScale = scale;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册次状态机动画结束的回调(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public addSecondaryListener(cb: (entry?: any) => void, target: AnimatorSpineSecondary) {
 | 
			
		||||
        this._secondaryListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注册动画完成时的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     * @param target 调用回调的this对象
 | 
			
		||||
     */
 | 
			
		||||
    public addCompleteListener(cb: (entry?: any) => void, target: any = null) {
 | 
			
		||||
        if (this._completeListenerMap.has(cb)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._completeListenerMap.set(cb, target);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 注销动画完成的监听
 | 
			
		||||
     * @param cb 回调
 | 
			
		||||
     */
 | 
			
		||||
    public removeCompleteListener(cb: (entry?: any) => void) {
 | 
			
		||||
        this._completeListenerMap.delete(cb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 清空动画完成的监听
 | 
			
		||||
     */
 | 
			
		||||
    public clearCompleteListener() {
 | 
			
		||||
        this._completeListenerMap.clear;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.5",
 | 
			
		||||
  "uuid": "81397024-6f01-43e4-8ce0-ec5d32635fc3",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,72 @@
 | 
			
		||||
import AnimatorSpine from "./AnimatorSpine";
 | 
			
		||||
import AnimatorBase, { AnimationPlayer } from "./core/AnimatorBase";
 | 
			
		||||
import AnimatorStateLogic from "./core/AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, requireComponent } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/** 
 | 
			
		||||
 * Spine状态机组件(次状态机),同一节点可添加多个,用于在不同track中播放动画,trackIndex必须大于0
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@requireComponent(sp.Skeleton)
 | 
			
		||||
export default class AnimatorSpineSecondary extends AnimatorBase {
 | 
			
		||||
    @property({ tooltip: CC_DEV && '动画播放的trackIndex,必须大于0' }) TrackIndex: number = 1;
 | 
			
		||||
 | 
			
		||||
    /** 主状态机 */
 | 
			
		||||
    private _main: AnimatorSpine = null;
 | 
			
		||||
    /** spine组件 */
 | 
			
		||||
    private _spine: sp.Skeleton = null;
 | 
			
		||||
 | 
			
		||||
    protected start() {
 | 
			
		||||
        if (!this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine);
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @override
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        if (this.PlayOnStart || this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._hasInit = true;
 | 
			
		||||
 | 
			
		||||
        this.initArgs(...args);
 | 
			
		||||
 | 
			
		||||
        this._spine = this.getComponent(sp.Skeleton);
 | 
			
		||||
        this._main = this.getComponent(AnimatorSpine);
 | 
			
		||||
        this._main.addSecondaryListener(this.onAnimFinished, this);
 | 
			
		||||
 | 
			
		||||
        if (this.AssetRawUrl !== null) {
 | 
			
		||||
            this.initJson(this.AssetRawUrl.json);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @override
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
        if (animName) {
 | 
			
		||||
            this._spine.setAnimation(this.TrackIndex, animName, loop); 
 | 
			
		||||
         } else {
 | 
			
		||||
             this._spine.clearTrack(this.TrackIndex);
 | 
			
		||||
         }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.5",
 | 
			
		||||
  "uuid": "32504c5e-bda8-4d01-b957-cdac7a65d92f",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								examples/example2-2-2/assets/script/animator/core.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/example2-2-2/assets/script/animator/core.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.1",
 | 
			
		||||
  "uuid": "686e46ec-3c93-40c8-a343-98d92f38c904",
 | 
			
		||||
  "isSubpackage": false,
 | 
			
		||||
  "subpackageName": "",
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,227 @@
 | 
			
		||||
import AnimatorController from "./AnimatorController";
 | 
			
		||||
import AnimatorState from "./AnimatorState";
 | 
			
		||||
import AnimatorStateLogic from "./AnimatorStateLogic";
 | 
			
		||||
 | 
			
		||||
const { ccclass, property, executionOrder } = cc._decorator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 自定义控制动画播放的接口
 | 
			
		||||
 */
 | 
			
		||||
export interface AnimationPlayer {
 | 
			
		||||
    /** 设置动画播放结束的回调 */
 | 
			
		||||
    setFinishedCallback(callback: () => void, target: any): void;
 | 
			
		||||
    /** 播放动画 */
 | 
			
		||||
    playAnimation(animName: string, loop: boolean): void;
 | 
			
		||||
    /** 缩放动画播放速率 */
 | 
			
		||||
    scaleTime(scale: number): void;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 状态机组件基类 优先执行生命周期
 | 
			
		||||
 */
 | 
			
		||||
@ccclass
 | 
			
		||||
@executionOrder(-1000)
 | 
			
		||||
export default class AnimatorBase extends cc.Component {
 | 
			
		||||
    @property({ type: cc.JsonAsset, tooltip: CC_DEV && '状态机json文件' })
 | 
			
		||||
    protected AssetRawUrl: cc.JsonAsset = null;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: CC_DEV && '是否在start中自动启动状态机' })
 | 
			
		||||
    protected PlayOnStart: boolean = true;
 | 
			
		||||
 | 
			
		||||
    @property({ tooltip: CC_DEV && '是否在update中自动触发状态机逻辑更新' })
 | 
			
		||||
    protected AutoUpdate: boolean = true;
 | 
			
		||||
 | 
			
		||||
    /** 是否初始化 */
 | 
			
		||||
    protected _hasInit: boolean = false;
 | 
			
		||||
    /** 状态机控制 */
 | 
			
		||||
    protected _ac: AnimatorController = null;
 | 
			
		||||
 | 
			
		||||
    /** 各个状态逻辑控制,key为状态名 */
 | 
			
		||||
    protected _stateLogicMap: Map<string, AnimatorStateLogic> = null;
 | 
			
		||||
    /** 状态切换时的回调 */
 | 
			
		||||
    protected _onStateChangeCall: (fromState: string, toState: string) => void = null;
 | 
			
		||||
    /** 自定义的动画播放控制器 */
 | 
			
		||||
    protected _animationPlayer: AnimationPlayer = null;
 | 
			
		||||
 | 
			
		||||
    /** 当前状态名 */
 | 
			
		||||
    public get curStateName(): string {
 | 
			
		||||
        return this._ac.curState.name;
 | 
			
		||||
    }
 | 
			
		||||
    /** 当前动画名 */
 | 
			
		||||
    public get curStateMotion(): string {
 | 
			
		||||
        return this._ac.curState.motion;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动初始化状态机,可传入0-3个参数,类型如下
 | 
			
		||||
     * - onStateChangeCall 状态切换时的回调
 | 
			
		||||
     * - stateLogicMap 各个状态逻辑控制
 | 
			
		||||
     * - animationPlayer 自定义动画控制
 | 
			
		||||
     * @virtual
 | 
			
		||||
     */
 | 
			
		||||
    public onInit(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 处理初始化参数
 | 
			
		||||
     */
 | 
			
		||||
    protected initArgs(...args: Array<Map<string, AnimatorStateLogic> | ((fromState: string, toState: string) => void) | AnimationPlayer>) {
 | 
			
		||||
        args.forEach((arg) => {
 | 
			
		||||
            if (!arg) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (typeof arg === 'function') {
 | 
			
		||||
                this._onStateChangeCall = arg;
 | 
			
		||||
            } else if (typeof arg === 'object') {
 | 
			
		||||
                if (arg instanceof Map) {
 | 
			
		||||
                    this._stateLogicMap = arg;
 | 
			
		||||
                } else {
 | 
			
		||||
                    this._animationPlayer = arg;
 | 
			
		||||
                    this._animationPlayer.setFinishedCallback(this.onAnimFinished, this);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private updateAnimator() {
 | 
			
		||||
        // 混合当前动画播放速度
 | 
			
		||||
        let playSpeed = this._ac.curState.speed;
 | 
			
		||||
        if (this._ac.curState.multi) {
 | 
			
		||||
            playSpeed *= this._ac.params.getNumber(this._ac.curState.multi) || 1;
 | 
			
		||||
        }
 | 
			
		||||
        this.scaleTime(playSpeed);
 | 
			
		||||
 | 
			
		||||
        // 更新AnimatorStateLogic
 | 
			
		||||
        if (this._stateLogicMap) {
 | 
			
		||||
            let curLogic = this._stateLogicMap.get(this._ac.curState.name);
 | 
			
		||||
            curLogic && curLogic.onUpdate();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 更新状态机逻辑
 | 
			
		||||
        this._ac.updateAnimator();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected update() {
 | 
			
		||||
        if (this._hasInit && this.AutoUpdate) {
 | 
			
		||||
            this.updateAnimator();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 手动调用更新
 | 
			
		||||
     */
 | 
			
		||||
    public manualUpdate() {
 | 
			
		||||
        if (this._hasInit && !this.AutoUpdate) {
 | 
			
		||||
            this.updateAnimator();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 解析状态机json文件
 | 
			
		||||
     */
 | 
			
		||||
    protected initJson(json: any) {
 | 
			
		||||
        this._ac = new AnimatorController(this, json);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 动画结束的回调
 | 
			
		||||
     */
 | 
			
		||||
    protected onAnimFinished() {
 | 
			
		||||
        this._ac.onAnimationComplete();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 播放动画
 | 
			
		||||
     * @virtual
 | 
			
		||||
     * @param animName 动画名
 | 
			
		||||
     * @param loop 是否循环播放
 | 
			
		||||
     */
 | 
			
		||||
    protected playAnimation(animName: string, loop: boolean) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 缩放动画播放速率
 | 
			
		||||
     * @virtual
 | 
			
		||||
     * @param scale 缩放倍率
 | 
			
		||||
     */
 | 
			
		||||
    protected scaleTime(scale: number) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 
 | 
			
		||||
     * 状态切换时的逻辑(状态机内部方法,不能由外部直接调用)
 | 
			
		||||
     */
 | 
			
		||||
    public onStateChange(fromState: AnimatorState, toState: AnimatorState) {
 | 
			
		||||
        this.playAnimation(toState.motion, toState.loop);
 | 
			
		||||
 | 
			
		||||
        let fromStateName = fromState ? fromState.name : '';
 | 
			
		||||
 | 
			
		||||
        if (this._stateLogicMap) {
 | 
			
		||||
            let fromLogic = this._stateLogicMap.get(fromStateName);
 | 
			
		||||
            fromLogic && fromLogic.onExit();
 | 
			
		||||
            let toLogic = this._stateLogicMap.get(toState.name);
 | 
			
		||||
            toLogic && toLogic.onEntry();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._onStateChangeCall && this._onStateChangeCall(fromStateName, toState.name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置boolean类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setBool(key: string, value: boolean) {
 | 
			
		||||
        this._ac.params.setBool(key, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取boolean类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public getBool(key: string): boolean {
 | 
			
		||||
        return this._ac.params.getBool(key) !== 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置number类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setNumber(key: string, value: number) {
 | 
			
		||||
        this._ac.params.setNumber(key, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取number类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public getNumber(key: string): number {
 | 
			
		||||
        return this._ac.params.getNumber(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置trigger类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public setTrigger(key: string) {
 | 
			
		||||
        this._ac.params.setTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 重置trigger类型参数的值
 | 
			
		||||
     */
 | 
			
		||||
    public resetTrigger(key: string) {
 | 
			
		||||
        this._ac.params.resetTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置autoTrigger类型参数的值(autoTrigger类型参数不需要主动reset,每次状态机更新结束后会自动reset)
 | 
			
		||||
     */
 | 
			
		||||
    public autoTrigger(key: string) {
 | 
			
		||||
        this._ac.params.autoTrigger(key);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 无视条件直接跳转状态
 | 
			
		||||
     * @param 状态名
 | 
			
		||||
     */
 | 
			
		||||
    public play(stateName: string) {
 | 
			
		||||
        if (!this._hasInit) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this._ac.play(stateName);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user