Skip to content

Commit

Permalink
Mod OutGameTutorialButton makes all buttons enabled when the tutorial…
Browse files Browse the repository at this point in the history
… completed
  • Loading branch information
nowsprinting committed Mar 18, 2024
1 parent d3c7c0a commit c2555de
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tests/Runtime/TestComponents/OutGameTutorialButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
using UnityEngine;
using Button = UnityEngine.UI.Button;

#pragma warning disable CS0618 // Type or member is obsolete

namespace DeNA.Anjin.TestComponents
{
[RequireComponent(typeof(Button))]
[AddComponentMenu("")] // Hide from "Add Component" picker
public class OutGameTutorialButton : MonoBehaviour
{
private static bool s_tutorialCompleted;

private void Awake()
{
var button = GetComponent<Button>();
Expand All @@ -19,7 +23,12 @@ private void Awake()
private void OnClick()
{
Debug.Log($"{gameObject.name} Clicked!");
if (s_tutorialCompleted)
{
return;
}

// Tutorial mode
var button = GetComponent<Button>();
button.interactable = false;

Expand All @@ -32,6 +41,11 @@ private void OnClick()
else
{
Debug.Log("Tutorial Completed!");
s_tutorialCompleted = true;
foreach (var x in FindObjectsOfType<Button>())
{
x.interactable = true;
}
}
}
}
Expand Down

0 comments on commit c2555de

Please sign in to comment.