Ejemplo n.º 1
0
        public void TestStateUpdate()
        {
            var sup     = new StateUpdateObject();
            var created = new RoomObjectObj
            {
                disposable    = true,
                id            = 27,
                isHidden      = false,
                lookDirection = Vector3.forward,
                owner         = "test",
                position      = Vector3.one,
                prefab        = "a test thing"
            };
            var updated = new RoomObjectObj
            {
                disposable    = false,
                id            = 23,
                isHidden      = true,
                lookDirection = Vector3.back,
                owner         = "test",
                position      = Vector3.down,
                prefab        = ""
            };
            var deleted = 0;



            var TestSUP = new StateUpdateObject
            {
                create = new List <RoomObjectObj>()
                {
                    created
                },
                update = new List <RoomObjectObj>()
                {
                    updated
                },
                delete = new List <int>()
                {
                    deleted
                },
            };

            var fbb    = new FlatBufferBuilder(1024);
            var offset = TestSUP.ToBuffer(fbb);

            fbb.Finish(offset.Value);
            var bArray = fbb.SizedByteArray();
            var bb     = new ByteBuffer(bArray);
            var desObj = StateUpdate.GetRootAsStateUpdate(bb);
            var passed = CompareStateUpdates(desObj, TestSUP);

            print("State Update : " + (passed ? "Passed" : "Failed"));
        }
Ejemplo n.º 2
0
        public void TestStateUpdate()
        {
            var sup     = new StateUpdateObject();
            var created = new RoomObjectObj
            {
                disposable    = true,
                id            = 27,
                isHidden      = false,
                lookDirection = Vector3.forward,
                owner         = "test",
                position      = Vector3.one,
                prefab        = "a test thing"
            };
            var updated = new RoomObjectObj
            {
                disposable    = false,
                id            = 23,
                isHidden      = true,
                lookDirection = Vector3.back,
                owner         = "test",
                position      = Vector3.down,
                prefab        = ""
            };
            var deleted = 0;

            var TestAnnotation = new AnnotationObject
            {
                isValid   = true,
                lineId    = "testLine",
                positions = new[] { Vector3.one },
                userId    = "testUser"
            };

            TargetPlacementObject poi = new TargetPlacementObject
            {
                id       = 0,
                isValid  = true,
                name     = "testPoi",
                position = Vector3.one
            };

            var sitedrive = "SomeSiteDrive";

            var TestSUP = new StateUpdateObject
            {
                poiPlacementObject = poi,
                annotationObjects  = new List <AnnotationObject>()
                {
                    TestAnnotation
                },
                create = new List <RoomObjectObj>()
                {
                    created
                },
                update = new List <RoomObjectObj>()
                {
                    updated
                },
                delete = new List <int>()
                {
                    deleted
                },
                siteDrive = sitedrive
            };

            var fbb    = new FlatBufferBuilder(1024);
            var offset = TestSUP.ToBuffer(fbb);

            fbb.Finish(offset.Value);
            var bArray = fbb.SizedByteArray();
            var bb     = new ByteBuffer(bArray);
            var desObj = StateUpdate.GetRootAsStateUpdate(bb);
            var passed = CompareStateUpdates(desObj, TestSUP);

            print("State Update : " + (passed ? "Passed" : "Failed"));
        }