~starkingdoms/starkingdoms

ref: 026450bb48c5ccc04f07b4dc6de2860a1c808085 starkingdoms/client/src/protocol/GoodbyeReason.ts -rw-r--r-- 1.1 KiB
026450bb — c0repwn3r add client code 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
export enum GoodbyeReason {
    UnexpectedPacket,
    UnexpectedNextState,
    UsernameTaken,
    PingPongTimeout,
    Done
}

export class GoodbyeReason_UnsupportedProtocol {
    supported: number;
    got: number;

    constructor(supported: number, got: number) {
        this.supported = supported;
        this.got = got;
    }

    to_object(): object {
        return { UnsupportedProtocol: {supported: this.supported, got: this.got} }
    }
}

// @ts-ignore
export function enum_GoodbyeReason_serialize(r: GoodbyeReason): string {
    if (r == GoodbyeReason.UnexpectedPacket) {
        return "UnexpectedPacket";
    } else if (r == GoodbyeReason.UnexpectedNextState) {
        return "UnexpectedNextState";
    } else if (r == GoodbyeReason.UsernameTaken) {
        return "UsernameTaken";
    } else if (r == GoodbyeReason.PingPongTimeout) {
        return "PingPongTimeout";
    } else if (r == GoodbyeReason.Done) {
        return "Done";
    }
}

export function enum_GoodbyeReason_deserialize(r: string): GoodbyeReason {
    if (r == "UnexpectedPacket") {

    }
}