diff --git a/assets/Script/example/SyncExmaple.ts b/assets/Script/example/SyncExmaple.ts index ea65b41..d1cb0c5 100644 --- a/assets/Script/example/SyncExmaple.ts +++ b/assets/Script/example/SyncExmaple.ts @@ -1,5 +1,5 @@ import { Component, Label, _decorator, view, director, Node, RichText, tween, Tween, math, randomRange, Vec3, Quat, ModelComponent, Color } from "cc"; -import { TestSimpleArrayReplicator, TestSimpleArrayReplicatorVersion } from "../sync/ArrayReplicator"; +import { TestArrayReplicator, TestSimpleArrayReplicator, TestSimpleArrayReplicatorVersion } from "../sync/ArrayReplicator"; import { getReplicateMark, ReplicatedOption } from "../sync/ReplicateMark"; import { getReplicator, replicated, replicatedClass } from "../sync/SyncUtil"; @@ -45,6 +45,8 @@ export default class SyncExample extends Component { TestSimpleArrayReplicator(); console.log("=============="); TestSimpleArrayReplicatorVersion(); + console.log("=============="); + TestArrayReplicator(); /*let vec = new Vec3(Vec3.ZERO); makeObjectReplicated(vec); vec.x = 123; diff --git a/assets/Script/sync/ArrayReplicator.ts b/assets/Script/sync/ArrayReplicator.ts index 1d242a5..6afc139 100644 --- a/assets/Script/sync/ArrayReplicator.ts +++ b/assets/Script/sync/ArrayReplicator.ts @@ -1,6 +1,6 @@ import ReplicateMark from "./ReplicateMark"; import { createReplicator } from "./ReplicatorFactory"; -import { Consturctor, getConsturctor, IReplicator } from "./SyncUtil"; +import { Consturctor, getConsturctor, IReplicator, replicated } from "./SyncUtil"; export type SimpleType = number | string | boolean | bigint; @@ -355,7 +355,9 @@ export class ArrayReplicator implements IReplicator { export function TestArrayReplicator() { class Point { + @replicated() x: number; + @replicated() y: number; constructor(x: any = 0, y: any = 0) { this.x = x; diff --git a/assets/Script/sync/SyncUtil.ts b/assets/Script/sync/SyncUtil.ts index 36644e4..d576ba9 100644 --- a/assets/Script/sync/SyncUtil.ts +++ b/assets/Script/sync/SyncUtil.ts @@ -73,7 +73,7 @@ function makePropertyReplicatedMark(cls: any, propertyKey: string, descriptor?: // 获取这个类的同步标记 let markObj = getReplicateMark(cls, true); // 初始化默认值def - if ('initializer' in descriptor) { + if ('initializer' in descriptor && typeof descriptor['initializer'] == 'function') { let def = (descriptor as any).initializer(); markObj.addMark(propertyKey, def, option); } else { diff --git a/profiles/v2/packages/scene.json b/profiles/v2/packages/scene.json index 0ef9e27..ac1056a 100644 --- a/profiles/v2/packages/scene.json +++ b/profiles/v2/packages/scene.json @@ -127,7 +127,7 @@ } }, "camera-uuids": [ - "d8be8bee-362a-494a-9643-8e52af4c0c15" + "f46876e4-e81b-4931-b493-6d367be385e7" ], "float-window": { "position": {