Esempio n. 1
0
 public ConnectHeadsetElement WithInformation(Headset info)
 {
     this._headsetInformation = info;
     SetName(this._headsetInformation.HeadsetID);
     SetConnectionType(this._headsetInformation.HeadsetConnection);
     return(this);
 }
Esempio n. 2
0
    private static Loudness CheckVoiceLevel(PlayerScript script, ChatChannel channels)
    {
        //Check if is not a ghost/spectator and the player has an inventory.
        if (script.IsDeadOrGhost || script.DynamicItemStorage == null)
        {
            return(Loudness.NORMAL);
        }

        foreach (ItemSlot slot in script.DynamicItemStorage.GetNamedItemSlots(NamedSlot.ear))
        {
            Headset headset = slot.Item?.gameObject.GetComponent <Headset>();
            if (headset == null)
            {
                continue;
            }

            //TODO this sets the voice level by the first headset found, if multiple should we choose loudest instead?
            if (headset.LoudSpeakOn && IsOnCorrectChannels(channels))
            {
                return(headset.LoudspeakLevel);
            }
        }

        return(Loudness.NORMAL);
    }
Esempio n. 3
0
        private static IPeripheral CreateValidPeripheral(int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            IPeripheral peripheral;

            if (peripheralType == "Headset")
            {
                peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Keyboard")
            {
                peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Monitor")
            {
                peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Mouse")
            {
                peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidPeripheralType);
            }

            return(peripheral);
        }
Esempio n. 4
0
        IEnumerator setConnect(Headset headsetInformation, Action onConnected)
        {
            _connectedDevice.Information = headsetInformation;
            yield return(null);

            onConnected.Invoke();
        }
        public IPeripheral CreatePeripheral(int id, string peripheralType, string manufacturer, string model,
                                            decimal price,
                                            double overallPerformance, string connectionType)
        {
            IPeripheral periph = null;

            if (peripheralType == "Headset")
            {
                periph = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Keyboard")
            {
                periph = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Monitor")
            {
                periph = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == "Mouse")
            {
                periph = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else
            {
                throw new ArgumentException("Peripheral type is invalid.");
            }

            return(periph);
        }
    public override IEnumerator Process()
    {
        yield return(WaitFor(SentBy));

        GameObject player = NetworkObject;

        if (ValidRequest(HeadsetItem))
        {
            Headset    headset       = HeadsetItem.GetComponent <Headset>();
            GameObject encryptionKey = Object.Instantiate(Resources.Load("Encryptionkey", typeof(GameObject)),
                                                          HeadsetItem.transform.parent) as GameObject;
            encryptionKey.GetComponent <EncryptionKey>().Type = headset.EncryptionKey;

            PlayerNetworkActions pna = player.GetComponent <PlayerNetworkActions>();
            string slot = UIManager.FindEmptySlotForItem(encryptionKey);
            if (pna.AddItem(encryptionKey, slot))
            {
                NetworkServer.Spawn(encryptionKey);
                headset.EncryptionKey = EncryptionKeyType.None;
                pna.PlaceInSlot(encryptionKey, slot);
            }
            else
            {
                Object.Destroy(encryptionKey);
                Debug.LogError("Could not add Encryptionkey item to player.");
            }
        }
    }
Esempio n. 7
0
        private void setConnectedHeadset(Headset selectedHeadsetInformation)
        {
            bool isInsightConnected = (selectedHeadsetInformation.HeadsetType == HeadsetTypes.HEADSET_TYPE_INSIGHT);

            insight.SetActive(isInsightConnected);
            epoc.SetActive(!isInsightConnected);
        }
Esempio n. 8
0
        public string AddPeripheral(int computerId, int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            CheckThatComputerWithThisIdExist(computerId);
            var computer = this.computers.FirstOrDefault(c => c.Id == computerId);

            if (this.peripherals.Any(p => p.Id == id))
            {
                throw new ArgumentException("Peripheral with this id already exists.");
            }

            IPeripheral peripheral = null;

            switch (peripheralType)
            {
                case "Headset":
                    peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
                    break;
                case "Keyboard":
                    peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
                    break;
                case "Monitor":
                    peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
                    break;
                case "Mouse":
                    peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
                    break;
                default:
                    throw new ArgumentException($"Peripheral type is invalid.");
            }

            this.peripherals.Add(peripheral);
            computer.AddPeripheral(peripheral);

            return $"Peripheral {peripheralType} with id {id} added successfully in computer with id {computerId}.";
        }
 public void SetConnectedHeadset(Headset headsetInfos)
 {
     lock (_object) {
         // Debug.Log("======== SetConnectedHeadset " + headsetInfos.HeadsetID);
         _curHeadsetObjectConnected = headsetInfos;
     }
 }
Esempio n. 10
0
 //Execution sequence for running the EEG connection protocols
 private bool ConnectionAlgorithm()
 {
     //Get a connection ID handle to ThinkGear
     if (AttemptConnect())
     {
         //Connect to TG Compatible headset
         if (ConnectToHeadset(connectionId, comPortName))
         {
             //Read Packet
             int packet = ReadPacket();
             Debug.Log("Packet read: " + packet);
             //Gets Value status and value
             if (GetValue(connectionId) != 0)
             {
                 eegBand = new Headset(connectionId, focusBaud);
                 return(true);
             }
         }
         else
         {
             Debug.Log("Connection Unsuccessful");
         }
     }
     return(false);
 }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        string manufacturer = SteamVR.instance.GetStringProperty(Valve.VR.ETrackedDeviceProperty.Prop_ManufacturerName_String).ToLower();

        if (manufacturer.Contains("oculus"))
        {
            headset = Headset.RIFT;
        }
        else if (manufacturer.Contains("htc"))
        {
            headset = Headset.VIVE;
        }
        else
        {
            headset = Headset.WMR;
        }

        foreach (LayoutGroup lg in layoutGroups)
        {
            setLayout(lg);
        }

        foreach (PlatformSpecificText pst in platformSpecificTexts)
        {
            setPlatformSpecificText(pst);
        }
    }
Esempio n. 12
0
        public string AddPeripheral(int computerId, int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            CheckIfComputerExist(computerId);

            if (this.peripherals.Any(x => x.Id == id))
            {
                throw new ArgumentException(ExceptionMessages.ExistingPeripheralId);
            }

            IPeripheral peripheral = null;

            switch (peripheralType)
            {
            case "Headset": peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType); break;

            case "Keyboard": peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType); break;

            case "Monitor": peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType); break;

            case "Mouse": peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType); break;

            default: throw new ArgumentException(string.Format(ExceptionMessages.InvalidPeripheralType));
            }

            IComputer computer = this.computers.FirstOrDefault(x => x.Id == computerId);

            computer.AddPeripheral(peripheral);
            this.peripherals.Add(peripheral);

            return(string.Format(SuccessMessages.AddedPeripheral, peripheral.GetType().Name, peripheral.Id, computer.Id));
        }
