public static void HandleFrameData(byte[] data)
        {
            var cur = System.DateTime.Now;

            lastReceivedTime = cur;
            if (GameStarted)
            {
                CommandManager.ProcessPacket((byte[])data);
            }
        }
        public static IEnumerator StreamPlayback(Replay playbackReplay)
        {
            int lastFrameByteCount = 0;
            int playbackPosition   = 0;

            byte[] playbackBytes = playbackReplay.Content;

            bool getNextStream = true;
            int  frameCount    = 0;
            int  nextFrame     = -1;


            yield return(null);

            FrameManager.EndFrame = playbackReplay.LastCommandedFrameCount;

            while (playbackPosition < playbackBytes.Length || frameCount <= nextFrame)
            {
                if (getNextStream == true)
                {
                    bufferBytes.FastClear();
                    lastFrameByteCount = (int)BitConverter.ToUInt16(playbackBytes, playbackPosition);
                    playbackPosition  += 2;
                    nextFrame          = BitConverter.ToInt32(playbackBytes, playbackPosition);
                    bufferBytes.AddRange(playbackBytes, playbackPosition, lastFrameByteCount);
                    playbackPosition += lastFrameByteCount;
                    getNextStream     = false;
                }

                if (nextFrame == frameCount)
                {
                    getNextStream = true;
                    CommandManager.ProcessPacket(bufferBytes);
                }
                else
                {
                    CommandManager.ProcessPacket(BitConverter.GetBytes(frameCount));
                }
                frameCount++;
            }
            yield break;
        }