Beispiel #1
0
    internal static void Query(Protocol.QueryPayload payload)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        string queryId = Convert.ToString(payload.raycastPayload.id);

        RaycastType raycastType = (RaycastType)payload.raycastPayload.raycastType;

        Ray ray = new Ray()
        {
            origin    = payload.raycastPayload.origin,
            direction = payload.raycastPayload.direction,
            distance  = payload.raycastPayload.distance
        };

        queuedMessage.method  = MessagingTypes.QUERY;
        queuedMessage.payload = new QueryMessage()
        {
            payload = new RaycastQuery()
            {
                id          = queryId,
                raycastType = raycastType,
                ray         = ray,
                sceneId     = currentSceneId
            }
        };

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #2
0
    internal static void SceneReady()
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();
        queuedMessage.method  = MessagingTypes.INIT_DONE;
        queuedMessage.payload = new Protocol.SceneReady();

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #3
0
    public static MessagingBus.QueuedSceneMessage_Scene DecodeSceneMessage(string sceneId, string message, string tag)
    {
        var queuedMessage = new MessagingBus.QueuedSceneMessage_Scene()
        {
            type = MessagingBus.QueuedSceneMessage.Type.SCENE_MESSAGE, sceneId = sceneId, message = message, tag = tag
        };

        var queuedMessageSeparatorIndex = queuedMessage.message.IndexOf('\t');

        queuedMessage.method = queuedMessage.message.Substring(0, queuedMessageSeparatorIndex);

        return(queuedMessage);
    }
Beispiel #4
0
    public void EnqueueSceneMessage(MessagingBus.QueuedSceneMessage_Scene message)
    {
        messagesList.Add(message);

        if (OUTPUT_ASSERT_CODE_ON_CONSOLE)
        {
            var output = JsonConvert.SerializeObject(message);
            output = output.Replace(@"""", @"""""");
            i++;
            Debug.Log($"string json{i} = JsonConvert.SerializeObject(queueHandler.messagesList[{i - 1}]);");
            Debug.Log($"string json{i}base = @\"{output}\";");
            Debug.Log($"Assert.AreEqual(json{i}base, json{i});");
        }
    }
Beispiel #5
0
    internal static void OpenExternalUrl(string url)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.OpenExternalUrl payload = new Protocol.OpenExternalUrl
        {
            url = url
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.OPEN_EXTERNAL_URL;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #6
0
    internal static void RemoveEntity()
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();
        Protocol.RemoveEntity payload =
            new Protocol.RemoveEntity()
        {
            entityId = currentEntityId
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.ENTITY_DESTROY;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #7
0
    internal static void EntityComponentDestroy(string name)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.EntityComponentDestroy payload = new Protocol.EntityComponentDestroy
        {
            entityId = currentEntityId,
            name     = name
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.ENTITY_COMPONENT_DESTROY;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #8
0
    internal static void SharedComponentDispose(string id)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.SharedComponentDispose payload =
            new Protocol.SharedComponentDispose
        {
            id = id
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.SHARED_COMPONENT_DISPOSE;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #9
0
    internal static void OpenNftDialog(string contactAddress, string comment, string tokenId)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.OpenNftDialog payload = new Protocol.OpenNftDialog
        {
            contactAddress = contactAddress,
            comment        = comment,
            tokenId        = tokenId
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.OPEN_NFT_DIALOG;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #10
0
    internal static void SetEntityParent(string parentId)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.SetEntityParent payload =
            new Protocol.SetEntityParent
        {
            entityId = currentEntityId,
            parentId = parentId
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.ENTITY_REPARENT;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #11
0
    internal static void SharedComponentCreate(int classId, string id)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.SharedComponentCreate payload =
            new Protocol.SharedComponentCreate
        {
            id      = id,
            classId = classId
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.SHARED_COMPONENT_CREATE;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #12
0
    internal static void SharedComponentUpdate(string id, string json)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.SharedComponentUpdate payload =
            new Protocol.SharedComponentUpdate
        {
            componentId = id,
            json        = json
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.SHARED_COMPONENT_UPDATE;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #13
0
    internal static void SharedComponentAttach(string id, string name)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.SharedComponentAttach payload = new Protocol.SharedComponentAttach
        {
            entityId = currentEntityId,
            id       = id,
            name     = name
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.SHARED_COMPONENT_ATTACH;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #14
0
    internal static void EntityComponentCreateOrUpdate(int classId, string json)
    {
        MessagingBus.QueuedSceneMessage_Scene queuedMessage = GetSceneMessageInstance();

        Protocol.EntityComponentCreateOrUpdate payload =
            new Protocol.EntityComponentCreateOrUpdate
        {
            entityId = currentEntityId,
            classId  = classId,
            json     = json
        };

        queuedMessage.payload = payload;
        queuedMessage.method  = MessagingTypes.ENTITY_COMPONENT_CREATE_OR_UPDATE;

        queueHandler.EnqueueSceneMessage(queuedMessage);
    }
Beispiel #15
0
    internal static MessagingBus.QueuedSceneMessage_Scene GetSceneMessageInstance()
    {
        MessagingBus.QueuedSceneMessage_Scene message;

        var sceneMessagesPool = queueHandler.sceneMessagesPool;

        if (sceneMessagesPool.Count > 0)
        {
            message = sceneMessagesPool.Dequeue();
        }
        else
        {
            message = new MessagingBus.QueuedSceneMessage_Scene();
        }

        message.sceneId = currentSceneId;
        message.tag     = currentTag;
        message.type    = MessagingBus.QueuedSceneMessage.Type.SCENE_MESSAGE;

        return(message);
    }
Beispiel #16
0
 public bool ProcessMessage(MessagingBus.QueuedSceneMessage_Scene msgObject, out CleanableYieldInstruction yieldInstruction)
 {
     yieldInstruction = null;
     return(true);
 }