Exemplo n.º 1
0
    private bool onSelectTrayScreen(TrayEvents.SelectTrayScreen evt)
    {
        string text = LegacyScreenToFSMEvent(evt.ScreenName);

        if (!string.IsNullOrEmpty(text))
        {
            trayFSMContext.SendEvent(new ExternalEvent("Root", "maxnpc"));
            trayFSMContext.SendEvent(new ExternalEvent("ScreenContainerContent", text));
        }
        return(false);
    }
Exemplo n.º 2
0
        private void setState(States newState)
        {
            if (state == newState)
            {
                return;
            }
            switch (newState)
            {
            case States.Idle:
                if (state == States.GivingQuest)
                {
                    hideDialog();
                }
                if (Mascot.InteractionBehaviours.RestoreTray)
                {
                    dispatcher.DispatchEvent(new TrayEvents.SelectTrayScreen("ControlsScreen"));
                    Service.Get <EventDispatcher>().DispatchEvent(default(HudEvents.ShowCellPhoneHud));
                }
                Mascot.IsTalking           = false;
                mascotService.ActiveMascot = null;
                dispatcher.DispatchEvent(default(InWorldUIEvents.EnableInWorldText));
                PlayIdleAnimation();
                break;

            case States.Dialog:
                dispatcher.DispatchEvent(new TrayEvents.CloseTray(isControlsVisible: false, isPersistent: false));
                dispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
                dispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElementGroup("MainNavButtons"));
                dispatcher.DispatchEvent(default(InWorldUIEvents.DisableInWorldText));
                mascotService.ActiveMascot = Mascot;
                break;

            case States.GivingQuest:
            {
                mascotService.ActiveMascot = Mascot;
                showGivingQuestDialog(Mascot);
                GameObject          gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
                StateMachineContext component  = gameObject.GetComponent <StateMachineContext>();
                component.SendEvent(new ExternalEvent("Root", "maxnpc"));
                component.SendEvent(new ExternalEvent("ScreenContainerContent", "quest"));
                dispatcher.DispatchEvent(default(InWorldUIEvents.DisableInWorldText));
                break;
            }

            case States.WaitingForSplashscreen:
                hideDialog();
                Mascot.IsTalking = false;
                dispatcher.DispatchEvent(new TrayEvents.SelectTrayScreen("ControlsScreen"));
                break;
            }
            state = newState;
        }
Exemplo n.º 3
0
        public void SendContextEvent(string target, string targetEvent)
        {
            ExternalEvent externalEvent = new ExternalEvent(target, targetEvent);

            if (context == null)
            {
                uiEventQueue.Enqueue(externalEvent);
            }
            else
            {
                context.SendEvent(externalEvent);
            }
        }
