< Summary

Class:DCL.Tutorial.TutorialController
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/TutorialController.cs
Covered lines:206
Uncovered lines:43
Coverable lines:249
Total lines:637
Line coverage:82.7% (206 of 249)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TutorialController()0%110100%
CreateTutorialView()0%110100%
SetConfiguration(...)0%3.13077.78%
Dispose()0%4.034087.5%
SetTutorialEnabled(...)0%110100%
SetTutorialEnabledForUsersThatAlreadyDidTheTutorial(...)0%6200%
SetBuilderInWorldTutorialEnabled()0%2100%
SetupTutorial(...)0%9.019095.45%
SetTutorialDisabled()0%880100%
StartTutorialFromStep()0%16.1716091.3%
ShowTeacher3DModel(...)0%330100%
SetTeacherPosition(...)0%4.374071.43%
PlayTeacherAnimation(...)0%220100%
SetTeacherCanvasSortingOrder(...)0%2.062075%
SkipTutorial()0%8.147071.43%
SetEagleEyeCameraActive(...)0%440100%
OnRenderingStateChanged(...)0%5.025090%
ExecuteSteps()0%27.5127091.11%
SetUserTutorialStepAsCompleted(...)0%110100%
MoveTeacher()0%6.976070%
IsTaskbarHUDInitialized_OnChange(...)0%64050%
MoreMenu_OnRestartTutorial()0%110100%
IsPlayerInsideGenesisPlaza()0%8.817066.67%
SendStepStartedSegmentStats(...)0%2100%
SendStepCompletedSegmentStats(...)0%2100%
SendSkipTutorialSegmentStats(...)0%2100%
EagleEyeCameraRotation()0%330100%
BlockPlayerCameraUntilBlendingIsFinished()0%15150100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/TutorialController.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.Interface;
 3using System;
 4using System.Collections;
 5using System.Collections.Generic;
 6using UnityEngine;
 7using DCL.Helpers;
 8
 9namespace DCL.Tutorial
 10{
 11    /// <summary>
 12    /// Controller that handles all the flow related to the onboarding tutorial.
 13    /// </summary>
 14    public class TutorialController : IPlugin
 15    {
 16        [Serializable]
 17        public class TutorialInitializationMessage
 18        {
 19            public string fromDeepLink;
 20            public string enableNewTutorialCamera;
 21        }
 22
 23        [Flags]
 24        public enum TutorialFinishStep
 25        {
 26            None = 0,
 27            OldTutorialValue = 99, // NOTE: old tutorial set tutorialStep to 99 when finished
 28            EmailRequested = 128, // NOTE: old email prompt set tutorialStep to 128 when finished
 29            NewTutorialFinished = 256
 30        }
 31
 32        public enum TutorialType
 33        {
 34            Initial,
 35            BuilderInWorld
 36        }
 37
 38        internal enum TutorialPath
 39        {
 40            FromGenesisPlaza,
 41            FromDeepLink,
 42            FromResetTutorial,
 43            FromBuilderInWorld,
 44            FromUserThatAlreadyDidTheTutorial
 45        }
 46
 1047        public static TutorialController i { get; private set; }
 48
 049        public HUDController hudController { get => HUDController.i; }
 50
 051        public int currentStepIndex { get; internal set; }
 52        public event Action OnTutorialEnabled;
 53        public event Action OnTutorialDisabled;
 54
 55        private const string PLAYER_PREFS_VOICE_CHAT_FEATURE_SHOWED = "VoiceChatFeatureShowed";
 56
 57        internal TutorialSettings configuration;
 58        internal TutorialView tutorialView;
 59
 60        internal bool isRunning = false;
 61        internal bool openedFromDeepLink = false;
 62        internal bool playerIsInGenesisPlaza = false;
 63        internal TutorialStep runningStep = null;
 64        internal bool tutorialReset = false;
 65        internal float elapsedTimeInCurrentStep = 0f;
 66        internal TutorialPath currentPath;
 67        internal int currentStepNumber;
 68        internal TutorialType tutorialType = TutorialType.Initial;
 69
 70        private Coroutine executeStepsCoroutine;
 71        private Coroutine teacherMovementCoroutine;
 72        private Coroutine eagleEyeRotationCoroutine;
 73
 074        internal bool userAlreadyDidTheTutorial { get; set; }
 75
 4476        public TutorialController ()
 77        {
 4478            tutorialView = CreateTutorialView();
 4479            SetConfiguration(tutorialView.configuration);
 4480        }
 81
 82        internal TutorialView CreateTutorialView()
 83        {
 8884            GameObject tutorialGO = GameObject.Instantiate(Resources.Load<GameObject>("TutorialView"));
 8885            tutorialGO.name = "TutorialController";
 8886            TutorialView tutorialView = tutorialGO.GetComponent<TutorialView>();
 8887            tutorialView.ConfigureView(this);
 88
 8889            return tutorialView;
 90        }
 91
 92        public void SetConfiguration(TutorialSettings configuration)
 93        {
 8894            this.configuration = configuration;
 95
 8896            i = this;
 8897            ShowTeacher3DModel(false);
 98
 8899            if (CommonScriptableObjects.isTaskbarHUDInitialized.Get())
 88100                IsTaskbarHUDInitialized_OnChange(true, false);
 101            else
 0102                CommonScriptableObjects.isTaskbarHUDInitialized.OnChange += IsTaskbarHUDInitialized_OnChange;
 103
 88104            if (configuration.debugRunTutorial)
 105            {
 0106                SetTutorialEnabled(JsonUtility.ToJson(new TutorialInitializationMessage
 107                {
 108                    fromDeepLink = configuration.debugOpenedFromDeepLink.ToString(),
 109                    enableNewTutorialCamera = false.ToString()
 110                }));
 111            }
 88112        }
 113
 114        public void Dispose()
 115        {
 44116            SetTutorialDisabled();
 117
 44118            CommonScriptableObjects.isTaskbarHUDInitialized.OnChange -= IsTaskbarHUDInitialized_OnChange;
 119
 44120            if (hudController != null &&
 121                hudController.taskbarHud != null)
 122            {
 0123                hudController.taskbarHud.moreMenu.OnRestartTutorial -= MoreMenu_OnRestartTutorial;
 124            }
 125
 44126            NotificationsController.disableWelcomeNotification = false;
 127
 44128            if (tutorialView != null)
 44129                GameObject.Destroy(tutorialView.gameObject);
 44130        }
 131
 132        public void SetTutorialEnabled(string json)
 133        {
 1134            TutorialInitializationMessage msg = JsonUtility.FromJson<TutorialInitializationMessage>(json);
 1135            SetupTutorial(msg.fromDeepLink, msg.enableNewTutorialCamera, TutorialType.Initial);
 1136        }
 137
 138        public void SetTutorialEnabledForUsersThatAlreadyDidTheTutorial(string json)
 139        {
 0140            TutorialInitializationMessage msg = JsonUtility.FromJson<TutorialInitializationMessage>(json);
 141
 142            // TODO (Santi): This a TEMPORAL fix. It will be removed when we refactorize the tutorial system in order to
 0143            if (PlayerPrefsUtils.GetInt(PLAYER_PREFS_VOICE_CHAT_FEATURE_SHOWED) == 1)
 0144                return;
 145
 0146            SetupTutorial(false.ToString(), msg.enableNewTutorialCamera, TutorialType.Initial, true);
 0147        }
 148
 0149        public void SetBuilderInWorldTutorialEnabled() { SetupTutorial(false.ToString(), false.ToString(), TutorialType.
 150
 151        /// <summary>
 152        /// Enables the tutorial controller and waits for the RenderingState is enabled to start to execute the correspo
 153        /// </summary>
 154        internal void SetupTutorial(string fromDeepLink, string enableNewTutorialCamera, TutorialType tutorialType, bool
 155        {
 2156            if (isRunning)
 0157                return;
 158
 2159            if (Convert.ToBoolean(enableNewTutorialCamera))
 160            {
 1161                configuration.eagleCamInitPosition = new Vector3(15, 115, -30);
 1162                configuration.eagleCamInitLookAtPoint = new Vector3(16, 105, 6);
 1163                configuration.eagleCamRotationActived = false;
 164            }
 165
 2166            isRunning = true;
 2167            DataStore.i.virtualAudioMixer.sceneSFXVolume.Set(0f);
 2168            this.userAlreadyDidTheTutorial = userAlreadyDidTheTutorial;
 2169            CommonScriptableObjects.allUIHidden.Set(false);
 2170            CommonScriptableObjects.tutorialActive.Set(true);
 2171            openedFromDeepLink = Convert.ToBoolean(fromDeepLink);
 2172            this.tutorialType = tutorialType;
 173
 2174            hudController?.taskbarHud?.ShowTutorialOption(false);
 2175            hudController?.profileHud?.HideProfileMenu();
 176
 2177            NotificationsController.disableWelcomeNotification = true;
 178
 2179            WebInterface.SetDelightedSurveyEnabled(false);
 180
 2181            if (!CommonScriptableObjects.rendererState.Get())
 1182                CommonScriptableObjects.rendererState.OnChange += OnRenderingStateChanged;
 183            else
 1184                OnRenderingStateChanged(true, false);
 185
 2186            OnTutorialEnabled?.Invoke();
 1187        }
 188
 189        /// <summary>
 190        /// Stop and disables the tutorial controller.
 191        /// </summary>
 192        public void SetTutorialDisabled()
 193        {
 76194            CommonScriptableObjects.featureKeyTriggersBlocked.Set(false);
 195
 76196            if (executeStepsCoroutine != null)
 197            {
 1198                CoroutineStarter.Stop(executeStepsCoroutine);
 1199                executeStepsCoroutine = null;
 200            }
 201
 76202            if (runningStep != null)
 203            {
 1204                GameObject.Destroy(runningStep.gameObject);
 1205                runningStep = null;
 206            }
 207
 76208            tutorialReset = false;
 76209            isRunning = false;
 76210            DataStore.i.virtualAudioMixer.sceneSFXVolume.Set(1f);
 76211            ShowTeacher3DModel(false);
 76212            WebInterface.SetDelightedSurveyEnabled(true);
 213
 76214            if (Environment.i != null && Environment.i.world != null)
 215            {
 76216                WebInterface.SendSceneExternalActionEvent(Environment.i.world.state.currentSceneId, "tutorial", "end");
 217            }
 218
 76219            NotificationsController.disableWelcomeNotification = false;
 220
 76221            hudController?.taskbarHud?.ShowTutorialOption(true);
 222
 76223            CommonScriptableObjects.tutorialActive.Set(false);
 224
 76225            CommonScriptableObjects.rendererState.OnChange -= OnRenderingStateChanged;
 226
 76227            OnTutorialDisabled?.Invoke();
 2228        }
 229
 230        /// <summary>
 231        /// Starts to execute the tutorial from a specific step (It is needed to call SetTutorialEnabled() before).
 232        /// </summary>
 233        /// <param name="stepIndex">First step to be executed.</param>
 234        public IEnumerator StartTutorialFromStep(int stepIndex)
 235        {
 32236            if (!isRunning)
 2237                yield break;
 238
 30239            if (runningStep != null)
 240            {
 10241                runningStep.OnStepFinished();
 10242                GameObject.Destroy(runningStep.gameObject);
 10243                runningStep = null;
 244            }
 245
 30246            switch (tutorialType)
 247            {
 248                case TutorialType.Initial:
 28249                    if (userAlreadyDidTheTutorial)
 250                    {
 2251                        yield return ExecuteSteps(TutorialPath.FromUserThatAlreadyDidTheTutorial, stepIndex);
 2252                    }
 26253                    else if (playerIsInGenesisPlaza || tutorialReset)
 254                    {
 24255                        if (tutorialReset)
 256                        {
 3257                            yield return ExecuteSteps(TutorialPath.FromResetTutorial, stepIndex);
 2258                        }
 259                        else
 260                        {
 21261                            yield return ExecuteSteps(TutorialPath.FromGenesisPlaza, stepIndex);
 262                        }
 21263                    }
 2264                    else if (openedFromDeepLink)
 265                    {
 2266                        yield return ExecuteSteps(TutorialPath.FromDeepLink, stepIndex);
 2267                    }
 268                    else
 269                    {
 0270                        SetTutorialDisabled();
 0271                        yield break;
 272                    }
 273
 274                    break;
 275                case TutorialType.BuilderInWorld:
 2276                    yield return ExecuteSteps(TutorialPath.FromBuilderInWorld, stepIndex);
 277                    break;
 278            }
 29279        }
 280
 281        /// <summary>
 282        /// Shows the teacher that will be guiding along the tutorial.
 283        /// </summary>
 284        /// <param name="active">True for show the teacher.</param>
 285        public void ShowTeacher3DModel(bool active)
 286        {
 185287            if (configuration.teacherCamera != null)
 185288                configuration.teacherCamera.enabled = active;
 289
 185290            if (configuration.teacherRawImage != null)
 128291                configuration.teacherRawImage.gameObject.SetActive(active);
 185292        }
 293
 294        /// <summary>
 295        /// Move the tutorial teacher to a specific position.
 296        /// </summary>
 297        /// <param name="position">Target position.</param>
 298        /// <param name="animated">True for apply a smooth movement.</param>
 299        public void SetTeacherPosition(Vector2 position, bool animated = true)
 300        {
 29301            if (teacherMovementCoroutine != null)
 0302                CoroutineStarter.Stop(teacherMovementCoroutine);
 303
 29304            if (configuration.teacherRawImage != null)
 305            {
 2306                if (animated)
 0307                    teacherMovementCoroutine = CoroutineStarter.Start(MoveTeacher(configuration.teacherRawImage.rectTran
 308                else
 2309                    configuration.teacherRawImage.rectTransform.position = position;
 310            }
 29311        }
 312
 313        /// <summary>
 314        /// Plays a specific animation on the tutorial teacher.
 315        /// </summary>
 316        /// <param name="animation">Animation to apply.</param>
 317        public void PlayTeacherAnimation(TutorialTeacher.TeacherAnimation animation)
 318        {
 55319            if (configuration.teacher == null)
 27320                return;
 321
 28322            configuration.teacher.PlayAnimation(animation);
 28323        }
 324
 325        /// <summary>
 326        /// Set sort order for canvas containing teacher RawImage
 327        /// </summary>
 328        /// <param name="sortOrder"></param>
 329        public void SetTeacherCanvasSortingOrder(int sortOrder)
 330        {
 13331            if (configuration.teacherCanvas == null)
 0332                return;
 333
 13334            configuration.teacherCanvas.sortingOrder = sortOrder;
 13335        }
 336
 337        /// <summary>
 338        /// Finishes the current running step, skips all the next ones and completes the tutorial.
 339        /// </summary>
 340        public void SkipTutorial()
 341        {
 5342            if (!configuration.debugRunTutorial && configuration.sendStats)
 343            {
 0344                SendSkipTutorialSegmentStats(
 345                    configuration.tutorialVersion,
 346                    runningStep.name.Replace("(Clone)", "").Replace("TutorialStep_", ""));
 347            }
 348
 5349            int skipIndex = configuration.stepsOnGenesisPlaza.Count +
 350                            configuration.stepsFromDeepLink.Count +
 351                            configuration.stepsFromReset.Count +
 352                            configuration.stepsFromBuilderInWorld.Count +
 353                            configuration.stepsFromUserThatAlreadyDidTheTutorial.Count;
 354
 5355            CoroutineStarter.Start(StartTutorialFromStep(skipIndex));
 356
 5357            hudController?.taskbarHud?.SetVisibility(true);
 5358            hudController?.profileHud?.SetBackpackButtonVisibility(true);
 0359        }
 360
 361        /// <summary>
 362        /// Activate/deactivate the eagle eye camera.
 363        /// </summary>
 364        /// <param name="isActive">True for activate the eagle eye camera.</param>
 365        public void SetEagleEyeCameraActive(bool isActive)
 366        {
 6367            configuration.eagleEyeCamera.gameObject.SetActive(isActive);
 6368            CoroutineStarter.Start(BlockPlayerCameraUntilBlendingIsFinished(isActive));
 369
 6370            if (isActive)
 371            {
 3372                configuration.eagleEyeCamera.transform.position = configuration.eagleCamInitPosition;
 3373                configuration.eagleEyeCamera.transform.LookAt(configuration.eagleCamInitLookAtPoint);
 374
 3375                if (configuration.eagleCamRotationActived)
 2376                    eagleEyeRotationCoroutine = CoroutineStarter.Start(EagleEyeCameraRotation(configuration.eagleCamRota
 2377            }
 3378            else if (eagleEyeRotationCoroutine != null)
 379            {
 2380                CoroutineStarter.Stop(eagleEyeRotationCoroutine);
 381            }
 4382        }
 383
 384        internal void OnRenderingStateChanged(bool renderingEnabled, bool prevState)
 385        {
 3386            if (!renderingEnabled)
 0387                return;
 388
 3389            CommonScriptableObjects.rendererState.OnChange -= OnRenderingStateChanged;
 390
 3391            playerIsInGenesisPlaza = IsPlayerInsideGenesisPlaza();
 392
 3393            if (configuration.debugRunTutorial)
 1394                currentStepIndex = configuration.debugStartingStepIndex >= 0 ? configuration.debugStartingStepIndex : 0;
 395            else
 2396                currentStepIndex = 0;
 397
 3398            PlayTeacherAnimation(TutorialTeacher.TeacherAnimation.Reset);
 3399            executeStepsCoroutine = CoroutineStarter.Start(StartTutorialFromStep(currentStepIndex));
 3400        }
 401
 402        private IEnumerator ExecuteSteps(TutorialPath tutorialPath, int startingStepIndex)
 403        {
 30404            List<TutorialStep> steps = new List<TutorialStep>();
 405
 406            switch (tutorialPath)
 407            {
 408                case TutorialPath.FromGenesisPlaza:
 21409                    steps = configuration.stepsOnGenesisPlaza;
 21410                    break;
 411                case TutorialPath.FromDeepLink:
 2412                    steps = configuration.stepsFromDeepLink;
 2413                    break;
 414                case TutorialPath.FromResetTutorial:
 3415                    steps = configuration.stepsFromReset;
 3416                    break;
 417                case TutorialPath.FromBuilderInWorld:
 2418                    steps = configuration.stepsFromBuilderInWorld;
 2419                    break;
 420                case TutorialPath.FromUserThatAlreadyDidTheTutorial:
 2421                    steps = configuration.stepsFromUserThatAlreadyDidTheTutorial;
 422                    break;
 423            }
 424
 30425            currentPath = tutorialPath;
 426
 30427            elapsedTimeInCurrentStep = 0f;
 148428            for (int i = startingStepIndex; i < steps.Count; i++)
 429            {
 44430                var stepPrefab = steps[i];
 431
 432                // TODO (Santi): This a TEMPORAL fix. It will be removed when we refactorize the tutorial system in orde
 44433                if (stepPrefab is TutorialStep_Tooltip_UsersAround &&
 434                    CommonScriptableObjects.voiceChatDisabled.Get())
 435                    continue;
 436
 44437                if (stepPrefab.letInstantiation)
 19438                    runningStep = GameObject.Instantiate(stepPrefab, tutorialView.transform).GetComponent<TutorialStep>(
 439                else
 25440                    runningStep = steps[i];
 441
 44442                currentStepIndex = i;
 443
 44444                elapsedTimeInCurrentStep = Time.realtimeSinceStartup;
 44445                currentStepNumber = i + 1;
 446
 44447                if (!configuration.debugRunTutorial && configuration.sendStats)
 448                {
 0449                    SendStepStartedSegmentStats(
 450                        configuration.tutorialVersion,
 451                        tutorialPath,
 452                        i + 1,
 453                        runningStep.name.Replace("(Clone)", "").Replace("TutorialStep_", ""));
 454                }
 455
 44456                if (tutorialPath == TutorialPath.FromUserThatAlreadyDidTheTutorial &&
 457                    runningStep is TutorialStep_Tooltip)
 458                {
 0459                    ((TutorialStep_Tooltip) runningStep).OverrideSetMaxTimeToHide(true);
 460                }
 461
 44462                runningStep.OnStepStart();
 44463                yield return runningStep.OnStepExecute();
 44464                if (i < steps.Count - 1)
 20465                    PlayTeacherAnimation(TutorialTeacher.TeacherAnimation.StepCompleted);
 466                else
 24467                    PlayTeacherAnimation(TutorialTeacher.TeacherAnimation.QuickGoodbye);
 468
 44469                yield return runningStep.OnStepPlayHideAnimation();
 44470                runningStep.OnStepFinished();
 44471                elapsedTimeInCurrentStep = Time.realtimeSinceStartup - elapsedTimeInCurrentStep;
 472
 44473                if (!configuration.debugRunTutorial &&
 474                    configuration.sendStats &&
 475                    tutorialPath != TutorialPath.FromUserThatAlreadyDidTheTutorial)
 476                {
 0477                    SendStepCompletedSegmentStats(
 478                        configuration.tutorialVersion,
 479                        tutorialPath,
 480                        i + 1,
 481                        runningStep.name.Replace("(Clone)", "").Replace("TutorialStep_", ""),
 482                        elapsedTimeInCurrentStep);
 483                }
 484
 44485                GameObject.Destroy(runningStep.gameObject);
 486
 44487                if (i < steps.Count - 1 && configuration.timeBetweenSteps > 0)
 0488                    yield return new WaitForSeconds(configuration.timeBetweenSteps);
 489            }
 490
 30491            if (!configuration.debugRunTutorial &&
 492                tutorialPath != TutorialPath.FromBuilderInWorld &&
 493                tutorialPath != TutorialPath.FromUserThatAlreadyDidTheTutorial)
 494            {
 26495                SetUserTutorialStepAsCompleted(TutorialFinishStep.NewTutorialFinished);
 496            }
 497
 30498            runningStep = null;
 499
 30500            SetTutorialDisabled();
 30501        }
 502
 52503        private void SetUserTutorialStepAsCompleted(TutorialFinishStep finishStepType) { WebInterface.SaveUserTutorialSt
 504
 505        internal IEnumerator MoveTeacher(Vector2 fromPosition, Vector2 toPosition)
 506        {
 1507            if (configuration.teacherRawImage == null)
 0508                yield break;
 509
 1510            float t = 0f;
 511
 2512            while (Vector2.Distance(configuration.teacherRawImage.rectTransform.position, toPosition) > 0)
 513            {
 2514                t += configuration.teacherMovementSpeed * Time.deltaTime;
 2515                if (t <= 1.0f)
 2516                    configuration.teacherRawImage.rectTransform.position = Vector2.Lerp(fromPosition, toPosition, config
 517                else
 0518                    configuration.teacherRawImage.rectTransform.position = toPosition;
 519
 2520                yield return null;
 521            }
 0522        }
 523
 524        private void IsTaskbarHUDInitialized_OnChange(bool current, bool previous)
 525        {
 88526            if (current &&
 527                hudController != null &&
 528                hudController.taskbarHud != null)
 529            {
 0530                hudController.taskbarHud.moreMenu.OnRestartTutorial -= MoreMenu_OnRestartTutorial;
 0531                hudController.taskbarHud.moreMenu.OnRestartTutorial += MoreMenu_OnRestartTutorial;
 532            }
 88533        }
 534
 535        internal void MoreMenu_OnRestartTutorial()
 536        {
 1537            SetTutorialDisabled();
 1538            tutorialReset = true;
 1539            SetTutorialEnabled(JsonUtility.ToJson(new TutorialInitializationMessage
 540            {
 541                fromDeepLink = false.ToString(),
 542                enableNewTutorialCamera = false.ToString()
 543            }));
 1544        }
 545
 546        internal static bool IsPlayerInsideGenesisPlaza()
 547        {
 3548            if (Environment.i.world == null)
 0549                return false;
 550
 3551            IWorldState worldState = Environment.i.world.state;
 552
 3553            if (worldState == null || worldState.currentSceneId == null)
 0554                return false;
 555
 3556            Vector2Int genesisPlazaBaseCoords = new Vector2Int(-9, -9);
 557
 3558            IParcelScene currentScene = null;
 3559            if (worldState.loadedScenes != null)
 0560                currentScene = worldState.loadedScenes[worldState.currentSceneId];
 561
 3562            if (currentScene != null && currentScene.IsInsideSceneBoundaries(genesisPlazaBaseCoords))
 0563                return true;
 564
 3565            return false;
 566        }
 567
 568        private void SendStepStartedSegmentStats(int version, TutorialPath tutorialPath, int stepNumber, string stepName
 569        {
 0570            WebInterface.AnalyticsPayload.Property[] properties = new WebInterface.AnalyticsPayload.Property[]
 571            {
 572                new WebInterface.AnalyticsPayload.Property("version", version.ToString()),
 573                new WebInterface.AnalyticsPayload.Property("path", tutorialPath.ToString()),
 574                new WebInterface.AnalyticsPayload.Property("step number", stepNumber.ToString()),
 575                new WebInterface.AnalyticsPayload.Property("step name", stepName)
 576            };
 0577            WebInterface.ReportAnalyticsEvent("tutorial step started", properties);
 0578        }
 579
 580        private void SendStepCompletedSegmentStats(int version, TutorialPath tutorialPath, int stepNumber, string stepNa
 581        {
 0582            WebInterface.AnalyticsPayload.Property[] properties = new WebInterface.AnalyticsPayload.Property[]
 583            {
 584                new WebInterface.AnalyticsPayload.Property("version", version.ToString()),
 585                new WebInterface.AnalyticsPayload.Property("path", tutorialPath.ToString()),
 586                new WebInterface.AnalyticsPayload.Property("step number", stepNumber.ToString()),
 587                new WebInterface.AnalyticsPayload.Property("step name", stepName),
 588                new WebInterface.AnalyticsPayload.Property("elapsed time", elapsedTime.ToString("0.00"))
 589            };
 0590            WebInterface.ReportAnalyticsEvent("tutorial step completed", properties);
 0591        }
 592
 593        private void SendSkipTutorialSegmentStats(int version, string stepName)
 594        {
 0595            WebInterface.AnalyticsPayload.Property[] properties = new WebInterface.AnalyticsPayload.Property[]
 596            {
 597                new WebInterface.AnalyticsPayload.Property("version", version.ToString()),
 598                new WebInterface.AnalyticsPayload.Property("path", currentPath.ToString()),
 599                new WebInterface.AnalyticsPayload.Property("step number", currentStepNumber.ToString()),
 600                new WebInterface.AnalyticsPayload.Property("step name", stepName),
 601                new WebInterface.AnalyticsPayload.Property("elapsed time", (Time.realtimeSinceStartup - elapsedTimeInCur
 602            };
 0603            WebInterface.ReportAnalyticsEvent("tutorial skipped", properties);
 0604        }
 605
 606        internal IEnumerator EagleEyeCameraRotation(float rotationSpeed)
 607        {
 4608            while (true)
 609            {
 6610                configuration.eagleEyeCamera.transform.Rotate(Vector3.up * Time.deltaTime * rotationSpeed, Space.World);
 6611                yield return null;
 612            }
 613        }
 614
 615        private IEnumerator BlockPlayerCameraUntilBlendingIsFinished(bool hideUIs)
 616        {
 6617            if (hideUIs)
 618            {
 3619                hudController?.minimapHud?.SetVisibility(false);
 3620                hudController?.profileHud?.SetVisibility(false);
 621            }
 622
 6623            CommonScriptableObjects.cameraBlocked.Set(true);
 624
 6625            yield return null;
 696626            yield return new WaitUntil(() => !CommonScriptableObjects.cameraIsBlending.Get());
 627
 6628            CommonScriptableObjects.cameraBlocked.Set(false);
 629
 6630            if (!hideUIs)
 631            {
 3632                hudController?.minimapHud?.SetVisibility(true);
 3633                hudController?.profileHud?.SetVisibility(true);
 634            }
 6635        }
 636    }
 637}

Methods/Properties

i()
i(DCL.Tutorial.TutorialController)
hudController()
currentStepIndex()
currentStepIndex(System.Int32)
userAlreadyDidTheTutorial()
userAlreadyDidTheTutorial(System.Boolean)
TutorialController()
CreateTutorialView()
SetConfiguration(DCL.Tutorial.TutorialSettings)
Dispose()
SetTutorialEnabled(System.String)
SetTutorialEnabledForUsersThatAlreadyDidTheTutorial(System.String)
SetBuilderInWorldTutorialEnabled()
SetupTutorial(System.String, System.String, DCL.Tutorial.TutorialController/TutorialType, System.Boolean)
SetTutorialDisabled()
StartTutorialFromStep()
ShowTeacher3DModel(System.Boolean)
SetTeacherPosition(UnityEngine.Vector2, System.Boolean)
PlayTeacherAnimation(DCL.Tutorial.TutorialTeacher/TeacherAnimation)
SetTeacherCanvasSortingOrder(System.Int32)
SkipTutorial()
SetEagleEyeCameraActive(System.Boolean)
OnRenderingStateChanged(System.Boolean, System.Boolean)
ExecuteSteps()
SetUserTutorialStepAsCompleted(DCL.Tutorial.TutorialController/TutorialFinishStep)
MoveTeacher()
IsTaskbarHUDInitialized_OnChange(System.Boolean, System.Boolean)
MoreMenu_OnRestartTutorial()
IsPlayerInsideGenesisPlaza()
SendStepStartedSegmentStats(System.Int32, DCL.Tutorial.TutorialController/TutorialPath, System.Int32, System.String)
SendStepCompletedSegmentStats(System.Int32, DCL.Tutorial.TutorialController/TutorialPath, System.Int32, System.String, System.Single)
SendSkipTutorialSegmentStats(System.Int32, System.String)
EagleEyeCameraRotation()
BlockPlayerCameraUntilBlendingIsFinished()