private ZOrderTimelineState _zOrderTimeline = null; // Initial value. /** * @private */ protected override void _OnClear() { foreach (var timeline in this._boneTimelines) { timeline.ReturnToPool(); } foreach (var timeline in this._slotTimelines) { timeline.ReturnToPool(); } foreach (var bonePose in this._bonePoses.Values) { bonePose.ReturnToPool(); } if (this._actionTimeline != null) { this._actionTimeline.ReturnToPool(); } if (this._zOrderTimeline != null) { this._zOrderTimeline.ReturnToPool(); } this.resetToPose = false; this.additiveBlending = false; this.displayControl = false; this.actionEnabled = false; this.layer = 0; this.playTimes = 1; this.timeScale = 1.0f; this.weight = 1.0f; this.autoFadeOutTime = 0.0f; this.fadeTotalTime = 0.0f; this.name = string.Empty; this.group = string.Empty; this.animationData = null; // this._timelineDirty = true; this._playheadState = 0; this._fadeState = -1; this._subFadeState = -1; this._position = 0.0f; this._duration = 0.0f; this._fadeTime = 0.0f; this._time = 0.0f; this._fadeProgress = 0.0f; this._weightResult = 0.0f; this._boneMask.Clear(); this._boneTimelines.Clear(); this._slotTimelines.Clear(); this._bonePoses.Clear(); this._armature = null; // this._actionTimeline = null; // this._zOrderTimeline = null; }
/** * @private * @internal */ internal void Init(Armature armature, AnimationData animationData, AnimationConfig animationConfig) { if (this._armature != null) { return; } this._armature = armature; this.animationData = animationData; this.resetToPose = animationConfig.resetToPose; this.additiveBlending = animationConfig.additiveBlending; this.displayControl = animationConfig.displayControl; this.actionEnabled = animationConfig.actionEnabled; this.layer = animationConfig.layer; this.playTimes = animationConfig.playTimes; this.timeScale = animationConfig.timeScale; this.fadeTotalTime = animationConfig.fadeInTime; this.autoFadeOutTime = animationConfig.autoFadeOutTime; this.weight = animationConfig.weight; this.name = animationConfig.name.Length > 0 ? animationConfig.name : animationConfig.animation; this.group = animationConfig.group; if (animationConfig.pauseFadeIn) { this._playheadState = 2; // 10 } else { this._playheadState = 3; // 11 } if (animationConfig.duration < 0.0f) { this._position = 0.0f; this._duration = this.animationData.duration; if (animationConfig.position != 0.0f) { if (this.timeScale >= 0.0f) { this._time = animationConfig.position; } else { this._time = animationConfig.position - this._duration; } } else { this._time = 0.0f; } } else { this._position = animationConfig.position; this._duration = animationConfig.duration; this._time = 0.0f; } if (this.timeScale < 0.0f && this._time == 0.0f) { this._time = -0.000001f; // Turn to end. } if (this.fadeTotalTime <= 0.0f) { this._fadeProgress = 0.999999f; // Make different. } if (animationConfig.boneMask.Count > 0) { this._boneMask.ResizeList(animationConfig.boneMask.Count); for (int i = 0, l = this._boneMask.Count; i < l; ++i) { this._boneMask[i] = animationConfig.boneMask[i]; } } this._actionTimeline = BaseObject.BorrowObject <ActionTimelineState>(); this._actionTimeline.Init(this._armature, this, this.animationData.actionTimeline); this._actionTimeline.currentTime = this._time; if (this._actionTimeline.currentTime < 0.0f) { this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime; } if (this.animationData.zOrderTimeline != null) { this._zOrderTimeline = BaseObject.BorrowObject <ZOrderTimelineState>(); this._zOrderTimeline.Init(this._armature, this, this.animationData.zOrderTimeline); } }