module.exports = PinaappleServer;

var Constants = require('./Constants');

function PinaappleServer(){
  this.msgQuene = new Array();  //消息队列
  this.processStatus = false;
  this.process = function() {
    if (!this.processStatus && this.msgQuene.length>0) {
      console.log('Show Quene: ' + this.msgQuene);
      this.processStatus = true;
      var data = this.msgQuene.shift();   //取第一个元素并进行处理
      console.log('Process: ' + data);
      this.processStatus = false;
    }
  }
  this.playerNumer = 0;
  this.gameStatus = Constants.GAME_READY;
}

PinaappleServer.prototype.do = function(data){
  console.log('Do :' + data);
  this.msgQuene.push(data);
  this.process();
};

@@ -541,16 +541,64 @@
 E_READY;
+%0A%0A  function gameloop(data) %7B%0A    // body...%0A  %7D
 %0A%7D%0A%0APina

add gameloop