2019-03-03 04:15:10 +01:00
|
|
|
import { Reviver,
|
|
|
|
Generic_toJSON,
|
|
|
|
Generic_fromJSON } from "../../utils/JSONReviver";
|
|
|
|
|
|
|
|
export class Message {
|
|
|
|
// Initializes a Message Object from a JSON save state
|
|
|
|
static fromJSON(value: any): Message {
|
|
|
|
return Generic_fromJSON(Message, value.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Name of Message file
|
2021-04-30 05:52:56 +02:00
|
|
|
filename = "";
|
2019-03-03 04:15:10 +01:00
|
|
|
|
|
|
|
// The text contains in the Message
|
2021-04-30 05:52:56 +02:00
|
|
|
msg = "";
|
2019-03-03 04:15:10 +01:00
|
|
|
|
|
|
|
// Flag indicating whether this Message has been received by the player
|
2021-04-30 05:52:56 +02:00
|
|
|
recvd = false;
|
2019-03-03 04:15:10 +01:00
|
|
|
|
|
|
|
constructor(filename="", msg="") {
|
|
|
|
this.filename = filename;
|
|
|
|
this.msg = msg;
|
|
|
|
this.recvd = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Serialize the current object to a JSON save state
|
|
|
|
toJSON(): any {
|
|
|
|
return Generic_toJSON("Message", this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Reviver.constructors.Message = Message;
|