Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SteelSeriesKeyboard.cs
Go to the documentation of this file.
2using System.Linq;
4using Newtonsoft.Json.Linq;
5using SteelSeries.GameSense;
6
8
10{
11 public const string EVENT_ID_BITMAP = "DO_RAINBOWS";
12
13 private const int HowManyKeysGameSenseKeyboardUses = 132;
14
15 private const int Rows = 6;
16
17 private const int Columns = 22;
18
19 private readonly int[][] _keyboardKeyColors = new int[132][];
20
22
24
26
27 private int _timesSent;
28
30
32 : base(RgbDeviceVendor.SteelSeries, Fragment.FromGrid(new Rectangle(0, 0, 22, 6)), colorProfile)
33 {
34 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
35 for (int i = 0; i < _keyboardKeyColors.Length; i++)
36 {
37 _keyboardKeyColors[i] = new int[3];
38 }
39 }
40
41 public override void Render(IEnumerable<RgbKey> keys)
42 {
43 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
44 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
45 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
46 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
47 foreach (RgbKey key in keys)
48 {
49 if (_keyboardTriggersForLookup.TryGetValue(key.KeyTriggerName, out var value))
50 {
51 Color color = ProcessLedColor(key.CurrentColor);
52 value.UpdateColor(color, key.IsVisible);
53 }
54 }
55 }
56
57 public override void Present()
58 {
59 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
60 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
61 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
62 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
63 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
64 for (int i = 0; i < base.LedCount; i++)
65 {
67 int[] obj = _keyboardKeyColors[i];
68 obj[0] = (int)(processedLedColor.X * 255f);
69 obj[1] = (int)(processedLedColor.Y * 255f);
70 obj[2] = (int)(processedLedColor.Z * 255f);
71 }
72 }
73
88
90 {
91 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
92 //IL_0006: Expected O, but got Unknown
93 //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
94 //IL_00dd: Expected O, but got Unknown
95 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
96 //IL_0123: Unknown result type (might be due to invalid IL or missing references)
97 //IL_0138: Unknown result type (might be due to invalid IL or missing references)
98 //IL_0145: Expected O, but got Unknown
99 JObject jObject = new JObject();
100 jObject.Add("bitmap", JToken.FromObject((object)_keyboardKeyColors));
102 where x.IsVisible
103 select x.EventName).ToList();
105 where x.IsVisible
106 select x.EventName;
107 list.AddRange(collection);
108 jObject.Add("excluded-events", JToken.FromObject((object)list));
109 JObject jObject2 = new JObject();
110 jObject2.Add("frame", (JToken)(object)jObject);
111 jObject2.Add("value", JToken.op_Implicit(_timesSent));
112 _timesSent++;
113 if (_timesSent >= 100)
114 {
115 _timesSent = 1;
116 }
117 JObject val = new JObject();
118 val.Add("event", JToken.op_Implicit("DO_RAINBOWS"));
119 val.Add("data", (JToken)(object)jObject2);
120 return val;
121 }
122
124 {
125 foreach (Bind_Event bind_Event in bindEvents)
126 {
127 if (bind_Event.handlers.Length >= 1)
128 {
129 AbstractHandler obj = bind_Event.handlers[0];
132 {
134 {
135 EventName = bind_Event.eventName,
136 TriggerName = contextColorEventHandlerType.ContextFrameKey
137 };
140 }
141 }
142 }
144 }
145}
Color ProcessLedColor(Color color)
Definition RgbDevice.cs:53
Vector4 GetProcessedLedColor(int index)
Definition RgbDevice.cs:37
override void Render(IEnumerable< RgbKey > keys)
readonly Dictionary< string, ColorKey > _keyboardTriggersForLookup
void CollectEventsToTrack(Bind_Event[] bindEvents, ARgbGameValueTracker[] miscEvents)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)