From 7a1b58942433a370e0ea1eaad8f9bd553dda2d01 Mon Sep 17 00:00:00 2001 From: YipLee <2274086727@qq.com> Date: Thu, 17 Jun 2021 22:44:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=B0=83=E7=94=A8=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- animator-runtime/animator2.x/core/AnimatorBase.ts | 2 ++ animator-runtime/animator2.x/core/AnimatorController.ts | 2 -- animator-runtime/animator3.x/core/AnimatorBase.ts | 2 ++ animator-runtime/animator3.x/core/AnimatorController.ts | 2 -- .../example2-2-2/assets/script/animator/core/AnimatorBase.ts | 2 ++ .../assets/script/animator/core/AnimatorController.ts | 2 -- .../example3-0rc/assets/script/animator/core/AnimatorBase.ts | 2 ++ .../assets/script/animator/core/AnimatorController.ts | 2 -- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/animator-runtime/animator2.x/core/AnimatorBase.ts b/animator-runtime/animator2.x/core/AnimatorBase.ts index d589ea3..3681277 100644 --- a/animator-runtime/animator2.x/core/AnimatorBase.ts +++ b/animator-runtime/animator2.x/core/AnimatorBase.ts @@ -121,6 +121,8 @@ export default class AnimatorBase extends cc.Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/animator-runtime/animator2.x/core/AnimatorController.ts b/animator-runtime/animator2.x/core/AnimatorController.ts index 4b48e56..3f98840 100644 --- a/animator-runtime/animator2.x/core/AnimatorController.ts +++ b/animator-runtime/animator2.x/core/AnimatorController.ts @@ -41,13 +41,11 @@ export default class AnimatorController { 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() { diff --git a/animator-runtime/animator3.x/core/AnimatorBase.ts b/animator-runtime/animator3.x/core/AnimatorBase.ts index 9892628..2f539a0 100644 --- a/animator-runtime/animator3.x/core/AnimatorBase.ts +++ b/animator-runtime/animator3.x/core/AnimatorBase.ts @@ -122,6 +122,8 @@ export default class AnimatorBase extends Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/animator-runtime/animator3.x/core/AnimatorController.ts b/animator-runtime/animator3.x/core/AnimatorController.ts index 263da52..3a541e0 100644 --- a/animator-runtime/animator3.x/core/AnimatorController.ts +++ b/animator-runtime/animator3.x/core/AnimatorController.ts @@ -42,13 +42,11 @@ export default class AnimatorController { 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() { diff --git a/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts b/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts index d589ea3..3681277 100644 --- a/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts +++ b/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts @@ -121,6 +121,8 @@ export default class AnimatorBase extends cc.Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts b/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts index 4b48e56..3f98840 100644 --- a/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts +++ b/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts @@ -41,13 +41,11 @@ export default class AnimatorController { 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() { diff --git a/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts b/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts index 9892628..2f539a0 100644 --- a/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts +++ b/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts @@ -122,6 +122,8 @@ export default class AnimatorBase extends Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts b/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts index 263da52..3a541e0 100644 --- a/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts +++ b/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts @@ -42,13 +42,11 @@ export default class AnimatorController { 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() {