import FqLogin from "../../../login/FqLogin";
import FSprite from "../object/FSprite";
import BaseEvent from "./base/BaseEvent";

/**
 * 捡任务道具
 */
const {ccclass, property} = cc._decorator;

@ccclass
export default class FPickGood extends BaseEvent {

    @property({
        displayName: '捡起的物品id'
    })
    public goodId = 2002;
    onLoad(){
        super.onLoad()
        this.node.zIndex = 9999;
    }
    public onBegin(tag:number){
        this.node.removeComponent(cc.PhysicsBoxCollider);

        let header = this.ff.mFFheader;
        header.addTmpGood(this.goodId,1);

        cc.tween(this.node).sequence(
            cc.spawn(
                cc.moveBy(1, cc.v2(0, 200)).easing(cc.easeSineOut()),
                cc.fadeOut(1)
            ),
            cc.callFunc(()=>{
                FqLogin.commitEvent(this.node.name,'','');
                this.node.removeFromParent(true);
                this.node.destroy();
            })
        ).start();
    }
    
    
}
