Example #1
0
        public IEnumerator UIContextsTests_ApplicationContext_ListForceNotify_ValueChange()
        {
            int count = 0;

            //Given a defined data struct is registered
            var data = new TestData();

            data.testList = new List <int> {
                1
            };
            var contextTarget = ApplicationContext.BindTarget(data);

            yield return(WaitAFrame());

            //When a UISelector is created
            UISelector.createSelector <List <int> >(ApplicationContext.current, "testList", (testList) =>
            {
                count++;
            });
            yield return(WaitAFrame());

            //Then update the List and UpdateWith
            data.testList[0] = 2;
            contextTarget.UpdateWith(ref data, UpdateNotification.ForceNotify);
            yield return(WaitAFrame());

            //Verify the update lambda was invoked
            Assert.IsTrue(count == 2, "Verify the update lambda was invoked");
            yield return(WaitAFrame());
        }
Example #2
0
        internal ExecutionFlow Report(Exception exception, ExceptionThread exceptionThread)
        {
            try
            {
                Logger.Trace("Starting to generate a bug report for the exception.");
                var serializableException = new SerializableException(exception);
                var report = new Report(serializableException);

                var handler = ProcessingException;
                if (handler != null)
                {
                    Logger.Trace("Notifying the user before handling the exception.");

                    // Allowing user to add any custom information to the report
                    handler(exception, report);
                }

                var uiDialogResult = UISelector.DisplayBugReportUI(exceptionThread, serializableException, report);
                if (uiDialogResult.Report == SendReport.Send)
                {
                    this.CreateReportZip(serializableException, report);
                }

                return(uiDialogResult.Execution);
            }
            catch (Exception ex)
            {
                Logger.Error("An exception occurred during bug report generation process. See the inner exception for details.", ex);
                return(ExecutionFlow.BreakExecution);                // Since an internal exception occured
            }
        }
    // MonoBehaviour's INTERFACE

    void Awake()
    {
        UIPageDescriptor pageDescriptor = GetComponentInChildren <UIPageDescriptor>();

        if (pageDescriptor == null)
        {
            return;
        }

        m_ResolutionSelector = pageDescriptor.GetWidget <UISelector>(s_WidgetId_ResolutionSelector);
        m_FullscreenToggle   = pageDescriptor.GetWidget <Toggle>(s_WidgetId_FullscreenToggle);

        m_ApplyButton = pageDescriptor.GetWidget <Button>(s_WidgetId_ApplyButton);

        m_SfxSlider   = pageDescriptor.GetWidget <Slider>(s_WidgetId_SfxSlider);
        m_MusicSlider = pageDescriptor.GetWidget <Slider>(s_WidgetId_MusicSlider);

        m_ScreenShakeToggle = pageDescriptor.GetWidget <Toggle>(s_WidgetId_ScreenShakeToggle);
        //m_SlowMotionToggle = pageDescriptor.GetWidget<Toggle>(s_WidgetId_SlowMotionToggle);
        m_CameraMovementToggle = pageDescriptor.GetWidget <Toggle>(s_WidgetId_CameraMovementToggle);

        m_XInputToggle = pageDescriptor.GetWidget <Toggle>(s_WidgetId_XInputToggle);
        m_RumbleToggle = pageDescriptor.GetWidget <Toggle>(s_WidgetId_RumbleToggle);

        InitResolutionSelector();
    }
Example #4
0
        public void UIProvider_AutoUIMode_Normal()
        {
            Settings.UIProvider = UIProvider.Auto;
            Settings.UIMode     = UIMode.Normal;

            MessageBox.Show("Now click 'Quit'", "User Input Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            MessageBox.Show("Now click 'Continue'", "User Input Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.ContinueExecution, SendReport.Send));

            // By default, Visual Studio loads some WinForms dlls so WinForms dialogs will be displayed via auto selection
            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIProvider: Auto" + Environment.NewLine + "UIMode: Normal" + Environment.NewLine + Environment.NewLine
                    + "Did you see a Normal WinForms error dialog?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
    // MonoBehaviour's INTERFACE

    void Awake()
    {
        UIPageDescriptor pageDescriptor = GetComponentInChildren <UIPageDescriptor>();

        if (pageDescriptor == null)
        {
            return;
        }

        m_TriggerProceed = pageDescriptor.GetWidget <UIEventTrigger>(s_WidgetId_TriggerProceed);
        m_TriggerCancel  = pageDescriptor.GetWidget <UIEventTrigger>(s_WidgetId_TriggerCancel);

        m_GameModeSelector = pageDescriptor.GetWidget <UISelector>(s_WidgetId_GameModeSelector);

        m_MatchDurationSelector = pageDescriptor.GetWidget <UISelector>(s_WidgetId_DurationSelector);
        m_RefereeSelector       = pageDescriptor.GetWidget <UISelector>(s_WidgetId_RefereeSelector);
        m_GoldenGoalSelector    = pageDescriptor.GetWidget <UISelector>(s_WidgetId_GoldenGoalSelector);
        m_AILevelSelector       = pageDescriptor.GetWidget <UISelector>(s_WidgetId_AILevelSelector);

        m_BallSelector    = pageDescriptor.GetWidget <UISelector>(s_WidgetId_BallSelector);
        m_StadiumSelector = pageDescriptor.GetWidget <UISelector>(s_WidgetId_StadiumSelector);

        InitMatchDurationSelector();
        InitRefereeSelector();
        InitGoldenGoalSelector();

        InitBallSelector();
    }
        public void UIContextsTests_ApplicationContext_IsAbleSupportTwoPropertiesWithOneValueChanged()
        {
            //Given a defined data struct is registered
            var updateDelegateWasCalled = 0;
            var data          = new AlternateData();
            var contextTarget = ApplicationContext.BindTarget(data);

            //When a UISelector is created
            var getter = UISelector.createSelector <bool>(ApplicationContext.current, "trueOrFalse", (trueOrFalse) =>
            {
                updateDelegateWasCalled++;
            });

            var getterString = UISelector.createSelector <string>(ApplicationContext.current, "aString", (aString) =>
            {
                updateDelegateWasCalled++;
            });

            //Then I should be able to invoke the update lambda
            data.trueOrFalse = true;
            data.aString     = "changed";
            contextTarget.UpdateWith(ref data);

            //Verify Getter returned True
            Assert.IsTrue(getter(), "Getter should return True");

            //Verify Getter returned "changed"
            Assert.IsTrue(getterString().Equals("changed"), "Getter should return 'changed'");

            //Verify the update lambda was invoked
            Assert.IsTrue(updateDelegateWasCalled == 2, "Verify the update lambdas were invoked each");
        }
Example #7
0
    // UTILS

    private SelectorItem GetSelectedItem(UISelector i_Selector)
    {
        if (i_Selector == null)
        {
            return(null);
        }

        SelectorItem item = i_Selector.currentItem;

        return(item);
    }
        public IEnumerator CreateARModeSelector_MissingInterface()
        {
            var data          = new TestData2();
            var contextTarget = ARContext.BindTarget(data);

            yield return(WaitAFrame());

            var arModeGetter = UISelector.createSelector <SetARModeAction.ARMode>(ARContext.current, nameof(IARModeDataProvider.arMode));

            LogAssert.Expect(LogType.Warning, "The data type of " + data.GetType() + " does not implement the interface " + nameof(IARModeDataProvider));

            yield return(WaitAFrame());
        }
Example #9
0
 // Use this for initialization
 void Start()
 {
     PlayBtn.gameObject.SetActive(false);
     BackMenuBtn.gameObject.SetActive(false);
     ResumeBtn.gameObject.SetActive(false);
     player      = GameManager.Instance.LocalPlayer;
     pMovement   = player.GetComponent <PlayerMovement> ();
     playerInput = GameManager.Instance.InputController;
     UISel       = GetComponent <UISelector> ();
     if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
     {
         IOSMenu.gameObject.SetActive(true);
     }
 }
Example #10
0
        public void ExceptionThread_Task()
        {
            // By default UI is not shown for task exceptions
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Task, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.ContinueExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.No,
                MessageBox.Show(
                    "ExceptionThread: Task" + Environment.NewLine + Environment.NewLine + "Did you see any UI on the screen?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #11
0
        public void UIMode_None()
        {
            Settings.UIMode = UIMode.None;

            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.UI_WinForms, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.No,
                MessageBox.Show(
                    "ExceptionThread: Task" + Environment.NewLine + Environment.NewLine + "Did you see any UI on the screen?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
        public IEnumerator DebugOptions_InitialValuesAreUpdatedOnStart()
        {
            //Given a runtime that has started

            //When Start() as executed
            yield return(WaitAFrame());

            //Then the debug options UGUI widgets should have the starting value
            Assert.True(IsDialogOpen("DebugOptionsDialog"));
            var listItem     = GivenGameObjectNamed("Text List Item");
            var valueText    = GivenObjectsInChildren <TMPro.TMP_Text>(listItem).First(c => c.name == "Value Text");
            var getter       = UISelector.createSelector <string>(ApplicationContext.current, nameof(IQualitySettingsDataProvider.qualityLevel));
            var initialValue = getter();

            Assert.AreEqual(initialValue, valueText.text);
        }
        public IEnumerator CreateARModeSelector_WithInterface()
        {
            var data          = new TestData();
            var contextTarget = ARContext.BindTarget(data);

            yield return(WaitAFrame());

            var arModeGetter = UISelector.createSelector <SetARModeAction.ARMode>(ARContext.current, nameof(IARModeDataProvider.arMode));

            yield return(WaitAFrame());

            data.arMode = SetARModeAction.ARMode.WallBased;
            contextTarget.UpdateWith(ref data);
            yield return(WaitAFrame());

            Assert.IsTrue(arModeGetter().Equals(SetARModeAction.ARMode.WallBased), "Getter should return WallBased AR Mode");
            yield return(WaitAFrame());
        }
Example #14
0
        public void UIProvider_WinFormsUIMode_Minimal()
        {
            Settings.UIProvider = UIProvider.WinForms;
            Settings.UIMode     = UIMode.Minimal;

            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.UI_WinForms, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIProvider: WinForms" + Environment.NewLine + "UIMode: Minimal" + Environment.NewLine + Environment.NewLine
                    + "Did you see a Minimal WinForms message box?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #15
0
        public void UIMode_AutoExceptionThread_WPF()
        {
            // Auto mode displays minimal UI by default
            Settings.UIMode = UIMode.Auto;

            // UIMode:Auto and exception on WPF thread
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.UI_WPF, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIMode: Auto" + Environment.NewLine + "ExceptionThread: WPF" + Environment.NewLine + Environment.NewLine
                    + "Did you see a Minimal WPF message box?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #16
0
        public void UIProvider_AutoUIMode_Minimal()
        {
            Settings.UIProvider = UIProvider.Auto;
            Settings.UIMode     = UIMode.Minimal;

            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.UI_WinForms, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            // By default, Visual Studio loads some WinForms dlls so WinForms dialogs will be displayed via auto selection
            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIProvider: Auto" + Environment.NewLine + "UIMode: Minimal" + Environment.NewLine + Environment.NewLine
                    + "Did you see a Minimal WinForms message box?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #17
0
        public void UIMode_AutoExceptionThread_Main()
        {
            // Auto mode displays minimal UI by default
            Settings.UIMode = UIMode.Auto;

            // By default UIFixture loads System.Windows.Forms so this should not behave as console but WinForms UI
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIMode: Auto" + Environment.NewLine + "ExceptionThread: Main" + Environment.NewLine + "Loaded Assembly: System.Windows.Forms"
                    + Environment.NewLine + Environment.NewLine + "Did you see a Minimal WinForms message box?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #18
0
    private bool SearchSelectedItem()
    {
        var searchItem = FindObjectAt(selectedX, selectedY);

        if (searchItem)
        {
            if (itemInHand != null)
            {
                itemInHand.DePicked(playerIndex);
            }

            searchItem.Picked(playerIndex);
            itemInHand = searchItem;

            return(true);
        }

        return(false);
    }
        public IEnumerator DebugOptions_QualityLevelIsUpdatedTwoWay()
        {
            //Given a runtime that has started

            //When Start() as executed and we change the value of the state
            Dispatcher.Dispatch(SetDebugOptionsAction.From(new { qualityLevel = "Test" }));
            yield return(WaitAFrame());

            //Then the Quality String option TMPRO should have the changed value
            Assert.True(IsDialogOpen("DebugOptionsDialog"));
            var listItem  = GivenGameObjectNamed("Text List Item");
            var valueText = GivenObjectsInChildren <TMPro.TMP_Text>(listItem).First(c => c.name == "Value Text");

            Assert.AreEqual(valueText.text, "Test");
            //Then the Quality String option in global state should have the changed value
            var getter   = UISelector.createSelector <string>(ApplicationContext.current, nameof(IQualitySettingsDataProvider.qualityLevel));
            var newValue = getter();

            Assert.AreEqual(newValue, "Test");
        }
        public void UIContextsTests_ApplicationContext_IsAbleSupportTwoContextTwoPropertiesWithEachOneValueChanged()
        {
            //Given a defined data struct is registered
            var updateDelegateWasCalled1 = 0;
            var updateDelegateWasCalled2 = 0;
            var data1          = new InternalData();
            var contextTarget1 = ApplicationContext.BindTarget(data1);

            var data2          = new DifferentData();
            var contextTarget2 = DebugOptionContext.BindTarget(data2);

            //When a UISelector is created
            var getter = UISelector.createSelector <bool>(ApplicationContext.current, "trueOrFalse", (trueOrFalse) =>
            {
                updateDelegateWasCalled1++;
            });

            var getterString = UISelector.createSelector <string>(DebugOptionContext.current, "aDifferentString", (aString) =>
            {
                updateDelegateWasCalled2++;
            });

            //Then I should be able to invoke the update lambda
            data1.trueOrFalse = true;
            contextTarget1.UpdateWith(ref data1);


            data2.aDifferentString = "changed";
            contextTarget2.UpdateWith(ref data2);

            //Verify Getter returned True
            Assert.IsTrue(getter(), "Getter should return True");

            //Verify Getter returned "changed"
            Assert.IsTrue(getterString().Equals("changed"), "Getter should return 'changed'");

            //Verify the update lambda was invoked
            Assert.IsTrue(updateDelegateWasCalled1 == 1, "Verify the update lambdas were invoked ApplicationContext");

            Assert.IsTrue(updateDelegateWasCalled1 == 1, "Verify the update lambdas were invoked DebugContext");
        }
Example #21
0
        public void UIProvider_ConsoleUIMode_Normal()
        {
            Settings.UIProvider = UIProvider.Console;
            Settings.UIMode     = UIMode.Normal;

            var consoleOut = new StringWriter();

            Console.SetOut(consoleOut);

            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIProvider: Console" + Environment.NewLine + "UIMode: Normal" + Environment.NewLine + Environment.NewLine + "Console Message: " + consoleOut
                    + Environment.NewLine + "Is the message written to the console right?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
Example #22
0
        internal ExecutionFlow Report(Exception exception, ExceptionThread exceptionThread)
        {
            try
            {
                Logger.Trace("Starting to generate a bug report for the exception.");
                var serializableException = new SerializableException(exception);
                var report = new Report(serializableException);

                var handler = ProcessingException;
                if (handler != null)
                {
                    Logger.Trace("Notifying the user before handling the exception.");

                    // Allowing user to add any custom information to the report
                    handler(exception, report);
                }

                var uiDialogResult = UISelector.DisplayBugReportUI(exceptionThread, serializableException, report);
                if (uiDialogResult.Report == SendReport.Send)
                {
                    this.CreateReportZip(serializableException, report);
                }

                // If NBug is configured not to delay error reporting and user did not select to exit the app immediately,
                // start dispatching the bug report right away
                if (!Settings.DeferredReporting)
                {
                    new NBug.Core.Submission.Dispatcher();
                }

                return(uiDialogResult.Execution);
            }
            catch (Exception ex)
            {
                Logger.Error("An exception occurred during bug report generation process. See the inner exception for details.", ex);
                return(ExecutionFlow.BreakExecution);                // Since an internal exception occured
            }
        }
        public void UIContextsTests_ApplicationContext_IsAbleCallUpdateDelegate()
        {
            //Given a defined data struct is registered
            var updateDelegateWasCalled = false;
            var data          = new InternalData();
            var contextTarget = ApplicationContext.BindTarget(data);

            //When a UISelector is created
            var getter = UISelector.createSelector <bool>(ApplicationContext.current, "trueOrFalse", (trueOrFalse) =>
            {
                updateDelegateWasCalled = true;
            });

            //Then I should be able to invoke the update lambda
            data.trueOrFalse = true;
            contextTarget.UpdateWith(ref data);

            //Verify Getter returned True
            Assert.IsTrue(getter(), "Getter should return True");

            //Verify the update lambda was invoked
            Assert.IsTrue(updateDelegateWasCalled, "Verify the update lambda was invoked");
        }
Example #24
0
        public void UIProvider_WinFormsUIMode_Full()
        {
            Settings.UIProvider = UIProvider.WinForms;
            Settings.UIMode     = UIMode.Full;

            MessageBox.Show("Now click 'Send and Quit'", "User Input Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));

            MessageBox.Show("Now click 'Quit'", "User Input Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Assert.Equal(
                UISelector.DisplayBugReportUI(ExceptionThread.Main, this.serializableException, this.report),
                new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.DoNotSend));

            Assert.Equal(
                DialogResult.Yes,
                MessageBox.Show(
                    "UIProvider: WinForms" + Environment.NewLine + "UIMode: Full" + Environment.NewLine + Environment.NewLine
                    + "Did you see a Full WinForms error dialog?",
                    "Assert Question",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question));
        }
    /* SetUISelector(UISelector ui)
     * Change l'etat de l'interface
     * */
    public void SetUISelector(UISelector ui)
    {
        _currentUI = ui;

        if(szbrand == "PoolCover")
        {
            //ARROWS NEXT PREV MODULE
            if(_currentUI == UISelector.addNext || _currentUI == UISelector.addPrev)
            {

                if(_currentUI == UISelector.addNext)
                {
                    _arrowNxt.transform.localScale = new Vector3(1.2f,1.2f,1.2f);
                    _arrowPrv.transform.localScale = new Vector3(1,1,1);
                }
                if(_currentUI == UISelector.addPrev)
                {
                    _arrowNxt.transform.localScale = new Vector3(1,1,1);
                    _arrowPrv.transform.localScale = new Vector3(1.2f,1.2f,1.2f);
                }
            }
            else
            {
                if((_arrowPrv!=null)&&(_arrowNxt!=null))
                {
                    _arrowPrv.transform.localScale = new Vector3(1,1,1);
                    _arrowNxt.transform.localScale = new Vector3(1,1,1);
                }
            }

            //LIMITS
            if(_currentUI == UISelector.limits)
            {
                _limitBwd.SetActive(true);
                _limitFwd.SetActive(true);
            }
            else
            {
                _limitBwd.SetActive(false);
                _limitFwd.SetActive(false);
            }
        }
    }