Пример #1
0
        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);
                }
            }
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        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;
                    }
                }
            }
        }
Пример #4
0
        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);
                }
            }
        }
Пример #5
0
 public void Set_Data(DataMessage _data)
 {
     data      = _data;
     data_type = data.type;
 }
Пример #6
0
 public static void AddToQueue(DataMessage msg)
 {
     instance.outputQueue.Enqueue(msg);
 }