예제 #1
0
        protected override void Draw()
        {
            update = ((DateTime.Now - lastUpdate).TotalSeconds > updateTime);
            if (update)
            {
                lastUpdate = DateTime.Now;
            }
            var core = Core.Instance;

            GUILayout.BeginVertical();

            GUILayout.Label(networkInfoText, labelStyle);
            DrawInfo(bytesReadText, BytesToString(core.BytesRead));
            DrawInfo(bytesWrittenText, BytesToString(core.BytesWritten));
            DrawInfo(bytesReadRateText, BytesToString((ulong)core.BytesReadRate) + "/s");
            DrawInfo(bytesWrittenRateText, BytesToString((ulong)core.BytesWrittenRate) + "/s");

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.Label(rpcInfoText, labelStyle);
            DrawInfo(rpcsExecutedText, core.RPCsExecuted.ToString());
            DrawInfo(rpcRateText, Math.Round(core.RPCRate) + " RPC/s");
            DrawInfo(rpcExecutionMode, core.OneRPCPerUpdate ? singleRPCModeText : (core.AdaptiveRateControl ? adaptiveModeText : staticModeText));
            DrawInfo(maxTimePerUpdateText, core.OneRPCPerUpdate ? notApplicableText : core.MaxTimePerUpdate + " ns");
            DrawInfo(rpcReceiveModeText, core.BlockingRecv ? blockingModeText : nonBlockingModeText);
            DrawInfo(recvTimeoutText, core.BlockingRecv ? core.RecvTimeout + " ns" : notApplicableText);
            DrawInfo(timePerRPCUpdateText, String.Format("{0:F5} s", core.TimePerRPCUpdate));
            DrawInfo(pollTimePerRPCUpdateText, String.Format("{0:F5} s", core.PollTimePerRPCUpdate));
            DrawInfo(execTimePerRPCUpdateText, String.Format("{0:F5} s", core.ExecTimePerRPCUpdate));

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.Label(streamInfoText, labelStyle);
            DrawInfo(streamingRPCsText, core.StreamRPCs.ToString());
            DrawInfo(streamingRPCsExecutedText, core.StreamRPCsExecuted.ToString());
            DrawInfo(streamingRPCRateText, Math.Round(core.StreamRPCRate) + " RPC/s");
            DrawInfo(timePerStreamUpdateText, String.Format("{0:F5} s", core.TimePerStreamUpdate));

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearStatisticsText, buttonStyle))
            {
                core.ClearStats();
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow();
        }
