예제 #1
0
        private void HandleVolumeItem(object sender, MessageData item)
        {
            var data = JsonSerializer.Deserialize <Volume>(item.Data);

            Debug.WriteLine(JsonSerializer.ToJsonString(data));
            VolumeEvent?.Invoke(sender, data);
        }
예제 #2
0
 public void VolumeChange(int step)
 {
     if (_isLocked == false)
     {
         Volume += step;
         VolumeEvent?.Invoke(this);
     }
 }
예제 #3
0
 public void VolumeDown()
 {
     if (_isLocked == false)
     {
         Volume--;
         VolumeEvent?.Invoke(this);
     }
 }
예제 #4
0
 public void VolumeUp()
 {
     if (_isLocked == false)
     {
         Volume++;
         VolumeEvent?.Invoke(this);
     }
 }
예제 #5
0
 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);
 }
예제 #6
0
            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);
            }
예제 #7
0
        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);
                }
            });
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
        private void HandleVolumeItem(object sender, MessageData item)
        {
            var data = JsonSerializer.Deserialize <Volume>(item.Data);

            VolumeEvent?.Invoke(sender, data);
        }