public static void Process() { while (instance.inputQueue.Count > 0) { DataMessage msg = instance.inputQueue.Dequeue(); if (msg.sendType == SEND_TYPE.LOCAL) { OutputQueue.AddToQueue(msg); } else { MyClient.Instance.SendMessageToServer(msg); } } }
public static void Process() { while (instance.pInputQueue.Count > 0) { DataMessage msg = instance.pInputQueue.Dequeue(); if (msg.dataType == DATAMESSAGE_TYPE.LATENCY_CHECK) { PredictionController.Instance().Process(msg as LatencyCheckMessage); } else { GameManager.RecieveMessage(msg); } } }
public static void RecieveMessage(DataMessage msg) { if (instance.state == GAME_STATE.LOBBY) { switch (msg.type) { case DataMessage_Type.GAME_STATE: instance.ProcessGameStateMessage(msg as GameStateMessage); break; } } else if (instance.state == GAME_STATE.PLAY) { if (msg.sendType == SEND_TYPE.NETWORKED) { if (msg.type == DataMessage_Type.PLAYER_INPUT) { PlayerInputMessage pMsg = msg as PlayerInputMessage; // Only recieve 2nd Player input if (pMsg.playerID == 2) { instance.ProcessPlayerInputMessage(pMsg); } } } else { switch (msg.type) { case DataMessage_Type.PLAYER_INPUT: PlayerInputMessage pMsg = msg as PlayerInputMessage; instance.ProcessPlayerInputMessage(pMsg); break; case DataMessage_Type.PLAYER_UPDATE: PlayerUpdateMessage updateMsg = msg as PlayerUpdateMessage; instance.ProcessPlayerUpdateMessage(updateMsg); break; default: Debug.Assert(false, "Not Processing Anything"); break; } } } }
public static void Process() { while (instance.pOutputQueue.Count > 0) { DataMessage msg = instance.pOutputQueue.Dequeue(); if (msg.sendType == SEND_TYPE.LOCAL) { InputQueue.AddToQueue(msg); } else { //InputQueue.AddToQueue(msg); MyClient.Instance().SendData(msg); } } }
public void Set_Data(DataMessage _data) { data = _data; data_type = data.type; }
public static void AddToQueue(DataMessage msg) { instance.outputQueue.Enqueue(msg); }