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() 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 */ /* Lets the player know what to do via text */
Components.InfoText.text = "Rotate"; Components.InfoText.text = "Rotate";
@@ -40,8 +43,8 @@ namespace InterfaceOff
Button button = go.GetComponent<Button>(); Button button = go.GetComponent<Button>();
button.onClick.AddListener(() => button.onClick.AddListener(() =>
{ {
/* Updates the rotation of the clicked image */
RectTransform rect = button.GetComponent<RectTransform>(); RectTransform rect = button.GetComponent<RectTransform>();
if (!(rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45)) if (!(rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45))
{ {
Vector3 rot = rect.rotation.eulerAngles; Vector3 rot = rect.rotation.eulerAngles;
@@ -50,21 +53,20 @@ namespace InterfaceOff
rect.rotation = Quaternion.Euler(rot); 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) if (rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45)
{ {
m_TilesRotatedCorrectly++; m_TilesRotatedCorrectly++;
button.interactable = false; 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() 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 */ /* Fetches a random question and sets it as the title */
TriviaQuestion question = Trivia.questions[Random.Range(0, Trivia.questions.Length)]; TriviaQuestion question = Trivia.questions[Random.Range(0, Trivia.questions.Length)];
Components.InfoText.text = question.question; Components.InfoText.text = question.question;

View File

@@ -1,16 +1,18 @@
{ {
"MonoBehaviour": { "MonoBehaviour": {
"Version": 3, "Version": 5,
"EnableBurstCompilation": true, "EnableBurstCompilation": true,
"EnableOptimisations": true, "EnableOptimisations": true,
"EnableSafetyChecks": false, "EnableSafetyChecks": false,
"EnableDebugInAllBuilds": false, "EnableDebugInAllBuilds": false,
"UsePlatformSDKLinker": false, "DebugDataKind": 0,
"EnableArmv9SecurityFeatures": false,
"CpuMinTargetX32": 0, "CpuMinTargetX32": 0,
"CpuMaxTargetX32": 0, "CpuMaxTargetX32": 0,
"CpuMinTargetX64": 0, "CpuMinTargetX64": 0,
"CpuMaxTargetX64": 0, "CpuMaxTargetX64": 0,
"CpuTargetsX32": 6, "CpuTargetsX32": 6,
"CpuTargetsX64": 72 "CpuTargetsX64": 72,
"OptimizeFor": 0
} }
} }