8893e0c9-f6fe-4757-ad89-badb269069f0.js 1.56 KB
"use strict";
cc._RF.push(module, '8893eDJ9v5HV62JutsmkGnw', 'MessageSceneModel');
// script/game/model/MessageSceneModel.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageSceneModel = void 0;
const AVG_1 = require("../../avg/AVG");
const simba_config_manager_1 = require("simba-config-manager");
const MessageSceneConfig_1 = require("../../config/MessageSceneConfig");
class MessageSceneModel {
    constructor(id) {
        this._id = id;
        this._recordKey = "m" + this._id;
    }
    get id() { return this._id; }
    get config() { return simba_config_manager_1.ConfigManager.getConfig(MessageSceneConfig_1.messageSceneConfig, this._id); }
    get firstPlot() { return this._firstPlot; }
    set firstPlot(plot) {
        this._firstPlot = plot;
        AVG_1.GameRecord.recordVariables[this._recordKey + ".f"] = plot.id;
    }
    get lastPlot() { return this._lastPlot; }
    set lastPlot(plot) {
        if (this._lastPlot === plot)
            return;
        this._lastPlot = plot;
        if (plot) {
            AVG_1.GameRecord.recordVariables[this._recordKey + ".l"] = plot.id;
        }
    }
    async initFromRecords() {
        let firstPlotId = AVG_1.GameRecord.recordVariables[this._recordKey + ".f"];
        let lastPlotId = AVG_1.GameRecord.recordVariables[this._recordKey + ".l"];
        this._firstPlot = (await AVG_1.getPlot(firstPlotId));
        if (lastPlotId !== undefined) {
            this._lastPlot = await AVG_1.getPlot(lastPlotId);
        }
    }
}
exports.MessageSceneModel = MessageSceneModel;

cc._RF.pop();