(36d2ff935) Merge branch 'dev' of github.com:Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-05-20 20:18:17 +03:00
parent 1340780205
commit 120dc39a9e
9 changed files with 101 additions and 76 deletions
@@ -188,14 +188,9 @@ namespace Barotrauma
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),
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);
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
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)
{ RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
{
@@ -203,6 +198,17 @@ namespace Barotrauma
};
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" };
foreach (string healthCircleStyle in healthCircleStyles)
{
@@ -657,7 +663,8 @@ namespace Barotrauma
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;
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),
style: "InnerGlow")
{
UserData = item,
CanBeFocused = false
UserData = item
};
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
itemSlot.SelectedColor = itemSlot.HoverColor = itemSlot.Color;
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
@@ -1068,7 +1075,7 @@ namespace Barotrauma
HoverColor = itemColor,
SelectedColor = itemColor
};
itemSlot.ToolTip = item.Name + "\n" + item.Description;
itemSlot.ToolTip = item.Name;
}
afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
@@ -16,7 +16,7 @@ namespace Barotrauma
private RenderTarget2D renderTarget;
private Sprite languageSelectionCursor;
private ScalableFont languageSelectionFont;
private ScalableFont languageSelectionFont, languageSelectionFontCJK;
private Video currSplashScreen;
private DateTime videoStartTime;
@@ -220,7 +220,13 @@ namespace Barotrauma
{
if (languageSelectionFont == null)
{
languageSelectionFont = new ScalableFont("Content/Fonts/BebasNeue-Regular.otf", (uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice);
languageSelectionFont = new ScalableFont("Content/Fonts/NotoSans/NotoSans-Bold.ttf",
(uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice);
}
if (languageSelectionFontCJK == null)
{
languageSelectionFontCJK = new ScalableFont("Content/Fonts/NotoSans/NotoSansCJKsc-Bold.otf",
(uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice, dynamicLoading: true);
}
if (languageSelectionCursor == null)
{
@@ -231,13 +237,15 @@ namespace Barotrauma
Vector2 textSpacing = new Vector2(0.0f, (GameMain.GraphicsHeight * 0.5f) / TextManager.AvailableLanguages.Count());
foreach (string language in TextManager.AvailableLanguages)
{
Vector2 textSize = languageSelectionFont.MeasureString(language);
string localizedLanguageName = TextManager.GetTranslatedLanguageName(language);
var font = TextManager.IsCJK(localizedLanguageName) ? languageSelectionFontCJK : languageSelectionFont;
Vector2 textSize = font.MeasureString(localizedLanguageName);
bool hover =
Math.Abs(PlayerInput.MousePosition.X - textPos.X) < textSize.X / 2 &&
Math.Abs(PlayerInput.MousePosition.Y - textPos.Y) < textSpacing.Y / 2;
//TODO: display the name of the language in the target language?
languageSelectionFont.DrawString(spriteBatch, language, textPos - textSize / 2,
font.DrawString(spriteBatch, localizedLanguageName, textPos - textSize / 2,
hover ? Color.White : Color.White * 0.6f);
if (hover && PlayerInput.LeftButtonClicked())
{
@@ -247,12 +255,15 @@ namespace Barotrauma
GameMain.Config.SetDefaultBindings(legacy: false);
GameMain.Config.CheckBindings(useDefaults: true);
WaitForLanguageSelection = false;
languageSelectionFont?.Dispose(); languageSelectionFont = null;
languageSelectionFontCJK?.Dispose(); languageSelectionFontCJK = null;
break;
}
textPos += textSpacing;
}
languageSelectionCursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
languageSelectionCursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, scale: 0.5f);
}
private void DrawSplashScreen(SpriteBatch spriteBatch, GraphicsDevice graphics)
@@ -111,7 +111,7 @@ namespace Barotrauma
string currWord = "";
for (int i = 0; i < text.Length; i++)
{
if (isCJK.IsMatch(text[i].ToString()))
if (TextManager.IsCJK(text[i].ToString()))
{
if (currWord.Length > 0)
{
@@ -200,24 +200,13 @@ namespace Barotrauma
linePos = size.X + spaceSize.X;
}
if (i < words.Count - 1 && !isCJK.IsMatch(words[i]) && !isCJK.IsMatch(words[i + 1]))
if (i < words.Count - 1 && !TextManager.IsCJK(words[i]) && !TextManager.IsCJK(words[i + 1]))
{
wrappedText.Append(" ");
}
}
return wrappedText.ToString().Replace(" \n ", "\n");
}
static Regex isCJK = new Regex(
@"\p{IsHangulJamo}|" +
@"\p{IsCJKRadicalsSupplement}|" +
@"\p{IsCJKSymbolsandPunctuation}|" +
@"\p{IsEnclosedCJKLettersandMonths}|" +
@"\p{IsCJKCompatibility}|" +
@"\p{IsCJKUnifiedIdeographsExtensionA}|" +
@"\p{IsCJKUnifiedIdeographs}|" +
@"\p{IsHangulSyllables}|" +
@"\p{IsCJKCompatibilityForms}");
}
}
}