Skip to content

Commit

Permalink
Fix offset choice button text in 4:3 mode (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Sep 21, 2022
1 parent 7fbac57 commit 83285b0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Assets.Scripts.UI.Choice/ChoiceController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Assets.Scripts.Core;
using Assets.Scripts.Core.Buriko;
using System;
using System.Collections.Generic;
using UnityEngine;
Expand Down Expand Up @@ -28,6 +29,13 @@ private void FinishChoice()

public void Create(List<string> optstrings, int count)
{
// The text X offset is only necessary when in 16:9 mode - when in 4:3 mode just use an offset of 0
float GUIXOffset = GameSystem.Instance.GetGUIOffset();
if(BurikoMemory.Instance.GetGlobalFlag("GRyukishiMode").IntValue() == 1)
{
GUIXOffset = 0;
}

GameObject gameObject = GameObject.FindGameObjectWithTag("PrimaryUIPanel");
for (int i = 0; i < count; i++)
{
Expand All @@ -44,21 +52,21 @@ public void Create(List<string> optstrings, int count)
float x;
if (i == count - 1 && count % 2 == 1)
{
x = GameSystem.Instance.GetGUIOffset();
x = GUIXOffset;
}
else if (i % 2 == 0)
{
x = GameSystem.Instance.GetGUIOffset() - 300f;
x = GUIXOffset - 300f;
}
else
{
x = GameSystem.Instance.GetGUIOffset() + 300f;
x = GUIXOffset + 300f;
}
gameObject2.transform.localPosition = new Vector3(x, (float)(-75 * (i / 2) + 27 * count - 50), 0f);
}
else
{
gameObject2.transform.localPosition = new Vector3(GameSystem.Instance.GetGUIOffset(), (float)(-75 * i + 27 * count + 50), 0f);
gameObject2.transform.localPosition = new Vector3(GUIXOffset, (float)(-75 * i + 27 * count + 50), 0f);
}
ChoiceButton component = gameObject2.GetComponent<ChoiceButton>();
component.ChangeText(optstrings[i]);
Expand Down

0 comments on commit 83285b0

Please sign in to comment.