Hull volume helper is hidden when no hulls are selected, using the HasPermission method for consistency
This commit is contained in:
@@ -256,7 +256,7 @@ namespace Barotrauma.Networking
|
||||
bool hasCharacter = inc.ReadBoolean();
|
||||
bool allowSpectating = inc.ReadBoolean();
|
||||
|
||||
endRoundButton.Visible = permissions.HasFlag(ClientPermissions.EndRound);
|
||||
endRoundButton.Visible = HasPermission(ClientPermissions.EndRound);
|
||||
|
||||
if (gameStarted && Screen.Selected != GameMain.GameScreen)
|
||||
{
|
||||
@@ -613,7 +613,7 @@ namespace Barotrauma.Networking
|
||||
msg = "Your current permissions:\n";
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
if (!newPermissions.HasFlag(permissions) || permission == ClientPermissions.None) continue;
|
||||
if (!HasPermission(permissions) || permission == ClientPermissions.None) continue;
|
||||
|
||||
System.Reflection.FieldInfo fi = typeof(ClientPermissions).GetField(permission.ToString());
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
@@ -625,7 +625,7 @@ namespace Barotrauma.Networking
|
||||
new GUIMessageBox("Permissions changed", msg).UserData = "permissions";
|
||||
}
|
||||
|
||||
endRoundButton.Visible = permissions.HasFlag(ClientPermissions.EndRound);
|
||||
endRoundButton.Visible = HasPermission(ClientPermissions.EndRound);
|
||||
|
||||
break;
|
||||
case (byte)PacketTypes.RequestFile:
|
||||
@@ -1037,8 +1037,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void KickPlayer(string kickedName, bool ban, bool range = false)
|
||||
{
|
||||
if (!permissions.HasFlag(ClientPermissions.Kick) && !ban) return;
|
||||
if (!permissions.HasFlag(ClientPermissions.Ban) && ban) return;
|
||||
if (!HasPermission(ClientPermissions.Kick) && !ban) return;
|
||||
if (!HasPermission(ClientPermissions.Ban) && ban) return;
|
||||
|
||||
NetOutgoingMessage msg = client.CreateMessage();
|
||||
msg.Write((byte)PacketTypes.KickPlayer);
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Barotrauma
|
||||
|
||||
private GUITextBox nameBox;
|
||||
|
||||
private GUIFrame hullVolumeFrame;
|
||||
|
||||
const int PreviouslyUsedCount = 10;
|
||||
private GUIListBox previouslyUsedList;
|
||||
|
||||
@@ -88,7 +90,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (buoyancyVol / selectedVol < 1.0f)
|
||||
{
|
||||
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol) + ")";
|
||||
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol).ToString("0.00") + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -124,13 +126,14 @@ namespace Barotrauma
|
||||
topPanel = new GUIFrame(new Rectangle(0, 0, 0, 31), GUI.Style);
|
||||
topPanel.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
|
||||
GUIFrame hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 400, 100), GUI.Style, topPanel);
|
||||
hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 280, 70), GUI.Style, topPanel);
|
||||
hullVolumeFrame.Padding = new Vector4(3.0f, 3.0f, 3.0f, 3.0f);
|
||||
|
||||
GUITextBlock totalHullVolume = new GUITextBlock(new Rectangle(0, 0, 0, 20), "", GUI.Style, hullVolumeFrame);
|
||||
GUITextBlock totalHullVolume = new GUITextBlock(new Rectangle(0, 0, 0, 20), "", GUI.Style, hullVolumeFrame, GUI.SmallFont);
|
||||
totalHullVolume.Visible = false;
|
||||
totalHullVolume.TextGetter = GetTotalHullVolume;
|
||||
|
||||
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", GUI.Style, hullVolumeFrame);
|
||||
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, hullVolumeFrame, GUI.SmallFont);
|
||||
selectedHullVolume.TextGetter = GetSelectedHullVolume;
|
||||
|
||||
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", GUI.Style, topPanel);
|
||||
@@ -894,6 +897,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (tutorial != null) tutorial.Update((float)deltaTime);
|
||||
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
|
||||
if (GUIComponent.MouseOn == null)
|
||||
{
|
||||
cam.MoveCamera((float)deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user