7cbed840-23cb-4f8c-9a98-d6a4d554ee6e.js
3.94 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
"use strict";
cc._RF.push(module, '7cbedhAI8tPjJqY1qTVVO5u', 'MainInfoSubviewImpl');
// script/game/ui/view/impl/MainInfoSubviewImpl.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.MainInfoViewImpl = void 0;
const CCDummyObjects_1 = require("../../../../common/CCDummyObjects");
const CCViewBase_1 = require("../../../../common/classbase/CCViewBase");
const PresenterCCViewFactory_1 = require("../../PresenterCCViewFactory");
const MainInfoSubviewiew_1 = require("../type/MainInfoSubviewiew");
const { ccclass, property } = cc._decorator;
let MainInfoViewImpl = /** @class */ (() => {
let MainInfoViewImpl = class MainInfoViewImpl extends CCViewBase_1.CCPureSubview {
constructor() {
super(...arguments);
//#region editor bindings
this.timeLabel = CCDummyObjects_1.DummyLabel;
this.energySprite = CCDummyObjects_1.DummySprite;
this.energyLabel = CCDummyObjects_1.DummyLabel;
this.energySprites = [];
this.coolddown = CCDummyObjects_1.DummyLabel;
this.onEnergyClickCallback = () => {
this._props.onClick();
};
this.updateTime = () => {
let now = new Date;
this.timeLabel.string = `${now.getHours()}:${(now.getMinutes() < 10 ? '0' : '') + now.getMinutes()}`;
this.scheduleOnce(() => {
this.scheduleOnce(this.updateTime, 60 - now.getSeconds());
});
};
}
//#endregion
onLoad() {
this.updateTime();
this.energySprite.type = cc.Sprite.Type.FILLED;
this.energySprite.fillType = cc.Sprite.FillType.VERTICAL;
this.bindProp("energycontent", (value) => {
this.energyLabel.string = value;
});
this.bindProp("timecontent", (value) => {
if (value === "") {
this.coolddown.node.active = false;
}
else {
this.coolddown.node.active = true;
this.coolddown.string = value;
}
});
this.bindProp("energybackindex", (value) => {
this.energySprite.spriteFrame = this.energySprites[value];
});
this.bindProp("energy", (value) => {
this.energySprite.fillRange = value;
});
this.energySprite.node.on(cc.Node.EventType.TOUCH_END, this.onEnergyClickCallback, this);
this.energyLabel.node.on(cc.Node.EventType.TOUCH_END, this.onEnergyClickCallback, this);
}
};
__decorate([
property(cc.Label)
], MainInfoViewImpl.prototype, "timeLabel", void 0);
__decorate([
property(cc.Sprite)
], MainInfoViewImpl.prototype, "energySprite", void 0);
__decorate([
property(cc.Label)
], MainInfoViewImpl.prototype, "energyLabel", void 0);
__decorate([
property(cc.SpriteFrame)
], MainInfoViewImpl.prototype, "energySprites", void 0);
__decorate([
property(cc.Label)
], MainInfoViewImpl.prototype, "coolddown", void 0);
MainInfoViewImpl = __decorate([
ccclass,
PresenterCCViewFactory_1.RegSubview(MainInfoSubviewiew_1.MainInfoSubviewType)
], MainInfoViewImpl);
return MainInfoViewImpl;
})();
exports.MainInfoViewImpl = MainInfoViewImpl;
cc._RF.pop();