758ea163-b8a6-4522-bb52-9d8a2427134e.js
4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"use strict";
cc._RF.push(module, '758eaFjuKZFIrtSnYokJxNO', 'MainViewImpl');
// script/game/ui/view/impl/MainViewImpl.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.MainViewImpl = void 0;
const CCDummyObjects_1 = require("../../../../common/CCDummyObjects");
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const UIManager_1 = require("../../../../common/gameplay/managers/UIManager");
const DiscoverSettingViewPresenter_1 = require("../../presenter/discover/DiscoverSettingViewPresenter");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const MainView_1 = require("../type/MainView");
const { ccclass, property } = cc._decorator;
let MainViewImpl = /** @class */ (() => {
let MainViewImpl = class MainViewImpl extends CCViewBase_1.CCPureView {
constructor() {
super(...arguments);
//#region editor bindings
this.contentParent = CCDummyObjects_1.DummyNode;
this.titleSprite = CCDummyObjects_1.DummySprite;
this.tabbarButtons = [];
this.tabbarSpriteFrames = [];
this.titleSpriteFrames = [];
this.onTabButtonClick = (event, index) => {
this._props.onTabClick(parseInt(index));
};
}
onLoad() {
this._tabContentContainer = this.contentParent.addComponent(CCViewBase_1.CCView);
this.bindProp("messageRedDot", this.tabbarButtons[0].node.getChildByName("RedDot"), "active");
this.bindProp("datingEventRedDot", this.tabbarButtons[1].node.getChildByName("RedDot"), "active");
}
getTabContentContainer() {
return this._tabContentContainer;
}
onPropsLoad(props) {
super.onPropsLoad(props);
let currTab = this._props.selectedTab;
this.tabbarButtons[currTab].normalSprite = this.tabbarSpriteFrames[currTab * 2 + 1];
this.titleSprite.spriteFrame = this.titleSpriteFrames[currTab];
}
onPropChange(key) {
super.onPropChange(key);
if (key === "selectedTab") {
let prevTab = this._prevProps.selectedTab;
this.tabbarButtons[prevTab].normalSprite = this.tabbarSpriteFrames[prevTab * 2];
let currTab = this._props.selectedTab;
this.tabbarButtons[currTab].normalSprite = this.tabbarSpriteFrames[currTab * 2 + 1];
this.titleSprite.spriteFrame = this.titleSpriteFrames[currTab];
}
}
onSettingClick(event, eventData) {
UIManager_1.UIManager.pushPresenter(DiscoverSettingViewPresenter_1.DiscoverSettingViewPresenter, undefined);
}
};
__decorate([
property({ type: cc.Node })
], MainViewImpl.prototype, "contentParent", void 0);
__decorate([
property({ type: cc.Sprite })
], MainViewImpl.prototype, "titleSprite", void 0);
__decorate([
property({ type: [cc.Button], displayName: "Tabbar Buttons" })
], MainViewImpl.prototype, "tabbarButtons", void 0);
__decorate([
property({ type: [cc.SpriteFrame], displayName: "Tabbar Spriteframes" })
], MainViewImpl.prototype, "tabbarSpriteFrames", void 0);
__decorate([
property({ type: [cc.SpriteFrame], displayName: "Title Spriteframes" })
], MainViewImpl.prototype, "titleSpriteFrames", void 0);
MainViewImpl = __decorate([
ccclass,
PresenterCCViewFactory_1.RegView(MainView_1.MainViewType, "prefab/ui/MainView")
], MainViewImpl);
return MainViewImpl;
})();
exports.MainViewImpl = MainViewImpl;
cc._RF.pop();