Esempio n. 13
0
        public IPeripheral CreatePeripheral(int id, string peripheralType, string manufacturer, string model, decimal price,
                                            double overallPerformance, string connectionType)
        {
            IPeripheral peripheral = null;

            if (peripheralType == PeripheralType.Headset.ToString())
            {
                peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == PeripheralType.Keyboard.ToString())
            {
                peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == PeripheralType.Monitor.ToString())
            {
                peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else if (peripheralType == PeripheralType.Mouse.ToString())
            {
                peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidPeripheralType);
            }

            return(peripheral);
        }
 public void AddHeadset(Headset headset)
 {
     headsets.Add(headset);
     if (onNewItemReceived != null)
     {
         onNewItemReceived.Invoke(factory.Create().WithInformation(headset));
     }
 }
Esempio n. 15
0
    public VRInputHandler()
    {
        HeadsetNode   = new Headset();
        LeftHandNode  = new Handheld();
        RightHandNode = new Handheld();

        UpdateDeviceList();
    }
Esempio n. 16
0
    public ChatChannel GetAvailableChannelsMask(bool transmitOnly = true)
    {
        if (this == null)
        {
            return(ChatChannel.OOC);
        }
        PlayerMove pm = gameObject.GetComponent <PlayerMove>();

        if (pm.isGhost)
        {
            ChatChannel ghostTransmitChannels = ChatChannel.Ghost | ChatChannel.OOC;
            ChatChannel ghostReceiveChannels  = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat;
            if (transmitOnly)
            {
                return(ghostTransmitChannels);
            }
            return(ghostTransmitChannels | ghostReceiveChannels);
        }

        //TODO: Checks if player can speak (is not gagged, unconcious, has no mouth)
        ChatChannel transmitChannels = ChatChannel.OOC | ChatChannel.Local;

        if (CustomNetworkManager.Instance._isServer)
        {
            PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>();
            if (pna && pna.SlotNotEmpty("ear"))
            {
                Headset headset = pna.Inventory["ear"].Item.GetComponent <Headset>();
                if (headset)
                {
                    EncryptionKeyType key = headset.EncryptionKey;
                    transmitChannels = transmitChannels | EncryptionKey.Permissions[key];
                }
            }
        }
        else
        {
            GameObject earSlotItem = UIManager.InventorySlots["ear"].Item;
            if (earSlotItem)
            {
                Headset headset = earSlotItem.GetComponent <Headset>();
                if (headset)
                {
                    EncryptionKeyType key = headset.EncryptionKey;
                    transmitChannels = transmitChannels | EncryptionKey.Permissions[key];
                }
            }
        }


        ChatChannel receiveChannels = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat;

        if (transmitOnly)
        {
            return(transmitChannels);
        }
        return(transmitChannels | receiveChannels);
    }
