예제 #1
0
        public static void Draw(DisplayText dt, RollbackDriver rollbackDriver)
        {
            dt.SetPosition(new Vector2(2, 2));

            if (rollbackDriver == null)
            {
                dt.Begin();
                dt.WriteLine("Waiting to start...", Color.DarkRed);
                dt.End();
                return;
            }


            dt.Begin();
            dt.WriteLine("Current = " + rollbackDriver.CurrentFrame + "   LNCF = " + rollbackDriver.LocalNCF +
                         "   SNCF = " + rollbackDriver.ServerNCF);
            dt.WriteLine("LNCF Offset = " + (rollbackDriver.CurrentFrame - rollbackDriver.LocalNCF));
            dt.WriteLine("SNCF Offset = " + (rollbackDriver.CurrentFrame - rollbackDriver.ServerNCF));
            dt.WriteLine("JLE Buffer Count = " + rollbackDriver.JLEBufferCount);
            dt.WriteLine();
            dt.WriteLine("Local Delay = " + rollbackDriver.LocalFrameDelay);
            dt.WriteLine();

            for (var i = 0; i < 4; i++)
            {
                var ifmf = rollbackDriver.InputFirstMissingFrame(i);
                if (ifmf.HasValue)
                {
                    dt.WriteLine("Input " + i + " offset = " + (rollbackDriver.CurrentFrame - (ifmf.Value - 1)));
                }
                else
                {
                    dt.WriteLine("Input " + i + " is offline");
                }
            }


            if (rollbackDriver.HasClockSyncInfo)             // Only the client has interesting timer sync values:
            {
                dt.WriteLine();
                dt.WriteLine("Packet time offset = " + rollbackDriver.PacketTimeOffset.ToString("0.000"));
                dt.WriteLine("Timer correction rate = " + rollbackDriver.TimerCorrectionRate.ToString("0.00000"));
                dt.WriteLine("Sync clock offset = " + rollbackDriver.SynchronisedClockFrameOffset.ToString("0.000"));
            }


            if (rollbackDriver.debugDisableInputBroadcast)
            {
                dt.WriteLine();
                dt.WriteLine("Input Packet Send Disabled!!!", Color.Red);
            }

            dt.End();
        }
예제 #2
0
        public void Draw(DisplayText dt)
        {
            dt.Begin(new Vector2(50, 50));

            if (network == null)
            {
                // Before Network Startup
                dt.WriteLine("[F1] = Begin Network");
                dt.WriteLine();
                dt.WriteLine("[F3] = Cycle bad network simulation");
                dt.WriteLine();
                dt.WriteLine();
                dt.WriteLine();
                dt.WriteLine("After starting:", Color.DarkGray);
                dt.WriteLine("---------------", Color.DarkGray);
                dt.WriteLine("[F12] = Debug output", Color.DarkGray);
                dt.WriteLine("[-/+] = Adjust local input delay", Color.DarkGray);
            }
            else
            {
                // After Network Started
                if (rollbackDriver == null)
                {
                    // Before Game Start/Connect
                    if (!network.UsingKnownPort)
                    {
                        dt.WriteLine("WARNING: Using non-standard port: " + network.PortNumber, Color.Red);
                    }
                    dt.WriteLine("[F1] = Start LAN Game");
                    dt.WriteLine("[F2] = Start Internet Game");
                    if (commandLineHost != null)
                    {
                        dt.WriteLine("[F3] = Connect to \"" + commandLineHost + "\"");
                    }
                    else
                    {
                        dt.WriteLine("[F3] = (specify host on command line)", Color.LightGray);
                    }
                    dt.WriteLine("[F4] = Side channel Auth (" + (useSideChannelAuth ? "on" : "off") + ")");

                    dt.WriteLine();
                    if (network.Discovery != null)
                    {
                        if (network.Discovery.Items.Count == 0)
                        {
                            dt.WriteLine("Searching for LAN games...");
                        }
                        for (int i = 0; i < network.Discovery.Items.Count && i < 10; i++)
                        {
                            string status = network.Discovery.Items[i].StatusString;
                            dt.WriteLine("[" + ((char)('0' + i)) + "] = " + network.Discovery.Items[i].GameInfo.Name + " - " + network.Discovery.Items[i].EndPoint
                                         + (status == "" ? "" : " - " + status));
                        }
                    }
                }
                else
                {
                    if (useSideChannelAuth && network.IsServer)
                    {
                        dt.WriteLine("[F8] = Toggle Auth Token");
                        dt.WriteLine();
                    }

                    if (!network.IsApplicationConnected)
                    {
                        if (network.LocalisedDisconnectReason == null)
                        {
                            dt.WriteLine("Connecting...");
                        }
                        else
                        {
                            dt.WriteLine("Disconnected!", Color.DarkRed);
                            dt.WriteLine(network.LocalisedDisconnectReason, Color.DarkRed);
                        }
                    }
                }
            }

            dt.End();
        }