import { _decorator, Component, EventTouch, Node, Vec3 } from 'cc';
import { HitColor } from './HitColor';
const { ccclass, property } = _decorator;

@ccclass('Main')
export class Main extends Component {
    start() {

    }

    update(deltaTime: number) {
        
    }

    protected onLoad(): void {
        console.log('AAAAAAA');
        let btn = this.node.getChildByName("btn");

        btn.on(Node.EventType.TOUCH_END, (e:EventTouch)=>{

            var uiLocation = e.touch.getUILocation()
            var wpos = new Vec3(uiLocation.x,uiLocation.y,1000)
            let bool = HitColor.hitTest(wpos, btn);
            console.log(wpos, bool);

        }, this);
    }
}

