private void RemoveConnectedPair(int connectionID)
    {
        UserIDAndConnectionIDPair pair = GetConnectedPair(connectionID);

        host.RemoveConnectedUserID(pair.userID);
        SetConnectedInPacket(pair.userID, false);
        connectedPairs.Remove(pair);
        CircleVRDisplay.GetHead(CircleVR.GetPair(pair.userID).trackerID).Connected = false;
        Debug.Log("[CircleVR Host Network] Disconnected User ID : " + pair.userID);
    }
    private void AddConnectedPair(UserIDAndConnectionIDPair pair)
    {
        Packet.TrackerData trackerData = GetTrackerDataInPacket(pair.userID);
        trackerData.connected = true;

        CircleVRNetwork.Send(CircleVRPacketType.HostInfo,
                             CircleVRNetwork.StringToByte(JsonUtility.ToJson(new HostInfo(config.circlevr.showBarrier, config.circlevr.safetyBarrierRadius))),
                             pair.connectionId, CircleVRNetwork.reliableChannel);

        connectedPairs.Add(pair);
        CircleVRDisplay.GetHead(CircleVR.GetPair(pair.userID).trackerID).Connected = true;

        Debug.Log("[CircleVR Host Network] Connected User ID : " + pair.userID);
    }
示例#3
0
    public void OnData(int connectionId, int channelId, byte key, byte[] data, byte error)
    {
        CircleVRPacketType type = (CircleVRPacketType)key;

        if (type == CircleVRPacketType.TrackingData)
        {
            CircleVRHostNetwork.Packet packet = JsonUtility.FromJson <CircleVRHostNetwork.Packet>(CircleVRNetwork.ByteToString(data));

            foreach (CircleVRHostNetwork.Packet.TrackerData trackerData in packet.trackerDatas)
            {
                Debug.Assert(trackerData != null);
                SetTrackerTransform(trackerData);
                CircleVRDisplay.GetHead(trackerData.onAirVRUserID).Connected = trackerData.connected;
            }
            return;
        }
    }
    public void OnBounded(string userID, AirVRStereoCameraRig rig)
    {
        this.userID = userID;

        Transform tracker = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(userID).trackerID);

        rig.externalTracker = tracker.Find("CenterAnchor");

        CircleVRErrorType error;

        if (host.AddConnectedUserIDs(userID, out error))
        {
            CircleVRDisplay.GetHead(CircleVR.GetPair(userID).trackerID).Connected = true;
            return;
        }

        Debug.Log("[Client Emulator] " + error.ToString());
    }
 public void OnUnbound()
 {
     host.RemoveConnectedUserID(userID);
     CircleVRDisplay.GetHead(CircleVR.GetPair(userID).trackerID).Connected = false;
 }