Exemplo n.º 4
0
        public void OnBackButtonPressed()
        {
            GameObject          gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
            StateMachineContext component  = gameObject.GetComponent <StateMachineContext>();

            if (currentState == QuestsDetailsState.Inventory)
            {
                component.SendEvent(new ExternalEvent("ScreenQuestsDetails", "pause"));
            }
            else
            {
                component.SendEvent(new ExternalEvent("Root", "mainnav_locomotion"));
            }
        }
 private void OnDisable()
 {
     if (smContext != null)
     {
         smContext.SendEvent(new ExternalEvent(fsmTarget, "unloaded"));
     }
 }
 protected void resetUI()
 {
     if (context != null)
     {
         context.SendEvent(new ExternalEvent("IglooScreenContainerContent", "igloonone"));
     }
 }
        private void Start()
        {
            string startEvent             = GetComponentInParent <SEDFSMStartEventSource>().StartEvent;
            StateMachineContext component = GetComponent <StateMachineContext>();

            component.SendEvent(new ExternalEvent(FSMName, startEvent));
        }
 private IEnumerator Start()
 {
     if (!string.IsNullOrEmpty(StateMachineToCheck))
     {
         StateMachineContext stateMachineContext = GetComponentInParent <StateMachineContext>();
         while (!stateMachineContext.ContainsStateMachine(StateMachineToCheck))
         {
             yield return(null);
         }
         string state = stateMachineContext.GetStateMachineState(StateMachineToCheck);
         int    num   = 0;
         while (true)
         {
             if (num < StatesToEvents.Length)
             {
                 if (StatesToEvents[num].State == state)
                 {
                     break;
                 }
                 num++;
                 continue;
             }
             yield break;
         }
         stateMachineContext.SendEvent(new ExternalEvent(Target, StatesToEvents[num].Event));
     }
     else
     {
         Log.LogError(this, "StateMachineToCheck was null or empty");
     }
 }
    protected override void OnEnable()
    {
        if (!Owner.CompareTag("Player"))
        {
            return;
        }
        EventDispatcher  eventDispatcher   = Service.Get <EventDispatcher>();
        MascotController componentInParent = ClubPenguin.SceneRefs.ActionSequencer.GetTrigger(Owner).GetComponentInParent <MascotController>();
        Mascot           mascot            = componentInParent.Mascot;

        if (mascot.InteractionBehaviours.ZoomIn && Controller != null)
        {
            CinematographyEvents.CameraLogicChangeEvent evt = default(CinematographyEvents.CameraLogicChangeEvent);
            evt.Controller = Controller;
            eventDispatcher.DispatchEvent(evt);
        }
        if (mascot.InteractionBehaviours.LowerTray && TrayClosed)
        {
            GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
            if (gameObject != null)
            {
                StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                component.SendEvent(new ExternalEvent("Root", "minnpc"));
            }
        }
        if (MainNavDisabled)
        {
            eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElementGroup("MainNavButtons"));
        }
        if (mascot.InteractionBehaviours.SuppressQuestNotifier)
        {
            eventDispatcher.DispatchEvent(new HudEvents.SuppressQuestNotifier(suppress: true, autoShow: true));
        }
        if (mascot.InteractionBehaviours.MoveToTalkSpot)
        {
            LocomoteToAction component2 = Owner.GetComponent <LocomoteToAction>();
            if (component2 != null)
            {
                component2.IsEnabled = true;
                if (mascot.InteractionBehaviours.OverrideInteracteeTxform)
                {
                    component2.Waypoints = new List <Transform>(1);
                    component2.IsEnabled = true;
                    Transform transform = new GameObject().transform;
                    transform.position = mascot.InteractionBehaviours.DesiredInteracteeTxform.position;
                    transform.rotation = mascot.InteractionBehaviours.DesiredInteracteeTxform.rotation;
                    component2.Waypoints.Add(transform);
                }
            }
        }
        else
        {
            LocomoteToAction component2 = Owner.GetComponent <LocomoteToAction>();
            if (component2 != null)
            {
                component2.IsEnabled = false;
            }
        }
    }
Exemplo n.º 10
0
        private void onPromptButtonPressed(DPrompt.ButtonFlags pressed)
        {
            if (pressed != DPrompt.ButtonFlags.YES)
            {
                return;
            }
            LocomotionController currentController = LocomotionHelper.GetCurrentController(base.gameObject);

            if (currentController is SitController)
            {
                LocomotionHelper.SetCurrentController <SwimController>(base.gameObject);
            }
            bubbleState = BubbleState.TransitionToHidden;
            playAudioEvent(mutableData.AirCriticalAudioEvent, EventAction.StopSound);
            GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);

            if (gameObject != null)
            {
                StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                if (component != null)
                {
                    component.SendEvent(new ExternalEvent("Root", "noUI"));
                }
            }
            Invoke("startBubbleScreenWipe", 0.7f);
            swimController.ResurfaceAccepted();
            dispatcher.DispatchEvent(default(DivingEvents.PlayerResurfaced));
        }
Exemplo n.º 11
0
        public void setControlsEnabled(bool enabled)
        {
            EventDispatcher eventDispatcher = Service.Get <EventDispatcher>();

            if (enabled)
            {
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElement("ControlsButton2"));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElement("ActionButton"));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElement("ChatButtons"));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElementGroup("MainNavButtons"));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElement("CellphoneButton"));
                return;
            }
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("ControlsButton2"));
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("ActionButton"));
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("ChatButtons"));
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElementGroup("MainNavButtons"));
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("CellphoneButton"));
            StateMachineContext component = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root).GetComponent <StateMachineContext>();

            if (component != null)
            {
                component.SendEvent(new ExternalEvent("Root", "mainnav_locomotion"));
            }
        }
