-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStateMutations.cs
More file actions
104 lines (102 loc) · 3.34 KB
/
Copy pathStateMutations.cs
File metadata and controls
104 lines (102 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using APC;
using APCEvents;
using APCEvents.APCIn;
using Godot;
using System;
using System.Collections.Generic;
using System.Reflection.Metadata.Ecma335;
using state_types;
using APCEvents.KeyAction;
using WindowsInput;
using APCEvents.APCOut;
using APCEvents.Color;
using APCEvents.UI;
using APCGear.Audio;
public partial class State : Node
{
public void enactShortcut(ShortcutEventArgs shortcutEventArgs)
{
Keyboard.simulateKeypress(shortcutEventArgs.Hotkey);
}
public void advanceColor(BtnId args)
{
btn_state btn = button_table[args.Id];
if (btn.colorTransitions == null) return;
if (btn.colorTransitions is ComplexColorTransition)
{
advanceComplexOnRelease(args);
return;
}
var color = btn.colorTransitions.next();
switch (btn.type)
{
case btn_type.INNER:
Pad.Instance.handler.set_inner(args.Id, (inner_state)color);
break;
case btn_type.OUTER:
Pad.Instance.handler.set_outer((APC.outer_btns)args.Id, (outer_state)color);
break;
default:
break;
}
Bus.Publish<ChangeColorInUiEvent, BtnSelectedEventArgs>(new BtnSelectedEventArgs() { id = args.Id});
}
public void pasteText(TextEventArgs args) => Keyboard.pasteText(args.text);
public void setButtonColor(ColorTransitions transitions)
{
btn_state btn = selected_btn;
switch (btn.type)
{
case btn_type.INNER:
Pad.Instance.handler.set_inner(selected_id, (inner_state)transitions.currentColor);
break;
case btn_type.OUTER:
Pad.Instance.handler.set_outer((APC.outer_btns)selected_id, (outer_state)transitions.currentColor);
break;
default:
break;
}
Bus.Publish<ChangeColorInUiEvent, BtnSelectedEventArgs>(new BtnSelectedEventArgs() { id = selected_id });
}
public void advanceComplexOnRelease(BtnId args)
{
btn_state btn = button_table[args.Id];
ComplexColorTransition transition = btn.colorTransitions as ComplexColorTransition;
if (transition != null)
{
Pad.Instance.handler.set_inner(selected_id, transition.released());
}
}
public void advanceComplexOnPressed(BtnId args) {
btn_state btn = button_table[args.Id];
ComplexColorTransition transition = btn.colorTransitions as ComplexColorTransition;
if (transition != null)
{
Pad.Instance.handler.set_inner(selected_id, transition.pressed());
}
}
public void changeVolume(SliderChangedEventArgs args)
{
sliders slid = (sliders)args.id;
var current = slider_table[slid];
if (current.process == Process.nullProcess) {
return;
} else if (current.process.id == 1) {
AudioHandler.setMasterVolume(args.value);
} else {
AudioHandler.setProcessVolume(current.process, args.value);
}
}
public void mute(Process p)
{
if (p == Process.nullProcess) { return; }
GD.Print("Muting ", p.name);
if (p.id == 1)
{
AudioHandler.setMasterMuteToggle();
} else
{
AudioHandler.muteProcess(p);
}
}
}