(5c35a640e) Update tutorial-rework with dev
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Barotrauma
|
||||
|
||||
private readonly bool isMultiplayer;
|
||||
|
||||
public CampaignSetupUI(bool isMultiplayer, GUIComponent newGameContainer, GUIComponent loadGameContainer, IEnumerable<string> saveFiles=null)
|
||||
public CampaignSetupUI(bool isMultiplayer, GUIComponent newGameContainer, GUIComponent loadGameContainer, IEnumerable<Submarine> submarines, IEnumerable<string> saveFiles = null)
|
||||
{
|
||||
this.isMultiplayer = isMultiplayer;
|
||||
this.newGameContainer = newGameContainer;
|
||||
@@ -45,6 +45,12 @@ namespace Barotrauma
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
var columnContainer = new GUILayoutGroup(new RectTransform(Vector2.One, newGameContainer.RectTransform), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
var leftColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform))
|
||||
{
|
||||
Stretch = true,
|
||||
@@ -63,7 +69,7 @@ namespace Barotrauma
|
||||
OnSelected = CheckForPax
|
||||
};
|
||||
|
||||
UpdateSubList();
|
||||
UpdateSubList(submarines);
|
||||
|
||||
// New game right sideon
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), TextManager.Get("SaveName") + ":", textAlignment: Alignment.BottomLeft);
|
||||
@@ -90,9 +96,8 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||
if (selectedSub == null) return false;
|
||||
|
||||
if (!(subList.SelectedData is Submarine selectedSub)) { return false; }
|
||||
|
||||
if (string.IsNullOrEmpty(selectedSub.MD5Hash.Hash))
|
||||
{
|
||||
((GUITextBlock)subList.SelectedComponent).TextColor = Color.DarkRed * 0.8f;
|
||||
@@ -199,9 +204,9 @@ namespace Barotrauma
|
||||
public void UpdateSubList(IEnumerable<Submarine> submarines)
|
||||
{
|
||||
#if DEBUG
|
||||
var subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
|
||||
var subsToShow = submarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
|
||||
#else
|
||||
var subsToShow = Submarine.SavedSubmarines;
|
||||
var subsToShow = submarines;
|
||||
#endif
|
||||
|
||||
subList.ClearChildren();
|
||||
|
||||
@@ -459,6 +459,12 @@ namespace Barotrauma
|
||||
OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; },
|
||||
Enabled = true
|
||||
};
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
startButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
OnLocationSelected?.Invoke(location, connection);
|
||||
@@ -502,7 +508,13 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
if (startButton != null) { startButton.Enabled = true; }
|
||||
if (startButton != null)
|
||||
{
|
||||
startButton.Enabled = true;
|
||||
startButton.Visible = GameMain.Client == null ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateItemFrame(PurchasedItem pi, PriceInfo priceInfo, GUIListBox listBox, int width)
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Barotrauma
|
||||
menuTabs[(int)Tab.LoadGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize));
|
||||
var paddedLoadGame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), menuTabs[(int)Tab.LoadGame].RectTransform, Anchor.Center), style: null);
|
||||
|
||||
campaignSetupUI = new CampaignSetupUI(false, paddedNewGame, paddedLoadGame)
|
||||
campaignSetupUI = new CampaignSetupUI(false, paddedNewGame, paddedLoadGame, Submarine.SavedSubmarines)
|
||||
{
|
||||
LoadGame = LoadGame,
|
||||
StartNewGame = StartGame
|
||||
@@ -336,7 +336,7 @@ namespace Barotrauma
|
||||
|
||||
UpdateTutorialList();
|
||||
|
||||
campaignSetupUI.UpdateSubList();
|
||||
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
||||
|
||||
ResetButtonStates(null);
|
||||
|
||||
|
||||
@@ -632,6 +632,13 @@ namespace Barotrauma
|
||||
Visible = false
|
||||
};
|
||||
|
||||
campaignViewButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), rightInfoColumn.RectTransform),
|
||||
TextManager.Get("CampaignView"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; },
|
||||
Visible = false
|
||||
};
|
||||
|
||||
StartButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("StartGameButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
@@ -644,13 +651,6 @@ namespace Barotrauma
|
||||
};
|
||||
clientHiddenElements.Add(StartButton);
|
||||
|
||||
campaignViewButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.0f, 0.06f) },
|
||||
TextManager.Get("CampaignView"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; },
|
||||
Visible = false
|
||||
};
|
||||
|
||||
spectateButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("SpectateButton"), style: "GUIButtonLarge");
|
||||
}
|
||||
@@ -726,6 +726,12 @@ namespace Barotrauma
|
||||
spectateButton.Visible = GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Selected = false;
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
GameMain.Client.SetReadyToStart(ReadyToStartBox);
|
||||
}
|
||||
else
|
||||
@@ -844,6 +850,13 @@ namespace Barotrauma
|
||||
GameMain.Client.ShowLogButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
|
||||
GameMain.Client.EndRoundButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound);
|
||||
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowSpectateButton()
|
||||
@@ -1191,7 +1204,7 @@ namespace Barotrauma
|
||||
|
||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight),
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight) { RelativeOffset = new Vector2(0.1f, 0.0f) },
|
||||
TextManager.Get("Shuttle"), textAlignment: Alignment.CenterRight, font: GUI.SmallFont)
|
||||
{
|
||||
TextColor = subTextBlock.TextColor * 0.8f,
|
||||
|
||||
@@ -716,7 +716,7 @@ namespace Barotrauma
|
||||
catch (PingException ex)
|
||||
{
|
||||
string errorMsg = "Failed to ping a server (" + serverInfo.ServerName + ", " + serverInfo.IP + ") - " + (ex?.InnerException?.Message ?? ex.Message);
|
||||
GameAnalyticsManager.AddErrorEventOnce("ServerListScreen.PingServer:PingException" + serverInfo.IP, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
GameAnalyticsManager.AddErrorEventOnce("ServerListScreen.PingServer:PingException" + serverInfo.IP, GameAnalyticsSDK.Net.EGAErrorSeverity.Warning, errorMsg);
|
||||
#if DEBUG
|
||||
DebugConsole.NewMessage(errorMsg, Color.Red);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user