diff --git a/assets/core/common/storage/StorageManager.ts b/assets/core/common/storage/StorageManager.ts index bc76970..3cc130f 100644 --- a/assets/core/common/storage/StorageManager.ts +++ b/assets/core/common/storage/StorageManager.ts @@ -7,7 +7,7 @@ import { EncryptUtil } from "../../utils/EncryptUtil"; export class StorageManager { private _key: string | null = null; private _iv: string | null = null; - private _id: number = -1; + private _id: string = ""; /** * 初始化密钥 @@ -23,7 +23,7 @@ export class StorageManager { * 设置用户唯一标识 * @param id */ - setUser(id: number) { + setUser(id: string) { this._id = id; } diff --git a/assets/core/gui/layer/Defines.ts b/assets/core/gui/layer/Defines.ts index b6d583d..ed9cb74 100644 --- a/assets/core/gui/layer/Defines.ts +++ b/assets/core/gui/layer/Defines.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2021-11-18 11:21:32 * @LastEditors: dgflash - * @LastEditTime: 2022-09-02 13:37:03 + * @LastEditTime: 2022-09-13 17:48:48 */ import { Node } from "cc"; @@ -56,5 +56,5 @@ export class ViewParams { /** 是否在使用状态 */ valid: boolean = true; /** 界面根节点 */ - node: Node | null = null;; + node: Node | null = null; } \ No newline at end of file diff --git a/assets/libs/animator-effect/Effect2DFollow3D.ts b/assets/libs/animator-effect/Effect2DFollow3D.ts index 5651243..4c0f9e4 100644 --- a/assets/libs/animator-effect/Effect2DFollow3D.ts +++ b/assets/libs/animator-effect/Effect2DFollow3D.ts @@ -7,6 +7,7 @@ import { Camera, Component, Node, Vec3, _decorator } from "cc"; import { oops } from "../../core/Oops"; +import { MathUtil } from "../../core/utils/MathUtil"; const { ccclass, property } = _decorator; @@ -36,18 +37,28 @@ export class Effect2DFollow3D extends Component { */ setTarget(node: Node) { this.node3d = node; - this.lateUpdate(0); + } + + start() { + var scale = this.zoom(); + this.node.setScale(scale, scale, 1); } protected lateUpdate(dt: number) { + var scale = this.zoom(); + scale = MathUtil.lerp(this.node.scale.x, scale, 0.1); + this.node.setScale(scale, scale, 1); + } + + private zoom(): number { this.camera.convertToUINode(this.node3d.worldPosition, oops.gui.game, this.pos); this.nodeUi.setPosition(this.pos); - // @ts-ignore 注:优化为事件触发式,避免重复计算 + // @ts-ignore Vec3.transformMat4(this.pos, this.node3d.worldPosition, this.camera._camera!.matView); - const ratio = this.distance / Math.abs(this.pos.z); - const value = Math.floor(ratio * 100) / 100; - this.node.setScale(value, value, 1); + var ratio = this.distance / Math.abs(this.pos.z); + var value = Math.floor(ratio * 100) / 100; + return value; } } diff --git a/assets/libs/camera/OrbitCamera.ts b/assets/libs/camera/OrbitCamera.ts index c89e1a4..a8fb8da 100644 --- a/assets/libs/camera/OrbitCamera.ts +++ b/assets/libs/camera/OrbitCamera.ts @@ -141,7 +141,7 @@ export class OrbitCamera extends Component { } if (this.enableScaleRadius) { - input.on(Input.EventType.MOUSE_WHEEL, this.onMouseWhee, this); + input.on(Input.EventType.MOUSE_WHEEL, this.onMouseWheel, this); } this.resetTargetRotation(); @@ -204,13 +204,13 @@ export class OrbitCamera extends Component { private onTouchEnd() { this._touched = false; } + //#endregion - private onMouseWhee(event: EventMouse) { + private onMouseWheel(event: EventMouse) { let scrollY = event.getScrollY(); this._targetRadius += this.radiusScaleSpeed * -Math.sign(scrollY); // 滚轮向前为负,滚轮向后为正 this._targetRadius = Math.min(this.maxRadius, Math.max(this.minRadius, this._targetRadius)); } - //#endregion update(dt: number) { let targetRotation = this._targetRotation;