Skip to content

Commit eb48e5a

Browse files
committed
Fixed text display cleared logging bug
1 parent be21a69 commit eb48e5a

2 files changed

Lines changed: 45 additions & 38 deletions

File tree

Runtime/Scripts/DataManagement/InputReporter.cs

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -64,63 +64,70 @@ private void Event(InputEventPtr eventPtr, InputDevice device) {
6464
{ "key display name", control.displayName },
6565
{ "value", keyControl.ReadValueFromEvent(eventPtr) },
6666
{ "control", control.ToString() },
67-
{ "time offset from logging ms", timeOffsetFromLoggingMs},
68-
});
69-
}
70-
71-
// Handle mouse button input
72-
if (reportMouseClicks && device is Mouse && control is ButtonControl buttonControl) {
73-
eventReporter.LogTS("input event", eventTime, new Dictionary<string, object> {
74-
{ "device", control.device.name },
75-
{ "input type", control.layout },
76-
{ "button name", control.name },
77-
{ "value", buttonControl.ReadValueFromEvent(eventPtr) },
78-
{ "button display name", control.displayName },
79-
{ "position", mousePosition },
80-
{ "control", control.ToString() },
67+
{ "display name", control.displayName },
8168
{ "time offset from logging ms", timeOffsetFromLoggingMs},
8269
});
8370
}
8471

8572
// Handle mouse position input
8673
// This may need to be updated to handle Vector2Control in the future
87-
if (reportMousePosition && !reportMousePositionOnFrame && device is Mouse && control is AxisControl axisControl && axisControl.parent.name == "position") { //
74+
if (device is Mouse && control is AxisControl axisControl && axisControl.parent.name == "position") {
8875
if (axisControl.name == "x") {
8976
mousePosition[0] = axisControl.ReadValueFromEvent(eventPtr);
9077
} else if (axisControl.name == "y") {
9178
mousePosition[1] = axisControl.ReadValueFromEvent(eventPtr);
9279
}
80+
if (reportMousePosition && !reportMousePositionOnFrame) {
81+
eventReporter.LogTS("input event", eventTime, new Dictionary<string, object> {
82+
{ "device", control.device.name },
83+
{ "input type", control.layout },
84+
{ "position name", control.name },
85+
{ "value", mousePosition },
86+
{ "position display name", control.displayName },
87+
{ "control", control.ToString() },
88+
{ "display name", control.displayName },
89+
{ "time offset from logging ms", timeOffsetFromLoggingMs},
90+
});
91+
}
92+
}
93+
94+
// Handle mouse button input
95+
if (reportMouseClicks && device is Mouse && control is ButtonControl buttonControl) {
9396
eventReporter.LogTS("input event", eventTime, new Dictionary<string, object> {
9497
{ "device", control.device.name },
9598
{ "input type", control.layout },
96-
{ "position name", control.name },
97-
{ "value", mousePosition },
98-
{ "position display name", control.displayName },
99+
{ "button name", control.name },
100+
{ "value", buttonControl.ReadValueFromEvent(eventPtr) },
101+
{ "button display name", control.displayName },
102+
{ "position", mousePosition },
103+
{ "screen size", new float[2] {Screen.width, Screen.height} },
99104
{ "control", control.ToString() },
105+
{ "display name", control.displayName },
100106
{ "time offset from logging ms", timeOffsetFromLoggingMs},
101107
});
102108
}
103109
}
104110
}
105111

106-
void Update() {
107-
if (reportMousePosition && reportMousePositionOnFrame && ++framesSinceLastMousePositionReport >= framesPerMousePositionReport) {
108-
framesSinceLastMousePositionReport = 0;
109-
var mouse = Mouse.current;
110-
var control = mouse.position;
111-
var position = control.ReadValue();
112-
eventReporter.LogTS("input event", new Dictionary<string, object> {
113-
{ "device", mouse.name },
114-
{ "input type", control.layout },
115-
{ "position name", control.name },
116-
{ "value", new float[2] {position.x, position.y} },
117-
{ "value2", mousePosition },
118-
{ "position display name", control.displayName },
119-
{ "control", control.ToString() },
120-
{ "time offset from logging ms", 0.0},
121-
});
122-
}
123-
}
112+
// void Update() {
113+
// if (reportMousePosition && reportMousePositionOnFrame && ++framesSinceLastMousePositionReport >= framesPerMousePositionReport) {
114+
// framesSinceLastMousePositionReport = 0;
115+
// var mouse = Mouse.current;
116+
// var control = mouse.position;
117+
// var position = control.ReadValue();
118+
// eventReporter.LogTS("input event", new Dictionary<string, object> {
119+
// { "device", mouse.name },
120+
// { "input type", control.layout },
121+
// { "position name", control.name },
122+
// { "value", new float[2] {position.x, position.y} },
123+
// { "value2", mousePosition },
124+
// { "screen size", new float[2] {Screen.width, Screen.height} },
125+
// { "position display name", control.displayName },
126+
// { "control", control.ToString() },
127+
// { "time offset from logging ms", 0.0},
128+
// });
129+
// }
130+
// }
124131
}
125132

126133
}

Runtime/Scripts/GUI/Singletons/TextDisplayer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public void ClearTitleTS() {
246246
}
247247
protected void ClearTitleHelper() {
248248
titleElement.text = "";
249-
eventReporter.LogTS("title display cleared title", new());
249+
eventReporter.LogTS("text display cleared title", new());
250250
}
251251

252252
public void ClearOnly() {
@@ -260,7 +260,7 @@ protected void ClearOnlyHelper() {
260260
textElement.text = "";
261261
footerElement.text = "";
262262
textElement.enableAutoSizing = true;
263-
eventReporter.LogTS("title display cleared", new());
263+
eventReporter.LogTS("text display cleared", new());
264264
}
265265

266266
public void Clear() {

0 commit comments

Comments
 (0)