private BatchKey(KAnimConverter.IAnimConverter controller) { _layer = controller.GetLayer(); _groupID = controller.GetBatchGroupID(false); _materialType = controller.GetMaterialType(); _z = controller.GetZ(); _idx = KAnimBatchManager.ControllerToChunkXY(controller); _hash = 0; }
protected override void Register() { if (IsActive() && batch == null && batchGroupID.IsValid && batchGroupID != KAnimBatchManager.NO_BATCH) { lastChunkXY = KAnimBatchManager.ControllerToChunkXY(this); KAnimBatchManager.Instance().Register(this); forceRebuild = true; SetDirty(); } }
public void UpdateAnim(float dt) { if (batch != null && base.transform.hasChanged) { base.transform.hasChanged = false; if (batch != null && batch.group.maxGroupSize == 1) { float z = lastPos.z; Vector3 position = base.transform.GetPosition(); if (z != position.z) { KAnimBatch kAnimBatch = batch; Vector3 position2 = base.transform.GetPosition(); kAnimBatch.OverrideZ(position2.z); } } Vector3 vector = lastPos = base.PositionIncludingOffset; if (visibilityType != VisibilityType.Always) { Vector2I u = KAnimBatchManager.ControllerToChunkXY(this); if (u != lastChunkXY && lastChunkXY != KBatchedAnimUpdater.INVALID_CHUNK_ID) { DeRegister(); Register(); } } SetDirty(); } if (!(batchGroupID == KAnimBatchManager.NO_BATCH) && IsActive()) { if (!forceRebuild && (mode == KAnim.PlayMode.Paused || stopped || curAnim == null || (mode == KAnim.PlayMode.Once && curAnim != null && (base.elapsedTime > curAnim.totalTime || curAnim.totalTime <= 0f) && animQueue.Count == 0))) { SuspendUpdates(true); } if (!isVisible && !forceRebuild) { if (visibilityType == VisibilityType.OffscreenUpdate && !stopped && mode != KAnim.PlayMode.Paused) { SetElapsedTime(base.elapsedTime + dt * playSpeed); } } else { curAnimFrameIdx = GetFrameIdx(base.elapsedTime, true); if (eventManagerHandle.IsValid() && aem != null) { float elapsedTime = aem.GetElapsedTime(eventManagerHandle); if ((int)((base.elapsedTime - elapsedTime) * 100f) != 0) { UpdateAnimEventSequenceTime(); } } UpdateFrame(base.elapsedTime); if (!stopped && mode != KAnim.PlayMode.Paused) { SetElapsedTime(base.elapsedTime + dt * playSpeed); } forceRebuild = false; } } }