private void UpdateScreenMessage() { if (warpMode == WarpMode.MCW_FORCE || warpMode == WarpMode.MCW_VOTE) { if (warpMaster != "") { int timeLeft = (int)(controllerExpireTime - Client.realtimeSinceStartup); if (warpMaster != dmpSettings.playerName) { DisplayMessage(warpMaster + " currently has warp control (timeout " + timeLeft + "s)", 1f); } else { DisplayMessage("You have warp control, press '<' while not in warp to release (timeout " + timeLeft + "s)", 1f); } } else { if (voteMaster != "") { int timeLeft = (int)(voteExpireTime - Client.realtimeSinceStartup); if (voteMaster == dmpSettings.playerName) { DisplayMessage("Waiting for vote replies... Yes: " + voteYesCount + ", No: " + voteNoCount + ", Needed: " + voteNeededCount + " (" + timeLeft + "s left)", 1f); } else { if (voteSent) { DisplayMessage("Voted! (Yes: " + voteYesCount + ", No: " + voteNoCount + ", Timeout: " + timeLeft + "s)", 1f); } else { DisplayMessage(voteMaster + " has started a warp vote, reply with '<' for no or '>' for yes (Yes: " + voteYesCount + ", No: " + voteNoCount + ", Timeout: " + timeLeft + "s)", 1f); } } } } } if (warpMode == WarpMode.MCW_LOWEST) { string fastestPlayer = GetFastestWarpingPlayer(); float ourRate = GetRateAtIndex(requestIndex, requestPhysWarp); string displayMessage = String.Empty; if (fastestPlayer != null && fastestPlayer != dmpSettings.playerName && clientWarpList.ContainsKey(fastestPlayer)) { PlayerWarpRate fastestRate = clientWarpList[fastestPlayer]; displayMessage += "\n" + fastestPlayer + " is requesting rate " + GetRateAtIndex(fastestRate.rateIndex, fastestRate.isPhysWarp) + "x"; } if (ourRate > 1f) { displayMessage += "\nWe are requesting rate: " + ourRate + "x"; } if (warpMaster != null && clientWarpList.ContainsKey(warpMaster)) { PlayerWarpRate currentWarpRate = clientWarpList[warpMaster]; float currentRate = GetRateAtIndex(currentWarpRate.rateIndex, currentWarpRate.isPhysWarp); displayMessage += "\nCurrent warp rate: " + currentRate + "x"; } if (displayMessage != String.Empty) { DisplayMessage(displayMessage, 1f); } } if (warpMode == WarpMode.SUBSPACE_SIMPLE) { int mostAdvancedSubspace = timeSyncer.GetMostAdvancedSubspace(); int ourSubspace = timeSyncer.currentSubspace; canSubspaceSimpleWarp = true; if ((ourSubspace != -1) && (mostAdvancedSubspace != ourSubspace)) { canSubspaceSimpleWarp = false; double deltaSeconds = timeSyncer.GetUniverseTime(mostAdvancedSubspace) - timeSyncer.GetUniverseTime(ourSubspace); DisplayMessage("Press '>' to warp " + Math.Round(deltaSeconds) + "s into the future", 1f); } } }
private void DrawContent(int windowID) { GUILayout.BeginVertical(); GUI.DragWindow(moveRect); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUIStyle chatButtonStyle = buttonStyle; if (chatWorker.chatButtonHighlighted) { chatButtonStyle = highlightStyle; } chatWorker.display = GUILayout.Toggle(chatWorker.display, "Chat", chatButtonStyle); craftLibraryWorker.display = GUILayout.Toggle(craftLibraryWorker.display, "Craft", buttonStyle); groupsWindow.display = GUILayout.Toggle(groupsWindow.display, "Group", buttonStyle); permissionsWindow.display = GUILayout.Toggle(permissionsWindow.display, "Permissions", buttonStyle); GUIStyle screenshotButtonStyle = buttonStyle; if (screenshotWorker.screenshotButtonHighlighted) { screenshotButtonStyle = highlightStyle; } screenshotWorker.display = GUILayout.Toggle(screenshotWorker.display, "Screenshot", screenshotButtonStyle); if (GUILayout.Button("-", buttonStyle)) { minmized = true; minWindowRect.x = windowRect.xMax - minWindowRect.width; minWindowRect.y = windowRect.y; } GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, scrollStyle); //Draw subspaces double ourTime = timeSyncer.locked ? timeSyncer.GetUniverseTime() : Planetarium.GetUniversalTime(); long serverClock = timeSyncer.GetServerClock(); foreach (SubspaceDisplayEntry currentEntry in subspaceDisplay) { double currentTime = 0; double diffTime = 0; string diffState = "Unknown"; if (!currentEntry.isUs) { if (!currentEntry.isWarping) { //Subspace entry if (currentEntry.subspaceEntry != null) { long serverClockDiff = serverClock - currentEntry.subspaceEntry.serverClock; double secondsDiff = serverClockDiff / 10000000d; currentTime = currentEntry.subspaceEntry.planetTime + (currentEntry.subspaceEntry.subspaceSpeed * secondsDiff); diffTime = currentTime - ourTime; diffState = (diffTime > 0) ? SecondsToVeryShortString((int)diffTime) + " in the future" : SecondsToVeryShortString(-(int)diffTime) + " in the past"; } } else { //Warp entry if (currentEntry.warpingEntry != null) { float[] warpRates = TimeWarp.fetch.warpRates; if (currentEntry.warpingEntry.isPhysWarp) { warpRates = TimeWarp.fetch.physicsWarpRates; } long serverClockDiff = serverClock - currentEntry.warpingEntry.serverClock; double secondsDiff = serverClockDiff / 10000000d; currentTime = currentEntry.warpingEntry.planetTime + (warpRates[currentEntry.warpingEntry.rateIndex] * secondsDiff); diffTime = currentTime - ourTime; diffState = (diffTime > 0) ? SecondsToVeryShortString((int)diffTime) + " in the future" : SecondsToVeryShortString(-(int)diffTime) + " in the past"; } } } else { currentTime = ourTime; diffState = "NOW"; } //Draw the subspace black bar. GUILayout.BeginHorizontal(subspaceStyle); GUILayout.Label("T+ " + SecondsToShortString((int)currentTime) + " - " + diffState); GUILayout.FlexibleSpace(); //Draw the sync button if needed #if !DEBUG if ((warpWorker.warpMode == WarpMode.SUBSPACE) && !currentEntry.isUs && !currentEntry.isWarping && (currentEntry.subspaceEntry != null) && (diffTime > 0)) #else if ((warpWorker.warpMode == WarpMode.SUBSPACE) && !currentEntry.isUs && !currentEntry.isWarping && (currentEntry.subspaceEntry != null)) #endif { if (GUILayout.Button("Sync", buttonStyle)) { timeSyncer.LockSubspace(currentEntry.subspaceID); } } GUILayout.EndHorizontal(); foreach (string currentPlayer in currentEntry.players) { if (currentPlayer == dmpSettings.playerName) { DrawPlayerEntry(playerStatusWorker.myPlayerStatus, playerColorWorker.GetPlayerColor(currentPlayer)); } else { DrawPlayerEntry(playerStatusWorker.GetPlayerStatus(currentPlayer), playerColorWorker.GetPlayerColor(currentPlayer)); } } } if (DateTime.Now.Day == 1 && DateTime.Now.Month == 4) { PlayerStatus easterEgg = new PlayerStatus(); easterEgg.playerName = "Princess Luna"; easterEgg.statusText = "Stranded on the Mün"; easterEgg.vesselText = ""; DrawPlayerEntry(easterEgg, new Color(0.251f, 0.275f, 0.502f)); } GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Disconnect", buttonStyle)) { disconnectEventHandled = false; } optionsWindow.display = GUILayout.Toggle(optionsWindow.display, "Options", buttonStyle); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }