123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { _decorator, Component, Node } from "cc";
- import BaseUI from "../../scripts/base/BaseUI";
- import { ScrollView } from "cc";
- import EV, { EV_TYPE } from "../../scripts/mgr/EV";
- import UserM from "../../scripts/api/UserM";
- const { ccclass, property } = _decorator;
- @ccclass("PageFamily")
- export class PageFamily extends BaseUI {
- private _data: any = {
- name: "",
- notice: "",
- };
- private _scrollView: ScrollView;
- onLoad(): void {
- super.onLoad();
- EV.ins.on(
- EV_TYPE.FAMILY_STATUS_UPDATE,
- this.onFamilyStatusUpdate.bind(this),
- this
- );
- }
- private onFamilyStatusUpdate() {
- this.refresh();
- }
- public onShow(): void {
- this.refresh();
- }
- async refresh() {
- let hasFamily = UserM.ins.hasFamily();
- this.FindNode("FamilyPageHas").active = hasFamily;
- this.FindNode("FamilyPageNo").active = !hasFamily;
- if (hasFamily) {
- this.FindNode("FamilyPageHas").getComponent(BaseUI).onShow();
- }
- }
- }
|