119881ba-3c1c-48cc-9108-491015644c5e.js
6.19 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
"use strict";
cc._RF.push(module, '11988G6PBxIzJEISRAVZExe', 'GiftListItemImpl');
// script/game/ui/view/impl/message/GiftListItemImpl.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.GiftListItemImpl = void 0;
const simba_cc_resutils_1 = require("simba-cc-resutils");
const simba_sdk_1 = require("simba-sdk");
const AVG_1 = require("../../../../../avg/AVG");
const CCDummyObjects_1 = require("../../../../../common/CCDummyObjects");
const CCViewBase_1 = require("../../../../../common/classbase/CCViewBase");
const GameTextData_1 = require("../../../../../common/gameplay/gamedata/GameTextData");
const UIManager_1 = require("../../../../../common/gameplay/managers/UIManager");
const Enums_1 = require("../../../../Enums");
const GameModelManager_1 = require("../../../../model/GameModelManager");
const AlertDialogViewPresenter_1 = require("../../../presenter/AlertDialogViewPresenter");
const { ccclass, property } = cc._decorator;
let GiftListItemImpl = /** @class */ (() => {
let GiftListItemImpl = class GiftListItemImpl extends CCViewBase_1.CCPureView {
constructor() {
super(...arguments);
//#region editor bindings
this.checkNode = CCDummyObjects_1.DummyNode;
this.bgSprite = CCDummyObjects_1.DummySprite;
this.iconSprite = CCDummyObjects_1.DummySprite;
this.likeSprite = CCDummyObjects_1.DummySprite;
this.numLabel = CCDummyObjects_1.DummyLabel;
this.likeLabel = CCDummyObjects_1.DummyLabel;
this.bgSFs = [];
this.likeSFs = [];
//#endregion
this._likeLabelColors = [cc.color(115, 105, 192), cc.color(148, 148, 148)];
}
onClick() {
let storeUnlocked = AVG_1.GameRecord.recordVariables["MallViewPresenter"] === 1;
if (this._props.count === 0) {
if (storeUnlocked) {
this.showEnterStoreAlert();
}
else {
UIManager_1.UIManager.showToast(GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_MAIN_FUNCTION_NOT_OPEN));
}
}
else {
this._props.onClick();
}
}
get checked() { return this.checkNode.active; }
onLoad() {
super.onLoad();
this.bindProp("count", (v) => {
this.numLabel.string = v.toString();
let index = v === 0 ? 1 : 0;
this.bgSprite.spriteFrame = this.bgSFs[index];
this.likeSprite.spriteFrame = this.likeSFs[index];
this.likeLabel.node.color = this._likeLabelColors[index];
this.iconSprite.setMaterial(0, this.iconSprite.getMaterials()[index + 1]);
});
this.bindProp("addLike", (v) => this.likeLabel.string = "+" + v);
this.bindProp("icon", async (v) => {
if (v) {
let sf = await simba_cc_resutils_1.ResUtils.loadRes(v, cc.SpriteFrame, 2);
if (cc.isValid(this.iconSprite)) {
this.iconSprite.spriteFrame = sf;
}
}
});
this.bindProp("select", this.checkNode, "active");
// this.node.on(cc.Node.EventType.)
}
showEnterStoreAlert() {
// GameDotMgr.getInstance().dotShopTotal(DotShopTotalType.Popup, { popType: "nohave_show" });
let temp = {
dataptr: {},
titlecontent: GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_NO_THIS_PROP_TITLE_VALUE),
content: GameModelManager_1.GameModelManager.getLanguageTxt(GameTextData_1.GameTextData.GAME_TEXT_ENTER_STORE_VALUE),
ishasad: false,
istwobtn: true,
adconfig: "",
// items: [],
hasBanner: false,
callback: (type, ret, param) => {
simba_sdk_1.SDK.hideBannerAd();
if (ret) {
GameModelManager_1.GameModelManager.MainTabForceClick.emit({ index: Enums_1.MainTabs.bedroomTab, pureClick: false, propId: parseInt(this._props.key) });
// GameDotMgr.getInstance().dotShopTotal(DotShopTotalType.Popup, { popType: "click_popup" });
if (type === "video") {
// GameModelManager.addDailyTasks(DailyQuestType.Dq_AdsWatch, 1);
}
}
}
};
UIManager_1.UIManager.pushPresenter(AlertDialogViewPresenter_1.default, temp);
}
};
__decorate([
property(cc.Node)
], GiftListItemImpl.prototype, "checkNode", void 0);
__decorate([
property(cc.Sprite)
], GiftListItemImpl.prototype, "bgSprite", void 0);
__decorate([
property(cc.Sprite)
], GiftListItemImpl.prototype, "iconSprite", void 0);
__decorate([
property(cc.Sprite)
], GiftListItemImpl.prototype, "likeSprite", void 0);
__decorate([
property(cc.Label)
], GiftListItemImpl.prototype, "numLabel", void 0);
__decorate([
property(cc.Label)
], GiftListItemImpl.prototype, "likeLabel", void 0);
__decorate([
property([cc.SpriteFrame])
], GiftListItemImpl.prototype, "bgSFs", void 0);
__decorate([
property([cc.SpriteFrame])
], GiftListItemImpl.prototype, "likeSFs", void 0);
GiftListItemImpl = __decorate([
ccclass
], GiftListItemImpl);
return GiftListItemImpl;
})();
exports.GiftListItemImpl = GiftListItemImpl;
cc._RF.pop();