Пример #1
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();
        }
Пример #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;
                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();
        }