| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import { AppKernel } from '@scripts/app/AppKernel';
- import VirtualList from '@scripts/components/virtualList/VirtualList';
- import { UIViewID } from '@scripts/define/UIDefine';
- import { UIPopup } from '@scripts/framework/ui/UIPopup';
- import { addBtnClick, addTogClick } from '@scripts/utils/UIHelper';
- import { _decorator, Component, Label, Node, Toggle } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('UIInvite')
- export class UIInvite extends UIPopup {
- readonly viewId: UIViewID = UIViewID.UIInvite;
- @property(Node)
- btnClose: Node;
- @property([Toggle])
- subToggles: Toggle[] = [];
- @property([Node])
- subViews: Node[] = [];
- @property(VirtualList)
- recordList: VirtualList;
- @property(Label)
- lblCode: Label;
- @property(Label)
- lblLink: Label;
- @property(Node)
- btnBind: Node;
- @property(Node)
- btnSpin: Node;
- @property(Label)
- lblBtnSpin: Label;
- @property(Node)
- btnCopy: Node;
- @property(Node)
- btnShare: Node;
- private _subViewID = -1;
- protected onCreate(): void | Promise<void> {
- addBtnClick(this.btnClose, this.closeSelf, this);
- addBtnClick(this.btnBind, this.onBtnBindClick, this);
- addBtnClick(this.btnSpin, this.onBtnSpinClick, this);
- this.recordList.renderEvent.target = this.node;
- this.recordList.renderEvent.component = "UIInvite";
- this.recordList.renderEvent.handler = "renderRecordItem";
- this.subToggles.forEach((tog, idx) => {
- addTogClick(tog, (t) => { this.onTogClick(t, idx) });
- })
- }
- private onBtnBindClick() {
- AppKernel.ui.open(UIViewID.UIInviteBind);
- }
- private onBtnSpinClick() {
- AppKernel.ui.open(UIViewID.UIInviteSpin);
- }
- private onTogClick(tog: Toggle, index: number) {
- if (this._subViewID === index) return;
- this.updateSubView(index);
- }
- private updateSubView(index: number) {
- this._subViewID = index;
- this.subViews.forEach((view, idx) => view.active = idx === index);
- }
- protected onOpen(_params: unknown) {
- this.subToggles[0].isChecked = true;
- this.updateSubView(0);
- }
- renderRecordItem(item: Node, index: number) {
- }
- }
|