12345678910111213141516171819202122232425262728293031323334 |
- var io = require('socket.io');
- cc.Class({
- extends: cc.Component,
- properties: {
- wsItem: cc.Prefab,
- wsList: cc.Node,
- room: cc.Node
- },
- // LIFE-CYCLE CALLBACKS:
- init () {
- },
-
- onLoad () {
- },
-
- start () {
- this.room.on(cc.Node.EventType.TOUCH_START, () => {
- this.room.getComponent(cc.Animation).play();
- }, this)
-
- // var socket = io('http://127.0.0.1:3000/');
- // socket.emit('fuck', 666);
- // socket.on('help', data => {
- // let wsItem = cc.instantiate(this.wsItem);
- // wsItem.getComponent('WsItem').init(data.key, data.value);
- // this.wsList.addChild(wsItem);
- // })
- },
- // update (dt) {},
- });
|