From 104a5cead659adaa61709255347a0e0d5daa548f Mon Sep 17 00:00:00 2001 From: ljqing Date: Mon, 30 Jan 2023 18:14:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9E=9A=E4=B8=BE=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E5=9C=BA=E6=99=AF=E5=90=8D=E7=A7=B0=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8F=8A=E5=BA=94=E7=94=A8=E8=9E=8D=E5=90=88=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 12 ++++++++++ src/entities/WSProtocol.ts | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 37f7795..1ab590a 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -1487,6 +1487,18 @@ export default class ClientConnection { ); } + public async EnumBlendingScene() { + return await this.doRpc( + new Protocol.EnumBlendingSceneRequestEntity() + ); + } + + public async ApplyBlendingScene(name: string) { + return await this.doRpc( + new Protocol.ApplyBlendingSceneRequestEntity(name) + ); + } + public destory() { this.ws?.close(); if (this.ws) { diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index be1d1d2..fc74613 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -526,6 +526,12 @@ export namespace Protocol { public static get kSetBlendingOption() { return Commands.PROTOCOL_PREFIX + "SetBlendingOption"; } + public static get kEnumBlendingScene() { + return Commands.PROTOCOL_PREFIX + "EnumBlendingScene"; + } + public static get kApplyBlendingScene() { + return Commands.PROTOCOL_PREFIX + "ApplyBlendingScene"; + } static _all_commands = new Set([ Commands.kUnKnowCommand, @@ -659,6 +665,8 @@ export namespace Protocol { Commands.kSetBlendingVerDensity, Commands.kResetBlending, Commands.kSetBlendingOption, + Commands.kEnumBlendingScene, + Commands.kApplyBlendingScene, ]); public static get AllCommands() { return this._all_commands; @@ -3484,4 +3492,39 @@ export namespace Protocol { id; value; } + + export class EnumBlendingSceneResponseEntity extends PacketEntity { + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + + scenes = []; + } + + export class EnumBlendingSceneRequestEntity extends PacketEntity { + constructor( + rpc_id = 0 + ) { + super(); + super.command = Commands.kEnumBlendingScene; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + } + } + + export class ApplyBlendingSceneRequestEntity extends PacketEntity { + constructor( + name: string, + rpc_id = 0 + ) { + super(); + super.command = Commands.kApplyBlendingScene; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.name = name ?? ""; + } + name; + } }