コード例 #1
0
        void TransitionItem3()
        {
            ShowTransitionedDescription("Trigger a transition component with callback.");

            // transition the third item which is a component that triggers its own transition out on complete.
            TransitionHelper.TransitionIn(TestGameObject3, TransitionItem4);
        }
コード例 #2
0
    // Ends the screen transition for a mission retry
    private void EndRetryTransition()
    {
        // Player
        GameManager.Player.ResetPlayer(v3PlayerStartPos);
        // End Goal
        goEndGoal.SetActive(false);

        // Stop and Reset Mission Timer
        missionTimer.StopTimer();
        missionTimer.ResetTimer();

        // Reset Score if it exists
        if (missionScore != null)
        {
            missionScore.ResetScore(true);
        }

        // Disable Mission UI
        goMissionUI.SetActive(false);

        // Camera
        gameCamera.Reset();
        gameCamera.transform.position = v3CameraStartPos;

        // Targets
        iTargets = agoTargets.Length;

        for (int i = 0; i < agoTargets.Length; i++)
        {
            agoTargets[i].SetActive(true);
            agoTargets[i].GetComponent <HealthManager>().Revive();
        }

        // Projectiles in Scene
        GameObject[] projectiles = GameObject.FindGameObjectsWithTag("Projectile");

        for (int i = 0; i < projectiles.Length; i++)
        {
            projectiles[i].SetActive(false);
        }

        // Debris in Scene
        GameObject[] debris = GameObject.FindGameObjectsWithTag("Debris");

        for (int i = 0; i < debris.Length; i++)
        {
            debris[i].SetActive(false);
        }

        vrMenuManager.gameObject.SetActive(true);
        vrMenuManager.GoToScreen("VRStart");
        AudioManager.Instance.StopAllSounds();

        if (onMissionRestart != null)
        {
            onMissionRestart();
        }

        TransitionHelper.TransitionIn(goScreenFadeUI);
    }
