import { _decorator, Component, Node, Event } from "cc";

import BaseUI from "../../scripts/base/BaseUI";
import { GameDetailLayer } from "../layer/GameDetailLayer";
import { Tips } from "../../scripts/mgr/Tips";
import { GameInfo } from "../../scripts/api/UserM";
import Utils from "../../scripts/utils/Utils";

const { ccclass, property } = _decorator;

@ccclass("PlayGameItem")
export class PlayGameItem extends BaseUI {
  protected onLoad(): void {
    super.onLoad();
  }

  private data: GameInfo;
  init(item: GameInfo) {
    this.data = item;
    // this.setText("lbl_game_name", item.gameName);
    this.setText(
      "lbl_remain_info",
      Utils.formatNumber(item.remainPog, 0) +
        "/" +
        Utils.formatNumber(item.seasonPog, 0)
    );
    this.setText("lbl_my_reward_pog", Utils.formatNumber(item.myRewardPog, 0));
  }

  protected simpleOnBtnClick(name: string): void {
    if (name === "btn_play") {
      Tips.show("Coming soon");
      // GameDetailLayer.show(this.gameId, this.FindNode("icon_game"));
    }
  }
}
