(47f7024a5) Adjusted door/hatch shadow sizes to get them to match the sprite more closely
This commit is contained in:
@@ -66,33 +66,6 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
||||
|
||||
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
|
||||
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||
"", style: "UIToggleButton");
|
||||
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||
foreach (GUIComponent child in btn.Children)
|
||||
{
|
||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
|
||||
{
|
||||
//Spacing = (int)(3 * GUI.Scale),
|
||||
ScrollBarEnabled = false,
|
||||
ScrollBarVisible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var characterInfo = new CharacterInfo(subElement);
|
||||
characterInfos.Add(characterInfo);
|
||||
foreach (XElement invElement in subElement.Elements())
|
||||
@@ -103,6 +76,50 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
||||
reportButtonFrame = new GUILayoutGroup(new RectTransform(
|
||||
new Point((HUDLayoutSettings.CrewArea.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform))
|
||||
{
|
||||
AbsoluteSpacing = (int)(5 * GUI.Scale),
|
||||
UserData = "reportbuttons",
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
//report buttons
|
||||
foreach (Order order in reports)
|
||||
{
|
||||
if (!order.TargetAllCharacters || order.SymbolSprite == null) continue;
|
||||
var btn = new GUIButton(new RectTransform(new Point(reportButtonFrame.Rect.Width), reportButtonFrame.RectTransform), style: null)
|
||||
{
|
||||
OnClicked = (GUIButton button, object userData) =>
|
||||
{
|
||||
if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
|
||||
SetCharacterOrder(null, order, null, Character.Controlled);
|
||||
HumanAIController.PropagateHullSafety(Character.Controlled, Character.Controlled.CurrentHull);
|
||||
return true;
|
||||
},
|
||||
UserData = order,
|
||||
ToolTip = order.Name
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
||||
{
|
||||
Color = Color.Red * 0.8f,
|
||||
HoverColor = Color.Red * 1.0f,
|
||||
PressedColor = Color.Red * 0.6f,
|
||||
UserData = "highlighted",
|
||||
CanBeFocused = false,
|
||||
Visible = false
|
||||
};
|
||||
|
||||
var img = new GUIImage(new RectTransform(Vector2.One, btn.RectTransform), order.Prefab.SymbolSprite, scaleToFit: true)
|
||||
{
|
||||
Color = order.Color,
|
||||
HoverColor = Color.Lerp(order.Color, Color.White, 0.5f),
|
||||
ToolTip = order.Name
|
||||
};
|
||||
}
|
||||
|
||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
|
||||
prevUIScale = GUI.Scale;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -14,6 +15,13 @@ namespace Barotrauma.Items.Components
|
||||
//openState when the vertices of the convex hull were last calculated
|
||||
private float lastConvexHullState;
|
||||
|
||||
[Serialize("1,1", false)]
|
||||
public Vector2 ShadowScale
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vector2 DrawSize
|
||||
{
|
||||
//use the extents of the item as the draw size
|
||||
@@ -22,11 +30,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Vector2[] GetConvexHullCorners(Rectangle rect)
|
||||
{
|
||||
Point shadowSize = rect.Size.Multiply(ShadowScale);
|
||||
Vector2 center = new Vector2(rect.Center.X, rect.Y - rect.Height / 2);
|
||||
|
||||
Vector2[] corners = new Vector2[4];
|
||||
corners[0] = new Vector2(rect.X - 1, rect.Y - rect.Height - 1);
|
||||
corners[1] = new Vector2(rect.X - 1, rect.Y + 1);
|
||||
corners[2] = new Vector2(rect.Right + 1, rect.Y + 1);
|
||||
corners[3] = new Vector2(rect.Right + 1, rect.Y - rect.Height - 1);
|
||||
corners[0] = center + new Vector2(-shadowSize.X, -shadowSize.Y) / 2;
|
||||
corners[1] = center + new Vector2(-shadowSize.X, shadowSize.Y) / 2;
|
||||
corners[2] = center + new Vector2(shadowSize.X, shadowSize.Y) / 2;
|
||||
corners[3] = center + new Vector2(shadowSize.X, -shadowSize.Y) / 2;
|
||||
|
||||
return corners;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user