Skip to content

Commit 3980ef3

Browse files
committed
DebugLogEntry now holds LogType rather than Sprite
1 parent 6578689 commit 3980ef3

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

Plugins/IngameDebugConsole/Scripts/DebugLogEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class DebugLogEntry
1515
private string completeLog;
1616

1717
// Sprite to show with this entry
18-
public Sprite logTypeSpriteRepresentation;
18+
public LogType logType;
1919

2020
// Collapsed count
2121
public int count;

Plugins/IngameDebugConsole/Scripts/DebugLogItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void SetContent( DebugLogEntry logEntry, DebugLogEntryTimestamp? logEntry
149149
transformComponent.sizeDelta = size;
150150

151151
SetText( logEntry, logEntryTimestamp, isExpanded );
152-
logTypeImage.sprite = logEntry.logTypeSpriteRepresentation;
152+
logTypeImage.sprite = DebugLogManager.logSpriteRepresentations[(int) logEntry.logType];
153153
}
154154

155155
// Show the collapsed count of the debug entry

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public class DebugLogManager : MonoBehaviour
228228
[SerializeField]
229229
private Sprite errorLog;
230230

231-
private Sprite[] logSpriteRepresentations;
231+
internal static Sprite[] logSpriteRepresentations;
232232

233233
// Visuals for resize button
234234
[SerializeField]
@@ -1192,7 +1192,7 @@ private void ProcessLog( QueuedDebugLogEntry queuedLogEntry, DebugLogEntryTimest
11921192
{
11931193
// It is not a duplicate,
11941194
// add it to the list of unique debug entries
1195-
logEntry.logTypeSpriteRepresentation = logSpriteRepresentations[(int) logType];
1195+
logEntry.logType = logType;
11961196
logEntry.collapsedIndex = collapsedLogEntries.Count;
11971197

11981198
collapsedLogEntries.Add( logEntry );
@@ -1222,7 +1222,6 @@ private void ProcessLog( QueuedDebugLogEntry queuedLogEntry, DebugLogEntryTimest
12221222
// If this debug entry matches the current filters,
12231223
// add it to the list of debug entries to show
12241224
int logEntryIndexInEntriesToShow = -1;
1225-
Sprite logTypeSpriteRepresentation = logEntry.logTypeSpriteRepresentation;
12261225
if( isCollapseOn && isEntryInCollapsedEntryList )
12271226
{
12281227
if( isLogWindowVisible || timestampsOfLogEntriesToShow != null )
@@ -1243,9 +1242,9 @@ private void ProcessLog( QueuedDebugLogEntry queuedLogEntry, DebugLogEntryTimest
12431242
}
12441243
}
12451244
else if( ( !isInSearchMode || queuedLogEntry.MatchesSearchTerm( searchTerm ) ) && ( logFilter == DebugLogFilter.All ||
1246-
( logTypeSpriteRepresentation == infoLog && ( ( logFilter & DebugLogFilter.Info ) == DebugLogFilter.Info ) ) ||
1247-
( logTypeSpriteRepresentation == warningLog && ( ( logFilter & DebugLogFilter.Warning ) == DebugLogFilter.Warning ) ) ||
1248-
( logTypeSpriteRepresentation == errorLog && ( ( logFilter & DebugLogFilter.Error ) == DebugLogFilter.Error ) ) ) )
1245+
( logType == LogType.Log && ( ( logFilter & DebugLogFilter.Info ) == DebugLogFilter.Info ) ) ||
1246+
( logType == LogType.Warning && ( ( logFilter & DebugLogFilter.Warning ) == DebugLogFilter.Warning ) ) ||
1247+
( logType != LogType.Log && logType != LogType.Warning && ( ( logFilter & DebugLogFilter.Error ) == DebugLogFilter.Error ) ) ) )
12491248
{
12501249
logEntriesToShow.Add( logEntry );
12511250
logEntryIndexInEntriesToShow = logEntriesToShow.Count - 1;
@@ -1327,9 +1326,9 @@ private void RemoveUncollapsedLogEntry( DebugLogEntry logEntry )
13271326
if( !isCollapseOn && logEntriesToShow[removedLogEntriesToShowCount] == logEntry )
13281327
removedLogEntriesToShowCount++;
13291328

1330-
if( logEntry.logTypeSpriteRepresentation == infoLog )
1329+
if( logEntry.logType == LogType.Log )
13311330
infoEntryCount--;
1332-
else if( logEntry.logTypeSpriteRepresentation == warningLog )
1331+
else if( logEntry.logType == LogType.Warning )
13331332
warningEntryCount--;
13341333
else
13351334
errorEntryCount--;
@@ -1733,12 +1732,12 @@ private void FilterLogs()
17331732
continue;
17341733

17351734
bool shouldShowLog = false;
1736-
if( logEntry.logTypeSpriteRepresentation == infoLog )
1735+
if( logEntry.logType == LogType.Log )
17371736
{
17381737
if( isInfoEnabled )
17391738
shouldShowLog = true;
17401739
}
1741-
else if( logEntry.logTypeSpriteRepresentation == warningLog )
1740+
else if( logEntry.logType == LogType.Warning )
17421741
{
17431742
if( isWarningEnabled )
17441743
shouldShowLog = true;

0 commit comments

Comments
 (0)