Index.js 766 B

12345678910111213141516171819202122232425262728293031323334
  1. var io = require('socket.io');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. wsItem: cc.Prefab,
  6. wsList: cc.Node,
  7. room: cc.Node
  8. },
  9. // LIFE-CYCLE CALLBACKS:
  10. init () {
  11. },
  12. onLoad () {
  13. },
  14. start () {
  15. this.room.on(cc.Node.EventType.TOUCH_START, () => {
  16. this.room.getComponent(cc.Animation).play();
  17. }, this)
  18. // var socket = io('http://127.0.0.1:3000/');
  19. // socket.emit('fuck', 666);
  20. // socket.on('help', data => {
  21. // let wsItem = cc.instantiate(this.wsItem);
  22. // wsItem.getComponent('WsItem').init(data.key, data.value);
  23. // this.wsList.addChild(wsItem);
  24. // })
  25. },
  26. // update (dt) {},
  27. });