import { _decorator, BlockInputEvents, Component, Node, Size, UITransform, v2 } from 'cc';
import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite';
import { NpkImage } from '../../Tool/NPKImage';
import { CloseButtonNode } from '../Common/CloseButtonNode';
const { ccclass, property } = _decorator;

export enum otherWinType{
    /// 长跑达人
    longRun = 0,
    /// 地轨中心的王
    groundKing = 1,
    /// 哈林的王
    halinKing = 2,
    /// 魔界大战的王
    hellWarKing = 3,
    /// 切斯特小镇的王
    townsKing = 4,
    /// 区域独占
    districtExclusive = 5

}

/// 其他获胜条件
@ccclass('OtherWinNode')
export class OtherWinNode extends Node {
    
    constructor(type:otherWinType){
        super();

        this.setPosition(0,0);
        this.addComponent( UITransform).setContentSize(new Size(1067,600));
        this.getComponent(UITransform).anchorPoint = v2(0, 1);
        this.addComponent( BlockInputEvents );
        
        /// 获胜条件图片
        const winImgNode = new Node();
        this.addChild(winImgNode);

        this.setPosition(366,-176.5);

        const winBs = winImgNode.addComponent( BaseSprite );
        winBs.updateSpriteFrame(NpkImage.conditionsofvictory,type);
        

        /// 关闭按钮
        const closeNode = new CloseButtonNode(()=>{
            this.active = false;
        });
        winImgNode.addChild(closeNode);

        closeNode.setPosition(310,-15);

    }


}


