~starkingdoms/starkingdoms

ref: f73656c66fcec95e0957a7500c291926e0dcab2e starkingdoms/client/src/protocol/state.ts -rw-r--r-- 786 bytes
f73656c6 — core the server currently does much nothing 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//@ts-nocheck

export const protobufPackage = "protocol.state";

export enum State {
  UNKNOWN = 0,
  Handshake = 1,
  Play = 2,
  UNRECOGNIZED = -1,
}

export function stateFromJSON(object: any): State {
  switch (object) {
    case 0:
    case "UNKNOWN":
      return State.UNKNOWN;
    case 1:
    case "Handshake":
      return State.Handshake;
    case 2:
    case "Play":
      return State.Play;
    case -1:
    case "UNRECOGNIZED":
    default:
      return State.UNRECOGNIZED;
  }
}

export function stateToJSON(object: State): string {
  switch (object) {
    case State.UNKNOWN:
      return "UNKNOWN";
    case State.Handshake:
      return "Handshake";
    case State.Play:
      return "Play";
    case State.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}