Esempio n. 17
0
    public ChatChannel GetAvailableChannelsMask(bool transmitOnly = true)
    {
        var isDeadOrGhost = IsGhost;

        if (playerHealth != null)
        {
            isDeadOrGhost = playerHealth.IsDead;
        }

        if (isDeadOrGhost)
        {
            ChatChannel ghostTransmitChannels = ChatChannel.Ghost | ChatChannel.OOC;
            ChatChannel ghostReceiveChannels  = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat;
            if (transmitOnly)
            {
                return(ghostTransmitChannels);
            }
            return(ghostTransmitChannels | ghostReceiveChannels);
        }

        //TODO: Checks if player can speak (is not gagged, unconcious, has no mouth)
        ChatChannel transmitChannels = ChatChannel.OOC | ChatChannel.Local;

        if (CustomNetworkManager.Instance._isServer)
        {
            var playerStorage = gameObject.GetComponent <ItemStorage>();
            if (playerStorage && !playerStorage.GetNamedItemSlot(NamedSlot.ear).IsEmpty)
            {
                Headset headset = playerStorage.GetNamedItemSlot(NamedSlot.ear)?.Item?.GetComponent <Headset>();
                if (headset)
                {
                    EncryptionKeyType key = headset.EncryptionKey;
                    transmitChannels = transmitChannels | EncryptionKey.Permissions[key];
                }
            }
        }
        else
        {
            GameObject earSlotItem = gameObject.GetComponent <ItemStorage>().GetNamedItemSlot(NamedSlot.ear).ItemObject;
            if (earSlotItem)
            {
                Headset headset = earSlotItem.GetComponent <Headset>();
                if (headset)
                {
                    EncryptionKeyType key = headset.EncryptionKey;
                    transmitChannels = transmitChannels | EncryptionKey.Permissions[key];
                }
            }
        }

        ChatChannel receiveChannels = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat;

        if (transmitOnly)
        {
            return(transmitChannels);
        }
        return(transmitChannels | receiveChannels);
    }
        /*******************************************************************************\
        * MonoBehaviour / instance methods                                            *
        \*******************************************************************************/
        private FoveManager()
        {
            if (m_sInstance != null)
            {
                Debug.Log("Found an existing instance");
            }

            m_headset = new Headset(currentCapabilities);
        }
    private static void setKey(GameObject player, GameObject headsetGO, GameObject keyGO)
    {
        var pna = player.GetComponent <PlayerNetworkActions>();

        if (pna.HasItem(keyGO))
        {
            Headset       headset       = headsetGO.GetComponent <Headset>();
            EncryptionKey encryptionkey = keyGO.GetComponent <EncryptionKey>();
            headset.EncryptionKey = encryptionkey.Type;
            pna.Consume(keyGO);
        }
    }
