LikeLevelSubviewImpl.ts
938 Bytes
import { DummyLabel, DummyNode, DummySprite } from "../../../../common/CCDummyObjects";
import { CCPureSubview } from "../../../../common/classbase/CCViewBase";
import { RegSubview } from "../../PresenterCCViewFactory";
import { LikeLevelProps, LikeLevelView, LikeLevelViewType } from "../type/LikeLevelSubview";
const { ccclass, property } = cc._decorator;
@ccclass
@RegSubview(LikeLevelViewType)
export class LikeLevelSubviewImpl extends CCPureSubview<LikeLevelProps> implements LikeLevelView {
//#region editor bindings
@property(cc.Sprite)
private bar = DummySprite;
@property(cc.Label)
private label = DummyLabel;
//#endregion
onLoad() {
super.onLoad();
this.bindProp("level", v => {
this.label.string = v + "";
});
this.bindProp("percent", v => {
this.bar.fillRange = v;
});
this.bindProp("visible", this.node, "active");
}
}