8893e0c9-f6fe-4757-ad89-badb269069f0.js 1.69 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 GameRecord_1 = require("../../avg/game-data/GameRecord");
const PlotsData_1 = require("../../avg/game-data/PlotsData");
const ConfigManager_1 = require("../../common/gameplay/managers/ConfigManager");
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 ConfigManager_1.ConfigManager.getConfig(MessageSceneConfig_1.messageSceneConfig, this._id); }
    get firstPlot() { return this._firstPlot; }
    set firstPlot(plot) {
        this._firstPlot = plot;
        GameRecord_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) {
            GameRecord_1.GameRecord.recordVariables[this._recordKey + ".l"] = plot.id;
        }
    }
    async initFromRecords() {
        let firstPlotId = GameRecord_1.GameRecord.recordVariables[this._recordKey + ".f"];
        let lastPlotId = GameRecord_1.GameRecord.recordVariables[this._recordKey + ".l"];
        this._firstPlot = (await PlotsData_1.getPlot(firstPlotId));
        if (lastPlotId !== undefined) {
            this._lastPlot = await PlotsData_1.getPlot(lastPlotId);
        }
    }
}
exports.MessageSceneModel = MessageSceneModel;

cc._RF.pop();