DatingEventViewImpl.ts 1.8 KB
import { CCPureView } from "../../../../common/classbase/CCViewBase";
import { RegView } from "../../PresenterCCViewFactory";
import { DatingEventViewType, DatingEventViewProps, DatingEventView } from "../type/DatingEventView";
import { View } from "../../../../common/classbase/ViewBase";
import { DatingEventSubviewImpl } from "./dating/DatingEventSubviewImpl";
import { DummyNode } from "../../../../common/CCDummyObjects";

const { ccclass, property } = cc._decorator;

@ccclass
@RegView(DatingEventViewType, "prefab/ui/DatingEventView")
export class DatingEventViewImpl extends CCPureView<DatingEventViewProps> implements DatingEventView {
    private _activeIndex = 0;

    //#region edntor bindings
    @property([DatingEventSubviewImpl])
    private subviews: DatingEventSubviewImpl[] = [];

    @property(cc.Node)
    private mainRedDot0 = DummyNode;
    @property(cc.Node)
    private mainRedDot1 = DummyNode;
    @property(cc.Node)
    private extraRedDot0 = DummyNode;
    @property(cc.Node)
    private extraRedDot1 = DummyNode;

    onTabChange(_: any, index: string) {
        this.subviews[this._activeIndex].hide();
        this._activeIndex = parseInt(index);
        this.subviews[this._activeIndex].show();
    }
    //#endregion


    private _tabGiftContentContainer: View;
    private _tabClothContentContainer: View;
    public getGiftContentContainer(): View {
        return this._tabGiftContentContainer;
    }

    public getClothContentContainer(): View {
        return this._tabClothContentContainer;
    }

    onLoad() {
        this.bindProp("mainEventRedDot", this.mainRedDot0, "active");
        this.bindProp("mainEventRedDot", this.mainRedDot1, "active");
        this.bindProp("extraEventRedDot", this.extraRedDot0, "active");
        this.bindProp("extraEventRedDot", this.extraRedDot1, "active");
    }
}