get rid of pianoverse.ServerMessage.Join and fix roles
This commit is contained in:
parent
0799979fd2
commit
87b903c650
|
@ -15,7 +15,7 @@ type MessageEvents = {
|
|||
) => void;
|
||||
welcome: () => void;
|
||||
rooms: (rooms: proto.ServerMessage_Room[]) => void;
|
||||
join: (join: proto.ServerMessage_Join) => void;
|
||||
join: (join: proto.Profile) => void;
|
||||
leave: (id: string) => void;
|
||||
chown: () => void;
|
||||
serverMessage: (serverMessage: string) => void;
|
||||
|
@ -41,7 +41,7 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
|
|||
} = {};
|
||||
rooms: proto.ServerMessage_Room[] = [];
|
||||
|
||||
players = new Map<string, proto.ServerMessage_Join>();
|
||||
players = new Map<string, proto.Profile>();
|
||||
move(x: number, y: number) {
|
||||
this.ws.send(
|
||||
new proto.ClientMessage({
|
||||
|
|
|
@ -55,7 +55,11 @@ message ClientMessage {
|
|||
|
||||
string chown = 15;
|
||||
}
|
||||
|
||||
enum Role {
|
||||
USER = 0;
|
||||
MODERATOR = 1;
|
||||
DEVELOPER = 2;
|
||||
}
|
||||
message ServerMessage {
|
||||
enum EventType {
|
||||
PONG = 0;
|
||||
|
@ -115,15 +119,7 @@ message ServerMessage {
|
|||
}
|
||||
|
||||
Profile profile = 10;
|
||||
Join join = 11;
|
||||
message Join {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string color = 3;
|
||||
int32 role = 4;
|
||||
float x = 6;
|
||||
float y = 7;
|
||||
}
|
||||
Profile join = 11;
|
||||
string leave = 12;
|
||||
|
||||
int32 rateLimit = 13;
|
||||
|
@ -137,7 +133,7 @@ message Profile {
|
|||
string id = 1;
|
||||
string name = 2;
|
||||
string color = 3;
|
||||
string sound = 4;
|
||||
Role role = 4;
|
||||
bool muted = 5;
|
||||
float x = 6;
|
||||
float y = 7;
|
||||
|
|
105
pianoverse_pb.ts
105
pianoverse_pb.ts
|
@ -8,6 +8,32 @@
|
|||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
||||
import { Message, proto3 } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
* @generated from enum pianoverse.Role
|
||||
*/
|
||||
export enum Role {
|
||||
/**
|
||||
* @generated from enum value: USER = 0;
|
||||
*/
|
||||
USER = 0,
|
||||
|
||||
/**
|
||||
* @generated from enum value: MODERATOR = 1;
|
||||
*/
|
||||
MODERATOR = 1,
|
||||
|
||||
/**
|
||||
* @generated from enum value: DEVELOPER = 2;
|
||||
*/
|
||||
DEVELOPER = 2,
|
||||
}
|
||||
// Retrieve enum metadata with: proto3.getEnumType(Role)
|
||||
proto3.util.setEnumType(Role, "pianoverse.Role", [
|
||||
{ no: 0, name: "USER" },
|
||||
{ no: 1, name: "MODERATOR" },
|
||||
{ no: 2, name: "DEVELOPER" },
|
||||
]);
|
||||
|
||||
/**
|
||||
* @generated from message pianoverse.ClientMessage
|
||||
*/
|
||||
|
@ -387,9 +413,9 @@ export class ServerMessage extends Message<ServerMessage> {
|
|||
profile?: Profile;
|
||||
|
||||
/**
|
||||
* @generated from field: pianoverse.ServerMessage.Join join = 11;
|
||||
* @generated from field: pianoverse.Profile join = 11;
|
||||
*/
|
||||
join?: ServerMessage_Join;
|
||||
join?: Profile;
|
||||
|
||||
/**
|
||||
* @generated from field: string leave = 12;
|
||||
|
@ -434,7 +460,7 @@ export class ServerMessage extends Message<ServerMessage> {
|
|||
{ no: 8, name: "release", kind: "message", T: Release },
|
||||
{ no: 9, name: "sustain", kind: "message", T: ServerMessage_Sustain },
|
||||
{ no: 10, name: "profile", kind: "message", T: Profile },
|
||||
{ no: 11, name: "join", kind: "message", T: ServerMessage_Join },
|
||||
{ no: 11, name: "join", kind: "message", T: Profile },
|
||||
{ no: 12, name: "leave", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 13, name: "rateLimit", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
||||
{ no: 14, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
|
@ -796,73 +822,6 @@ export class ServerMessage_Sustain extends Message<ServerMessage_Sustain> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message pianoverse.ServerMessage.Join
|
||||
*/
|
||||
export class ServerMessage_Join extends Message<ServerMessage_Join> {
|
||||
/**
|
||||
* @generated from field: string id = 1;
|
||||
*/
|
||||
id = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string name = 2;
|
||||
*/
|
||||
name = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string color = 3;
|
||||
*/
|
||||
color = "";
|
||||
|
||||
/**
|
||||
* @generated from field: int32 role = 4;
|
||||
*/
|
||||
role = 0;
|
||||
|
||||
/**
|
||||
* @generated from field: float x = 6;
|
||||
*/
|
||||
x = 0;
|
||||
|
||||
/**
|
||||
* @generated from field: float y = 7;
|
||||
*/
|
||||
y = 0;
|
||||
|
||||
constructor(data?: PartialMessage<ServerMessage_Join>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "pianoverse.ServerMessage.Join";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "color", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "role", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
||||
{ no: 6, name: "x", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
||||
{ no: 7, name: "y", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ServerMessage_Join {
|
||||
return new ServerMessage_Join().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ServerMessage_Join {
|
||||
return new ServerMessage_Join().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ServerMessage_Join {
|
||||
return new ServerMessage_Join().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: ServerMessage_Join | PlainMessage<ServerMessage_Join> | undefined, b: ServerMessage_Join | PlainMessage<ServerMessage_Join> | undefined): boolean {
|
||||
return proto3.util.equals(ServerMessage_Join, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message pianoverse.Profile
|
||||
*/
|
||||
|
@ -883,9 +842,9 @@ export class Profile extends Message<Profile> {
|
|||
color = "";
|
||||
|
||||
/**
|
||||
* @generated from field: string sound = 4;
|
||||
* @generated from field: pianoverse.Role role = 4;
|
||||
*/
|
||||
sound = "";
|
||||
role = Role.USER;
|
||||
|
||||
/**
|
||||
* @generated from field: bool muted = 5;
|
||||
|
@ -913,7 +872,7 @@ export class Profile extends Message<Profile> {
|
|||
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 3, name: "color", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "sound", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 4, name: "role", kind: "enum", T: proto3.getEnumType(Role) },
|
||||
{ no: 5, name: "muted", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
||||
{ no: 6, name: "x", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
||||
{ no: 7, name: "y", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
||||
|
|
Loading…
Reference in a new issue