1e05df6b-92a9-4dbd-ba55-fd849f3329b2.js 2.42 KB
"use strict";
cc._RF.push(module, '1e05d9rkqlNvbpV/YSfMymy', 'DatingEventSceneModel');
// script/game/model/DatingEventSceneModel.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatingEventSceneModel = exports.DatingEventStatus = void 0;
const ConfigManager_1 = require("../../common/gameplay/managers/ConfigManager");
const DateSceneConfig_1 = require("../../config/DateSceneConfig");
const GameRecord_1 = require("../../avg/game-data/GameRecord");
const PlotsData_1 = require("../../avg/game-data/PlotsData");
const EditorEnums_1 = require("../../avg/EditorEnums");
var DatingEventStatus;
(function (DatingEventStatus) {
    DatingEventStatus[DatingEventStatus["Locked"] = 1] = "Locked";
    DatingEventStatus[DatingEventStatus["New"] = 2] = "New";
    DatingEventStatus[DatingEventStatus["InProgress"] = 3] = "InProgress";
    DatingEventStatus[DatingEventStatus["Completed"] = 4] = "Completed";
})(DatingEventStatus = exports.DatingEventStatus || (exports.DatingEventStatus = {}));
class DatingEventSceneModel {
    constructor(id) {
        this._id = id;
        this._recordKey = "de" + this._id;
        this._bg = "";
    }
    get id() { return this._id; }
    get config() { return ConfigManager_1.ConfigManager.getConfig(DateSceneConfig_1.dateSceneConfig, this._id); }
    get status() { return this._status; }
    set status(v) {
        if (this._status !== v) {
            this._status = v;
            GameRecord_1.GameRecord.recordVariables[this._recordKey + ".s"] = v;
        }
    }
    get firstPlot() { return this._firstPlot; }
    set firstPlot(plot) {
        this._firstPlot = plot;
        GameRecord_1.GameRecord.recordVariables[this._recordKey + ".f"] = plot.id;
    }
    get background() { return this._bg; }
    set background(bg) {
        this._bg = bg;
        GameRecord_1.GameRecord.recordVariables[this._recordKey + ".bg"] = bg;
    }
    async initFromRecords() {
        this._status = GameRecord_1.GameRecord.recordVariables[this._recordKey + ".s"] || DatingEventStatus.Locked;
        let firstPlotId = this.config.DateType === EditorEnums_1.DateType.Date_Normal ? GameRecord_1.GameRecord.recordVariables[this._recordKey + ".f"] : this.config.start_plot_id;
        this._firstPlot = (await PlotsData_1.getPlot(firstPlotId));
        this._bg = GameRecord_1.GameRecord.recordVariables[this._recordKey + ".bg"] || "";
    }
}
exports.DatingEventSceneModel = DatingEventSceneModel;

cc._RF.pop();