public static void SetEncryptionKey(int radioId, int encKey) { var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null && currentRadio.modulation != RadioInformation.Modulation.DISABLED) // disabled { if (currentRadio.modulation != RadioInformation.Modulation.DISABLED) // disabled { //update stuff if ((currentRadio.encMode == RadioInformation.EncryptionMode.ENCRYPTION_COCKPIT_TOGGLE_OVERLAY_CODE) || (currentRadio.encMode == RadioInformation.EncryptionMode.ENCRYPTION_JUST_OVERLAY)) { if (encKey > 252) { encKey = 252; } else if (encKey < 1) { encKey = 1; } currentRadio.encKey = (byte)encKey; //make radio data stale to force resysnc ClientStateSingleton.Instance.LastSent = 0; } } } }
public static void DecreaseEncryptionKey(int radioId) { var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null) { SetEncryptionKey(radioId, currentRadio.encKey - 1); } }
public static void SetRadioVolume(float volume, int radioId) { if (volume > 1.0) { volume = 1.0f; } else if (volume < 0) { volume = 0; } var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null && currentRadio.modulation != RadioInformation.Modulation.DISABLED && currentRadio.volMode == RadioInformation.VolumeMode.OVERLAY) { currentRadio.volume = volume; } }
public static void RadioVolumeDown(short radioId) { var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null && currentRadio.modulation != RadioInformation.Modulation.DISABLED && currentRadio.volMode == RadioInformation.VolumeMode.OVERLAY) { var volume = currentRadio.volume; volume -= 0.1f; if (volume < 0) { volume = 0f; } currentRadio.volume = volume; } }
public static void RadioChannelDown(int radioId) { var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null) { if (currentRadio.modulation != RadioInformation.Modulation.DISABLED && ClientStateSingleton.Instance.DcsPlayerRadioInfo.control == DCSPlayerRadioInfo.RadioSwitchControls.HOTAS) { var fixedChannels = ClientStateSingleton.Instance.FixedChannels; //now get model if (fixedChannels != null && fixedChannels[radioId - 1] != null) { var radioChannels = fixedChannels[radioId - 1]; if (radioChannels.PresetChannels.Count > 0) { int previous = currentRadio.channel - 1; if (previous < 1) { //set to last radio SelectRadioChannel(radioChannels.PresetChannels.Last(), radioId); radioChannels.SelectedPresetChannel = radioChannels.PresetChannels.Last(); } else { var preset = radioChannels.PresetChannels[previous - 1]; //set to previous radio SelectRadioChannel(preset, radioId); radioChannels.SelectedPresetChannel = preset; } } } } } }
public static void RadioChannelUp(int radioId) { var currentRadio = RadioHelper.GetRadio(radioId); if (currentRadio != null) { if (currentRadio.modulation != RadioInformation.Modulation.DISABLED && ClientStateSingleton.Instance.DcsPlayerRadioInfo.control == DCSPlayerRadioInfo.RadioSwitchControls.HOTAS) { var fixedChannels = ClientStateSingleton.Instance.FixedChannels; //now get model if (fixedChannels != null && fixedChannels[radioId - 1] != null) { var radioChannels = fixedChannels[radioId - 1]; if (radioChannels.PresetChannels.Count > 0) { int next = currentRadio.channel + 1; if (radioChannels.PresetChannels.Count < next || currentRadio.channel < 1) { //set to first radio SelectRadioChannel(radioChannels.PresetChannels[0], radioId); radioChannels.SelectedPresetChannel = radioChannels.PresetChannels[0]; } else { var preset = radioChannels.PresetChannels[next - 1]; SelectRadioChannel(preset, radioId); radioChannels.SelectedPresetChannel = preset; } } } } } }