コード例 #1
0
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                XmlSerializer serializer = new XmlSerializer(typeof(InputControls));
                using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(mappingFilePath))
                {
                    serializer.Serialize(textWriter, mapping.Controls);
                    textWriter.Close();
                }
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
コード例 #2
0
        public InputMapping Clone()
        {
            InputMapping clonedMapping = new InputMapping(validButtons, validAxes);

            clonedMapping.SetButtonMappings(controls.CameraSwapButton, controls.TakeOffButton, controls.LandButton, controls.HoverButton, controls.EmergencyButton, controls.FlatTrimButton);
            clonedMapping.SetAxisMappings(controls.RollAxisMapping, controls.PitchAxisMapping, controls.YawAxisMapping, controls.GazAxisMapping);
            return(clonedMapping);
        }
コード例 #3
0
 protected void CreateMapping(List<String> validButtons, List<String> validAxes)
 {
     mapping = new InputMapping(validButtons, validAxes);
     if (!LoadMapping())
     {
         CreateStandardMapping();
     }
     backupMapping = mapping.Clone();
 }
コード例 #4
0
 protected void CreateMapping(List <String> validButtons, List <String> validAxes)
 {
     mapping = new InputMapping(validButtons, validAxes);
     if (!LoadMapping())
     {
         CreateStandardMapping();
     }
     backupMapping = mapping.Clone();
 }
コード例 #5
0
        public void DetermineMapping()
        {
            serializationUtils = new SerializationUtils();

            mapping = GetStandardMapping();
            LoadMapping();

            backupMapping = mapping.Clone();
        }
コード例 #6
0
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                DictionarySerializer.Serialize(mapping.Controls.Mappings, mappingFilePath);
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
コード例 #7
0
 public InputMapping Clone()
 {
     InputMapping clonedMapping = new InputMapping(validButtons, validAxes);
     clonedMapping.SetButtonMappings(controls.CameraSwapButton, controls.TakeOffButton, controls.LandButton, controls.HoverButton, controls.EmergencyButton, controls.FlatTrimButton);
     clonedMapping.SetAxisMappings(controls.RollAxisMapping, controls.PitchAxisMapping, controls.YawAxisMapping, controls.GazAxisMapping);
     return clonedMapping;
 }
コード例 #8
0
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                XmlSerializer serializer = new XmlSerializer(typeof(InputControls));
                using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(mappingFilePath))
                {
                    serializer.Serialize(textWriter, mapping.Controls);
                    textWriter.Close();
                }
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
コード例 #9
0
 public void CopyMappingsFrom(InputMapping mapping)
 {
     SetButtonMappings(mapping.CameraSwapButton, mapping.TakeOffButton, mapping.LandButton, mapping.HoverButton, mapping.EmergencyButton, mapping.FlatTrimButton);
     SetAxisMappings(mapping.RollAxisMapping, mapping.PitchAxisMapping, mapping.YawAxisMapping, mapping.GazAxisMapping);
 }
コード例 #10
0
 public void SetDefaultMapping()
 {
     CreateStandardMapping();
     backupMapping = mapping.Clone();
 }
コード例 #11
0
 public void SetDefaultMapping()
 {
     CreateStandardMapping();
     backupMapping = mapping.Clone();
 }
コード例 #12
0
        private void TakeOverMapping(InputMapping mapping)
        {
            textBoxAxisRoll.Text = mapping.RollAxisMapping;
            textBoxAxisPitch.Text = mapping.PitchAxisMapping;
            textBoxAxisYaw.Text = mapping.YawAxisMapping;
            textBoxAxisGaz.Text = mapping.GazAxisMapping;

            textBoxButtonTakeOff.Text = mapping.TakeOffButton;
            textBoxButtonLand.Text = mapping.LandButton;
            textBoxButtonHover.Text = mapping.HoverButton;
            textBoxButtonEmergency.Text = mapping.EmergencyButton;
            textBoxButtonFlatTrim.Text = mapping.FlatTrimButton;
            textBoxButtonChangeCamera.Text = mapping.CameraSwapButton;

            CheckForDoubleInput();
        }
コード例 #13
0
 public GenericInput()
 {
     mapping       = new InputMapping(new List <String>(), new List <String>());
     backupMapping = mapping.Clone();
 }
コード例 #14
0
 public void CopyValidButtonsAndAxesFrom(InputMapping mappingToCopyFrom)
 {
     validButtons = mappingToCopyFrom.ValidButtons;
     validAxes    = mappingToCopyFrom.ValidAxes;
 }
コード例 #15
0
 public void CopyValidButtonsAndAxesFrom(InputMapping mappingToCopyFrom)
 {
     validButtons = mappingToCopyFrom.ValidButtons;
     validAxes = mappingToCopyFrom.ValidAxes;
 }
コード例 #16
0
 public void CopyMappingFrom(ConfigurableInput input)
 {
     mapping       = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }
コード例 #17
0
 public void SetDefaultMapping()
 {
     mapping       = GetStandardMapping();
     backupMapping = mapping.Clone();
 }
コード例 #18
0
 public void RevertMapping()
 {
     mapping = backupMapping.Clone();
 }
コード例 #19
0
 public void RevertMapping()
 {
     mapping = backupMapping.Clone();
 }
コード例 #20
0
 public void CopyMappingFrom(GenericInput input)
 {
     mapping = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }
コード例 #21
0
 public void CopyMappingsFrom(InputMapping mapping)
 {
     SetButtonMappings(mapping.CameraSwapButton, mapping.TakeOffButton, mapping.LandButton, mapping.HoverButton, mapping.EmergencyButton, mapping.FlatTrimButton);
     SetAxisMappings(mapping.RollAxisMapping, mapping.PitchAxisMapping, mapping.YawAxisMapping, mapping.GazAxisMapping);
 }
コード例 #22
0
 public GenericInput()
 {
     mapping = new InputMapping(new List<String>(), new List<String>());
     backupMapping = mapping.Clone();
 }
コード例 #23
0
        private void UpdateMapping(InputMapping mapping, Control control, String inputValue)
        {
            if (control == Control.AxisRoll) { mapping.RollAxisMapping = inputValue; }
            if (control == Control.AxisPitch) { mapping.PitchAxisMapping = inputValue; }
            if (control == Control.AxisYaw) { mapping.YawAxisMapping = inputValue; }
            if (control == Control.AxisGaz) { mapping.GazAxisMapping = inputValue; }

            if (control == Control.ButtonTakeoff) { mapping.TakeOffButton = inputValue; }
            if (control == Control.ButtonLand) { mapping.LandButton = inputValue; }
            if (control == Control.ButtonHover) { mapping.HoverButton = inputValue; }
            if (control == Control.ButtonEmergency) { mapping.EmergencyButton = inputValue; }
            if (control == Control.ButtonFlatTrim) { mapping.FlatTrimButton = inputValue; }
            if (control == Control.ButtonChangeCamera) { mapping.CameraSwapButton = inputValue; }
        }
コード例 #24
0
 public void CopyMappingFrom(GenericInput input)
 {
     mapping       = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }