Removed uneeded close buttons

This commit is contained in:
Pasha Bibko
2026-01-20 15:59:13 +00:00
parent 7307a64e77
commit fc629e45b6
3 changed files with 19 additions and 12 deletions

View File

@@ -17,6 +17,9 @@ namespace InterfaceOff
protected override void OnWindowInstantiation()
{
/* Destroys the Window Close button to stop accidental clicking */
Destroy(Components.CloseButtonRectTransform.gameObject);
/* Lets the player know what to do via text */
Components.InfoText.text = "Rotate";
@@ -40,8 +43,8 @@ namespace InterfaceOff
Button button = go.GetComponent<Button>();
button.onClick.AddListener(() =>
{
/* Updates the rotation of the clicked image */
RectTransform rect = button.GetComponent<RectTransform>();
if (!(rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45))
{
Vector3 rot = rect.rotation.eulerAngles;
@@ -50,21 +53,20 @@ namespace InterfaceOff
rect.rotation = Quaternion.Euler(rot);
}
/* Stops further rotation if it is the correct orientation */
if (rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45)
{
m_TilesRotatedCorrectly++;
button.interactable = false;
}
/* Closes the window if they are all finished */
if (m_TilesRotatedCorrectly == 4)
{
DestroyWindow();
}
});
}
}
public override void OnWindowCloseButtonClicked()
{
if (m_TilesRotatedCorrectly == 4)
{
DestroyWindow();
}
}
}
}

View File

@@ -46,6 +46,9 @@ namespace InterfaceOff
protected override void OnWindowInstantiation()
{
/* Destroys the Window Close button to stop accidental clicking */
Destroy(Components.CloseButtonRectTransform.gameObject);
/* Fetches a random question and sets it as the title */
TriviaQuestion question = Trivia.questions[Random.Range(0, Trivia.questions.Length)];
Components.InfoText.text = question.question;