示例#1
0
        public void DrawContent(int windowId)
        {
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);

            #region Horizontal toolbar

            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            var chatButtonStyle = ButtonStyle;
            if (SystemsContainer.Get <ChatSystem>().ChatButtonHighlighted)
            {
                chatButtonStyle = HighlightStyle;
            }
            if (!SettingsSystem.ServerSettings.DropControlOnVesselSwitching)
            {
                var tooltip = "Drops control of the vessels that you are not controlling so other players can control them";
                if (GUILayout.Button(new GUIContent("DropCtrl", tooltip), ButtonStyle))
                {
                    SystemsContainer.Get <VesselLockSystem>().DropAllOtherVesselControlLocks();
                }
            }
            WindowsContainer.Get <ChatWindow>().Display         = GUILayout.Toggle(WindowsContainer.Get <ChatWindow>().Display, "Chat", chatButtonStyle);
            WindowsContainer.Get <CraftLibraryWindow>().Display = GUILayout.Toggle(WindowsContainer.Get <CraftLibraryWindow>().Display, "Craft", ButtonStyle);
            WindowsContainer.Get <DebugWindow>().Display        = GUILayout.Toggle(WindowsContainer.Get <DebugWindow>().Display, "Debug", ButtonStyle);
#if DEBUG
            WindowsContainer.Get <SystemsWindow>().Display = GUILayout.Toggle(WindowsContainer.Get <SystemsWindow>().Display, "Systems", ButtonStyle);
#endif

            GUILayout.EndHorizontal();

            #endregion

            #region Players information

            ScrollPosition = GUILayout.BeginScrollView(ScrollPosition, ScrollStyle);

            //Draw other subspaces
            foreach (var currentEntry in SubspaceDisplay)
            {
                if (currentEntry.SubspaceId == -1)
                {
                    //Draw the warping players
                    GUILayout.BeginHorizontal(SubspaceStyle);
                    GUILayout.Label("WARPING");
                    GUILayout.EndHorizontal();
                }
                else
                {
                    GUILayout.BeginHorizontal(SubspaceStyle);
                    GUILayout.Label($"T: +{KSPUtil.PrintTimeCompact(WarpSystem.GetSubspaceTime(currentEntry.SubspaceId), false)}");
                    GUILayout.FlexibleSpace();
                    if (NotWarpingAndIsFutureSubspace(currentEntry.SubspaceId) && GUILayout.Button("Sync", ButtonStyle))
                    {
                        WarpSystem.CurrentSubspace = currentEntry.SubspaceId;
                    }
                    GUILayout.EndHorizontal();
                }

                foreach (var currentPlayer in currentEntry.Players)
                {
                    DrawPlayerEntry(currentPlayer == SettingsSystem.CurrentSettings.PlayerName
                        ? SystemsContainer.Get <StatusSystem>().MyPlayerStatus
                        : SystemsContainer.Get <StatusSystem>().GetPlayerStatus(currentPlayer));
                }
            }

            GUILayout.EndScrollView();

            #endregion

            GUILayout.FlexibleSpace();
#if DEBUG
            GUILayout.BeginHorizontal();
            DrawDebugSwitches();
            GUILayout.EndHorizontal();
#endif
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Disconnect", ButtonStyle))
            {
                DisconnectEventHandled = false;
            }
            WindowsContainer.Get <OptionsWindow>().Display = GUILayout.Toggle(WindowsContainer.Get <OptionsWindow>().Display, "Options", ButtonStyle);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }