public void AfterTest()
        {
            _dropdown = null;

            LocalisationManager.CurrentLocalisationInterface = null;
            _locInterface = null;
        }
        public void BeforeTest()
        {
            _locInterface = new MockLocalisationInterface();
            LocalisationManager.CurrentLocalisationInterface = _locInterface;

            _dropdown = new GameObject().AddComponent <TestLocalisationDropdown>();
            _dropdown.TestStart();
        }
예제 #3
0
        public void AfterTest()
        {
            _localisableUIText = null;
            _localisedText     = null;

            LocalisationManager.CurrentLocalisationInterface = null;
            _localisationInterface = null;
        }
        public void AfterTest()
        {
            LocalisationManager.CurrentLocalisationInterface = null;
            _localisation = null;

            _hud.TestDestroy();

            _secondLine = null;
            _firstLine  = null;

            _hud = null;
        }
        public void GetInteractableName_UsesStringBasedOnLocalisedTextRef()
        {
            var expectedText = "HALDO";

            var localisationInterface = new MockLocalisationInterface();

            LocalisationManager.CurrentLocalisationInterface      = localisationInterface;
            localisationInterface.GetTextForLocalisationKeyResult = new LocalisedText(new LocalisedTextEntries(new List <LocalisedTextEntry> {
                new LocalisedTextEntry(ELanguageOptions.EnglishUK, expectedText)
            }));

            Assert.IsTrue(_interactable.GetInteractableName().Equals(expectedText));

            LocalisationManager.CurrentLocalisationInterface = null;
        }
        public void BeforeTest()
        {
            _hud = new GameObject().AddComponent <TestDialogueHUDComponent>();

            _hud.DispatcherOverride    = new UnityMessageEventDispatcher();
            _hud.DisplayedDialogueText = new GameObject().AddComponent <Text>();
            _hud.NameText      = new GameObject().AddComponent <Text>();
            _hud.PortraitImage = new GameObject().AddComponent <Image>();

            _firstDelegateCalled  = false;
            _secondDelegateCalled = false;

            _firstLine = new DialogueLineEntry
            {
                DialogueKey   = new LocalisationKey("FirstNameSpace", "FirstKey"),
                NameKey       = new LocalisationKey("FirstNameySpace", "FirstKey"),
                DialogueSpeed = 2.0f,
                Portrait      = Resources.Load <Sprite>(SpritePath),
                TalkNoise     = new AudioClip()
            };

            _secondLine = new DialogueLineEntry
            {
                DialogueKey   = new LocalisationKey("SecondNameSpace", "SecondKey"),
                NameKey       = new LocalisationKey("SecondNameySpace", "SecondKey"),
                DialogueSpeed = 2.0f,
                Portrait      = Resources.Load <Sprite>(SecondSpritePath),
                TalkNoise     = new AudioClip()
            };

            _localisation = new MockLocalisationInterface();
            _localisation.GetTextForLocalisationKeyResult = new LocalisedText
                                                            (
                new LocalisedTextEntries
                (
                    new List <LocalisedTextEntry>
            {
                new LocalisedTextEntry
                    (ELanguageOptions.EnglishUK, FirstText)
            }
                )
                                                            );

            LocalisationManager.CurrentLocalisationInterface = _localisation;

            _hud.TestStart();
        }
예제 #7
0
        public void BeforeTest()
        {
            _localisationInterface = new MockLocalisationInterface();
            LocalisationManager.CurrentLocalisationInterface = _localisationInterface;

            _localisedText = new LocalisedText(new LocalisedTextEntries {
                Entries = new List <LocalisedTextEntry>
                {
                    new LocalisedTextEntry(ELanguageOptions.EnglishUK, "TEXTYTEXT"),
                    new LocalisedTextEntry(ELanguageOptions.German, "OtherTextyText")
                }
            });

            _localisationInterface.GetTextForLocalisationKeyResult = _localisedText;

            _localisableUIText = new GameObject().AddComponent <TestLocalisableUIText>();
        }
예제 #8
0
        public void GetTextFromLocalisationKey_QueriesLocalisationManagerToGetLocalisedText()
        {
            var locInterface = new MockLocalisationInterface();

            LocalisationManager.CurrentLocalisationInterface = locInterface;

            var entries = new List <LocalisedTextEntry>
            {
                new LocalisedTextEntry(ELanguageOptions.EnglishUK, "TEST")
            };

            locInterface.GetTextForLocalisationKeyResult = new LocalisedText(new LocalisedTextEntries(entries));

            var expectedKey = new LocalisationKey("Testy", "Test");

            Assert.AreEqual(locInterface.GetTextForLocalisationKeyResult.ToString(), LocalisedTextFunctions.GetTextFromLocalisationKey(expectedKey));
            Assert.AreSame(locInterface.SubmittedGetTextLocalisationKey, expectedKey);

            LocalisationManager.CurrentLocalisationInterface = null;
        }
예제 #9
0
        public void LocalisedTextRef_ToString_UsesUnderlyingLocalisedText()
        {
            var locInterface = new MockLocalisationInterface();

            LocalisationManager.CurrentLocalisationInterface = locInterface;

            var entries = new List <LocalisedTextEntry>
            {
                new LocalisedTextEntry(ELanguageOptions.EnglishUK, "TEST")
            };

            locInterface.GetTextForLocalisationKeyResult = new LocalisedText(new LocalisedTextEntries(entries));

            var expectedKey = new LocalisationKey("Testy", "Test");

            var localisedTextRef = new LocalisedTextRef(expectedKey);

            Assert.IsTrue(localisedTextRef.ToString().Equals(localisedTextRef.InternalLocalisedText.ToString()));

            LocalisationManager.CurrentLocalisationInterface = null;
        }
예제 #10
0
        public void LocalisedTextRef_QueriesLocalisationManagerToGetLocalisedText()
        {
            var locInterface = new MockLocalisationInterface();

            LocalisationManager.CurrentLocalisationInterface = locInterface;

            var entries = new List <LocalisedTextEntry>
            {
                new LocalisedTextEntry(ELanguageOptions.German, "TEST")
            };

            locInterface.GetTextForLocalisationKeyResult = new LocalisedText(new LocalisedTextEntries(entries));

            var expectedKey = new LocalisationKey("Testy", "Test");

            var localisedTextRef = new LocalisedTextRef(expectedKey);

            Assert.AreSame(expectedKey, locInterface.SubmittedGetTextLocalisationKey);
            Assert.AreSame(locInterface.GetTextForLocalisationKeyResult, localisedTextRef.InternalLocalisedText);

            LocalisationManager.CurrentLocalisationInterface = null;
        }
        public void BeforeTest()
        {
            var locInstance = new MockLocalisationInterface
            {
                GetTextForLocalisationKeyResult = new LocalisedText(new LocalisedTextEntries())
            };

            LocalisationManager.CurrentLocalisationInterface = locInstance;

            var instance = new GameObject().AddComponent <MockInputComponent>();

            instance.gameObject.AddComponent <TestGameInstance>().TestAwake();

            var player = new GameObject();

            player.AddComponent <TestUnityMessageEventDispatcherComponent>().TestAwake();

            _actionStateMachineComponent = player.AddComponent <MockActionStateMachineComponent>();

            _playerUi = player.gameObject.AddComponent <TestPlayerUIControllerComponent>();
            _playerUi.TestStart();
        }