79c62680-4cac-4b63-ba23-c756a07cc67f.js 2.53 KB
"use strict";
cc._RF.push(module, '79c62aATKxLY7ojx1agfMZ/', 'GuideManager');
// scripts/component/GuideManager.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GuideManager = void 0;
var UIManager_1 = require("../ui/UIManager");
var GuideManager = /** @class */ (function () {
    function GuideManager() {
    }
    Object.defineProperty(GuideManager, "ins", {
        get: function () {
            if (this._ins == null) {
                this._ins = new GuideManager();
            }
            return this._ins;
        },
        enumerable: false,
        configurable: true
    });
    GuideManager.prototype.init = function (node) {
        this._talkNode = node.getChildByName('talk');
        this._handNode = node.getChildByName('hand');
        this._talkNode.removeFromParent();
        this._handNode.removeFromParent();
        this._talkNode.active = false;
        this._handNode.active = false;
        UIManager_1.UIManager.ins.widgetLayer.addChild(this._talkNode);
        UIManager_1.UIManager.ins.widgetLayer.addChild(this._handNode);
    };
    GuideManager.prototype.showTalk = function (wpos, txt) {
        this._talkNode.parent.convertToNodeSpaceAR(wpos, wpos);
        this._talkNode.setPosition(wpos);
        var label = this._talkNode.getComponentInChildren(cc.Label);
        label.string = txt;
        this._talkNode.active = true;
        this._talkNode.height = label.node.height + 30;
        var arrow = this._talkNode.getChildByName('arrow');
        arrow.y = -this._talkNode.height / 2;
        this._talkNode.y += this._talkNode.height / 2;
        cc.Tween.stopAllByTarget(this._talkNode);
        this._talkNode.scale = 0;
        cc.tween(this._talkNode).to(0.2, { scale: 1 }, { easing: 'backOut' }).start();
    };
    GuideManager.prototype.hideTalk = function () {
        cc.Tween.stopAllByTarget(this._talkNode);
        this._talkNode.active = false;
    };
    GuideManager.prototype.showHand = function (wpos, down) {
        if (down === void 0) { down = true; }
        this._handNode.parent.convertToNodeSpaceAR(wpos, wpos);
        this._handNode.setPosition(wpos);
        this._handNode.active = true;
        var img = this._handNode.getChildByName('btn');
        img.angle = down ? 90 : 270;
        this._handNode.y += (this._handNode.height / 2 * (down ? 1 : -1));
    };
    GuideManager.prototype.hideHand = function () {
        this._handNode.active = false;
    };
    GuideManager._ins = null;
    return GuideManager;
}());
exports.GuideManager = GuideManager;

cc._RF.pop();