protected override void OnElementInitialisedImpl()
        {
            _currentState = EEmoteState.None;

            SetMappings();
            RegisterMessages();
        }
Exemple #2
0
 // IEmoteInterface
 public void SetEmoteState(EEmoteState inState)
 {
     if (_emoteState != inState)
     {
         _emoteState = inState;
         UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(gameObject, new EmoteStatusChangedMessage(_emoteState));
     }
 }
        public void ReceivesStateChangeMessage_NoneStateRemainsInactive()
        {
            const EEmoteState state = EEmoteState.None;

            _dispatcher.InvokeMessageEvent(new EmoteStatusChangedUIMessage(state));

            Assert.IsFalse(_emote.EmoteGraphics.Find((image) => image.State == state).DisplayImage.gameObject.activeSelf);
        }
        public void ReceivesStateChangeMessage_RelevantMessageSetActive()
        {
            const EEmoteState state = EEmoteState.Alerted;

            _dispatcher.InvokeMessageEvent(new EmoteStatusChangedUIMessage(state));

            Assert.IsTrue(_emote.EmoteGraphics.Find((image) => image.State == state).DisplayImage.gameObject.activeSelf);
        }
        public void GetEmoteState_Set_ChangedState()
        {
            const EEmoteState newState = EEmoteState.Alerted;

            _emote.SetEmoteState(newState);

            Assert.AreEqual(newState, _emote.GetEmoteState());
        }
        private void OnEmoteStateChanged(EmoteStatusChangedUIMessage inMessage)
        {
            if (_emoteMappings.ContainsKey(_currentState))
            {
                _emoteMappings[_currentState].gameObject.SetActive(false);
            }

            _currentState = inMessage.State;

            if (_currentState != EEmoteState.None)
            {
                _emoteMappings[_currentState].gameObject.SetActive(true);
            }
        }
        public void ReceivesEmoteStateChangedMessage_PropogatesToUI()
        {
            var messageSpy = new UnityTestMessageHandleResponseObject <EmoteStatusChangedUIMessage>();

            var handle =
                UnityMessageEventFunctions.RegisterActionWithDispatcher <EmoteStatusChangedUIMessage>(_local.GetInstantiatedUI(),
                                                                                                      messageSpy.OnResponse);

            const EEmoteState expectedState = EEmoteState.Alerted;

            UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(_local.gameObject, new EmoteStatusChangedMessage(expectedState));

            Assert.IsTrue(messageSpy.ActionCalled);
            Assert.AreEqual(expectedState, messageSpy.MessagePayload.State);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_local.GetInstantiatedUI(), handle);
        }
        public void SetEmoteState_Changed_SendsMessageWithNewState()
        {
            var messageSpy = new UnityTestMessageHandleResponseObject <EmoteStatusChangedMessage>();

            var handle =
                UnityMessageEventFunctions.RegisterActionWithDispatcher <EmoteStatusChangedMessage>(_emote.gameObject,
                                                                                                    messageSpy.OnResponse);

            const EEmoteState newState = EEmoteState.Alerted;

            _emote.SetEmoteState(newState);

            Assert.IsTrue(messageSpy.ActionCalled);
            Assert.AreEqual(newState, messageSpy.MessagePayload.State);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(_emote.gameObject, handle);
        }
Exemple #9
0
 public EmoteStatusChangedUIMessage(EEmoteState inState)
     : base()
 {
     State = inState;
 }
 public void SetEmoteState(EEmoteState inState)
 {
     SetEmoteStateResult = inState;
 }