コード例 #1
0
ファイル: GhopperDaemon.cs プロジェクト: shu1/dfu
    // Function: Init
    // 		Call this when you're ready to start daemon-based communications.
    // 		*(Actually, this can probably be moved into the MonoBehaviour's Start method, so devs just need to call <SendGameInit> when they're ready.)*
    public void Init()
    {
        DebugExtras.Log("GhopperDaemon.Init");
        detailedDebug = _detailedDebug;

        if (!didInit) {

            GhopperEnv attachedEventReceiver = gameObject.GetComponent<GhopperEnv>();
            if (gameEventReceiver == null) {
                if (attachedEventReceiver != null) {
                gameEventReceiver = attachedEventReceiver;
                } else {
                    DebugExtras.LogError("Please attach your GhopperEnv subclass to the same prefab as the GhopperDaemon, or assign it manually to GhopperDaemon.gameEventReceiver before init.");
                }
            }

        //			usingTouchReader = (touchReader != null);

            // recognized (daemon) message address setup
            SetDaemonMessageReceiver(PLAYER_API_ADDRESS, OnReceivePlayerEvent);
            SetDaemonMessageReceiver(GAME_API_ADDRESS, OnReceiveGameEvent);
            SetDaemonMessageReceiver(BEZEL_API_ADDRESS, OnReceiveBezelEvent);

            // udp/osc setup -- PENDING UPDATE -- will need to transition to reactivision + mindstorm OSC
        //			udp.init(hostIP, remotePort, localPort);
        //			osc.init(udp);
        //
        //			osc.SetAllMessageHandler(OnReceiveOsc);

            // osc (&tuio) setup
            TuioConfiguration receiverConfig = new TuioConfiguration();

            oscReceiver = new OSCReceiver();
            oscSender = new OSCSender();
            tuioTracker = new TuioTracking();

            oscSender.Start();

            receiverConfig.Port = GetLaunchOption("-daemonspeak", listenPort);
            oscReceiver.ConfigureFramework( receiverConfig );
            oscReceiver.SetAllMessageHandler( OnReceiveOsc );
            TuioTrackingComponent.StartTracking(oscReceiver, tuioTracker);

            oscReceiver.Start();

            didInit = true;
        }
    }
コード例 #2
0
ファイル: TuioTracking.cs プロジェクト: badbod99/unity3d-tuio
		public void ConfigureFramework(TuioConfiguration config)
	    {
	        this.config = config as TuioConfiguration;
	    }
コード例 #3
0
	public override void initialize()
	{		
		TuioConfiguration config = new TuioConfiguration();
		
		if (tracking == null) tracking = new TuioTracking();
		
		tracking.ConfigureFramework(config);
		
		tracking.Start();
	}