Esempio n. 20
0
        private static void setKey(ConnectedPlayer player, GameObject headsetGO, GameObject keyGO)
        {
            var pna = player.Script.playerNetworkActions;

            if (pna.HasItem(keyGO))
            {
                Headset       headset       = headsetGO.GetComponent <Headset>();
                EncryptionKey encryptionkey = keyGO.GetComponent <EncryptionKey>();
                headset.EncryptionKey = encryptionkey.Type;
                Inventory.ServerDespawn(keyGO.GetComponent <Pickupable>().ItemSlot);
            }
        }
Esempio n. 21
0
        /// <inheritdoc />
        /// <summary>
        /// Sets all Chroma devices to the specified <see cref="Color" />.
        /// </summary>
        /// <param name="color">The <see cref="Color" /> to set.</param>
        public async Task SetAllAsync(Color color)
        {
            await Keyboard.SetAllAsync(color).ConfigureAwait(false);

            await Mouse.SetAllAsync(color).ConfigureAwait(false);

            await Mousepad.SetAllAsync(color).ConfigureAwait(false);

            await Keypad.SetAllAsync(color).ConfigureAwait(false);

            await Headset.SetAllAsync(color).ConfigureAwait(false);

            await ChromaLink.SetAllAsync(color).ConfigureAwait(false);
        }
Esempio n. 22
0
        /*******************************************************************************\
        * MonoBehaviour / instance methods                                            *
        \*******************************************************************************/
        private FoveManager()
        {
            if (m_sInstance != null)
            {
                Debug.Log("Found an existing instance");
            }

            ClientCapabilities capabilities = 0;

            capabilities |= ClientCapabilities.Gaze;
            capabilities |= ClientCapabilities.Orientation;
            capabilities |= ClientCapabilities.Position;

            m_headset = new Headset(capabilities);
        }
Esempio n. 23
0
    static void Main(string[] args)
    {
        IDevice device = (new Product() as IProduct).GetDevice();

        // C# 8.0 이전 컴파일 오류
        // C# 9.0 + .NET 5 환경에서 컴파일 가능

        /*
         * ISoundDevice soundDevice = new Headset().GetDevice();
         */

        // C# 8.0 이전
        // C# 9.0 + .NET Core 3.1 이하
        IDevice hds = new Headset().GetDevice();
    }
    public override IEnumerator Process()
    {
        yield return(WaitFor(SentBy));

        GameObject player = NetworkObject;

        if (ValidRequest(HeadsetItem, Encryptionkey))
        {
            Headset       headset       = HeadsetItem.GetComponent <Headset>();
            EncryptionKey encryptionkey = Encryptionkey.GetComponent <EncryptionKey>();

            headset.EncryptionKey = encryptionkey.Type;

            NetworkServer.Destroy(Encryptionkey);
        }
    }
Esempio n. 25
0
    public override IEnumerator Process()
    {
        yield return(WaitFor(SentBy));

        GameObject player = NetworkObject;

        if (ValidRequest(HeadsetItem))
        {
            Headset    headset       = HeadsetItem.GetComponent <Headset>();
            GameObject encryptionKey = Object.Instantiate(Resources.Load("Encryptionkey", typeof(GameObject)), HeadsetItem.transform.parent) as GameObject;
            encryptionKey.GetComponent <EncryptionKey>().Type = headset.EncryptionKey;
            //TODO when added interact with dropped headset, add encryption key to empty hand
            headset.EncryptionKey = EncryptionKeyType.None;
            ItemFactory.SpawnItem(encryptionKey, player.transform.position, player.transform.parent);
        }
    }
Esempio n. 26
0
        public string AddPeripheral(int computerId, int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            var computer = this.computers.FirstOrDefault(x => x.Id == computerId);

            if (computer == null)
            {
                throw new ArgumentException(ExceptionMessages.NotExistingComputerId);
            }

            IPeripheral peripheral = null;

            if (this.peripherals.Any(x => x.Id == id))
            {
                throw new ArgumentException(ExceptionMessages.ExistingPeripheralId);
            }

            if (peripheralType == "Headset")
            {
                peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
                computer.AddPeripheral(peripheral);
                this.peripherals.Add(peripheral);
            }
            else if (peripheralType == "Keyboard")
            {
                peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
                computer.AddPeripheral(peripheral);
                this.peripherals.Add(peripheral);
            }
            else if (peripheralType == "Monitor")
            {
                peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
                computer.AddPeripheral(peripheral);
                this.peripherals.Add(peripheral);
            }
            else if (peripheralType == "Mouse")
            {
                peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
                computer.AddPeripheral(peripheral);
                this.peripherals.Add(peripheral);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidPeripheralType);
            }

            return(string.Format(SuccessMessages.AddedPeripheral, peripheralType, peripheral.Id, computer.Id));
        }
