Renaming fields in the Client class for consistency

This commit is contained in:
Joonas Rikkonen
2017-11-23 20:43:22 +02:00
parent 4689bec441
commit 1c09f757a2
14 changed files with 197 additions and 189 deletions
@@ -91,6 +91,7 @@ namespace Barotrauma.Networking
fileReceiver = new FileReceiver();
fileReceiver.OnFinished += OnFileReceived;
fileReceiver.OnTransferFailed += OnTransferFailed;
characterInfo = new CharacterInfo(Character.HumanConfigFile, name,Gender.None,null);
characterInfo.Job = null;
@@ -765,7 +766,7 @@ namespace Barotrauma.Networking
myCharacter = null;
foreach (Client c in otherClients)
{
c.inGame = false;
c.InGame = false;
c.Character = null;
}
yield return CoroutineStatus.Success;
@@ -908,7 +909,7 @@ namespace Barotrauma.Networking
}
ConnectedClients.Add(newClient);
GameMain.NetLobbyScreen.AddPlayer(newClient.name);
GameMain.NetLobbyScreen.AddPlayer(newClient.Name);
}
Voting.AllowSubVoting = allowSubVoting;
@@ -1142,6 +1143,14 @@ namespace Barotrauma.Networking
}
}
private void OnTransferFailed(FileReceiver.FileTransferIn transfer)
{
if (transfer.FileType == FileTransferType.CampaignSave)
{
GameMain.Client.RequestFile(FileTransferType.CampaignSave, null, null);
}
}
public void CreateEntityEvent(IClientSerializable entity, object[] extraData)
{
entityEventManager.CreateEvent(entity, extraData);
@@ -105,7 +105,7 @@ namespace Barotrauma.Networking
if (y >= startY && y < startY + height - 120)
{
GUI.SmallFont.DrawString(spriteBatch, c.name + " (" + c.Connection.RemoteEndPoint.Address.ToString() + ")", new Vector2(x + 10, y), clientColor);
GUI.SmallFont.DrawString(spriteBatch, c.Name + " (" + c.Connection.RemoteEndPoint.Address.ToString() + ")", new Vector2(x + 10, y), clientColor);
GUI.SmallFont.DrawString(spriteBatch, "Ping: " + (int)(c.Connection.AverageRoundtripTime * 1000.0f) + " ms", new Vector2(x + 20, y + 10), clientColor);
}
if (y + 25 >= startY && y < startY + height - 130) GUI.SmallFont.DrawString(spriteBatch, "Resent messages: " + c.Connection.Statistics.ResentMessages, new Vector2(x + 20, y + 20), clientColor);
@@ -130,7 +130,7 @@ namespace Barotrauma.Networking
{
var transfers = fileSender.ActiveTransfers.FindAll(t => t.Connection == client.Connection);
var clientNameBox = GameMain.NetLobbyScreen.PlayerList.FindChild(client.name);
var clientNameBox = GameMain.NetLobbyScreen.PlayerList.FindChild(client.Name);
var clientInfo = clientNameBox.FindChild("filetransfer");
if (clientInfo == null)
@@ -473,27 +473,27 @@ namespace Barotrauma.Networking
{
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, cList);
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
frame.Color = (c.inGame && c.Character != null && !c.Character.IsDead) ? Color.Gold * 0.2f : Color.Transparent;
frame.Color = (c.InGame && c.Character != null && !c.Character.IsDead) ? Color.Gold * 0.2f : Color.Transparent;
frame.HoverColor = Color.LightGray * 0.5f;
frame.SelectedColor = Color.Gold * 0.5f;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
c.name + " (" + c.Connection.RemoteEndPoint.Address.ToString() + ")",
c.Name + " (" + c.Connection.RemoteEndPoint.Address.ToString() + ")",
Color.Transparent, Color.White,
Alignment.Left, Alignment.Left,
null, frame);
var banButton = new GUIButton(new Rectangle(-110, 0, 100, 20), "Ban", Alignment.Right | Alignment.CenterY, "", frame);
banButton.UserData = c.name;
banButton.UserData = c.Name;
banButton.OnClicked = GameMain.NetLobbyScreen.BanPlayer;
var rangebanButton = new GUIButton(new Rectangle(-220, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, "", frame);
rangebanButton.UserData = c.name;
rangebanButton.UserData = c.Name;
rangebanButton.OnClicked = GameMain.NetLobbyScreen.BanPlayerRange;
var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.Right | Alignment.CenterY, "", frame);
kickButton.UserData = c.name;
kickButton.UserData = c.Name;
kickButton.OnClicked = GameMain.NetLobbyScreen.KickPlayer;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
@@ -30,9 +30,9 @@ namespace Barotrauma.Networking
{
foreach (Client c in GameMain.Server.ConnectedClients)
{
if (!IsWhiteListed(c.name, c.Connection.RemoteEndPoint.Address.ToString()))
if (!IsWhiteListed(c.Name, c.Connection.RemoteEndPoint.Address.ToString()))
{
whitelistedPlayers.Add(new WhiteListedPlayer(c.name, c.Connection.RemoteEndPoint.Address.ToString()));
whitelistedPlayers.Add(new WhiteListedPlayer(c.Name, c.Connection.RemoteEndPoint.Address.ToString()));
if (whitelistFrame != null) CreateWhiteListFrame(whitelistFrame.Parent);
}
}