"use strict";
cc._RF.push(module, '280c3rsZJJKnZ9RqbALVwtK', 'HelloWorld');
// Script/HelloWorld.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {
        // defaults, set visually when attaching this script to the Canvas
        text: '0',

        card1: {
            default: null,
            type: cc.Node
        },

        card2: {
            default: null,
            type: cc.Node
        },

        card3: {
            default: null,
            type: cc.Node
        },

        cardIndex: {
            default: null,
            type: cc.Label
        }
    },

    // use this for initialization
    onLoad: function onLoad() {
        this.cardIndex.string = this.text;
        this.isOpened = {};
        this.cards = {
            "1": this.card1,
            "2": this.card2,
            "3": this.card3
        };
    },

    start: function start() {},

    onClick1: function onClick1() {
        this.onClick(1);
    },

    onClick2: function onClick2() {
        this.onClick(2);
    },

    onClick3: function onClick3() {
        this.onClick(3);
    },

    onClick: function onClick(index) {
        this.cardIndex.string = "";
        cc.log("card: " + index);
        if (!this.isOpened[index]) {
            this.isOpened[index] = true;
            this.cards[index].runAction(cc.rotate3DTo(0.2, 0, -90, 0));
            //this.cards[index].eulerAngles = cc.v3(0, -90, 0);
            cc.log("card: " + index);
        }
        this.cardIndex.string = index + "";
    },

    onEnable: function onEnable() {},

    onDisable: function onDisable() {},

    // called every frame
    update: function update(dt) {}
});

cc._RF.pop();