import { _decorator, Component, Node } from "cc";
import BaseUI from "../../scripts/base/BaseUI";
import { POGClaimLayer, POGClaimLayerCallback } from "../layer/POGClaimLayer";
import { Tips } from "../../scripts/mgr/Tips";
import { Sprite } from "cc";
import { Label } from "cc";
const { ccclass, property } = _decorator;

@ccclass("GameTaskItem")
export class GameTaskItem extends BaseUI implements POGClaimLayerCallback {
  onClaim(isCritical: boolean): void {
    console.log("onClaim", isCritical);
    if (isCritical) {
      Tips.show("Critical");
    } else {
      Tips.show("Claim");
    }

    this.FindNode("btn_claim").getComponent(Sprite).grayscale = true;
    this.FindNode("btn_claim").getComponentInChildren(Label).string = "Claimed";
  }
  private pogValue: number;
  init(pogValue: number) {
    this.pogValue = pogValue;
  }

  protected simpleOnBtnClick(name: string): void {
    switch (name) {
      case "btn_claim":
        POGClaimLayer.show(this.pogValue, this);
        break;
    }
  }
}
