UI rework fully implemented. Default positions optimized.
This commit is contained in:
1 parent
1759587d51
commit
af2b103d6b
4 files changed
+29
-19
No files matched your search
+6
-5
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -11,8 +11,9 @@ namespace CalamityMod.UI
|
||||
{
|
||||
public class ChargeMeterUI
|
||||
{
|
||||
internal const float DefaultChargePosX = 49.47917f;
|
||||
internal const float DefaultChargePosY = 43f;
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
internal const float DefaultChargePosX = 50.104603f;
|
||||
internal const float DefaultChargePosY = 58.05169f;
|
||||
private const float MouseDragEpsilon = 0.05f; // 0.05%
|
||||
|
||||
private static Vector2? dragOffset = null;
|
||||
@@ -20,8 +21,8 @@ namespace CalamityMod.UI
|
||||
|
||||
internal static void Load()
|
||||
{
|
||||
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeterBorder").Value;
|
||||
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeter").Value;
|
||||
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeterBorder", AssetRequestMode.ImmediateLoad).Value;
|
||||
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/ChargeMeter", AssetRequestMode.ImmediateLoad).Value;
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -13,10 +13,11 @@ namespace CalamityMod.UI
|
||||
{
|
||||
public static class RipperUI
|
||||
{
|
||||
public const float DefaultRagePosX = 26.04167f;
|
||||
public const float DefaultRagePosY = 3f;
|
||||
public const float DefaultAdrenPosX = 33.8542f;
|
||||
public const float DefaultAdrenPosY = 3f;
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
public const float DefaultRagePosX = 35.77406f;
|
||||
public const float DefaultRagePosY = 3.9761431f;
|
||||
public const float DefaultAdrenPosX = 35.77406f;
|
||||
public const float DefaultAdrenPosY = 8.846918f;
|
||||
private const float MouseDragEpsilon = 0.05f; // 0.05%
|
||||
|
||||
private const int RageAnimFrameDelay = 6;
|
||||
|
||||
@@ -34,9 +34,13 @@ namespace CalamityMod.UI
|
||||
{
|
||||
public class SpeedrunTimerUI
|
||||
{
|
||||
// These values put the Speedrun Timer roughly at the top center of a 1080p screen.
|
||||
internal const float DefaultTimerPosX = 46f;
|
||||
internal const float DefaultTimerPosY = 1.481f;
|
||||
|
||||
private static readonly float SplitHorizontalOffset = +30f;
|
||||
private static readonly float SplitVerticalOffset = +44f;
|
||||
|
||||
public static void Draw(Player player)
|
||||
{
|
||||
if (Main.gameMenu || !CalamityConfig.Instance.SpeedrunTimer)
|
||||
@@ -72,8 +76,8 @@ namespace CalamityMod.UI
|
||||
TimeSpan split = calamityPlayer.lastSplit;
|
||||
text = split.ToString(split.Days > 0 ? formatStrDays : formatStr);
|
||||
scale = 1f;
|
||||
float lineTwoY = screenPos.Y + 44f;
|
||||
float lineTwoX = screenPos.X - 58f;
|
||||
float lineTwoX = screenPos.X + SplitHorizontalOffset;
|
||||
float lineTwoY = screenPos.Y + SplitVerticalOffset;
|
||||
Texture2D texture = GetSplitIcon(calamityPlayer.lastSplitType);
|
||||
|
||||
// If a split icon exists, draw it.
|
||||
|
||||
+12
-8
@@ -3,6 +3,7 @@ using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -10,8 +11,9 @@ namespace CalamityMod.UI
|
||||
{
|
||||
public class StealthUI
|
||||
{
|
||||
internal const float DefaultStealthPosX = 42.7083f;
|
||||
internal const float DefaultStealthPosY = 56.0000f;
|
||||
// These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision.
|
||||
internal const float DefaultStealthPosX = 50.104603f;
|
||||
internal const float DefaultStealthPosY = 55.765408f;
|
||||
private const float MouseDragEpsilon = 0.05f; // 0.05%
|
||||
|
||||
private static Vector2? dragOffset = null;
|
||||
@@ -19,10 +21,10 @@ namespace CalamityMod.UI
|
||||
|
||||
internal static void Load()
|
||||
{
|
||||
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeter").Value;
|
||||
indicatorTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator").Value;
|
||||
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBar").Value;
|
||||
fullBarTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBarFull").Value;
|
||||
edgeTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeter", AssetRequestMode.ImmediateLoad).Value;
|
||||
indicatorTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator", AssetRequestMode.ImmediateLoad).Value;
|
||||
barTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBar", AssetRequestMode.ImmediateLoad).Value;
|
||||
fullBarTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/UI/StealthMeterBarFull", AssetRequestMode.ImmediateLoad).Value;
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -66,8 +68,10 @@ namespace CalamityMod.UI
|
||||
CalamityConfig.Instance.StealthMeterPosY = screenRatioPosition.Y;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
return;
|
||||
}
|
||||
|
||||
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
|
||||
@@ -77,9 +81,9 @@ namespace CalamityMod.UI
|
||||
if (modPlayer.StealthStrikeAvailable())
|
||||
spriteBatch.Draw(indicatorTexture, screenPos, null, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
|
||||
|
||||
float completionRatio = modPlayer.rogueStealth / modPlayer.rogueStealthMax;
|
||||
float completionRatio = modPlayer.rogueStealthMax <= 0f ? 0f : modPlayer.rogueStealth / modPlayer.rogueStealthMax;
|
||||
Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width);
|
||||
bool full = modPlayer.rogueStealth >= modPlayer.rogueStealthMax;
|
||||
bool full = (modPlayer.rogueStealthMax > 0f) && (modPlayer.rogueStealth >= modPlayer.rogueStealthMax);
|
||||
spriteBatch.Draw(full ? fullBarTexture : barTexture, screenPos + new Vector2(offset * uiScale, 0), barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
|
||||
|
||||
Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
|
||||
|
||||
Reference in new issue
Block a user