(2402e736e) Tester's build, January 25th 2020

This commit is contained in:
Joonas Rikkonen
2020-01-25 12:48:13 +02:00
parent 4a58987eae
commit eaa18a20a3
57 changed files with 710 additions and 139 deletions
@@ -244,6 +244,7 @@ namespace Barotrauma
private IEnumerable<object> WaitForCampaignSetup()
{
GUI.SetCursorWaiting();
string headerText = TextManager.Get("CampaignStartingPleaseWait");
var msgBox = new GUIMessageBox(headerText, TextManager.Get("CampaignStarting"), new string[] { TextManager.Get("Cancel") });
@@ -251,6 +252,7 @@ namespace Barotrauma
{
GameMain.NetLobbyScreen.HighlightMode(GameMain.NetLobbyScreen.SelectedModeIndex);
GameMain.NetLobbyScreen.SelectMode(GameMain.NetLobbyScreen.SelectedModeIndex);
GUI.ClearCursorWait();
CoroutineManager.StopCoroutines("WaitForCampaignSetup");
return true;
};
@@ -263,6 +265,7 @@ namespace Barotrauma
yield return CoroutineStatus.Running;
}
msgBox.Close();
GUI.ClearCursorWait();
yield return CoroutineStatus.Success;
}
@@ -746,6 +746,21 @@ namespace Barotrauma.CharacterEditor
buttonsPanelToggle?.UpdateOpenState((float)deltaTime, new Vector2(-buttonsPanel.Rect.Width - leftArea.RectTransform.AbsoluteOffset.X, 0), buttonsPanel.RectTransform);
}
public CursorState GetMouseCursorState()
{
foreach (var limb in character.AnimController.Limbs)
{
if (limb?.ActiveSprite == null) { continue; }
if (selectedJoints.Any(j => j.LimbA == limb || j.LimbB == limb)) { continue; }
// character limbs
if (editLimbs && !spriteSheetRect.Contains(PlayerInput.MousePosition) &&
MathUtils.RectangleContainsPoint(GetLimbPhysicRect(limb), PlayerInput.MousePosition)) { return CursorState.Hand; }
// spritesheet
if (GetLimbSpritesheetRect(limb).Contains(PlayerInput.MousePosition)) { return CursorState.Hand; }
}
return CursorState.Default;
}
/// <summary>
/// Fps independent mouse input. The draw method is called multiple times per frame.
/// </summary>
@@ -18,6 +18,11 @@ namespace Barotrauma
get { return GameMain.GameSession.CrewManager; }
}
public CampaignUI CampaignUI
{
get { return campaignUI; }
}
public string GetMoney()
{
return campaignUI == null ? "" : campaignUI.GetMoney();
@@ -545,10 +545,10 @@ namespace Barotrauma
break;
case Tab.CharacterEditor:
Submarine.MainSub = null;
GameMain.CharacterEditorScreen.Select();
CoroutineManager.StartCoroutine(SelectScreenWithWaitCursor(GameMain.CharacterEditorScreen));
break;
case Tab.SubmarineEditor:
GameMain.SubEditorScreen.Select();
CoroutineManager.StartCoroutine(SelectScreenWithWaitCursor(GameMain.SubEditorScreen));
break;
case Tab.QuickStartDev:
QuickStart();
@@ -560,7 +560,7 @@ namespace Barotrauma
break;
case Tab.SteamWorkshop:
if (!Steam.SteamManager.IsInitialized) return false;
GameMain.SteamWorkshopScreen.Select();
CoroutineManager.StartCoroutine(SelectScreenWithWaitCursor(GameMain.SteamWorkshopScreen));
break;
case Tab.Credits:
titleText.Visible = false;
@@ -577,6 +577,16 @@ namespace Barotrauma
return true;
}
private IEnumerable<object> SelectScreenWithWaitCursor(Screen screen)
{
GUI.SetCursorWaiting();
//tiny delay to get the cursor to render
yield return new WaitForSeconds(0.02f);
GUI.ClearCursorWait();
screen.Select();
yield return CoroutineStatus.Success;
}
public bool ReturnToMainMenu(GUIButton button, object obj)
{
GUI.PreventPauseMenuToggle = false;
@@ -1165,7 +1175,8 @@ namespace Barotrauma
maxPlayersBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1.0f), buttonContainer.RectTransform), textAlignment: Alignment.Center)
{
Text = maxPlayers.ToString(),
Enabled = false
// ?
// Enabled = false
};
new GUIButton(new RectTransform(new Vector2(0.2f, 1.0f), buttonContainer.RectTransform), "+", textAlignment: Alignment.Center)
{
@@ -1080,6 +1080,7 @@ namespace Barotrauma
public IEnumerable<object> WaitForStartRound(GUIButton startButton, bool allowCancel)
{
GUI.SetCursorWaiting();
string headerText = TextManager.Get("RoundStartingPleaseWait");
var msgBox = new GUIMessageBox(headerText, TextManager.Get("RoundStarting"),
allowCancel ? new string[] { TextManager.Get("Cancel") } : new string[0]);
@@ -1091,6 +1092,7 @@ namespace Barotrauma
startButton.Enabled = true;
GameMain.Client.RequestRoundEnd();
CoroutineManager.StopCoroutines("WaitForStartRound");
GUI.ClearCursorWait();
return true;
};
msgBox.Buttons[0].OnClicked += msgBox.Close;
@@ -1113,7 +1115,7 @@ namespace Barotrauma
{
startButton.Enabled = true;
}
GUI.ClearCursorWait();
yield return CoroutineStatus.Success;
}
@@ -147,6 +147,8 @@ namespace Barotrauma
private DateTime refreshDisableTimer;
private bool waitingForRefresh;
private bool steamPingInfoReady;
private const float sidebarWidth = 0.2f;
public ServerListScreen()
{
@@ -1423,6 +1425,15 @@ namespace Barotrauma
{
if (waitingForRefresh) { return; }
steamPingInfoReady = false;
CoroutineManager.StopCoroutines("EstimateLobbyPing");
TaskPool.Add(Steamworks.SteamNetworkingUtils.WaitForPingDataAsync(), (task) =>
{
steamPingInfoReady = true;
});
friendsListUpdateTime = Timing.TotalTime - 1.0;
UpdateFriendsList();
@@ -1684,11 +1695,7 @@ namespace Barotrauma
}
else if (serverInfo.PingLocation != null)
{
Steamworks.Data.PingLocation pingLocation = serverInfo.PingLocation.Value;
serverInfo.Ping = Steamworks.SteamNetworkingUtils.LocalPingLocation?.EstimatePingTo(pingLocation) ?? -1;
serverInfo.PingChecked = true;
serverPingText.TextColor = GetPingTextColor(serverInfo.Ping);
serverPingText.Text = serverInfo.Ping > -1 ? serverInfo.Ping.ToString() : "?";
CoroutineManager.StartCoroutine(EstimateLobbyPing(serverInfo, serverPingText), "EstimateLobbyPing");
}
if (serverInfo.LobbyID == 0 && (string.IsNullOrWhiteSpace(serverInfo.IP) || string.IsNullOrWhiteSpace(serverInfo.Port)))
@@ -1749,6 +1756,22 @@ namespace Barotrauma
FilterServers();
}
private IEnumerable<object> EstimateLobbyPing(ServerInfo serverInfo, GUITextBlock serverPingText)
{
while (!steamPingInfoReady)
{
yield return CoroutineStatus.Running;
}
Steamworks.Data.PingLocation pingLocation = serverInfo.PingLocation.Value;
serverInfo.Ping = Steamworks.SteamNetworkingUtils.LocalPingLocation?.EstimatePingTo(pingLocation) ?? -1;
serverInfo.PingChecked = true;
serverPingText.TextColor = GetPingTextColor(serverInfo.Ping);
serverPingText.Text = serverInfo.Ping > -1 ? serverInfo.Ping.ToString() : "?";
yield return CoroutineStatus.Success;
}
private void ServerQueryFinished()
{
if (!serverList.Content.Children.Any())
@@ -1435,7 +1435,7 @@ namespace Barotrauma
#if DEBUG
deleteBtn.Enabled = true;
#else
deleteBtn.Enabled = userData is Submarine sub && sub.IsVanillaSubmarine();
deleteBtn.Enabled = userData is Submarine sub && !sub.IsVanillaSubmarine();
#endif
}
return true;