-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugPanelSave.cs
More file actions
120 lines (93 loc) · 2.37 KB
/
Copy pathDebugPanelSave.cs
File metadata and controls
120 lines (93 loc) · 2.37 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Linq;
namespace DebugPanels
{
public class DebugPanelSave : ScriptableObject
{
#if UNITY_EDITOR
#region Variables
public List<LogGroup> LogGroups = new List<LogGroup>();
public bool Changed = true;
#endregion
#region Methods
public LogGroup GetLogGroup(string _name)
{
return LogGroups.Find(x => x.Name == _name);
}
public LogGroup CreateLogGroup(string _name)
{
LogGroup b_LogGroup = new LogGroup(_name);
LogGroups.Add(b_LogGroup);
OrderLogGroups();
return b_LogGroup;
}
public LogGroup GetOrCreateLogGroup(string _name)
{
LogGroup b_LogGroup = LogGroups.Find(x => x.Name == _name);
if (b_LogGroup == null)
{
b_LogGroup = new LogGroup(_name);
LogGroups.Add(b_LogGroup);
OrderLogGroups();
}
return b_LogGroup;
}
private void OrderLogGroups()
{
LogGroups = LogGroups.OrderBy(x => x.Name).ToList();
}
public void Clear()
{
LogGroups.Clear();
Changed = true;
}
#endregion
#endif
}
[Serializable]
public class LogGroup
{
#region Variables
public string Name;
public List<Log> Logs;
#endregion
#region Constructor
public LogGroup(string _name)
{
Name = _name;
Logs = new List<Log>();
}
#endregion
#region Methods
public Log GetLog(string _key)
{
return Logs.Find(x => x.Key == _key);
}
public void Log(string _key, string _value)
{
Log b_log = Logs.Find(x => x.Key == _key);
if (b_log == null)
Logs.Add(new Log(_key, _value));
else
b_log.Value = _value;
}
#endregion
}
[Serializable]
public class Log
{
#region Variables
public string Key;
public string Value;
#endregion
#region Constructor
public Log(string _key, string _value)
{
Key = _key;
Value = _value;
}
#endregion
}
}