(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/View/StartView.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'b61e9/2/+dFN4WPYWZB2/yG', 'StartView', __filename);
// Script/View/StartView.ts

Object.defineProperty(exports, "__esModule", { value: true });
var GameController_1 = require("../Controller/GameController");
var axios_1 = require("../Tools/axios");
var Message = require('../Tools/message');
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var StartView = /** @class */ (function (_super) {
    __extends(StartView, _super);
    function StartView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StartView.prototype.onLoad = function () {
        var _this = this;
        // init logic
        Message.show();
        axios_1.default.post(window['hostName'] + "/app/games/" + window['activityId'] + "/players/" + window['openid'] + "/play-start").then(function (_a) {
            var data = _a.data;
            Message.hide();
            _this.Num.string = "3";
            setTimeout(function () {
                _this.Num.string = "2";
            }, 1000);
            setTimeout(function () {
                _this.Num.node.active = false;
                _this.Num1.active = true;
            }, 2000);
            setTimeout(function () {
                window['score'] = 0;
                _this.startGame(data.playCode, data.playMeta.boundary, data.playMeta.seconds);
            }, 3000);
        }).catch(function (error) {
            alert(error.response.data.message);
        });
        //this.startGame([10,15,11,12,13], 6, 40)
    };
    StartView.prototype.startGame = function (playCode, boundary, seconds) {
        // this.node.destroy();
        this.countDownBox.active = false;
        this.game.active = true;
        this.game.getComponent(GameController_1.default).startGame(playCode, boundary, seconds);
    };
    __decorate([
        property({
            type: cc.Node
        })
    ], StartView.prototype, "game", void 0);
    __decorate([
        property({
            type: cc.Node
        })
    ], StartView.prototype, "countDownBox", void 0);
    __decorate([
        property({
            type: cc.Label
        })
    ], StartView.prototype, "Num", void 0);
    __decorate([
        property({
            type: cc.Node
        })
    ], StartView.prototype, "Num1", void 0);
    StartView = __decorate([
        ccclass
    ], StartView);
    return StartView;
}(cc.Component));
exports.default = StartView;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=StartView.js.map
        