Пример #1
0
        private void TestCore(string resultName, string expectedName, string typeName, string value, string stepText)
        {
            string    compareText = GetCompareText(stepText);
            CompareOp compareOp   = ToCompareOp(compareText);
            //Console.WriteLine($"***** Testing:  result name: <{resultName}>, expected name: <{expectedName}>, type name: <{typeName}>, compare: <{compareOp}>, value: <{value}>");
            ITypeProcessor expected = null;

            if (!IsSingleCompareOp(compareOp))
            {
                if (!_manager.GetProcessorForExistingName(expectedName, out expected))
                {
                    expected = _manager.GetProcessorFor(typeName, value);
                }
            }

            if (expected == null)// && string.IsNullOrWhiteSpace(resultName))
            {
                expected = new ObjectProcessor(_scenario);
                expected.PostCurrentValue();
            }

            ITypeProcessor actual = _manager.GetProcessorForExistingName(resultName);

            DoCompare(actual, expected, compareOp);
        }
Пример #2
0
    // ------------------------------------------------------------------------------------------ //
    // Init Hierarchy.
    // ------------------------------------------------------------------------------------------ //

    static void Traverse(GameObject obj,
                         ObjectProcessor processor,
                         ExportContext context) {
      processor(obj, context);
      foreach (Transform child in obj.transform) {
        Traverse(child.gameObject, processor, context);
      }
    }
Пример #3
0
 void Traverse(GameObject obj, ObjectProcessor processor)
 {
     processor(obj);
     foreach (Transform child in obj.transform)
     {
         Traverse(child.gameObject, processor);
     }
 }
Пример #4
0
    //private void Update()
    //{
    //    if (Input.GetMouseButton(0))
    //    {
    //        Debug.Log(Input.mousePosition);
    //    }
    //}
    private void OnEnable()
    {
        Debug.Log(string.Format("TUIO listening on port {0}... (Press escape to quit)", port));

        if (IsShowTip)
        {
            if (_tipObjects.Count == 0)
            {
                GameObject prefab = new GameObject("tip", typeof(Image));

                Canvas canvas = FindObjectOfType <Canvas>();

                for (int i = 0; i < 15; i++)
                {
                    GameObject go = Instantiate(prefab, canvas.transform);

                    Image image = go.GetComponent <Image>();

                    image.rectTransform.position = Vector3.zero;

                    _tipObjects.Add(image);

                    go.SetActive(false);
                }
            }
        }

        _screenWidth  = Screen.width;
        _screenHeight = Screen.height;
        // tuio

        CursorProcessor cursorProcessor = new CursorProcessor();

        cursorProcessor.CursorAdded   += OnCursorAdded;
        cursorProcessor.CursorUpdated += OnCursorUpdated;
        cursorProcessor.CursorRemoved += OnCursorRemoved;

        BlobProcessor blobProcessor = new BlobProcessor();

        blobProcessor.BlobAdded   += OnBlobAdded;
        blobProcessor.BlobUpdated += OnBlobUpdated;
        blobProcessor.BlobRemoved += OnBlobRemoved;

        ObjectProcessor objectProcessor = new ObjectProcessor();

        objectProcessor.ObjectAdded   += OnObjectAdded;
        objectProcessor.ObjectUpdated += OnObjectUpdated;
        objectProcessor.ObjectRemoved += OnObjectRemoved;

        // listen...
        Connect();
        _tuioServer.AddDataProcessor(cursorProcessor);
        _tuioServer.AddDataProcessor(blobProcessor);
        _tuioServer.AddDataProcessor(objectProcessor);

        Debug.Log("connect");
    }
Пример #5
0
 //添加tuio解析器
 private void InitProcessor()
 {
     if (mServer == null)
     {
         return;
     }
     mObjectProcessor                = new ObjectProcessor();
     mObjectProcessor.ObjectAdded   += OnObjectAdded;
     mObjectProcessor.ObjectUpdated += OnObjectUpdated;
     mObjectProcessor.ObjectRemoved += OnObjectRemoved;
     mServer.AddDataProcessor(mObjectProcessor);
 }
Пример #6
0
        public void ObjectAdapterExample()
        {
            string          fileName  = "adapterTest.log";
            ObjectProcessor processor = new ObjectProcessor();

            File.Delete(fileName);

            ILogWriter logWriter = new FileAdapter(fileName);

            processor.Run(logWriter);

            Console.WriteLine(File.ReadAllText(fileName));
        }
