Esempio n. 1
0
        public void SendChatMessage(string message)
        {
            ActionEventMessage actionEvent = new ActionEventMessage();

            actionEvent.ActionFragment.ObservationRadius = 1000;
            actionEvent.ActionFragment.ActionName        = "Chat";
            actionEvent.ActionFragment.SourceObjectId    = AvatarId;

            OmChatExt omChatExt = new OmChatExt();

            omChatExt.Message = message;

            actionEvent.SetExtension <OmChatExt>(omChatExt);

            DeckProgram.CloudView.ExecuteAction(actionEvent);
        }
Esempio n. 2
0
        public void ActionMessageEncoding()
        {
            ActionEventMessage originalMessage = new ActionEventMessage();

            originalMessage.ActionFragment.ActionName        = "TestInteractionName";
            originalMessage.ActionFragment.SourceObjectId    = Guid.NewGuid();
            originalMessage.ActionFragment.ObservationRadius = 100;

            OmChatExt originalChatFragment = new OmChatExt();

            originalChatFragment.Message = "TestChatMessage";

            originalMessage.SetExtension <OmChatExt>(originalChatFragment);

            byte[] encodedBytes = new byte[MxpConstants.MaxPacketSize];

            Assert.AreEqual(originalMessage.FrameCount, 1);
            Assert.AreEqual(originalMessage.FrameDataSize(0), 67);

            int currentIndex = originalMessage.EncodeFrameData(0, encodedBytes, 0);

            ActionEventMessage decodedMessage = new ActionEventMessage();

            decodedMessage.MessageId = originalMessage.MessageId;

            int currentDecodeIndex = decodedMessage.DecodeFrameData(0, encodedBytes, 0, originalMessage.FrameDataSize(0));

            OmChatExt decodedChatFragment = decodedMessage.GetExtension <OmChatExt>();

            String originalMessageString = originalMessage.ToString();
            String decodedMessageString  = decodedMessage.ToString();

            Assert.AreEqual(originalMessageString, decodedMessageString);

            Assert.AreEqual(originalChatFragment.Message, decodedChatFragment.Message);
        }