コード例 #1
0
    internal void create(Location location, SurfaceRectangle localSurface, SurfaceRectangle remoteSurfaceProxy, float length)
    {
        _handheldListener = new UDPHandheldListener(int.Parse(_properties.localSetupInfo.receiveHandheldPort), "negativespace");

        _location            = location;
        _localSurface        = localSurface;
        _remoteSurfaceProxy  = remoteSurfaceProxy;
        _negativeSpaceLength = length;

        _createNegativeSpaceMesh();

        NegativeSpaceCenter = new GameObject("NegativeSpaceCenter");
        NegativeSpaceCenter.transform.position = (_localSurface.SurfaceBottomLeft + _remoteSurfaceProxy.SurfaceTopRight) * 0.5f;
        NegativeSpaceCenter.transform.rotation = GameObject.Find("localScreenCenter").transform.rotation;

        _log.WriteLine(this, "Waiting for handheld at " + _properties.localSetupInfo.receiveHandheldPort);
        _log.WriteLine(this, "Negative Space Created for Location " + _location + " with length " + _negativeSpaceLength);

        _handCursor = new GameObject("HandCursor");
        _handCursor.transform.position = Vector3.zero;
        _handCursor.transform.rotation = Quaternion.identity;
        _handCursor.transform.parent   = _main.LocalOrigin.transform;
        _handCursor.AddComponent <NegativeSpaceCursor>();

        _spaceCreated = true;
    }
コード例 #2
0
    public void load()
    {
        _filename = Application.dataPath + "/" + configFilename;
        if (File.Exists(_filename))
        {
            _log.WriteLine(this, "Config file found!");

            try
            {
                localSetupInfo  = _retrieveInfo(_location);
                remoteSetupInfo = _retrieveInfo(_location == Location.A ? Location.B : Location.A);


                _configRead = true;
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
                Debug.Log(e.StackTrace);
                _configRead = false;
            }
        }
        else
        {
            _log.WriteLine(this, "Cannot find the config file");
        }
    }
コード例 #3
0
    public void request()
    {
        _log.WriteLine(this, "Requesting surface to " + _properties.localSetupInfo.trackerListenPort + " to receive in " + _properties.localSetupInfo.localSurfaceListen);
        _log.WriteLine(this, "Requesting surface to " + _properties.remoteSetupInfo.trackerListenPort + " to receive in " + _properties.localSetupInfo.remoteSurfaceListen);

        _requestLocal();
        _requestRemote();
        lastTry = DateTime.Now;
    }
コード例 #4
0
    public void StartReceive()
    {
        _portForLocal  = int.Parse(_properties.localSetupInfo.localSurfaceListen);
        _portForRemote = int.Parse(_properties.localSetupInfo.remoteSurfaceListen);

        _anyIP_LocalSurface     = new IPEndPoint(IPAddress.Any, _portForLocal);
        _udpClient_LocalSurface = new UdpClient(_anyIP_LocalSurface);
        _udpClient_LocalSurface.BeginReceive(new AsyncCallback(this.ReceiveCallback_LocalSurface), null);

        _anyIP_RemoteSurface     = new IPEndPoint(IPAddress.Any, _portForRemote);
        _udpClient_RemoteSurface = new UdpClient(_anyIP_RemoteSurface);
        _udpClient_RemoteSurface.BeginReceive(new AsyncCallback(this.ReceiveCallback_RemoteSurface), null);

        _log.WriteLine(this, "Awaiting Surfaces: remote at " + _portForRemote + ", local at " + _portForLocal);
    }
コード例 #5
0
ファイル: Main.cs プロジェクト: mauriciosousa/CoisosDoTracker
    void Awake()
    {
        Application.runInBackground = true;
        _surfaceRequestListener     = GetComponent <SurfaceRequestListener>();
        _properties            = GetComponent <Properties>();
        _log                   = GetComponent <VisualLog>();
        _negativeSpace         = GetComponent <NegativeSpace>();
        _bodiesListener        = GameObject.Find("BodiesManager").GetComponent <UdpBodiesListener>();
        _bodies                = GameObject.Find("BodiesManager").GetComponent <BodiesManager>();
        _prespectiveProjection = Camera.main.GetComponent <PerspectiveProjection>();
        _tracker               = GameObject.Find("RavatarManager").GetComponent <Tracker>();
        _tcpKinectListener     = GameObject.Find("RavatarManager").GetComponent <TcpKinectListener>();
        _workspace             = GetComponent <RPCWorkspace>();

        _properties.load();

        ConfigLoaded = _properties.ConfigLoaded;

        if (!ConfigLoaded)
        {
            _log.Show = true;
        }
        else
        {
            _log.WriteLine(this, "Config Loaded");
            _surfaceRequestListener.StartReceive();
        }

        if (location == Location.A)
        {
            _workspace.InitServer();
        }
        else
        {
            _workspace.InitClient();
        }
    }
コード例 #6
0
 void OnConnectedToServer()
 {
     _log.WriteLine("[RPC] Connection established");
 }