Example #1
0
        public void SwitchPlayerProfile()
        {
            this.inputTypes.Clear();
            this.inputMaps.Clear();
            for (int index = 0; index < 4; ++index)
            {
                XInputPad device = Input.GetDevice <XInputPad>(index);
                if (device != null && device.isConnected)
                {
                    this.inputTypes.Add("XBOX GAMEPAD");
                    this.inputMaps.Add(Input.GetDefaultMapping(device.productName, device.productGUID).Clone());
                    break;
                }
            }
            List <string> stringList = new List <string>();

            for (int index = 0; index < 8; ++index)
            {
                if (DInput.GetState(index) != null)
                {
                    string productName = DInput.GetProductName(index);
                    string productGuid = DInput.GetProductGUID(index);
                    string str         = productName + productGuid;
                    if (!stringList.Contains(str))
                    {
                        stringList.Add(str);
                        this.inputMaps.Add(Input.GetDefaultMapping(productName, productGuid).Clone());
                        if (productName.Length > 24)
                        {
                            productName = productName.Substring(0, 24);
                        }
                        this.inputTypes.Add(productName);
                    }
                }
            }
            this.inputTypes.Add("KEYBOARD P1");
            this.inputMaps.Add(Input.GetDefaultMapping("KEYBOARD P1", "").Clone());
            this.inputTypes.Add("KEYBOARD P2");
            this.inputMaps.Add(Input.GetDefaultMapping("KEYBOARD P2", "").Clone());
            this.inputConfigType = 0;
            this.SwitchConfigType();
        }
 protected override PadState GetState(int index) => this.ConvertDInputState(DInput.GetState(index));