Exemple #1
0
    public void QueueEntityComponentCorrectly()
    {
        const string entityId       = "1";
        const string componentId    = "component-1";
        const int    componentClass = 1;

        EntryPoint_World.SetEntityId(entityId);
        EntryPoint_World.CreateEntity();
        EntryPoint_World.EntityComponentCreateOrUpdate(componentClass, componentId);
        EntryPoint_World.EntityComponentDestroy(componentId);

        Assert.AreEqual(3, queueHandler.messagesList.Count);

        string json1base = @"{""method"":""CreateEntity"",""payload"":{""entityId"":""1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";
        string json2base = @"{""method"":""UpdateEntityComponent"",""payload"":{""entityId"":""1"",""classId"":1,""json"":""component-1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";
        string json3base = @"{""method"":""ComponentRemoved"",""payload"":{""entityId"":""1"",""name"":""component-1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        string json1 = JsonConvert.SerializeObject(queueHandler.messagesList[0]);
        string json2 = JsonConvert.SerializeObject(queueHandler.messagesList[1]);
        string json3 = JsonConvert.SerializeObject(queueHandler.messagesList[2]);

        Assert.AreEqual(json1base, json1);
        Assert.AreEqual(json2base, json2);
        Assert.AreEqual(json3base, json3);
    }
Exemple #2
0
    public void QueueSceneReadyCorrectly()
    {
        EntryPoint_World.SceneReady();

        string json1     = JsonConvert.SerializeObject(queueHandler.messagesList[0]);
        string json1base = @"{""method"":""InitMessagesFinished"",""payload"":{},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json1base, json1);
    }
Exemple #3
0
    public void SetUp()
    {
        queueHandler = new MessageQueueHandler_Mock();
        entryPoint   = new EntryPoint_World(queueHandler);

        const string sceneId = "test-scene-id";
        const string tag     = "test-tag";

        EntryPoint_World.SetSceneId(sceneId);
        EntryPoint_World.SetTag(tag);
    }
Exemple #4
0
        void Awake()
        {
            if (i != null)
            {
                Utils.SafeDestroy(this);
                return;
            }

            i = this;

#if !UNITY_EDITOR
            Debug.Log("DCL Unity Build Version: " + DCL.Configuration.ApplicationSettings.version);
            Debug.unityLogger.logEnabled = false;
#endif

            InitializeSceneBoundariesChecker();

            RenderProfileManifest.i.Initialize();
            Environment.i.Initialize(this, this);

            // We trigger the Decentraland logic once SceneController has been instanced and is ready to act.
            if (startDecentralandAutomatically)
            {
                WebInterface.StartDecentraland();
            }

            ParcelScene.parcelScenesCleaner.Start();

            if (deferredMessagesDecoding)           // We should be able to delete this code
            {
                StartCoroutine(DeferredDecoding()); //
            }
            DCLCharacterController.OnCharacterMoved += SetPositionDirty;

            physicsSyncController = new PhysicsSyncController();

            CommonScriptableObjects.sceneID.OnChange += OnCurrentSceneIdChange;

            //TODO(Brian): Move those suscriptions elsewhere when we have the PoolManager in its own
            //             assembly. (already done in PR #1149, not merged yet)
            PoolManager.i.OnGet -= physicsSyncController.MarkDirty;
            PoolManager.i.OnGet += physicsSyncController.MarkDirty;

#if !UNITY_EDITOR
            worldEntryPoint = new EntryPoint_World(this); // independent subsystem => put at entrypoint but not at environment
#endif
        }
Exemple #5
0
    public void QueueQueryCorrectly()
    {
        Protocol.QueryPayload payload = new Protocol.QueryPayload();
        payload.queryType      = 79014;
        payload.raycastPayload = new Protocol.RaycastQueryPayload
        {
            direction   = Vector3.right,
            distance    = 10,
            id          = 66,
            origin      = Vector3.zero,
            raycastType = 1
        };
        EntryPoint_World.Query(payload);

        string json1     = JsonConvert.SerializeObject(queueHandler.messagesList[0]);
        string json1base = @"{""method"":""Query"",""payload"":{""queryType"":null,""payload"":{""sceneId"":""test-scene-id"",""id"":""66"",""raycastType"":1,""ray"":{""origin"":{""x"":0.0,""y"":0.0,""z"":0.0},""direction"":{""x"":1.0,""y"":0.0,""z"":0.0},""distance"":10.0}}},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json1base, json1);
    }
