Ejemplo n.º 1
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorOrganellePlaced:
            {
                if (!HasBeenShown && CanTrigger && !overallState.TutorialActive())
                {
                    Show();
                    return(true);
                }

                break;
            }

            case TutorialEventType.MicrobeEditorUndo:
            {
                if (ShownCurrently)
                {
                    Hide();
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorUndo:
            {
                if (!HasBeenShown && CanTrigger)
                {
                    Show();
                    overallState.EditorTutorialEnd.CanTrigger = true;

                    return(true);
                }

                break;
            }

            case TutorialEventType.MicrobeEditorRedo:
            {
                if (ShownCurrently)
                {
                    Hide();
                }

                break;
            }
            }

            return(false);
        }
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorTabChanged:
            {
                if (!HasBeenShown && CanTrigger && ((StringEventArgs)args).Data == cellEditorTab)
                {
                    Show();
                }

                break;
            }

            case TutorialEventType.MicrobeEditorOrganellePlaced:
            {
                if (ShownCurrently)
                {
                    Hide();
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorTabChanged:
            {
                string tab = ((StringEventArgs)args).Data;

                if (!HasBeenShown && CanTrigger && tab == "patch")
                {
                    Show();
                }

                if (ShownCurrently && tab == "editor")
                {
                    Hide();
                }

                break;
            }

            case TutorialEventType.MicrobeEditorPatchSelected:
            {
                if (ShownCurrently && ((PatchEventArgs)args).Patch != null)
                {
                    Hide();
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 5
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobePlayerSpawned:
            {
                if (!Complete && !ProcessWhileHidden)
                {
                    ProcessWhileHidden = true;
                    Time = 0;
                }

                break;
            }

            case TutorialEventType.MicrobePlayerReadyToEdit:
                Inhibit();
                break;

            case TutorialEventType.EnteredMicrobeEditor:
                Inhibit();
                break;
            }

            return(false);
        }
Ejemplo n.º 6
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.EnteredMicrobeEditor:
            {
                if (!HasBeenShown && CanTrigger)
                {
                    Show();
                }

                break;
            }

            case TutorialEventType.MicrobeEditorTabChanged:
            {
                string tab = ((StringEventArgs)args).Data;

                // Hide when switched to another tab
                if (tab != reportTab)
                {
                    if (ShownCurrently)
                    {
                        Hide();
                    }
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 7
0
        protected bool CheckEventEditorEntryEvent(TutorialEventType eventType)
        {
            if (eventType != TutorialEventType.EnteredMicrobeEditor)
            {
                return(false);
            }

            if (!HasBeenShown)
            {
                ++NumberOfEditorEntries;
                CanTrigger = NumberOfEditorEntries >= TriggersOnNthEditorSession;
            }

            return(true);
        }
Ejemplo n.º 8
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobePlayerDied:
            {
                if (!HasBeenShown && CanTrigger)
                {
                    Show();
                    return(true);
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 9
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.EnteredMicrobeStage:
            {
                patchNamePopup = ((CallbackEventArgs)args).Data;

                if (!HasBeenShown && CanTrigger)
                {
                    Show();
                    return(true);
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 10
0
    /// <summary>
    ///   Handles an event that potentially changes the tutorial state
    /// </summary>
    /// <param name="eventType">Type of the event that happened</param>
    /// <param name="args">Event arguments or EventArgs.Empty</param>
    /// <param name="sender">Who sent it, some events need access to the stage</param>
    public void SendEvent(TutorialEventType eventType, EventArgs args, object sender)
    {
        // TODO: some events might actually be better to always handle
        if (!Enabled)
        {
            return;
        }

        foreach (var tutorial in Tutorials)
        {
            if (!tutorial.HandlesEvents)
            {
                continue;
            }

            if (tutorial.CheckEvent(this, eventType, args, sender))
            {
                break;
            }
        }
    }
Ejemplo n.º 11
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobePlayerOrientation:
            {
                bool consumed = false;

                if (!HasBeenShown && overallState.MicrobeStageWelcome.Complete && CanTrigger)
                {
                    Show();

                    moveForwardTime   = 0;
                    moveLeftTime      = 0;
                    moveRightTime     = 0;
                    moveBackwardsTime = 0;

                    consumed = true;
                }

                if (ShownCurrently)
                {
                    keyPromptRotation = -((RotationEventArgs)args).RotationInDegrees.y;
                    consumed          = true;
                }

                if (consumed)
                {
                    return(true);
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 12
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.EnteredMicrobeStage:
            {
                if (!HasBeenShown)
                {
                    ++NumberOfMicrobeStageEntries;
                    if (NumberOfMicrobeStageEntries >= TriggersOnNthSwimmingSession &&
                        !overallState.TutorialActive())
                    {
                        Show();
                    }
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 13
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            if (base.CheckEvent(overallState, eventType, args, sender))
            {
                return(true);
            }

            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorAutoEvoPredictionOpened:
            {
                if (ShownCurrently)
                {
                    Hide();
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 14
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            if (CheckEventEditorEntryEvent(eventType))
            {
                return(false);
            }

            switch (eventType)
            {
            case TutorialEventType.MicrobeEditorTabChanged:
            {
                if (!HasBeenShown && CanTrigger && ((StringEventArgs)args).Data == cellEditorTab &&
                    !overallState.TutorialActive())
                {
                    Show();
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 15
0
 public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                 object sender)
 {
     return(false);
 }
Ejemplo n.º 16
0
        public override bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                        object sender)
        {
            switch (eventType)
            {
            case TutorialEventType.MicrobePlayerCompounds:
            {
                var compounds = ((CompoundBagEventArgs)args).Compounds;

                if (!HasBeenShown && !CanTrigger &&
                    compounds.GetCompoundAmount(glucose) < compounds.Capacity -
                    Constants.GLUCOSE_TUTORIAL_TRIGGER_ENABLE_FREE_STORAGE_SPACE)
                {
                    CanTrigger = true;
                    return(true);
                }

                break;
            }

            case TutorialEventType.MicrobeCompoundsNearPlayer:
            {
                var data = (CompoundPositionEventArgs)args;

                if (!HasBeenShown && data.GlucosePosition.HasValue && CanTrigger && !overallState.TutorialActive())
                {
                    Show();
                }

                if (data.GlucosePosition.HasValue && ShownCurrently)
                {
                    glucosePosition = data.GlucosePosition.Value;
                    return(true);
                }

                break;
            }

            case TutorialEventType.MicrobePlayerTotalCollected:
            {
                if (!ShownCurrently)
                {
                    break;
                }

                var compounds = ((CompoundEventArgs)args).Compounds;

                if (compounds.ContainsKey(glucose) &&
                    compounds[glucose] >= Constants.GLUCOSE_TUTORIAL_COLLECT_BEFORE_COMPLETE)
                {
                    // Tutorial is now complete
                    Hide();
                    return(true);
                }

                break;
            }
            }

            return(false);
        }
Ejemplo n.º 17
0
 /// <summary>
 ///   Checks (and handles) tutorial events that this tutorial reacts to
 /// </summary>
 /// <param name="overallState">State access to all the tutorials</param>
 /// <param name="eventType">Type of the event that happened</param>
 /// <param name="args">Event arguments or EventArgs.Empty</param>
 /// <param name="sender">The object that sent the event</param>
 /// <returns>True if handled (no other tutorial gets to see it), false if wasn't handled / consumed.</returns>
 public abstract bool CheckEvent(TutorialState overallState, TutorialEventType eventType, EventArgs args,
                                 object sender);