DateCountViewImpl.ts
2.95 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
import { DateCountViewType, DateCountViewProps, DateCountView } from "../type/DateCountView";
import { CCPureView } from "../../../../common/classbase/CCViewBase";
import { RegView } from "../../PresenterCCViewFactory";
import { DummyNode, DummyRichText, DummySprite } from "../../../../common/CCDummyObjects";
import { ResUtils } from "simba-cc-resutils";
import { GameModelManager } from "../../../model/GameModelManager";
const { ccclass, property } = cc._decorator;
@ccclass
@RegView(DateCountViewType, "prefab/ui/DateCountView")
export class DateCountViewImpl extends CCPureView<DateCountViewProps> implements DateCountView {
@property(cc.Sprite)
progressTipSpr: cc.Sprite = DummySprite;
@property(cc.Sprite)
preNumberSpr: cc.Sprite = DummySprite;
@property(cc.Sprite)
curNumberSpr: cc.Sprite = DummySprite;
@property(cc.Sprite)
skinSpr: cc.Sprite = DummySprite;
@property(cc.Node)
numberNode: cc.Node = DummyNode;
@property(cc.RichText)
skinNameLabel: cc.RichText = DummyRichText;
@property(cc.Node)
kaNode: cc.Node = DummyNode;
private _resumPosY: number = -120;
private _moveTmpPosY: number = -10;
private _actLifeCycle: number = 2;
private _rotationStep: number = -60;
onLoad() {
this.bindProp("skinSprPath", async (value) => {
if (value && "" !== value.trim() && !value.endsWith("/")) {
this.skinSpr.spriteFrame = await ResUtils.loadRes(value, cc.SpriteFrame);
}
});
this.bindProp("progressTipSprPath", async (value) => {
if (value && "" !== value.trim() && !value.endsWith("/")) {
this.progressTipSpr.spriteFrame = await ResUtils.loadRes(value, cc.SpriteFrame);
}
});
this.bindProp("preNumberSprPath", async (value) => {
if (value && "" !== value.trim() && !value.endsWith("/")) {
this.preNumberSpr.spriteFrame = await ResUtils.loadRes(value, cc.SpriteFrame);
}
});
this.bindProp("curNumberSprPath", async (value) => {
if (value && "" !== value.trim() && !value.endsWith("/")) {
this.curNumberSpr.spriteFrame = await ResUtils.loadRes(value, cc.SpriteFrame);
}
});
this.bindProp("skinName", async (value) => {
this.skinNameLabel.string = value;
});
}
onEnable() {
this.kaNodeAnim();
}
runMoveAction = () => {
this.numberNode.y = this._resumPosY;
cc.tween(this.numberNode).to(this._actLifeCycle, { y: this._moveTmpPosY }, { easing: 'backInOut' }).start();
}
resumeMoveAction = () => {
this.numberNode.y = this._resumPosY;
}
kaNodeAnim() {
cc.tween(this.kaNode).by(this._actLifeCycle, { angle: this._rotationStep }).repeatForever().start()
}
closeAction() {
if (this._props.canClose) {
this.close();
// GameModelManager.checkAutoPopView();
}
}
}