多人对战游戏 room.setCustomProperties 传参json 数据 报错4313 - INVALID_ROOM_ATTR

room.setCustomProperties 传参有什么额外的要求吗?
为什么我传{a:1}是可以的,但是传{a:{b:1}}就报错?(4313 - INVALID_ROOM_ATTR)

btw: 为什么工单系统我没法用?有什么要求吗?我是付费用户,付费金额>100

请问你使用的是 js 还是 c# 的 sdk?哪个版本呢?

用法可以参考 单元测试
如果还有问题,请粘贴一下代码和日志。

我看了下你们的单元测试用例,
参数类型是:

const props = {
    title: 'room311',
    gold: 1000,
};

没有覆盖我遇到的情况:

props = {
    a:{
        b:2
    }
}

我想知道 room.setCustomProperties 方法,能不能传递这样的数据形式?
文档里写的 type 是 Object,{a:{b:2}} 不可以吗?

【多人在线游戏的日志在哪看到?控制台里吗?】

可以的,我刚刚测试了一下你描述的嵌套对象。

it('test change room properties', () =>
    new Promise(async resolve => {
      const roomName = 'tcp0_r';
      const p0 = newPlay('tcp0_0');
      const p1 = newPlay('tcp0_1');
      let f0 = false;
      let f1 = false;
      await p0.connect();
      await p0.createRoom({ roomName });
      p0.on(Event.ROOM_CUSTOM_PROPERTIES_CHANGED, async () => {
        const props = p0.room.customProperties;
        expect(props.title).to.be.equal('room311');
        expect(props.gold).to.be.equal(1000);
        expect(props.data.num).to.be.equal(123);
        expect(props.data.detail).to.be.equal('hello');
        f0 = true;
        if (f0 && f1) {
          await p0.close();
          await p1.close();
          resolve();
        }
      });
      await p1.connect();
      await p1.joinRoom(roomName);
      p1.on(Event.ROOM_CUSTOM_PROPERTIES_CHANGED, async () => {
        const props = p1.room.customProperties;
        expect(props.title).to.be.equal('room311');
        expect(props.gold).to.be.equal(1000);
        expect(props.data.num).to.be.equal(123);
        expect(props.data.detail).to.be.equal('hello');
        f1 = true;
        if (f0 && f1) {
          await p0.close();
          await p1.close();
          resolve();
        }
      });
      const props = {
        title: 'room311',
        gold: 1000,
        data: {
          num: 123,
          detail: 'hello',
        },
      };
      await p1.room.setCustomProperties(props);
      debug(`current room title: ${props.title}`);
      expect(props.title).to.be.equal('room311');
      debug(`current room gold: ${props.gold}`);
      expect(props.gold).to.be.equal(1000);
      debug(`current room num: ${props.data.num}`);
      expect(props.data.num).to.be.equal(123);
      debug(`current room detail: ${props.data.detail}`);
      expect(props.data.detail).to.be.equal('hello');
    }));

后面也有 Player CustomProperties 的单元测试,就是嵌套的。
Room Properties 和 Player Properties 数据结构是一样的。

明白了,我回家后,看一下具体日志吧,

Hi, 可以详细告知,查看日志的方法吗?我在控制台里没有找到日志。

我仔细看了下,我的传参结构是{a:{b:{c:3}}} 是3层嵌套对象,才会报错。

非常感谢您的反馈,多层(3 层以上)嵌套的属性确实是一个 bug。
现已修复,请再次尝试。

1 人赞了这个帖子.

好的,谢啦,晚上回去调试一下。