Exemplo n.º 1
0
        /// <summary>
        /// Sets calibrations based on the ToString of this class.
        /// </summary>
        /// <param name="storageString"></param>
        public void SetCalibrations(string storageString)
        {
            if (string.IsNullOrEmpty(storageString))
            {
                return;
            }

            string[] chunks = storageString.Split(new char[] { '-' });

            foreach (string calStr in chunks)
            {
                if (calStr.StartsWith("wm"))
                {
                    WiimoteCalibration.SetCalibration(calStr);
                }
                else if (calStr.StartsWith("nun"))
                {
                    NunchukCalibration.SetCalibration(calStr);
                }
                else if (calStr.StartsWith("cls"))
                {
                    ClassicCalibration.SetCalibration(calStr);
                }
                else if (calStr.StartsWith("ccp"))
                {
                    ClassicProCalibration.SetCalibration(calStr);
                }
                else if (calStr.StartsWith("pro"))
                {
                    ProCalibration.SetCalibration(calStr);
                }
            }
        }
Exemplo n.º 2
0
        public void ChangeExtension(ControllerType type)
        {
            if (DeviceType == type)
            {
                return;
            }

            switch (type)
            {
            case ControllerType.Wiimote:
                if (State is IWiimoteExtension)
                {
                    ConfigureWiimote(((IWiimoteExtension)State).wiimote);
                }
                else
                {
                    ConfigureWiimote(new Wiimote());
                }
                break;

            case ControllerType.Nunchuk:
            case ControllerType.NunchukB:
                var nState = new Nunchuk();
                nState.SetCalibration(Calibrations.CalibrationPreset.Default);
                ConfigureNunchuk(nState);
                ConfigureWiimote(nState.wiimote);
                break;

            case ControllerType.ClassicController:
                var cState = new ClassicController();
                cState.SetCalibration(Calibrations.CalibrationPreset.Default);
                ConfigureClassicController(cState);
                ConfigureWiimote(cState.wiimote);
                break;

            case ControllerType.ClassicControllerPro:
                var ccpState = new ClassicControllerPro();
                ccpState.SetCalibration(Calibrations.CalibrationPreset.Default);
                ConfigureClassicControllerPro(ccpState);
                ConfigureWiimote(ccpState.wiimote);
                break;

            case ControllerType.Guitar:
                var guitar = new Guitar();
                guitar.SetCalibration(Calibrations.CalibrationPreset.Default);
                ConfigureGuitar(guitar);
                ConfigureWiimote(guitar.wiimote);
                break;

            case ControllerType.TaikoDrum:
                var takio = new TaikoDrum();
                takio.SetCalibration(Calibrations.CalibrationPreset.Default);     // for wiimote
                ConfigureWiimote(takio.wiimote);
                break;

            default:
                // Invalid
                return;
            }

            DeviceType = type;
            _nextQueue.Enqueue(InputReport.Status);
        }