private void HandleVolumeItem(object sender, MessageData item) { var data = JsonSerializer.Deserialize <Volume>(item.Data); Debug.WriteLine(JsonSerializer.ToJsonString(data)); VolumeEvent?.Invoke(sender, data); }
public void VolumeChange(int step) { if (_isLocked == false) { Volume += step; VolumeEvent?.Invoke(this); } }
public void VolumeDown() { if (_isLocked == false) { Volume--; VolumeEvent?.Invoke(this); } }
public void VolumeUp() { if (_isLocked == false) { Volume++; VolumeEvent?.Invoke(this); } }
public HappyEventTrigger(EntityPreset preset, Player p) : base(preset.Position, Drawing.DrawOrder.BACKGROUND) { visible = false; if (GlobalState.events.GetEvent("HappyStarted") != 0) { exists = false; } _p = p; _state = StateLogic(); volume = new(0, 0.9f); }
internal static bool TryUnpack(string dataString, out VolumeEvent volume) { volume = default; if (string.IsNullOrEmpty(dataString)) { return(false); } var parts = dataString.Split('~'); if (parts.Length != 3) { return(false); } volume = new VolumeEvent(parts[1], Utils.ParseDecimal(parts[2])); return(true); }
private async void CheckVolume() { await Task.Run(async() => { var oldVolume = _audioManager.GetStreamVolume(Stream.Music); while (true) { int newVolume; if ((newVolume = _audioManager.GetStreamVolume(Stream.Music)) != oldVolume) { oldVolume = newVolume; VolumeEvent?.Invoke(newVolume); } await Task.Delay(300); } }); }
public void DoVolumeEvent(VolumeEvent volumeEvent) { VirtualKeyCode key = VirtualKeyCode.NO_KEY; switch (volumeEvent) { case VolumeEvent.VOL_UP: key = VirtualKeyCode.VOLUME_UP; break; case VolumeEvent.VOL_DOWN: key = VirtualKeyCode.VOLUME_DOWN; break; case VolumeEvent.VOL_MUTE: key = VirtualKeyCode.VOLUME_MUTE; break; } if (VirtualKeyCode.NO_KEY != key) { mInputSimulator.Keyboard.KeyPress(key); } }
private void HandleVolumeItem(object sender, MessageData item) { var data = JsonSerializer.Deserialize <Volume>(item.Data); VolumeEvent?.Invoke(sender, data); }