a74b3401-86a0-4d31-8f5a-50ef121f9013.js 4.41 KB
"use strict";
cc._RF.push(module, 'a74b3QBhqBNMY9aUO8SH5AT', 'GuideViewImpl');
// script/game/ui/view/impl/GuideViewImpl.ts

"use strict";
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 });
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const Enums_1 = require("../../../Enums");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const GuideView_1 = require("../type/GuideView");
const { ccclass, property } = cc._decorator;
let GuideViewImpl = /** @class */ (() => {
    let GuideViewImpl = class GuideViewImpl extends CCViewBase_1.CCPureView {
        constructor() {
            super(...arguments);
            this.maskNode = new cc.Node;
            this.maskSprNode = new cc.Node;
            this.frameSprNode = new cc.Node;
            this.guideBtn = new cc.Node;
            this.arrowNode = new cc.Node;
        }
        onGuideClick() {
            this._props.clickCallFunc();
        }
        setGuideInfo(x, y, w, h, direction) {
            this.maskSprNode.getComponent(cc.Widget).updateAlignment();
            w += 46;
            h += 46;
            let pos = cc.v3(x, y, 0);
            let srcSize = cc.size(w, h);
            let clickSize = cc.size(w + 20, h + 20);
            this.maskNode.position = pos;
            this.frameSprNode.position = pos;
            this.guideBtn.position = pos;
            this.maskNode.setContentSize(srcSize);
            this.frameSprNode.setContentSize(clickSize);
            this.guideBtn.setContentSize(clickSize);
            let r = 0;
            let g = this.arrowNode.height / 2;
            let py = y;
            let px = x;
            switch (direction) {
                case Enums_1.DirectionType.UP:
                    {
                        r = 180;
                        py += (h / 2 + g) * (-1);
                        px = x;
                    }
                    break;
                case Enums_1.DirectionType.DOWM:
                    {
                        r = 0;
                        py += h / 2 + g;
                        px = x;
                    }
                    break;
                case Enums_1.DirectionType.LEFT:
                    {
                        r = 90;
                        py = y;
                        px += (w / 2 + g) * (-1);
                    }
                    break;
                case Enums_1.DirectionType.RIGHT:
                    {
                        r = -90;
                        py = y;
                        px += w / 2 + g;
                    }
                    break;
            }
            this.arrowNode.angle = r;
            this.arrowNode.x = px;
            this.arrowNode.y = py;
            this.maskSprNode.getComponent(cc.Widget).updateAlignment();
        }
    };
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "maskNode", tooltip: "蒙板节点" })
    ], GuideViewImpl.prototype, "maskNode", void 0);
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "maskSprNode", tooltip: "蒙板图片节点" })
    ], GuideViewImpl.prototype, "maskSprNode", void 0);
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "frameSprNode", tooltip: "边框节点" })
    ], GuideViewImpl.prototype, "frameSprNode", void 0);
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "guideBtn", tooltip: "引导按钮" })
    ], GuideViewImpl.prototype, "guideBtn", void 0);
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "arrowNode", tooltip: "箭头节点" })
    ], GuideViewImpl.prototype, "arrowNode", void 0);
    GuideViewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegView(GuideView_1.GuideViewType, "prefab/ui/GuideView")
    ], GuideViewImpl);
    return GuideViewImpl;
})();
exports.default = GuideViewImpl;

cc._RF.pop();