Exemplo n.º 12
0
 private void OnDestroy()
 {
     if (!string.IsNullOrEmpty(Target))
     {
         StateMachineContext stateMachineContext = GetComponentInParent <StateMachineContext>();
         if (stateMachineContext == null)
         {
             GameObject gameObject = GameObject.FindGameObjectWithTag(UIConstants.Tags.UI_Tray_Root);
             if (!gameObject.IsDestroyed())
             {
                 stateMachineContext = gameObject.GetComponent <StateMachineContext>();
             }
         }
         if (stateMachineContext != null)
         {
             stateMachineContext.SendEvent(new ExternalEvent(Target, Event));
         }
         else if (!AllowMissingStateMachine)
         {
             Log.LogError(this, "Could not find a StateMachineContext");
         }
     }
     else
     {
         StateMachine component = GetComponent <StateMachine>();
         if (component != null)
         {
             component.SendEvent(Event);
         }
         else
         {
             Log.LogError(this, "Could not find a StateMachine");
         }
     }
 }
Exemplo n.º 13
0
 protected override void onHandle(NavBarSecondaryInputMap.Result inputResult)
 {
     if (inputResult.Close.WasJustReleased || inputResult.Locomotion.Direction.sqrMagnitude > float.Epsilon)
     {
         StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();
         componentInParent.SendEvent(new ExternalEvent(target, targetEvent));
     }
 }
Exemplo n.º 14
0
 private void onButtonClicked(ButtonClickListener.ClickType clickType)
 {
     if (stateMachineContext != null)
     {
         stateMachineContext.SendEvent(new ExternalEvent("Root", "popup_closed"));
     }
     UnityEngine.Object.Destroy(base.gameObject);
 }
Exemplo n.º 15
0
    private IEnumerator AutoTransition()
    {
        yield return(new WaitForSeconds(4.15f));

        StateMachineContext smc = GetComponentInParent <StateMachineContext>();

        smc.SendEvent(new ExternalEvent("AccountRootFSM", "closepopup"));
    }
 private bool onMainNavBarBackButtonClicked(MainNavBarBackButton.MainNavBarBackButtonClicked evt)
 {
     if (base.enabled)
     {
         StateMachineContext componentInChildren = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root).GetComponentInChildren <StateMachineContext>();
         componentInChildren.SendEvent(new ExternalEvent(Target, Event));
     }
     return(false);
 }
Exemplo n.º 17
0
        public void OnOpenButtonPressed()
        {
            GetComponentInParent <QuestsScreenController>().CurrentChapterData = chapterData;
            GameObject          gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
            StateMachineContext component  = gameObject.GetComponent <StateMachineContext>();

            component.SendEvent(new ExternalEvent("ScreenQuestsAdventures", "logQuests"));
            removeBreadcrumb();
        }
    private void Start()
    {
        GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);

        trayFSMContext = gameObject.GetComponent <StateMachineContext>();
        if (Service.Get <MascotService>().ActiveMascot != null)
        {
            trayFSMContext.SendEvent(new ExternalEvent("ScreenQuests", "adventures"));
        }
        else if (Service.Get <QuestService>().ActiveQuest != null)
        {
            trayFSMContext.SendEvent(new ExternalEvent("ScreenQuests", "details"));
        }
        else
        {
            trayFSMContext.SendEvent(new ExternalEvent("ScreenQuests", "home"));
        }
        Service.Get <EventDispatcher>().AddListener <QuestScreenEvents.ShowQuestLogAdventures>(onShowQuestLogAdventures);
    }
Exemplo n.º 19
0
 public void MarketplaceScreenOutroComplete()
 {
     if (hasOpened)
     {
         Object.Destroy(base.gameObject);
         GameObject          gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
         StateMachineContext component  = gameObject.GetComponent <StateMachineContext>();
         component.SendEvent(new ExternalEvent("Root", "mainnav_locomotion"));
     }
 }
