Beispiel #1
0
    public void RegisterHololens(HololensAvatarLogic hololens)
    {
        bool foundTab = false;

        //match a Hololens to it's tab by ID
        for (int i = 0; i < hlTabs.Count && !foundTab; i++)
        {
            HololensPane pane = hlTabs[i];
            if (pane.ID.Equals(hololens.ID) &&
                !pane.hasLinkedHololens())
            {
                foundTab = true;
                pane.linkHololens(hololens);
                pane.SaveData(i);
                PlayerPrefs.Save();
            }
        }

        //if no matching tab was found, create a new one
        if (!foundTab)
        {
            //create a new tab
            HololensPane pane = createTab();
            //match it to this hololens
            pane.ID = hololens.ID;
            pane.linkHololens(hololens);
            //save so we load the tab next time
            pane.SaveData(hlTabs.Count - 1);
            PlayerPrefs.SetInt("NumDevices", hlTabs.Count);
            PlayerPrefs.Save();
        }
    }
Beispiel #2
0
    public void CmdChangeClientState(NetworkInstanceId target, int index)
    {
        HololensAvatarLogic hololensTarget = NetworkServer.objects[target].GetComponent <HololensAvatarLogic>();

        Debug.Log("[MobileAvatarLogic:CmdChangeClientState] changing " + hololensTarget.ID + " to " + index);
        hololensTarget.TargetChangeState(hololensTarget.connectionToClient, index);
    }
 public void linkHololens(HololensAvatarLogic hololens)
 {
     IP             = hololens.IP;
     linkedHololens = hololens;
     setConnectedToServer(true);
     linkedHololens.OnDestroyListeners.Add(HololensDisconnected);
     string[] states = new string[linkedHololens.StateNames.Count];
     for (int i = 0; i < states.Length; i++)
     {
         states[i] = linkedHololens.StateNames[i];
     }
     StatesChanged(states);
     linkedHololens.OnStateListListeners.Add(StatesChanged);
 }
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader)
    {
        AvatarMessage message        = extraMessageReader.ReadMessage <AvatarMessage>();
        int           selectedAvatar = message.avatarIndex;

        Debug.Log("[MultiAvatarNetworkManager:OnServerAddPlayer] server add with message " + selectedAvatar);
        GameObject player = Instantiate(spawnPrefabs[selectedAvatar]);
        //if this is a hololens, lets add it's extra data for the Docent UI
        HololensAvatarLogic hlPlayer = player.GetComponent <HololensAvatarLogic>();

        if (hlPlayer != null)
        {
            string fullAddress = conn.address;
            //filter out the ipv4 address section
            System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(fullAddress, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
            hlPlayer.IP = match.Value;
            hlPlayer.ID = message.avatarName;
        }
        NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
    }
Beispiel #5
0
    public void CmdChangeClientState(NetworkInstanceId target, int index)
    {
        HololensAvatarLogic hololensTarget = NetworkServer.objects[target].GetComponent <HololensAvatarLogic>();

        hololensTarget.TargetChangeState(hololensTarget.connectionToClient, index);
    }
 public void HololensDisconnected()
 {
     linkedHololens = null;
     setConnectedToServer(false);
     RefocusApp();
 }