예제 #1
0
        private static void TryLoadTutorial(string trigger)
        {
            foreach (var tutorial in availableTutorials)
            {
                bool hasComplete             = instance.database.Get <bool>("complete_" + tutorial.id);
                bool hasCompletePrerequisite = string.IsNullOrEmpty(tutorial.prerequisite) || instance.database.Get <bool>("complete_" + tutorial.prerequisite);
                bool matchTrigger            = string.Equals(tutorial.trigger, trigger);

                if (!hasComplete && hasCompletePrerequisite && matchTrigger)
                {
                    activeTut = tutorial;
                    var steps = allTutSteps.FindAll(s => s.id.Equals(tutorial.id));
                    steps.Sort((s1, s2) => s1.index.CompareTo(s2.index));
                    activeTut.Init(steps.ToArray(), instance.guiService, instance.databinding);
                    break;
                }
            }
        }
예제 #2
0
        public static void CompleteTutorial(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                if (activeTut != null && activeTut.id.Equals(id))
                {
                    if (!activeTut.hasComplete)
                    {
                        activeTut.ForceComplete();
                    }

                    activeTut = null;
                }

                instance.database.Set("complete_" + id, true, true, true);

                LogWrapper.DebugLog("[{0}] Mark tutorial {1} as completed", instance.GetType(), id);
            }
        }