Exemplo n.º 20
0
    private IEnumerator sendLoadedEvent()
    {
        while (smContext == null)
        {
            yield return(null);

            smContext = GetComponentInParent <StateMachineContext>();
        }
        smContext.SendEvent(new ExternalEvent(fsmTarget, "loaded"));
    }
        private void onCellPhonePrefabLoaded(string path, GameObject cellPhonePrefab)
        {
            GameObject popup = Object.Instantiate(cellPhonePrefab);

            PopupEvents.ShowCameraSpacePopup evt = new PopupEvents.ShowCameraSpacePopup(popup, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.CellPhone", "MainCamera", 1f, 0);
            Service.Get <EventDispatcher>().DispatchEvent(evt);
            StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();

            componentInParent.SendEvent(new ExternalEvent("Root", "noui"));
        }
 protected override void onHandle(NavBarTitleInputMap.Result inputResult)
 {
     back.HandleMappedInput(inputResult.Back);
     exit.HandleMappedInput(inputResult.Exit);
     if (inputResult.Locomotion.Direction.sqrMagnitude > float.Epsilon)
     {
         StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();
         componentInParent.SendEvent(new ExternalEvent(target, targetEvent));
     }
 }
Exemplo n.º 23
0
        public override void OnEnter()
        {
            GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);

            if (gameObject != null)
            {
                StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                component.SendEvent(new ExternalEvent(StateMachineName, EventName));
            }
            Finish();
        }
Exemplo n.º 24
0
        private void destroyAndCloseCellPhone()
        {
            destroy();
            Service.Get <EventDispatcher>().DispatchEvent(default(CellPhoneEvents.CellPhoneClosed));
            StateMachineContext component = SceneRefs.UiTrayRoot.GetComponent <StateMachineContext>();

            if (component != null)
            {
                component.SendEvent(new ExternalEvent("Root", "mainnav_locomotion"));
            }
        }
Exemplo n.º 25
0
        public override void SetInputFieldSelected()
        {
            CoroutineRunner.Start(selectInputField(), this, "selectInputField");
            base.SetInputFieldSelected();
            StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();

            if (componentInParent != null && componentInParent.ContainsStateMachine("Root"))
            {
                componentInParent.SendEvent(new ExternalEvent("Root", "chat_input"));
            }
        }
    private void resetControls()
    {
        GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);

        if (gameObject != null)
        {
            StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
            component.SendEvent(new ExternalEvent("Root", "exit_cinematic"));
        }
        dispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
        dispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElementGroup("MainNavButtons"));
    }
Exemplo n.º 27
0
    protected void setDataAndTemporarilyClose()
    {
        if (returnToPreviousState != null)
        {
            returnToPreviousState.SetCurrentTargetAndState("IglooScreenContainer", "max");
            returnToPreviousState.SetPreviousState(base.gameObject);
        }
        base.gameObject.SetActive(value: false);
        StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();

        componentInParent.SendEvent(new ExternalEvent("IglooScreenContainer", "min"));
    }
Exemplo n.º 28
0
 public void OnAddFriendClicked()
 {
     if (FriendsDataModelService.FriendsList.Count < FriendsDataModelService.MaxFriendsCount)
     {
         StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>();
         componentInParent.SendEvent(new ExternalEvent("FriendsScreen", "addFriends"));
     }
     else
     {
         Service.Get <PromptManager>().ShowPrompt("MaximumFriendsPrompt", null);
     }
 }
Exemplo n.º 29
0
 private void changeCameraController(CameraController controller, Transform cameraTarget, bool hideControls)
 {
     if (currentCameraController != null)
     {
         CinematographyEvents.CameraLogicResetEvent evt = default(CinematographyEvents.CameraLogicResetEvent);
         evt.Controller = currentCameraController;
         dispatcher.DispatchEvent(evt);
     }
     CinematographyEvents.CameraLogicChangeEvent evt2 = default(CinematographyEvents.CameraLogicChangeEvent);
     evt2.Controller         = controller;
     currentCameraController = controller;
     dispatcher.DispatchEvent(evt2);
     dispatcher.DispatchEvent(new CinematographyEvents.ChangeCameraTarget(cameraTarget));
     if (hideControls)
     {
         trayFSMContext.SendEvent(new ExternalEvent("Root", "minnpc"));
     }
     else
     {
         trayFSMContext.SendEvent(new ExternalEvent("Root", "exit_cinematic"));
     }
 }
Exemplo n.º 30
0
		public void OnAnimationComplete()
		{
			GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
			if (gameObject != null)
			{
				StateMachineContext component = gameObject.GetComponent<StateMachineContext>();
				if (component != null)
				{
					component.SendEvent(new ExternalEvent("Root", "restoreUI"));
				}
			}
			Object.Destroy(base.gameObject);
		}