14efdf6b-2bb1-4cd6-810c-221e64db9a8d.js 5.79 KB
"use strict";
cc._RF.push(module, '14efd9rK7FM1oEMIh5k25qN', 'DiscoverViewImpl');
// script/game/ui/view/impl/DiscoverViewImpl.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 });
exports.DiscoverViewImpl = void 0;
const simba_sdk_1 = require("simba-sdk");
const CCDummyObjects_1 = require("../../../../common/CCDummyObjects");
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const simba_cc_resutils_1 = require("simba-cc-resutils");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const DiscoverView_1 = require("../type/DiscoverView");
const Enums_1 = require("../../../Enums");
var Tabs;
(function (Tabs) {
    Tabs[Tabs["forum"] = 0] = "forum";
    Tabs[Tabs["edit"] = 1] = "edit";
    Tabs[Tabs["customerService"] = 2] = "customerService";
    Tabs[Tabs["productionTeam"] = 3] = "productionTeam";
})(Tabs || (Tabs = {}));
;
const { ccclass, property } = cc._decorator;
let DiscoverViewImpl = /** @class */ (() => {
    let DiscoverViewImpl = class DiscoverViewImpl extends CCViewBase_1.CCPureView {
        constructor() {
            super(...arguments);
            //#region editor bindings
            // @property({ type: cc.Label, tooltip: "人物名字" })
            // private manName: cc.Label = DummyLabel;
            this.manId = CCDummyObjects_1.DummyLabel;
            this.menSprite = CCDummyObjects_1.DummySprite;
            this.infoRootNode = CCDummyObjects_1.DummyNode;
            this.forum = CCDummyObjects_1.DummyButton;
            this.createGameClubBtn = () => {
                this.node.getComponent(cc.Widget).updateAlignment();
                this.node.getComponent(cc.Layout).updateLayout();
                let info = simba_sdk_1.SDK.systemInfo.displayInfo;
                let aspect = info.windowSize.height / cc.view.getVisibleSize().height;
                this.node.getComponent(cc.Widget).updateAlignment();
                let pos = this.forum.node.convertToWorldSpaceAR(cc.v2(0, 0));
                pos.x += cc.view.getViewportRect().x / cc.view.getScaleX();
                let xPos = pos.x * aspect;
                let yPos = info.windowSize.height - pos.y * aspect;
                let width = this.forum.node.width * aspect;
                let height = this.forum.node.height * aspect;
                let left = xPos - width / 2;
                let top = yPos - height / 2;
                // this.forum.node.active = false;
                simba_sdk_1.SDK.createGameClubButton({
                    type: "text",
                    text: "",
                    style: {
                        left: left,
                        top: top,
                        width: width,
                        height: height
                    },
                    icon: "green"
                });
            };
            this.onTouchMainInfo = () => {
                this._props.onCopyInfo();
            };
        }
        onLoad() {
            // this.bindProp("manName", this.manName, "string");
            this.bindProp("manId", this.manId, "string");
            this.bindProp("manIcon", async (value) => {
                if (value != "")
                    this.menSprite.spriteFrame = await simba_cc_resutils_1.ResUtils.loadRes(value, cc.SpriteFrame);
            });
            this.infoRootNode.on(cc.Node.EventType.TOUCH_END, this.onTouchMainInfo, this);
        }
        onForumCallback() {
        }
        onTabClick(target, data) {
            switch (parseInt(data)) {
                case Tabs.forum:
                    // GameDotMgr.getInstance().dotClickUI("click_forum");
                    this._props.onItemClick(Enums_1.DiscoverItemType.Forum);
                    break;
                case Tabs.edit:
                    // GameDotMgr.getInstance().dotClickUI("click_setting");
                    this._props.onItemClick(Enums_1.DiscoverItemType.Settings);
                    break;
                case Tabs.customerService:
                    // GameDotMgr.getInstance().dotClickUI("click_customerService");
                    this._props.onItemClick(Enums_1.DiscoverItemType.CustomerService);
                    break;
                case Tabs.productionTeam:
                    this._props.onItemClick(Enums_1.DiscoverItemType.ProductionTeam);
                    break;
            }
        }
        onPropsLoad(props) {
            super.onPropsLoad(props);
        }
        onPropChange(key) {
            super.onPropChange(key);
        }
    };
    __decorate([
        property({ type: cc.Label, tooltip: "人物 ID" })
    ], DiscoverViewImpl.prototype, "manId", void 0);
    __decorate([
        property({ type: cc.Sprite, tooltip: "人物头像" })
    ], DiscoverViewImpl.prototype, "menSprite", void 0);
    __decorate([
        property({ type: cc.Node, tooltip: "人物根结点" })
    ], DiscoverViewImpl.prototype, "infoRootNode", void 0);
    __decorate([
        property({ type: cc.Button, tooltip: "论坛按钮" })
    ], DiscoverViewImpl.prototype, "forum", void 0);
    DiscoverViewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegView(DiscoverView_1.DiscoverViewType, "prefab/ui/DiscoverView")
    ], DiscoverViewImpl);
    return DiscoverViewImpl;
})();
exports.DiscoverViewImpl = DiscoverViewImpl;

cc._RF.pop();