
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/Script/Barrier.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, '90c37YHUUVPsY0mlNmom67u', 'Barrier');
// Script/Barrier.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 (Object.prototype.hasOwnProperty.call(b, 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 Map_1 = require("./Map");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var Block = /** @class */ (function (_super) {
    __extends(Block, _super);
    function Block() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // 新增缓存变量
        _this.selfBoxColliders = [];
        _this.allBoxColliders = [];
        // @property({
        //     tooltip: '碰撞形状，None就是无敌，不参与碰撞',
        //     type: cc.Enum(BlockType),
        //     // default: BlockType.Nomal,
        //     displayName: '碰撞形状'
        // })
        // LIFE-CYCLE CALLBACKS:
        // @property(cc.SpriteAtlas)
        // UI: cc.SpriteAtlas = null;
        _this.initialTouchOffset = null;
        _this.offsetTolerance = 100; // 偏移容忍度; 
        _this.touchPoint = null; //触摸点
        _this.isTouch = false; //是否触摸
        _this.posX = 0; //地图块的X坐标
        _this.posY = 0; //地图块的Y坐标
        _this.moveLeft = true; //是否可以左移;
        _this.moveRight = true; //是否可以右移;
        _this.moveUp = true; //是否可以上移;
        _this.moveDown = true; //是否可以下移;
        _this.moveCorner = 0; //是否碰撞角落
        _this.moveY = 0; //是否可以上下移动;
        _this.moveX = 0; //是否可以左右移动;
        _this.touchPointX = 0; //触摸点X坐标;
        _this.touchPointY = 0; //触摸点Y坐标;
        _this.blockId = 0; //方块ID;
        _this.level = 0; //叠加方块层数;
        _this.pz = false;
        return _this;
    }
    Block.prototype.onLoad = function () {
        // this.node.on(cc.Node.EventType.TOUCH_START, this.touchStart, this);
        // this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);  
        // this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this);  
        // this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);  
        this.pz = false;
        this.stacking = cc.v2(0, 0);
        // this.selfBoxColliders = this.node.getComponentsInChildren(cc.BoxCollider)
        // .filter(collider => collider.tag < 4);
    };
    Block.prototype.start = function () {
    };
    Block.prototype.jsonDeepClone = function (obj) {
        return JSON.parse(JSON.stringify(obj));
    };
    Block.prototype.init = function (block_Info, posX, posY, node) {
        this.block_Info = this.jsonDeepClone(block_Info);
        var mapInfo = Map_1.default._instance.mapInfo;
        console.log("block_Info", this.block_Info);
        for (var i = 0; i < mapInfo.length; i++) {
            var blockRect = mapInfo[i].getBoundingBox();
            // 使用 cc.Intersection.pointInRect 方法判断点是否在矩形范围内
            var point = cc.v2(this.node.position.x - 5, this.node.position.y + 10);
            if (blockRect.contains(point)) {
                this.posX = mapInfo[i].getComponent("MapBlock").posX;
                this.posY = mapInfo[i].getComponent("MapBlock").posY;
                this.level = 50 + this.posX - this.posY * 3;
                this.node.zIndex = this.level;
                this.node.x = mapInfo[i].x + 65;
                this.node.y = mapInfo[i].y - 60;
                i = 10000;
                break;
            }
        }
    };
    Block = __decorate([
        ccclass
    ], Block);
    return Block;
}(cc.Component));
exports.default = Block;

cc._RF.pop();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 8660 characters]