Exemple #6
0
    public void QueueEntityMessagesCorrectly()
    {
        const string entityId_1 = "1";
        const string entityId_2 = "2";

        EntryPoint_World.SetEntityId(entityId_1);
        EntryPoint_World.CreateEntity();
        EntryPoint_World.SetEntityId(entityId_2);
        EntryPoint_World.CreateEntity();
        EntryPoint_World.SetEntityParent(entityId_1);

        EntryPoint_World.SetEntityId(entityId_1);
        EntryPoint_World.RemoveEntity();
        EntryPoint_World.SetEntityId(entityId_2);
        EntryPoint_World.RemoveEntity();

        string json1     = JsonConvert.SerializeObject(queueHandler.messagesList[0]);
        string json1base = @"{""method"":""CreateEntity"",""payload"":{""entityId"":""1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json1base, json1);

        string json2     = JsonConvert.SerializeObject(queueHandler.messagesList[1]);
        string json2base = @"{""method"":""CreateEntity"",""payload"":{""entityId"":""2""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json2base, json2);

        string json3     = JsonConvert.SerializeObject(queueHandler.messagesList[2]);
        string json3base = @"{""method"":""SetEntityParent"",""payload"":{""entityId"":""2"",""parentId"":""1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json3base, json3);

        string json4     = JsonConvert.SerializeObject(queueHandler.messagesList[3]);
        string json4base = @"{""method"":""RemoveEntity"",""payload"":{""entityId"":""1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json4base, json4);

        string json5     = JsonConvert.SerializeObject(queueHandler.messagesList[4]);
        string json5base = @"{""method"":""RemoveEntity"",""payload"":{""entityId"":""2""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json5base, json5);
    }
Exemple #7
0
        void Awake()
        {
            if (i != null)
            {
                Utils.SafeDestroy(this);
                return;
            }

            i = this;

            DataStore.i.debugConfig.soloScene          = debugConfig.soloScene;
            DataStore.i.debugConfig.soloSceneCoords    = debugConfig.soloSceneCoords;
            DataStore.i.debugConfig.ignoreGlobalScenes = debugConfig.ignoreGlobalScenes;
            DataStore.i.debugConfig.msgStepByStep      = debugConfig.msgStepByStep;

            if (!Configuration.EnvironmentSettings.RUNNING_TESTS)
            {
                performanceMetricsController = new PerformanceMetricsController();
                RenderProfileManifest.i.Initialize();
                SetupEnvironment();
            }

            featureController = new FeatureController();
            DCL.Interface.WebInterface.SendSystemInfoReport();

#if !UNITY_EDITOR
            Debug.Log("DCL Unity Build Version: " + DCL.Configuration.ApplicationSettings.version);
            Debug.unityLogger.logEnabled = false;

            worldEntryPoint = new EntryPoint_World(Environment.i.world.sceneController);
#endif

            // TODO(Brian): This is a temporary fix to address elevators issue in the xmas event.
            // We should re-enable this later as produces a performance regression.
            if (!Configuration.EnvironmentSettings.RUNNING_TESTS)
            {
                Environment.i.platform.cullingController.SetAnimationCulling(false);
            }
        }
Exemple #8
0
    public void QueueSharedComponentMessagesCorrectly()
    {
        const string entityId       = "1";
        const string componentId    = "component-1";
        const int    componentClass = 1;

        EntryPoint_World.SetEntityId(entityId);
        EntryPoint_World.CreateEntity();
        EntryPoint_World.SharedComponentCreate(componentClass, componentId);
        EntryPoint_World.SharedComponentAttach(componentId, null);
        EntryPoint_World.SharedComponentUpdate(componentId, "{}");
        EntryPoint_World.SharedComponentDispose(componentId);

        string json1     = JsonConvert.SerializeObject(queueHandler.messagesList[0]);
        string json1base = @"{""method"":""CreateEntity"",""payload"":{""entityId"":""1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json1base, json1);

        string json2     = JsonConvert.SerializeObject(queueHandler.messagesList[1]);
        string json2base = @"{""method"":""ComponentCreated"",""payload"":{""id"":""component-1"",""classId"":1,""name"":null},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json2base, json2);

        string json3     = JsonConvert.SerializeObject(queueHandler.messagesList[2]);
        string json3base = @"{""method"":""AttachEntityComponent"",""payload"":{""entityId"":""1"",""id"":""component-1"",""name"":null},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json3base, json3);

        string json4     = JsonConvert.SerializeObject(queueHandler.messagesList[3]);
        string json4base = @"{""method"":""ComponentUpdated"",""payload"":{""componentId"":""component-1"",""json"":""{}""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json4base, json4);

        string json5     = JsonConvert.SerializeObject(queueHandler.messagesList[4]);
        string json5base = @"{""method"":""ComponentDisposed"",""payload"":{""id"":""component-1""},""tag"":""test-tag"",""type"":1,""sceneId"":""test-scene-id"",""message"":null,""isUnreliable"":false,""unreliableMessageKey"":null}";

        Assert.AreEqual(json5base, json5);
    }