コード例 #3
0
        IEnumerator TransitionParallel(GameObject fromGameObject, GameObject toGameObject)
        {
            float transitionOutTime = 0;

            if (fromGameObject != null)
            {
                if (TransitionHelper.ContainsTransition(fromGameObject))
                {
                    var transitions = TransitionHelper.TransitionOut(fromGameObject);
                    transitionOutTime = TransitionHelper.GetTransitionOutTime(transitions);
                }
            }
            if (toGameObject != null)
            {
                toGameObject.SetActive(true);
                if (TransitionHelper.ContainsTransition(toGameObject))
                {
                    TransitionHelper.TransitionIn(toGameObject);
                }
            }

            // wait for transition out to complete before we disable.
            if (!Mathf.Approximately(0, transitionOutTime))
            {
                yield return(new WaitForSeconds(transitionOutTime));
            }

            if (fromGameObject != null)
            {
                fromGameObject.SetActive(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// The actual method that does the work
        /// </summary>
        void PerformAction()
        {
            var gameObject = Fsm.GetOwnerDefaultTarget(Target);

            if (gameObject != null)
            {
                TransitionHelper.TransitionIn(gameObject);
            }
        }
コード例 #5
0
    // Begins the Transition In and starts the Dismiss Coroutine
    private void TransitionSaveNotification()
    {
        TransitionHelper.TransitionIn(gameObject);

        if (dismissCoroutine != null)
        {
            StopCoroutine(dismissCoroutine);
            dismissCoroutine = null;
        }

        dismissCoroutine = StartCoroutine(DismissSaveNotification());
    }
コード例 #6
0
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            var targetFinal = GameActionHelper.ResolveTarget(TargetType, this, Target);

            if (targetFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (targetFinal != null)
            {
                TransitionHelper.TransitionIn(targetFinal);
            }
        }
コード例 #7
0
ファイル: ScriptingDemo.cs プロジェクト: mymy0301/escapeplan
        /// <summary>
        /// Trigger Component transition with callbacks.
        /// </summary>
        void Step3TransitionWithCallback(TransitionStep transitionStep)
        {
            ShowTransitionedDescription("Trigger a transition component with callback.");

            // transition the third item which is a component that has triggers to transition out again when the in
            // transition has completed and a transition out on complete trigger to run the next step.
            TransitionHelper.TransitionIn(TestGameObject3); //, CustomTransitionStep);

            // Rather than using a callback on the component we could also have passed an onComplete method
            // to TransitionIn as shown below. That would however return after the transition in completed.
            // Here we want to run the components transition out first and then proceed so we set the oncomplete
            // callback in the components transition out configuration instead.
            //TransitionHelper.TransitionIn(TestGameObject3, CustomTransitionStep);
        }
コード例 #8
0
    // Handles Menu Input
    private void HandleMenuInput()
    {
        if (UIMenuInputMapper.bPolling || bMenuInputDisabled)
        {
            return;
        }

        if (playerInput.GetButtonDown("MenuStart"))
        {
            if (sCurrentPanel == "Start")
            {
                GoToScreen("MainMenu");
                TransitionHelper.TransitionIn(goMenuInputPanel);
            }
        }
    }
コード例 #9
0
        // Use this for initialization
        void Start()
        {
            var activeChanged = Shown.Skip(1);

            activeChanged.Where(active => active).Subscribe(active =>
            {
                TransitionHelper.TransitionIn(gameObject);
            }).AddTo(this);

            activeChanged.Where(active => !active).TakeUntilDestroy(this).Subscribe(active =>
            {
                TransitionHelper.TransitionOut(gameObject);
            }).AddTo(this);

            if (Shown.Value)
            {
                TransitionHelper.TransitionIn(gameObject);
            }
        }
コード例 #10
0
        public override void Start()
        {
            NextScene.Where(scene => !string.IsNullOrEmpty(scene)).Subscribe(s => GetComponent <FadeScreen>().OutConfig.SceneToLoad = s).AddTo(this);

            base.Start();

            ActiveMenu.Subscribe(active =>
            {
                if (active == 0)
                {
                    TransitionHelper.TransitionIn(Wheels);
                }
                else
                {
                    TransitionHelper.TransitionOut(Wheels);
                }
                Menus.ForEach(m => m.Shown.Value = false);
                Menus[active].Shown.Value        = true;
            }).AddTo(this);
        }
コード例 #11
0
 IEnumerator TransitionOutIn(GameObject fromGameObject, GameObject toGameObject)
 {
     if (fromGameObject != null)
     {
         // is an out transition then run and wait for completion
         if (TransitionHelper.ContainsTransition(fromGameObject))
         {
             var transitions       = TransitionHelper.TransitionOut(fromGameObject);
             var transitionOutTime = TransitionHelper.GetTransitionOutTime(transitions);
             yield return(new WaitForSeconds(transitionOutTime));
         }
         fromGameObject.SetActive(false);
     }
     if (toGameObject != null)
     {
         toGameObject.SetActive(true);
         if (TransitionHelper.ContainsTransition(toGameObject))
         {
             TransitionHelper.TransitionIn(toGameObject);
         }
     }
 }
コード例 #12
0
 public void TransitionIn()
 {
     TransitionHelper.TransitionIn(TransitionFromButtons);
 }
コード例 #13
0
        ///// <summary>
        ///// Show the dialog instance substituting in passed values and running any transitions.
        ///// </summary>
        ///// <param name="title"></param>
        ///// <param name="text"></param>
        ///// <param name="text2"></param>
        ///// <param name="sprite"></param>
        ///// <param name="doneCallback"></param>
        ///// <param name="destroyOnClose"></param>
        ///// <param name="dialogButtons"></param>
        //public void Show(LocalisableText title, LocalisableText text, LocalisableText text2 = null, Sprite sprite = null,
        //    Action<DialogInstance> doneCallback = null, bool destroyOnClose = true,
        //    DialogButtonsType dialogButtons = DialogButtonsType.Custom)
        //{
        //    var tTitle = title == null ? null : title.GetValue();
        //    var tText = title == null ? null : text.GetValue();
        //    var tText2 = title == null ? null : text2.GetValue();
        //    Show(title: tTitle, text: tText, text2: tText2, sprite: sprite, doneCallback: doneCallback, destroyOnClose: destroyOnClose, dialogButtons: dialogButtons);
        //}

        /// <summary>
        /// Show the dialog instance substituting in passed values and running any transitions.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="titleKey"></param>
        /// <param name="text"></param>
        /// <param name="textKey"></param>
        /// <param name="text2"></param>
        /// <param name="text2Key"></param>
        /// <param name="sprite"></param>
        /// <param name="doneCallback"></param>
        /// <param name="destroyOnClose"></param>
        /// <param name="dialogButtons"></param>
        /// <param name="buttonText"></param>
        public void Show(string title = null, string titleKey = null, string text   = null, string textKey = null,
                         string text2 = null, string text2Key = null, Sprite sprite = null,
                         Action <DialogInstance> doneCallback = null, bool destroyOnClose = true,
                         DialogButtonsType dialogButtons      = DialogButtonsType.Custom, LocalisableText[] buttonText = null)
        {
            GameObject childGameObject;

            _dialogButtons  = dialogButtons;
            DoneCallback    = doneCallback;
            _destroyOnClose = destroyOnClose;

            // increase open count - not thread safe, but should be ok!
            Assert.IsTrue(DialogManager.IsActive, "Ensure that you have added a DialogManager component to your scene before showing a dialog!");
            DialogManager.Instance.Count++;
            IsShown = true;

            // default result
            DialogResult = DialogResultType.Ok;

            if (!string.IsNullOrEmpty(titleKey))
            {
                title = GlobalLocalisation.GetText(titleKey);
            }
            if (title != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Title", title, true);
            }

            if (sprite != null)
            {
                UIHelper.SetSpriteOnChildGameObject(gameObject, "ph_Image", sprite, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Image", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            if (!string.IsNullOrEmpty(textKey))
            {
                text = GlobalLocalisation.GetText(textKey);
            }
            if (text != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Text", text, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Text", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            if (!string.IsNullOrEmpty(text2Key))
            {
                text2 = GlobalLocalisation.GetText(text2Key);
            }
            if (text2 != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Text2", text2, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Text2", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            GameObject okButton, cancelButton;

            switch (_dialogButtons)
            {
            case DialogButtonsType.Ok:
                okButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "OkButton", true);
                if (okButton != null)
                {
                    okButton.SetActive(true);
                }
                else
                {
                    Assert.IsNotNull(_textTemplateButton, "If using Ok buttons, ensure the Dialog a GameObject named OkButton or a GameObject named TextButton that is a template for text buttons");
                    var button = CreateTextButton(LocalisableText.CreateLocalised("Button.Ok"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneOk());
                }
                break;

            case DialogButtonsType.OkCancel:
                okButton     = GameObjectHelper.GetChildNamedGameObject(gameObject, "OkButton", true);
                cancelButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "CancelButton", true);
                if (okButton != null && cancelButton != null)
                {
                    okButton.SetActive(true);
                    cancelButton.SetActive(true);
                }
                else
                {
                    Assert.IsNotNull(_textTemplateButton, "If using OkCancel buttons, ensure the Dialog has GameObjects named OkButton and CancelButton or a GameObject named TextButton that is a template for text buttons");
                    var button = CreateTextButton(LocalisableText.CreateLocalised("Button.Ok"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneOk());
                    button = CreateTextButton(LocalisableText.CreateLocalised("Button.Cancel"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneCancel());
                }
                break;

            case DialogButtonsType.Cancel:
                cancelButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "CancelButton", true);
                if (cancelButton != null)
                {
                    cancelButton.SetActive(true);
                }
                else
                {
                    Assert.IsNotNull(_textTemplateButton, "If using a Cancel button, ensure the Dialog a GameObject named CancelButton or a GameObject named TextButton that is a template for text buttons");
                    var button = CreateTextButton(LocalisableText.CreateLocalised("Button.Cancel"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneCancel());
                }
                break;

            case DialogButtonsType.YesNo:
                var yesButton = GameObjectHelper.GetChildNamedGameObject(gameObject, "YesButton", true);
                var noButton  = GameObjectHelper.GetChildNamedGameObject(gameObject, "NoButton", true);
                if (yesButton != null && noButton != null)
                {
                    yesButton.SetActive(true);
                    noButton.SetActive(true);
                }
                else
                {
                    Assert.IsNotNull(_textTemplateButton, "If using YesNo buttons, ensure the Dialog has GameObjects named YesButton and NoButton or a GameObject named TextButton that is a template for text buttons");
                    var button = CreateTextButton(LocalisableText.CreateLocalised("Button.Yes"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneYes());
                    button = CreateTextButton(LocalisableText.CreateLocalised("Button.No"));
                    button.GetComponent <Button>().onClick.AddListener(() => DoneNo());
                }
                break;

            case DialogButtonsType.Text:
                Assert.IsNotNull(_textTemplateButton, "If using Text buttons, ensure the Dialog has a GameObject named TextButton that is a template for text buttons");
                Assert.IsNotNull(buttonText, "If using Text buttons, ensure you pass a valid array of localisable texts into the show method.");
                var counter = 0;
                foreach (var localisableText in buttonText)
                {
                    var button   = CreateTextButton(localisableText);
                    var counter1 = counter;
                    button.GetComponent <Button>().onClick.AddListener(() => DoneCustom(counter1));
                    counter++;
                }
                break;
            }

            // show / transition in and when done call coroutine
            float transitionTime = 0;

            Target.SetActive(true);
#if BEAUTIFUL_TRANSITIONS
            //if (TransitionHelper.ContainsTransition(gameObject))
            //{
            transitionTime = TransitionHelper.GetTransitionInTime(TransitionHelper.TransitionIn(gameObject));
            //}
#endif
            StartCoroutine(CoRoutines.DelayedCallback(transitionTime, ShowFinished));
        }
コード例 #14
0
 public void TransitionIn()
 {
     TransitionHelper.TransitionIn(TransitionGameobject);
 }
コード例 #15
0
 // Initialization
 void Start()
 {
     TransitionHelper.TransitionIn(gameObject);
 }
コード例 #16
0
 // Fade Screen In
 private void FadeIn()
 {
     TransitionHelper.TransitionIn(goObjFadeUI, FadeOut);
 }
コード例 #17
0
        /// <summary>
        /// Show the dialog instance substituting in passed values and running any transitions.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="titleKey"></param>
        /// <param name="text"></param>
        /// <param name="textKey"></param>
        /// <param name="text2"></param>
        /// <param name="text2Key"></param>
        /// <param name="sprite"></param>
        /// <param name="doneCallback"></param>
        /// <param name="destroyOnClose"></param>
        /// <param name="dialogButtons"></param>
        public void Show(string title = null, string titleKey = null, string text   = null, string textKey = null,
                         string text2 = null, string text2Key = null, Sprite sprite = null,
                         Action <DialogInstance> doneCallback = null, bool destroyOnClose = true,
                         DialogButtonsType dialogButtons      = DialogButtonsType.Custom)
        {
            GameObject childGameObject;

            _dialogButtons  = dialogButtons;
            DoneCallback    = doneCallback;
            _destroyOnClose = destroyOnClose;

            // increase open count - not thread safe, but should be ok!
            Assert.IsTrue(DialogManager.IsActive, "Ensure that you have added a DialogManager component to your scene before showing a dialog!");
            DialogManager.Instance.Count++;
            IsShown = true;

            // default result
            DialogResult = DialogResultType.Ok;

            if (titleKey != null)
            {
                title = LocaliseText.Get(titleKey);
            }
            if (title != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Title", title, true);
            }

            if (sprite != null)
            {
                UIHelper.SetSpriteOnChildGameObject(gameObject, "ph_Image", sprite, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Image", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            if (textKey != null)
            {
                text = LocaliseText.Get(textKey);
            }
            if (text != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Text", text, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Text", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            if (text2Key != null)
            {
                text2 = LocaliseText.Get(text2Key);
            }
            if (text2 != null)
            {
                UIHelper.SetTextOnChildGameObject(gameObject, "ph_Text2", text2, true);
            }
            else
            {
                childGameObject = GameObjectHelper.GetChildNamedGameObject(gameObject, "ph_Text2", true);
                if (childGameObject != null)
                {
                    childGameObject.SetActive(false);
                }
            }

            switch (_dialogButtons)
            {
            case DialogButtonsType.Ok:
                GameObjectHelper.GetChildNamedGameObject(gameObject, "OkButton", true).SetActive(true);
                break;

            case DialogButtonsType.OkCancel:
                GameObjectHelper.GetChildNamedGameObject(gameObject, "OkButton", true).SetActive(true);
                GameObjectHelper.GetChildNamedGameObject(gameObject, "CancelButton", true).SetActive(true);
                break;

            case DialogButtonsType.Cancel:
                GameObjectHelper.GetChildNamedGameObject(gameObject, "CancelButton", true).SetActive(true);
                break;

            case DialogButtonsType.YesNo:
                GameObjectHelper.GetChildNamedGameObject(gameObject, "YesButton", true).SetActive(true);
                GameObjectHelper.GetChildNamedGameObject(gameObject, "NoButton", true).SetActive(true);
                break;
            }

            // show / transition in and when done call coroutine
            float transitionTime = 0;

            Target.SetActive(true);
#if BEAUTIFUL_TRANSITIONS
            //if (TransitionHelper.ContainsTransition(gameObject))
            //{
            transitionTime = TransitionHelper.GetTransitionInTime(TransitionHelper.TransitionIn(gameObject));
            //}
#endif
            StartCoroutine(CoRoutines.DelayedCallback(transitionTime, ShowFinished));
        }