Skip to content

Commit

Permalink
Fix position of arrow count label at different aspect ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
Interkarma committed Nov 26, 2021
1 parent 53b5df3 commit d4fc32b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Assets/Scripts/Game/UserInterfaceWindows/DaggerfallHUD.cs
Expand Up @@ -223,6 +223,7 @@ public override void Update()
breathBar.Scale = NativePanel.LocalScale;
crosshair.CrosshairScale = CrosshairScale;
interactionModeIcon.Scale = NativePanel.LocalScale;
arrowCountTextLabel.Scale = NativePanel.LocalScale;

// Align compass to screen panel
Rect screenRect = ParentPanel.Rectangle;
Expand Down Expand Up @@ -253,9 +254,9 @@ public override void Update()
{
// Arrow count label position is offset to left of compass and centred relative to compass height
// This is done every frame to handle adaptive resolutions
Vector2 arrowLabelPos = compass.Position;
arrowLabelPos.x -= arrowCountTextLabel.TextWidth;
arrowLabelPos.y += compass.Size.y / 2 - arrowCountTextLabel.TextHeight / 2;
Vector2 arrowLabelPos = new Vector2(screenRect.width, screenRect.height);
arrowLabelPos.x -= compass.Size.x + arrowCountTextLabel.TextWidth + 8;
arrowLabelPos.y -= compass.Size.y / 2 + arrowCountTextLabel.TextHeight / 2;

DaggerfallUnityItem arrows = GameManager.Instance.PlayerEntity.Items.GetItem(ItemGroups.Weapons, (int)Weapons.Arrow, allowQuestItem: false, priorityToConjured: true);
arrowCountTextLabel.Text = (arrows != null) ? arrows.stackCount.ToString() : "0";
Expand Down

0 comments on commit d4fc32b

Please sign in to comment.