Replaced the arrows in server lobby buttons with images, made GUIImages rotatable (todo: make them align correctly when rotated/scaled), fixed the size of the sub save warning messagebox
This commit is contained in:
@@ -6,9 +6,11 @@ namespace Barotrauma
|
||||
{
|
||||
public class GUIImage : GUIComponent
|
||||
{
|
||||
Sprite sprite;
|
||||
public float Rotation;
|
||||
|
||||
Rectangle sourceRect;
|
||||
private Sprite sprite;
|
||||
|
||||
private Rectangle sourceRect;
|
||||
|
||||
bool crop;
|
||||
|
||||
@@ -85,7 +87,7 @@ namespace Barotrauma
|
||||
|
||||
if (sprite != null && sprite.Texture != null)
|
||||
{
|
||||
spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * (currColor.A / 255.0f), 0.0f, Vector2.Zero,
|
||||
spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * (currColor.A / 255.0f), Rotation, Vector2.Zero,
|
||||
Scale, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,17 @@ namespace Barotrauma
|
||||
: base(new Rectangle(0,0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
Color.Black*0.5f, Alignment.TopLeft, null, parent)
|
||||
{
|
||||
if (height == 0)
|
||||
{
|
||||
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
||||
string[] lines = wrappedText.Split('\n');
|
||||
foreach (string line in lines)
|
||||
{
|
||||
height += (int)GUI.Font.MeasureString(line).Y;
|
||||
}
|
||||
height += 220;
|
||||
}
|
||||
|
||||
var frame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, this);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
|
||||
|
||||
@@ -938,11 +938,11 @@ namespace Barotrauma
|
||||
|
||||
public void CheckForErrors()
|
||||
{
|
||||
string errorMsg = "";
|
||||
List<string> errorMsgs = new List<string>();
|
||||
|
||||
if (!Hull.hullList.Any())
|
||||
{
|
||||
errorMsg = "No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly.";
|
||||
errorMsgs.Add("No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly.");
|
||||
}
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
@@ -951,24 +951,24 @@ namespace Barotrauma
|
||||
|
||||
if (!item.linkedTo.Any())
|
||||
{
|
||||
errorMsg += "\nThe submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.";
|
||||
errorMsgs.Add("The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.");
|
||||
}
|
||||
}
|
||||
|
||||
if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null)
|
||||
{
|
||||
errorMsg += "\nNo waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.";
|
||||
errorMsgs.Add("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.");
|
||||
}
|
||||
|
||||
if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null)
|
||||
{
|
||||
errorMsg += "\nThe submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). "
|
||||
+"To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\".";
|
||||
errorMsgs.Add("The submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). "
|
||||
+"To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\".");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
if (errorMsgs.Any())
|
||||
{
|
||||
new GUIMessageBox("Warning", errorMsg);
|
||||
new GUIMessageBox("Warning", string.Join("\n\n", errorMsgs), 400, 0);
|
||||
}
|
||||
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
@@ -1074,7 +1074,7 @@ namespace Barotrauma
|
||||
{
|
||||
stream = SaveUtil.DecompressFiletoStream(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Loading submarine \"" + file + "\" failed!", e);
|
||||
return null;
|
||||
|
||||
@@ -515,11 +515,18 @@ namespace Barotrauma
|
||||
infoButton.UserData = -1;
|
||||
infoButton.OnClicked += ViewJobInfo;
|
||||
|
||||
GUIButton upButton = new GUIButton(new Rectangle(30, 2, 15, 15), "^", GUI.Style, jobText);
|
||||
GUIButton upButton = new GUIButton(new Rectangle(30, 2, 15, 15), "", GUI.Style, jobText);
|
||||
//TODO: make GUIImages align correctly when scaled/rotated
|
||||
//so there's no need to do this ↓
|
||||
new GUIImage(new Rectangle(3,2,0,0), GUI.Arrow, Alignment.Center, upButton).Scale = 0.6f;
|
||||
upButton.UserData = -1;
|
||||
upButton.OnClicked += ChangeJobPreference;
|
||||
|
||||
GUIButton downButton = new GUIButton(new Rectangle(50, 2, 15, 15), "˅", GUI.Style, jobText);
|
||||
GUIButton downButton = new GUIButton(new Rectangle(50, 2, 15, 15), "", GUI.Style, jobText);
|
||||
var downArrow = new GUIImage(new Rectangle(13,14,0,0), GUI.Arrow, Alignment.Center, downButton);
|
||||
downArrow.Rotation = MathHelper.Pi;
|
||||
downArrow.Scale = 0.6f;
|
||||
|
||||
downButton.UserData = 1;
|
||||
downButton.OnClicked += ChangeJobPreference;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user