12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { _decorator, Component, Node } from "cc";
- import BaseUI from "../../scripts/base/BaseUI";
- import { Tips } from "../../scripts/mgr/Tips";
- import { TipsData, TipsLayer } from "../layer/TipsLayer";
- import Utils from "../../scripts/utils/Utils";
- const { ccclass, property } = _decorator;
- export enum ManagePlayerItemType {
- APPROVE = 0,
- MEMBERS = 1,
- }
- @ccclass("ManagePlayerItem")
- export class ManagePlayerItem extends BaseUI {
- init(type: ManagePlayerItemType, data: any) {
- this.setText("lbl_user_name", "Player_" + data);
- this.initType(type);
- }
- private type: ManagePlayerItemType = null!;
- initType(type: ManagePlayerItemType) {
- this.type = type;
- if (type == ManagePlayerItemType.APPROVE) {
- this.setText("lbl_manager_name", "" + "Approve");
- } else if (type == ManagePlayerItemType.MEMBERS) {
- this.setText("lbl_manager_name", "" + "Remove");
- }
- this.FindNode("exp").active = type == ManagePlayerItemType.MEMBERS;
- this.FindNode("lbl_approve_info").active = type == ManagePlayerItemType.APPROVE;
- }
- protected simpleOnBtnClick(name: string): void {
- switch (name) {
- case "btn_manage_one":
- if (this.type == ManagePlayerItemType.APPROVE) {
- } else if (this.type == ManagePlayerItemType.MEMBERS) {
- this.remove();
- }
- break;
- }
- }
- remove() {
- let self = this;
- TipsLayer.showConfirm(
- Utils.setI18nLabel("Family.RemoveSuccessTitle"),
- Utils.setI18nLabel("Family.RemoveConfirmContent")
- ).then((success) => {
- if (success) {
- Tips.show(Utils.setI18nLabel("Family.RemoveMemberSuccess"));
- self.node.destroy();
- }
- });
- }
- }
|