// 绘制球桌
cc.Class({
    extends: cc.Component,

    properties: {
        g: {
            default: null,
            type: cc.Graphics,
        },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        this.darwTable();
    },

    // 绘制球桌
    darwTable:function() {
        // 台面
        this.g.lineWidth = 8;
        this.g.fillColor.fromHEX('#ffffff');
        this.g.moveTo(0, 0);
        this.g.lineTo(-90, 0);
        this.g.lineTo(-90, 168);
        this.g.lineTo(90, 168);
        this.g.lineTo(90, 0);
        this.g.close();
        this.g.stroke();
        this.g.fill();

        // 桌角
        this.g.lineWidth = 5;
        this.g.moveTo(-79, 0);
        this.g.lineTo(-79, -44);
        this.g.stroke();

        this.g.moveTo(79, 0);
        this.g.lineTo(79, -44);
        this.g.stroke();

        // 中线
        this.g.moveTo(0, 0);
        this.g.lineTo(0, 168);
        this.g.stroke();

        // 中网
        this.g.lineWidth = 8;
        this.g.moveTo(-99, 84);
        this.g.lineTo(-99, 103);
        this.g.lineTo(99, 103);
        this.g.lineTo(99, 84);
        this.g.close();
        this.g.stroke();
        this.g.fill();

        // 网架
        this.g.lineWidth = 8;
        this.g.moveTo(-94, 76);
        this.g.lineTo(-104, 76);
        this.g.lineTo(-104, 108);
        this.g.lineTo(-102, 108);
        this.g.lineTo(-102, 80);
        this.g.lineTo(-94, 80);
        this.g.close();
        this.g.stroke();
        this.g.fill();

        this.g.moveTo(94, 76);
        this.g.lineTo(104, 76);
        this.g.lineTo(104, 108);
        this.g.lineTo(102, 108);
        this.g.lineTo(102, 80);
        this.g.lineTo(94, 80);
        this.g.close();
        this.g.stroke();
        this.g.fill();
    },
});
