(2c8393f34) Fixed "The suitable treatments list may be inaccurate" overflowing in German & Russian, show item name tooltips when hovering over the treatment suggestions
This commit is contained in:
@@ -188,14 +188,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
|
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
|
||||||
|
|
||||||
lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight),
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
|
||||||
TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.TopRight, font: GUI.SmallFont, wrap: true)
|
|
||||||
{
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }, TextManager.Get("SuitableTreatments"), textAlignment: Alignment.BottomRight);
|
|
||||||
|
|
||||||
recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) });
|
recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.47f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) });
|
||||||
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
|
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
|
||||||
{ RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
|
{ RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
|
||||||
{
|
{
|
||||||
@@ -203,6 +198,17 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
dropItemArea.RectTransform.NonScaledSize = new Point(dropItemArea.Rect.Width);
|
dropItemArea.RectTransform.NonScaledSize = new Point(dropItemArea.Rect.Width);
|
||||||
|
|
||||||
|
lowSkillIndicator = new GUIImage(new RectTransform(new Vector2(0.5f, 0.22f), paddedInfoFrame.RectTransform, Anchor.TopRight, Pivot.Center) { RelativeOffset = new Vector2(0.16f, 0.12f) },
|
||||||
|
style: "GUINotificationButton")
|
||||||
|
{
|
||||||
|
ToolTip = TextManager.Get("lowmedicalskillwarning"),
|
||||||
|
Color = Color.OrangeRed,
|
||||||
|
HoverColor = Color.Orange,
|
||||||
|
PressedColor = Color.Orange,
|
||||||
|
Visible = false
|
||||||
|
};
|
||||||
|
lowSkillIndicator.RectTransform.MaxSize = new Point(lowSkillIndicator.Rect.Height);
|
||||||
|
|
||||||
string[] healthCircleStyles = new string[] { "HealthCircleInner", "HealthCircleMid", "HealthCircleOuter" };
|
string[] healthCircleStyles = new string[] { "HealthCircleInner", "HealthCircleMid", "HealthCircleOuter" };
|
||||||
foreach (string healthCircleStyle in healthCircleStyles)
|
foreach (string healthCircleStyle in healthCircleStyles)
|
||||||
{
|
{
|
||||||
@@ -657,7 +663,8 @@ namespace Barotrauma
|
|||||||
openHealthWindow = null;
|
openHealthWindow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
lowSkillIndicator.Visible = Timing.TotalTime % 1.0f < 0.8f && Character.Controlled != null && Character.Controlled.GetSkillLevel("medical") < 50.0f;
|
lowSkillIndicator.Visible = Character.Controlled != null && Character.Controlled.GetSkillLevel("medical") < 50.0f;
|
||||||
|
lowSkillIndicator.Color = new Color(lowSkillIndicator.Color, MathHelper.Lerp(0.1f, 1.0f, (float)(Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 2.0f));
|
||||||
|
|
||||||
float rotationSpeed = 0.25f;
|
float rotationSpeed = 0.25f;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -1053,10 +1060,10 @@ namespace Barotrauma
|
|||||||
var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
|
var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
|
||||||
style: "InnerGlow")
|
style: "InnerGlow")
|
||||||
{
|
{
|
||||||
UserData = item,
|
UserData = item
|
||||||
CanBeFocused = false
|
|
||||||
};
|
};
|
||||||
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
|
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
|
||||||
|
itemSlot.SelectedColor = itemSlot.HoverColor = itemSlot.Color;
|
||||||
|
|
||||||
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
|
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
|
||||||
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
|
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
|
||||||
@@ -1068,7 +1075,7 @@ namespace Barotrauma
|
|||||||
HoverColor = itemColor,
|
HoverColor = itemColor,
|
||||||
SelectedColor = itemColor
|
SelectedColor = itemColor
|
||||||
};
|
};
|
||||||
itemSlot.ToolTip = item.Name + "\n" + item.Description;
|
itemSlot.ToolTip = item.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
|
afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
|
||||||
|
|||||||
@@ -337,6 +337,79 @@ namespace Barotrauma
|
|||||||
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Z);
|
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Z);
|
||||||
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.X);
|
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.X);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckBindings(bool useDefaults)
|
||||||
|
{
|
||||||
|
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||||
|
{
|
||||||
|
var binding = keyMapping[(int)inputType];
|
||||||
|
if (binding == null)
|
||||||
|
{
|
||||||
|
switch (inputType)
|
||||||
|
{
|
||||||
|
case InputType.Deselect:
|
||||||
|
if (useDefaults)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legacy support
|
||||||
|
var selectKey = keyMapping[(int)InputType.Select];
|
||||||
|
if (selectKey != null && selectKey.Key != Keys.None)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(selectKey.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case InputType.Shoot:
|
||||||
|
if (useDefaults)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legacy support
|
||||||
|
var useKey = keyMapping[(int)InputType.Use];
|
||||||
|
if (useKey != null && useKey.MouseButton.HasValue)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(useKey.MouseButton.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (binding == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!");
|
||||||
|
binding = new KeyOrMouse(Keys.D1);
|
||||||
|
}
|
||||||
|
keyMapping[(int)inputType] = binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Load DefaultConfig
|
||||||
|
private void LoadDefaultConfig(bool setLanguage = true)
|
||||||
|
{
|
||||||
|
XDocument doc = XMLExtensions.TryLoadXml(savePath);
|
||||||
|
|
||||||
|
if (setLanguage || string.IsNullOrEmpty(Language))
|
||||||
|
{
|
||||||
|
Language = doc.Root.GetAttributeString("language", "English");
|
||||||
|
}
|
||||||
|
|
||||||
|
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
||||||
|
|
||||||
|
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
|
||||||
|
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
|
||||||
|
|
||||||
|
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
|
||||||
|
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
|
||||||
|
|
||||||
|
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
|
||||||
|
|
||||||
if (legacy)
|
if (legacy)
|
||||||
{
|
{
|
||||||
@@ -1042,12 +1115,17 @@ namespace Barotrauma
|
|||||||
gMode = new XElement("graphicsmode");
|
gMode = new XElement("graphicsmode");
|
||||||
doc.Root.Add(gMode);
|
doc.Root.Add(gMode);
|
||||||
}
|
}
|
||||||
|
if (GraphicsWidth == 0 || GraphicsHeight == 0)
|
||||||
//display error messages after all content packages have been loaded
|
|
||||||
//to make sure the package that contains text files has been loaded before we attempt to use TextManager
|
|
||||||
foreach (string missingPackagePath in missingPackagePaths)
|
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath));
|
gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMode.ReplaceAttributes(
|
||||||
|
new XAttribute("width", GraphicsWidth),
|
||||||
|
new XAttribute("height", GraphicsHeight),
|
||||||
|
new XAttribute("vsync", VSyncEnabled),
|
||||||
|
new XAttribute("displaymode", windowMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
XElement audio = doc.Root.Element("audio");
|
XElement audio = doc.Root.Element("audio");
|
||||||
@@ -1086,17 +1164,18 @@ namespace Barotrauma
|
|||||||
doc.Root.Add(new XElement("contentpackage",
|
doc.Root.Add(new XElement("contentpackage",
|
||||||
new XAttribute("path", contentPackage.Path)));
|
new XAttribute("path", contentPackage.Path)));
|
||||||
}
|
}
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
|
||||||
|
var keyMappingElement = new XElement("keymapping");
|
||||||
|
doc.Root.Add(keyMappingElement);
|
||||||
|
for (int i = 0; i < keyMapping.Length; i++)
|
||||||
{
|
{
|
||||||
bool packageOk = contentPackage.VerifyFiles(out List<string> errorMessages);
|
if (keyMapping[i].MouseButton == null)
|
||||||
if (!packageOk)
|
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\":\n" + string.Join("\n", errorMessages));
|
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].Key));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
foreach (ContentFile file in contentPackage.Files)
|
else
|
||||||
{
|
{
|
||||||
ToolBox.IsProperFilenameCase(file.Path);
|
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1106,6 +1185,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
jobPreferences.Add(new XElement("job", new XAttribute("identifier", jobName)));
|
jobPreferences.Add(new XElement("job", new XAttribute("identifier", jobName)));
|
||||||
}
|
}
|
||||||
|
gameplay.Add(jobPreferences);
|
||||||
|
doc.Root.Add(gameplay);
|
||||||
|
|
||||||
var playerElement = new XElement("player",
|
var playerElement = new XElement("player",
|
||||||
new XAttribute("name", defaultPlayerName ?? ""),
|
new XAttribute("name", defaultPlayerName ?? ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user