Esempio n. 27
0
        /*******************************************************************************\
        * MonoBehaviour / instance methods                                            *
        \*******************************************************************************/
        private FoveManager()
        {
            if (sInstance != null)
            {
                Debug.LogError("Found an existing instance");
            }

            var logSinkDelegatePtr = Marshal.GetFunctionPointerForDelegate(logSinkDelegate);

            UnityFuncs.SetLogSinkFunction(logSinkDelegatePtr);

            headset = new Headset(currentCapabilities);

            submitNativeFunc          = UnityFuncs.GetSubmitFunctionPtr();
            wfrpNativeFunc            = UnityFuncs.GetWfrpFunctionPtr();
            updateMirrorTexNativeFunc = UnityFuncs.GetUpdateMirrorTexPtrFunctionPtr();
        }
        public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            UITableViewCell cell    = tableView.DequeueReusableCell(CellIdentifier);
            Headset         headset = Headsets [indexPath.Row];

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier);
            }

            cell.TextLabel.Text = headset.HeadsetName;
            if (headset.HeadsetId == _selectedHeadsetId)
            {
                cell.Accessory = UITableViewCellAccessory.Checkmark;
            }
            return(cell);
        }
        public string AddPeripheral(int computerId, int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            if (!IsComputerExist(computerId))
            {
                throw new ArgumentException("Computer with this id does not exist.");
            }

            if (peripherals.Any(x => x.Id == id))
            {
                throw new ArgumentException("Peripheral with this id already exists.");
            }

            IPeripheral peripheral = null;

            if (peripheralType == "Headset")
            {
                peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
            }

            else if (peripheralType == "Keyboard")
            {
                peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
            }

            else if (peripheralType == "Monitor")
            {
                peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
            }

            else if (peripheralType == "Mouse")
            {
                peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
            }

            else
            {
                throw new ArgumentException("Peripheral type is invalid.");
            }

            var computer = computers.FirstOrDefault(c => c.Id == computerId);

            computer.AddPeripheral(peripheral);
            peripherals.Add(peripheral);

            return($"Peripheral {peripheral.GetType().Name} with id {peripheral.Id} added successfully in computer with id {computer.Id}.");
        }
Esempio n. 30
0
        public string AddPeripheral(int computerId, int id, string peripheralType, string manufacturer, string model, decimal price, double overallPerformance, string connectionType)
        {
            var computer = this.computers.FirstOrDefault(x => x.Id == computerId);

            if (computer == null)
            {
                throw new ArgumentException("Computer with this id does not exist.");
            }

            IPeripheral peripheral = null;

            switch (peripheralType)
            {
            case nameof(Headset):
                peripheral = new Headset(id, manufacturer, model, price, overallPerformance, connectionType);
                break;

            case nameof(Keyboard):
                peripheral = new Keyboard(id, manufacturer, model, price, overallPerformance, connectionType);
                break;

            case nameof(Monitor):
                peripheral = new Monitor(id, manufacturer, model, price, overallPerformance, connectionType);
                break;

            case nameof(Mouse):
                peripheral = new Mouse(id, manufacturer, model, price, overallPerformance, connectionType);
                break;
            }

            if (peripheral == null)
            {
                throw new ArgumentException("Peripheral type is invalid.");
            }

            if (this.peripherals.Any(x => x.Id == peripheral.Id))
            {
                throw new ArgumentException("Peripheral with this id already exists.");
            }

            computer.AddPeripheral(peripheral);
            this.peripherals.Add(peripheral);

            return($"Peripheral {peripheral.GetType().Name} with id {peripheral.Id} added successfully in computer with id {computer.Id }.");
        }