38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -13,36 +13,53 @@ namespace Barotrauma.Networking
|
||||
|
||||
public GUIComponent CreateBanFrame(GUIComponent parent)
|
||||
{
|
||||
banFrame = new GUIListBox(new Rectangle(0, 0, 0, 0), "", parent);
|
||||
banFrame = new GUIListBox(new RectTransform(Vector2.One, parent.RectTransform, Anchor.Center));
|
||||
|
||||
foreach (BannedPlayer bannedPlayer in bannedPlayers)
|
||||
{
|
||||
GUITextBlock textBlock = new GUITextBlock(
|
||||
new Rectangle(0, 0, 0, 55),
|
||||
bannedPlayer.IP + " (" + bannedPlayer.Name + ")",
|
||||
"",
|
||||
Alignment.Left, Alignment.TopLeft, banFrame);
|
||||
textBlock.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
textBlock.UserData = banFrame;
|
||||
var playerFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.25f), ((GUIListBox)banFrame).Content.RectTransform) { MinSize = new Point(0, 70) }, style: null)
|
||||
{
|
||||
UserData = banFrame
|
||||
};
|
||||
|
||||
var removeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Remove", Alignment.TopRight, "", textBlock);
|
||||
removeButton.UserData = bannedPlayer;
|
||||
removeButton.OnClicked = RemoveBan;
|
||||
var paddedPlayerFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.85f), playerFrame.RectTransform, Anchor.Center))
|
||||
{
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), paddedPlayerFrame.RectTransform),
|
||||
bannedPlayer.IP + " (" + bannedPlayer.Name + ")");
|
||||
|
||||
var removeButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.4f), paddedPlayerFrame.RectTransform, Anchor.TopRight), TextManager.Get("BanListRemove"))
|
||||
{
|
||||
UserData = bannedPlayer,
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = RemoveBan
|
||||
};
|
||||
if (bannedPlayer.IP.IndexOf(".x") <= -1)
|
||||
{
|
||||
var rangeBanButton = new GUIButton(new Rectangle(-85, 0, 90, 20), "Ban range", Alignment.TopRight, "", textBlock);
|
||||
rangeBanButton.UserData = bannedPlayer;
|
||||
rangeBanButton.OnClicked = RangeBan;
|
||||
var rangeBanButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.4f), paddedPlayerFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.22f, 0.0f) }, TextManager.Get("BanRange"))
|
||||
{
|
||||
UserData = bannedPlayer,
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = RangeBan
|
||||
};
|
||||
}
|
||||
|
||||
var reasonText = new GUITextBlock(new Rectangle(0, 0, 170, 20),
|
||||
string.IsNullOrEmpty(bannedPlayer.Reason) ? "Reason: none" : ToolBox.LimitString("Reason: " + bannedPlayer.Reason, GUI.SmallFont, 170),
|
||||
"", Alignment.BottomLeft, Alignment.TopLeft, textBlock, false, GUI.SmallFont);
|
||||
reasonText.ToolTip = bannedPlayer.Reason;
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform),
|
||||
bannedPlayer.ExpirationTime == null ?
|
||||
TextManager.Get("BanPermanent") : TextManager.Get("BanExpires").Replace("[time]", bannedPlayer.ExpirationTime.Value.ToString()),
|
||||
font: GUI.SmallFont);
|
||||
|
||||
var reasonText = new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform),
|
||||
TextManager.Get("BanReason") +
|
||||
(string.IsNullOrEmpty(bannedPlayer.Reason) ? TextManager.Get("None") : ToolBox.LimitString(bannedPlayer.Reason, GUI.SmallFont, 170)),
|
||||
font: GUI.SmallFont, wrap: true)
|
||||
{
|
||||
ToolTip = bannedPlayer.Reason
|
||||
};
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20),
|
||||
bannedPlayer.ExpirationTime == null ? "Permanent" : "Expires " + bannedPlayer.ExpirationTime.Value.ToString(),
|
||||
"", Alignment.BottomRight, Alignment.TopRight, textBlock, false, GUI.SmallFont);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,8 +75,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (banFrame != null)
|
||||
{
|
||||
banFrame.Parent.RemoveChild(banFrame);
|
||||
CreateBanFrame(banFrame.Parent);
|
||||
var parent = banFrame.Parent;
|
||||
parent.RemoveChild(banFrame);
|
||||
CreateBanFrame(parent);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -74,8 +92,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (banFrame != null)
|
||||
{
|
||||
banFrame.Parent.RemoveChild(banFrame);
|
||||
CreateBanFrame(banFrame.Parent);
|
||||
var parent = banFrame.Parent;
|
||||
parent.RemoveChild(banFrame);
|
||||
CreateBanFrame(parent);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user