"use strict";
cc._RF.push(module, '65c1aiT6bVJ4bfXcq+jnmrf', 'Game');
// scripts/Game.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var NpcManager_1 = require("./EVA_npc/NpcManager");
// 资源加载类
var ResLoaderManager_1 = require("./Manager/ResLoaderManager");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var Game = /** @class */ (function (_super) {
    __extends(Game, _super);
    function Game() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // npc 管理者
        _this.npcManager = null;
        _this.sm = null;
        //Test 引导
        _this.guideIndex = 0;
        return _this;
        // start() { }
        // update (dt) {}
    }
    // 初始化
    Game.prototype.init = function () {
        // 资源管理实例
        this.sm = ResLoaderManager_1.default.getInstance();
        // 获取NPC管理器实例
        this.npcManager = NpcManager_1.default.getInstance();
    };
    // 加载开始
    Game.prototype.load = function () {
        var _this = this;
        // 资源加载器
        var res = ResLoaderManager_1.default.getInstance();
        res.initJsonCfg(function (completedCount, totalCount) {
            if (completedCount === totalCount) {
                res.initPrefaRes(function (completedCount, totalCount) {
                    if (completedCount === totalCount) {
                        res.initSpriteAtlas(function (completedCount, totalCount) {
                            if (completedCount === totalCount) { // 加载完成
                                _this.loadOver();
                            }
                        });
                    }
                });
            }
        });
    };
    Game.prototype.loadOver = function () {
        // NPC管理器初始化自己所需的数据
        this.npcManager.init();
        // NPC管理器初始化数据完成后 开始创建NPC
        this.npcManager.npcStart();
    };
    Game.prototype.onLoad = function () {
        // 初始化程序
        this.init();
        this.load();
    };
    Game = __decorate([
        ccclass
    ], Game);
    return Game;
}(cc.Component));
exports.default = Game;

cc._RF.pop();