Merged branch master into master

This commit is contained in:
juanjp600
2016-08-30 17:36:11 -03:00
6 changed files with 49 additions and 9 deletions

View File

@@ -78,7 +78,7 @@
width="24" height="32" resizevertical="true"/>
<topwindow sprite="Content/Map/testroom.png" sourcerect="625,327,128,80" depth ="0.05"
width = "128" height ="80" body="true" health="100"/>
width = "128" height ="49" body="true" health="100"/>
<verticalwindow sprite="Content/Map/testroom.png" sourcerect="399,560,128,224" depth ="0.05"
width = "128" height ="224" body="true" health="100"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -363,8 +363,47 @@ namespace Barotrauma
case "controlcharacter":
case "control":
if (commands.Length < 2) break;
string name = string.Join(" ", commands.Skip(1)).ToLowerInvariant();
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLowerInvariant() == name);
int characterIndex;
string characterName;
if (int.TryParse(commands.Last(), out characterIndex))
{
characterName = string.Join(" ", commands.Skip(1).Take(commands.Length-2)).ToLowerInvariant();
}
else
{
characterName = string.Join(" ", commands.Skip(1)).ToLowerInvariant();
characterIndex = -1;
}
var matchingCharacters = Character.CharacterList.FindAll(c => !c.IsNetworkPlayer && c.Name.ToLowerInvariant() == characterName);
if (!matchingCharacters.Any())
{
ThrowError("Matching characters not found");
return;
}
if (characterIndex==-1)
{
Character.Controlled = matchingCharacters.First();
if (matchingCharacters.Count > 1)
{
NewMessage(
"Found multiple matching characters. "+
"Use \"control [charactername] [0-"+(matchingCharacters.Count-1)+"]\" to choose which character to control.",
Color.LightGray);
}
}
else if (characterIndex<0 || characterIndex>= matchingCharacters.Count)
{
ThrowError("Character index out of range. Select an index between 0 and " + (matchingCharacters.Count - 1));
}
else
{
Character.Controlled = matchingCharacters[characterIndex];
}
break;
case "godmode":
if (Submarine.MainSub == null) return;

View File

@@ -1522,7 +1522,7 @@ namespace Barotrauma.Networking
}
else
{
GameServer.Log(message.Text, message.Color);
GameServer.Log(message.TextWithSender, message.Color);
}
sender.ChatSpamSpeed += 5.0f;

View File

@@ -264,6 +264,7 @@ namespace Barotrauma.Networking
public void AddChatMessage(ChatMessage message)
{
if (message.Type == ChatMessageType.Radio &&
Character.Controlled != null &&
message.Sender != null && message.Sender != myCharacter)
@@ -278,6 +279,8 @@ namespace Barotrauma.Networking
return;
}
GameServer.Log(message.TextWithSender, message.Color);
string displayedText = message.Text;
if (message.Sender != null)
@@ -293,8 +296,6 @@ namespace Barotrauma.Networking
GameMain.NetLobbyScreen.NewChatMessage(message);
GameServer.Log(message.Text, message.Color);
while (chatBox.CountChildren > 20)
{
chatBox.RemoveChild(chatBox.children[1]);
@@ -304,7 +305,7 @@ namespace Barotrauma.Networking
{
displayedText = message.SenderName + ": " + displayedText;
}
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), displayedText,
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
Alignment.Left, null, null, true);

View File

@@ -98,10 +98,10 @@ namespace Barotrauma.Networking
{
float prevSize = listBox.BarSize;
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont);
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont);
textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height));
listBox.AddChild(textBlock);
//listBox.AddChild(textBlock);
textBlock.TextColor = line.Color;
textBlock.CanBeFocused = false;