import { _decorator, Component, Node } from "cc";
import BaseUI from "../base/BaseUI";
const { ccclass, property } = _decorator;

@ccclass("BallUITaskItem")
export class TaskItem extends BaseUI {
  private _go: () => void;

  public init(data: any, go: () => void) {
    this.setText("lbl_title", data.title);
    this.FindNode("btn_claim").active = data.isClaimed;
    this._go = go;
  }

  protected simpleOnBtnClick(name: string): void {
    switch (name) {
      case "btn_go":
        this._go();
        break;
      case "btn_claim":
        this.FindNode("btn_claim").active = false;
        break;
    }
  }
}