Пример #7
0
        private static void ListenForTUIO()
        {
            Console.WriteLine(string.Format("TUIO listening on port {0}... (Press escape to quit)", port));

            // tuio
            tuioServer = new TuioServer(port);

            CursorProcessor cursorProcessor = new CursorProcessor();

            cursorProcessor.CursorAdded   += OnCursorAdded;
            cursorProcessor.CursorUpdated += OnCursorUpdated;
            cursorProcessor.CursorRemoved += OnCursorRemoved;

            BlobProcessor blobProcessor = new BlobProcessor();

            blobProcessor.BlobAdded   += OnBlobAdded;
            blobProcessor.BlobUpdated += OnBlobUpdated;
            blobProcessor.BlobRemoved += OnBlobRemoved;

            ObjectProcessor objectProcessor = new ObjectProcessor();

            objectProcessor.ObjectAdded   += OnObjectAdded;
            objectProcessor.ObjectUpdated += OnObjectUpdated;
            objectProcessor.ObjectRemoved += OnObjectRemoved;

            // listen...
            tuioServer.Connect();

            tuioServer.AddDataProcessor(cursorProcessor);
            tuioServer.AddDataProcessor(blobProcessor);
            tuioServer.AddDataProcessor(objectProcessor);

            do
            {
                while (!Console.KeyAvailable)
                {
                    Thread.Sleep(100);
                }
            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

            // done
            tuioServer.Disconnect();
            tuioServer = null;

            Console.WriteLine("Bye!");
        }
        /// <inheritdoc />
        protected override void init()
        {
            cursorProcessor                = new CursorProcessor();
            cursorProcessor.CursorAdded   += OnCursorAdded;
            cursorProcessor.CursorUpdated += OnCursorUpdated;
            cursorProcessor.CursorRemoved += OnCursorRemoved;

            blobProcessor              = new BlobProcessor();
            blobProcessor.BlobAdded   += OnBlobAdded;
            blobProcessor.BlobUpdated += OnBlobUpdated;
            blobProcessor.BlobRemoved += OnBlobRemoved;

            objectProcessor                = new ObjectProcessor();
            objectProcessor.ObjectAdded   += OnObjectAdded;
            objectProcessor.ObjectUpdated += OnObjectUpdated;
            objectProcessor.ObjectRemoved += OnObjectRemoved;

            connect();
        }
Пример #9
0
        private void PropertyTestImpl(
            string propNameOrValueKey,
            string keyOrTypeName,
            string keyOrValue,
            string stepText,
            bool isValue,
            string propName2      = null,
            string keyOrTypeName2 = null)
        {
            string    compareText = GetCompareText(stepText);
            CompareOp compareOp   = ToCompareOp(compareText);

            //Console.WriteLine($"***** PropertyTest:  propName: <{propNameOrValueKey}>, keyOrTypeName: <{keyOrTypeName}>, keyOrValue: <{keyOrValue}>, compare: <{compareOp}>, propName2: <{propName2}>, keyOrTypeName2: <{keyOrTypeName2}>");

            GetPropertyOrFieldData(propNameOrValueKey, keyOrTypeName, out object instance, out PropertyInfo prop, out FieldInfo field);
            GetPropertyOrFieldData(propName2, keyOrTypeName2, out object instance2, out PropertyInfo prop2, out FieldInfo field2);

            ITypeProcessor actual   = GetProcessorFor(propNameOrValueKey, instance, prop, field);
            ITypeProcessor expected = null;

            if (!IsSingleCompareOp(compareOp))
            {
                if (isValue)
                {
                    expected = actual.Clone();
                    expected.SetValue(keyOrValue);
                }
                else
                {
                    expected = GetProcessorFor(keyOrValue, instance2, prop2, field2);
                }
            }

            if (expected == null)
            {
                expected = new ObjectProcessor(_scenario);
                expected.PostCurrentValue();
            }

            DoCompare(actual, expected, compareOp);
        }
Пример #10
0
        /// <inheritdoc />
        protected override void OnEnable()
        {
            base.OnEnable();

            screenWidth  = Screen.width;
            screenHeight = Screen.height;

            cursorProcessor                = new CursorProcessor();
            cursorProcessor.CursorAdded   += OnCursorAdded;
            cursorProcessor.CursorUpdated += OnCursorUpdated;
            cursorProcessor.CursorRemoved += OnCursorRemoved;

            blobProcessor              = new BlobProcessor();
            blobProcessor.BlobAdded   += OnBlobAdded;
            blobProcessor.BlobUpdated += OnBlobUpdated;
            blobProcessor.BlobRemoved += OnBlobRemoved;

            objectProcessor                = new ObjectProcessor();
            objectProcessor.ObjectAdded   += OnObjectAdded;
            objectProcessor.ObjectUpdated += OnObjectUpdated;
            objectProcessor.ObjectRemoved += OnObjectRemoved;

            connect();
        }
Пример #11
0
        private void OnEnable()
        {
            Debug.Log(string.Format("TUIO listening on port {0}... (Press escape to quit)", port));

            screenWidth  = Screen.width;
            screenHeight = Screen.height;
            // tuio

            CursorProcessor cursorProcessor = new CursorProcessor();

            cursorProcessor.CursorAdded   += OnCursorAdded;
            cursorProcessor.CursorUpdated += OnCursorUpdated;
            cursorProcessor.CursorRemoved += OnCursorRemoved;

            BlobProcessor blobProcessor = new BlobProcessor();

            blobProcessor.BlobAdded   += OnBlobAdded;
            blobProcessor.BlobUpdated += OnBlobUpdated;
            blobProcessor.BlobRemoved += OnBlobRemoved;

            ObjectProcessor objectProcessor = new ObjectProcessor();

            objectProcessor.ObjectAdded   += OnObjectAdded;
            objectProcessor.ObjectUpdated += OnObjectUpdated;
            objectProcessor.ObjectRemoved += OnObjectRemoved;

            // listen...
            connect();
            tuioServer.AddDataProcessor(cursorProcessor);
            tuioServer.AddDataProcessor(blobProcessor);
            tuioServer.AddDataProcessor(objectProcessor);



            Debug.Log("connect");
        }
Пример #12
0
 protected void LoadLevel(string fileName, ObjectProcessor op)
 {
     orujin.LoadLevel(fileName, op);
 }
 public void LoadLevel(String fileName, ObjectProcessor op)
 {
     LevelLoader.FromFile(fileName, this.Content, op);
 }