Example #1
0
            public static void Set(UIState.State state, bool showed)
            {
                var key = GetKey(state);

                PlayerPrefs.SetInt(key, showed ? 1 : 0);
                PlayerPrefs.Save();
            }
Example #2
0
        IEnumerator ShowLines(UIState.State state, List <string> lines)
        {
            dialogParent.SetActive(true);
            foreach (var l in lines)
            {
                if (CancelDialogDown)
                {
                    break;
                }
                var line = l;

                dialogText.text = line;

                yield return(StartCoroutine(RevealCharacters(dialogText)));

                var t = Time.time;
                while (!SkipTextDown && !CancelDialogDown && Time.time - t < 6)
                {
                    yield return(null);
                }
                if (CancelDialogDown)
                {
                    break;
                }

                yield return(null);
            }

            OnTutorialEnd();
        }
Example #3
0
 public void Show(UIState.State state, string[] lines)
 {
     if (lines != null && lines.Length > 0)
     {
         Show(state, lines.ToList());
     }
 }
Example #4
0
 public void Show(UIState.State state, List <string> lines)
 {
     if (lines == null || lines.Count == 0)
     {
         return;
     }
     StartCoroutine(ShowLines(state, lines));
 }
Example #5
0
            public string[] GetTutorialForState(UIState.State state)
            {
                switch (state)
                {
                case UIState.State.Title:               return(Title);

                case UIState.State.Game:                return(Game);

                case UIState.State.Tutorial:            return(Tutorial);
                }
                return(null);
            }
Example #6
0
 public static bool ShowTutorialIfNeeded(UIState.State state, System.Action action)
 {
     //  show once, depending on the State
     if (!Get(state) ||
         // Always show the tutorial one tho
         state == UIState.State.Tutorial)
     {
         Set(state, true);
         action?.Invoke();
         return(true);
     }
     return(false);
 }
Example #7
0
            public static bool Get(UIState.State state)
            {
                var key = GetKey(state);

                return(PlayerPrefs.HasKey(key) && PlayerPrefs.GetInt(key, 0) == 1);
            }
Example #8
0
 static string GetKey(UIState.State state)
 {
     var id = GetId(state); return($"{prefsPrefix}.{id}");
 }
Example #9
0
 static int GetId(UIState.State state)
 {
     return((int)state);
 }
Example #10
0
 public static void ClearPrefForState(UIState.State state) => PlayerPrefs.DeleteKey(GetKey(state));
Example #11
0
 void OnStateChanged(UIState.State state)
 {
     // check if we should start a dialog
     TutorialShowedStatus.ShowTutorialIfNeeded(state, () => Show(state, dialog.tutorials.GetTutorialForState(state)));
 }