New artifact sprites, ping sound for handheld sonar, fixed newlines multiplying in GUITextBlocks every time the block is resized

This commit is contained in:
Regalis
2016-04-16 21:42:40 +03:00
parent 5bacb66543
commit a45f58cd08
5 changed files with 13 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -25,7 +25,7 @@
name="Thermal Artifact"
pickdistance="150">
<Sprite texture="artifact.png" depth="0.7" sourcerect="74,0,44,61"/>
<Sprite texture="artifact.png" depth="0.7" sourcerect="75,0,50,62"/>
<Deconstruct time="30">
<Item name="Steel Bar"/>

View File

@@ -199,6 +199,7 @@
holdangle="30" handle1="-10,0"/>
<Radar range="6000.0" powerconsumption="10" drawhudwhenequipped="true" detectsubmarinewalls="true">
<sound file="Content/Items/Engine/radarPing.ogg" type="OnUse" range="1000.0"/>
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.6"/>
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>

View File

@@ -110,7 +110,7 @@
spritecolor="1.0,1.0,1.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
impacttolerance="10">
impacttolerance="7">
<Sprite texture ="Content/Items/Medical/med.png" sourcerect="24,16,8,16" depth="0.6"/>

View File

@@ -17,6 +17,8 @@ namespace Barotrauma
protected Color textColor;
private string wrappedText;
public delegate string TextGetterHandler();
public TextGetterHandler TextGetter;
@@ -40,6 +42,7 @@ namespace Barotrauma
set
{
text = value;
wrappedText = value;
SetTextPos();
}
}
@@ -159,21 +162,16 @@ namespace Barotrauma
{
if (text==null) return;
wrappedText = text;
Vector2 size = MeasureText(text);
if (Wrap && rect.Width>0)
{
//text = text.Replace("\n"," ");
text = ToolBox.WrapText(text, rect.Width - padding.X - padding.Z, Font);
wrappedText = ToolBox.WrapText(text, rect.Width - padding.X - padding.Z, Font);
Vector2 newSize = MeasureText(text);
Vector2 newSize = MeasureText(wrappedText);
//Rectangle newRect = rect;
//newRect.Width += (int)(newSize.X-size.X);
//newRect.Height += (int)(newSize.Y - size.Y);
//Rect = newRect;
size = newSize;
}
@@ -204,9 +202,9 @@ namespace Barotrauma
textPos.X = (int)textPos.X;
textPos.Y = (int)textPos.Y;
if (text.Contains("\n"))
if (wrappedText.Contains("\n"))
{
string[] lines = text.Split('\n');
string[] lines = wrappedText.Split('\n');
Vector2 lastLineSize = MeasureText(lines[lines.Length-1]);
caretPos = new Vector2(rect.X + lastLineSize.X, rect.Y + size.Y - lastLineSize.Y) + textPos - origin;
}
@@ -256,7 +254,7 @@ namespace Barotrauma
if (!string.IsNullOrEmpty(text))
{
spriteBatch.DrawString(Font,
text,
Wrap ? wrappedText : text,
new Vector2(rect.X, rect.Y) + textPos + offset,
textColor * (textColor.A / 255.0f),
0.0f, origin, 1.0f,