예제 #2
0
        protected override void Draw(bool needRescale)
        {
            if (needRescale)
            {
                int scaledFontSize = Style.fontSize;
                scaledIndentWidth = indentWidth * GameSettings.UI_SCALE;
                Style.fixedWidth  = windowWidth * GameSettings.UI_SCALE;

                labelStyle.fontSize             = scaledFontSize;
                stretchyLabelStyle.fontSize     = scaledFontSize;
                fixedLabelStyle.fontSize        = scaledFontSize;
                fixedLabelStyle.fixedWidth      = fixedLabelWidth * GameSettings.UI_SCALE;
                textFieldStyle.fontSize         = scaledFontSize;
                textFieldStyle.fixedWidth       = textFieldWidth * GameSettings.UI_SCALE;
                longTextFieldStyle.fontSize     = scaledFontSize;
                longTextFieldStyle.fixedWidth   = longTextFieldWidth * GameSettings.UI_SCALE;
                stretchyTextFieldStyle.fontSize = scaledFontSize;
                buttonStyle.fontSize            = scaledFontSize;
                toggleStyle.fontSize            = scaledFontSize;
                separatorStyle.fontSize         = scaledFontSize;
                lightStyle.fontSize             = scaledFontSize;
                errorLabelStyle.fontSize        = scaledFontSize;
                comboOptionsStyle.fontSize      = scaledFontSize;
                GUILayoutExtensions.SetLightStyleSize(lightStyle, Style.lineHeight);
                resized = true;
            }

            // Force window to resize to height of content
            if (resized)
            {
                Position = new Rect(Position.x, Position.y, Position.width, 0f);
                resized  = false;
            }

            var running = Server.Running;

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            DrawServerStatus();
            DrawStartStopButton();
            GUILayout.EndHorizontal();

            GUILayout.Space(4);

            GUILayout.BeginHorizontal();
            DrawAddress();
            if (running)
            {
                GUILayout.Space(4);
                DrawShowInfoWindow();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            DrawRPCPort();
            GUILayout.Space(4);
            DrawStreamPort();
            GUILayout.EndHorizontal();

            if (running)
            {
                GUILayout.BeginHorizontal();
                DrawServerInfo();
                GUILayout.EndHorizontal();
                GUILayoutExtensions.Separator(separatorStyle);
                DrawClientsList();
            }
            else
            {
                GUILayout.BeginHorizontal();
                DrawAdvancedToggle();
                GUILayout.EndHorizontal();

                if (advanced)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawAutoStartServerToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawAutoAcceptConnectionsToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawConfirmRemoveClientToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawOneRPCPerUpdateToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawMaxTimePerUpdate();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawAdaptiveRateControlToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawBlockingRecvToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(scaledIndentWidth);
                    DrawRecvTimeout();
                    GUILayout.EndHorizontal();
                }

                foreach (var error in Errors)
                {
                    GUILayout.Label(error, errorLabelStyle);
                }
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
예제 #3
0
파일: MainWindow.cs 프로젝트: pipi1226/krpc
        protected override void Draw()
        {
            // Force window to resize to height of content
            if (resized)
            {
                Position = new Rect(Position.x, Position.y, Position.width, 0f);
                resized  = false;
            }

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            DrawServerStatus();
            DrawStartStopButton();
            GUILayout.EndHorizontal();

            GUILayout.Space(4);

            GUILayout.BeginHorizontal();
            DrawAddress();
            if (Server.Running)
            {
                GUILayout.Space(4);
                DrawShowInfoWindow();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            DrawRPCPort();
            GUILayout.Space(4);
            DrawStreamPort();
            GUILayout.EndHorizontal();

            if (Server.Running)
            {
                GUILayout.BeginHorizontal();
                DrawServerInfo();
                GUILayout.EndHorizontal();
                GUILayoutExtensions.Separator(separatorStyle);
                DrawClientsList();
            }
            else
            {
                GUILayout.BeginHorizontal();
                DrawAdvancedToggle();
                GUILayout.EndHorizontal();

                if (advanced)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawAutoStartServerToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawAutoAcceptConnectionsToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawOneRPCPerUpdateToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawMaxTimePerUpdate();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawAdaptiveRateControlToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawBlockingRecvToggle();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(indentWidth);
                    DrawRecvTimeout();
                    GUILayout.EndHorizontal();
                }

                foreach (var error in Errors)
                {
                    GUILayout.Label(error, errorLabelStyle);
                }
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
예제 #4
0
        protected override void Draw()
        {
            update = ((DateTime.Now - lastUpdate).TotalSeconds > updateTime);
            if (update)
            {
                lastUpdate = DateTime.Now;
            }

            // Force window to resize to height of content
            if (running != Server.Running)
            {
                running  = Server.Running;
                Position = new Rect(Position.x, Position.y, Position.width, 0f);
            }

            GUILayout.BeginVertical();

            if (Server.Running)
            {
                GUILayout.Label(networkInfoText, labelStyle);
                DrawInfo(bytesReadText, BytesToString(Server.BytesRead));
                DrawInfo(bytesWrittenText, BytesToString(Server.BytesWritten));
                DrawInfo(bytesReadRateText, BytesToString((ulong)Server.BytesReadRate) + "/s");
                DrawInfo(bytesWrittenRateText, BytesToString((ulong)Server.BytesWrittenRate) + "/s");

                GUILayoutExtensions.Separator(separatorStyle);

                GUILayout.Label(rpcInfoText, labelStyle);
                DrawInfo(rpcsExecutedText, Server.RPCsExecuted.ToString());
                DrawInfo(rpcRateText, Math.Round(Server.RPCRate) + " RPC/s");
                DrawInfo(rpcExecutionMode, Server.OneRPCPerUpdate ? singleRPCModeText : (Server.AdaptiveRateControl ? adaptiveModeText : staticModeText));
                DrawInfo(maxTimePerUpdateText, Server.OneRPCPerUpdate ? notApplicableText : Server.MaxTimePerUpdate + " ns");
                DrawInfo(rpcReceiveModeText, Server.BlockingRecv ? blockingModeText : nonBlockingModeText);
                DrawInfo(recvTimeoutText, Server.BlockingRecv ? Server.RecvTimeout + " ns" : notApplicableText);
                DrawInfo(timePerRPCUpdateText, String.Format("{0:F5} s", Server.TimePerRPCUpdate));
                DrawInfo(pollTimePerRPCUpdateText, String.Format("{0:F5} s", Server.PollTimePerRPCUpdate));
                DrawInfo(execTimePerRPCUpdateText, String.Format("{0:F5} s", Server.ExecTimePerRPCUpdate));

                GUILayoutExtensions.Separator(separatorStyle);

                GUILayout.Label(streamInfoText, labelStyle);
                DrawInfo(streamingRPCsText, Server.StreamRPCs.ToString());
                DrawInfo(streamingRPCsExecutedText, Server.StreamRPCsExecuted.ToString());
                DrawInfo(streamingRPCRateText, Math.Round(Server.StreamRPCRate) + " RPC/s");
                DrawInfo(timePerStreamUpdateText, String.Format("{0:F5} s", Server.TimePerStreamUpdate));

                GUILayoutExtensions.Separator(separatorStyle);

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(clearStatisticsText, buttonStyle))
                {
                    Server.ClearStats();
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label("Server not running");
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
예제 #5
0
        protected override void Draw(bool needRescale)
        {
            if (needRescale)
            {
                int scaledFontSize = Style.fontSize;
                Style.fixedWidth           = windowWidth * GameSettings.UI_SCALE;
                labelStyle.fontSize        = scaledFontSize;
                nameLabelStyle.fontSize    = scaledFontSize;
                nameLabelStyle.fixedWidth  = 160f * GameSettings.UI_SCALE;
                valueLabelStyle.fontSize   = scaledFontSize;
                valueLabelStyle.fixedWidth = 120f * GameSettings.UI_SCALE;
                buttonStyle.fontSize       = scaledFontSize;

                // Force window to resize to height of content
                Position = new Rect(Position.x, Position.y, Position.width, 0f);
            }

            update = ((DateTime.Now - lastUpdate).TotalSeconds > updateTime);
            if (update)
            {
                lastUpdate = DateTime.Now;
            }
            var core = Core.Instance;

            GUILayout.BeginVertical();

            GUILayout.Label(networkInfoText, labelStyle);
            DrawInfo(bytesReadText, BytesToString(core.BytesRead));
            DrawInfo(bytesWrittenText, BytesToString(core.BytesWritten));
            DrawInfo(bytesReadRateText, BytesToString((ulong)core.BytesReadRate) + "/s");
            DrawInfo(bytesWrittenRateText, BytesToString((ulong)core.BytesWrittenRate) + "/s");

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.Label(rpcInfoText, labelStyle);
            DrawInfo(rpcsExecutedText, core.RPCsExecuted.ToString());
            DrawInfo(rpcRateText, Math.Round(core.RPCRate) + " RPC/s");
            DrawInfo(rpcExecutionMode, core.OneRPCPerUpdate ? singleRPCModeText : (core.AdaptiveRateControl ? adaptiveModeText : staticModeText));
            DrawInfo(maxTimePerUpdateText, core.OneRPCPerUpdate ? notApplicableText : core.MaxTimePerUpdate + " ns");
            DrawInfo(rpcReceiveModeText, core.BlockingRecv ? blockingModeText : nonBlockingModeText);
            DrawInfo(recvTimeoutText, core.BlockingRecv ? core.RecvTimeout + " ns" : notApplicableText);
            DrawInfo(timePerRPCUpdateText, string.Format("{0:F5} s", core.TimePerRPCUpdate));
            DrawInfo(pollTimePerRPCUpdateText, string.Format("{0:F5} s", core.PollTimePerRPCUpdate));
            DrawInfo(execTimePerRPCUpdateText, string.Format("{0:F5} s", core.ExecTimePerRPCUpdate));

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.Label(streamInfoText, labelStyle);
            DrawInfo(streamingRPCsText, core.StreamRPCs.ToString());
            DrawInfo(streamingRPCsExecutedText, core.StreamRPCsExecuted.ToString());
            DrawInfo(streamingRPCRateText, Math.Round(core.StreamRPCRate) + " RPC/s");
            DrawInfo(timePerStreamUpdateText, string.Format("{0:F5} s", core.TimePerStreamUpdate));

            GUILayoutExtensions.Separator(separatorStyle);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearStatisticsText, buttonStyle))
            {
                core.ClearStats();
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUI.DragWindow();
        }
예제 #6
0
        protected override void Draw(bool needRescale)
        {
            if (needRescale)
            {
                int scaledFontSize = Style.fontSize;
                scaledIndentWidth = indentWidth * GameSettings.UI_SCALE;
                Style.fixedWidth  = windowWidth * GameSettings.UI_SCALE;

                labelStyle.fontSize             = scaledFontSize;
                stretchyLabelStyle.fontSize     = scaledFontSize;
                fixedLabelStyle.fontSize        = scaledFontSize;
                fixedLabelStyle.fixedWidth      = fixedLabelWidth * GameSettings.UI_SCALE;
                textFieldStyle.fontSize         = scaledFontSize;
                textFieldStyle.fixedWidth       = textFieldWidth * GameSettings.UI_SCALE;
                longTextFieldStyle.fontSize     = scaledFontSize;
                longTextFieldStyle.fixedWidth   = longTextFieldWidth * GameSettings.UI_SCALE;
                stretchyTextFieldStyle.fontSize = scaledFontSize;
                buttonStyle.fontSize            = scaledFontSize;
                toggleStyle.fontSize            = scaledFontSize;
                separatorStyle.fontSize         = scaledFontSize;
                lightStyle.fontSize             = scaledFontSize;
                errorLabelStyle.fontSize        = scaledFontSize;
                comboOptionsStyle.fontSize      = scaledFontSize;
                comboOptionStyle.fontSize       = scaledFontSize;
                GUILayoutExtensions.SetLightStyleSize(lightStyle, Style.lineHeight);
                Resized = true;
            }

            // Force window to resize to height of content
            if (Resized)
            {
                Position = new Rect(Position.x, Position.y, Position.width, 0f);
                Resized  = false;
            }

            GUILayout.BeginVertical();

            DrawStartServer();
            GUILayoutExtensions.Separator(separatorStyle);

            var servers = core.Servers.ToList();

            foreach (var server in servers)
            {
                DrawServer(server, servers.Count == 1);
                GUILayoutExtensions.Separator(separatorStyle);
            }

            DrawAddServer();
            GUILayoutExtensions.Separator(separatorStyle);

            if (Errors.Any())
            {
                foreach (var error in Errors)
                {
                    GUILayout.Label(error, errorLabelStyle);
                }
                GUILayoutExtensions.Separator(separatorStyle);
            }

            DrawAdvancedServerOptions();
            DrawShowInfoWindow();
            GUILayout.EndVertical();

            GUI.DragWindow();
        }