Skip to content

Commit 0f32fed

Browse files
committed
Renamed directories
1 parent 355eced commit 0f32fed

33 files changed

+357
-8
lines changed
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#if UNITY_EDITOR
2+
using Backtrace.Unity.Model;
3+
using System.IO;
4+
using UnityEditor;
5+
using UnityEngine;
6+
7+
namespace Backtrace.Unity.Editor
8+
{
9+
[CustomEditor(typeof(BacktraceClientConfiguration))]
10+
public class BacktraceClientConfigurationEditor : UnityEditor.Editor
11+
{
12+
public const string LABEL_SERVER_URL = "Server Address";
13+
public const string LABEL_REPORT_PER_MIN = "Reports per minute";
14+
public const string LABEL_HANDLE_UNHANDLED_EXCEPTION = "Handle unhandled exceptions";
15+
16+
private const string CONFIG_NAME = "backtrace_client_config";
17+
18+
public override void OnInspectorGUI()
19+
{
20+
var settings = (BacktraceClientConfiguration)target;
21+
22+
settings.ServerUrl = EditorGUILayout.TextField(LABEL_SERVER_URL, settings.ServerUrl);
23+
settings.UpdateServerUrl();
24+
if (!settings.ValidateServerUrl())
25+
{
26+
EditorGUILayout.HelpBox("Please insert valid Backtrace server url!", MessageType.Error);
27+
}
28+
settings.ReportPerMin = EditorGUILayout.IntField(LABEL_REPORT_PER_MIN, settings.ReportPerMin);
29+
settings.HandleUnhandledExceptions = EditorGUILayout.Toggle(LABEL_HANDLE_UNHANDLED_EXCEPTION, settings.HandleUnhandledExceptions);
30+
}
31+
}
32+
33+
}
34+
35+
#endif

Editor/Menu/BacktraceClientConfigurationEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#if UNITY_EDITOR
2+
using Backtrace.Unity.Model;
3+
using UnityEditor;
4+
using UnityEngine;
5+
6+
namespace Backtrace.Unity.Editor
7+
{
8+
[CustomEditor(typeof(BacktraceClient))]
9+
public class BacktraceClientEditor : UnityEditor.Editor
10+
{
11+
public override void OnInspectorGUI()
12+
{
13+
var component = (BacktraceClient)target;
14+
component.Configuration =
15+
(BacktraceConfiguration)EditorGUILayout.ObjectField(
16+
"Backtrace configuration",
17+
component.Configuration,
18+
typeof(BacktraceConfiguration),
19+
false);
20+
if (component.Configuration != null)
21+
{
22+
BacktraceConfigurationEditor editor = (BacktraceConfigurationEditor)CreateEditor(component.Configuration);
23+
editor.OnInspectorGUI();
24+
if (component.Configuration.Enabled && component.gameObject.GetComponent<BacktraceDatabase>() == null)
25+
{
26+
component.gameObject.AddComponent<BacktraceDatabase>();
27+
}
28+
else if (!component.Configuration.Enabled && component.gameObject.GetComponent<BacktraceDatabase>() != null)
29+
{
30+
DestroyImmediate(component.gameObject.GetComponent<BacktraceDatabase>());
31+
}
32+
}
33+
}
34+
}
35+
36+
}
37+
38+
#endif

Editor/Menu/BacktraceClientEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#if UNITY_EDITOR
2+
using Backtrace.Unity.Model;
3+
using UnityEditor;
4+
using UnityEngine;
5+
6+
namespace Backtrace.Unity.Editor
7+
{
8+
[CustomEditor(typeof(BacktraceConfiguration))]
9+
public class BacktraceConfigurationEditor : UnityEditor.Editor
10+
{
11+
public const string LABEL_SERVER_URL = "Server Address";
12+
public const string LABEL_REPORT_PER_MIN = "Reports per minute";
13+
public const string LABEL_HANDLE_UNHANDLED_EXCEPTION = "Handle unhandled exceptions";
14+
public const string LABEL_ENABLE_DATABASE = "Enable Database";
15+
16+
public const string LABEL_PATH = "Backtrace database path";
17+
public const string LABEL_AUTO_SEND_MODE = "Auto send mode";
18+
public const string LABEL_CREATE_DATABASE_DIRECTORY = "Create database directory";
19+
public const string LABEL_MAX_REPORT_COUNT = "Maximum number of records";
20+
public const string LABEL_MAX_DATABASE_SIZE = "Maximum database size (mb)";
21+
public const string LABEL_RETRY_INTERVAL = "Retry interval";
22+
public const string LABEL_RETRY_LIMIT = "Maximum retries";
23+
public const string LABEL_RETRY_ORDER = "Retry order (FIFO/LIFO)";
24+
25+
public override void OnInspectorGUI()
26+
{
27+
serializedObject.Update();
28+
29+
SerializedProperty serverUrl = serializedObject.FindProperty("ServerUrl");
30+
serverUrl.stringValue = BacktraceConfiguration.UpdateServerUrl(serverUrl.stringValue);
31+
EditorGUILayout.PropertyField(serverUrl, new GUIContent(LABEL_SERVER_URL));
32+
if (!BacktraceConfiguration.ValidateServerUrl(serverUrl.stringValue))
33+
{
34+
EditorGUILayout.HelpBox("Please insert valid Backtrace server url!", MessageType.Error);
35+
}
36+
37+
EditorGUILayout.PropertyField(serializedObject.FindProperty("ReportPerMin"), new GUIContent(LABEL_REPORT_PER_MIN));
38+
39+
40+
SerializedProperty unhandledExceptions = serializedObject.FindProperty("HandleUnhandledExceptions");
41+
EditorGUILayout.PropertyField(unhandledExceptions, new GUIContent(LABEL_HANDLE_UNHANDLED_EXCEPTION));
42+
43+
SerializedProperty enabled = serializedObject.FindProperty("Enabled");
44+
EditorGUILayout.PropertyField(enabled, new GUIContent(LABEL_ENABLE_DATABASE));
45+
46+
if (enabled.boolValue)
47+
{
48+
EditorGUILayout.LabelField("Backtrace Database settings.");
49+
50+
SerializedProperty databasePath = serializedObject.FindProperty("DatabasePath");
51+
EditorGUILayout.PropertyField(databasePath, new GUIContent(LABEL_PATH));
52+
if (string.IsNullOrEmpty(databasePath.stringValue))
53+
{
54+
EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error);
55+
}
56+
57+
SerializedProperty autoSendMode = serializedObject.FindProperty("AutoSendMode");
58+
EditorGUILayout.PropertyField(autoSendMode, new GUIContent(LABEL_AUTO_SEND_MODE));
59+
60+
61+
SerializedProperty createDatabase = serializedObject.FindProperty("CreateDatabase");
62+
EditorGUILayout.PropertyField(createDatabase, new GUIContent(LABEL_CREATE_DATABASE_DIRECTORY));
63+
64+
SerializedProperty maxRecordCount = serializedObject.FindProperty("MaxRecordCount");
65+
EditorGUILayout.PropertyField(maxRecordCount, new GUIContent(LABEL_MAX_REPORT_COUNT));
66+
67+
SerializedProperty maxDatabaseSize = serializedObject.FindProperty("MaxDatabaseSize");
68+
EditorGUILayout.PropertyField(maxDatabaseSize, new GUIContent(LABEL_MAX_DATABASE_SIZE));
69+
70+
SerializedProperty retryInterval = serializedObject.FindProperty("RetryInterval");
71+
EditorGUILayout.PropertyField(retryInterval, new GUIContent(LABEL_RETRY_INTERVAL));
72+
73+
EditorGUILayout.LabelField("Backtrace database require at least one retry.");
74+
SerializedProperty retryLimit = serializedObject.FindProperty("RetryLimit");
75+
EditorGUILayout.PropertyField(retryLimit, new GUIContent(LABEL_RETRY_LIMIT));
76+
77+
SerializedProperty retryOrder = serializedObject.FindProperty("RetryOrder");
78+
EditorGUILayout.PropertyField(retryOrder, new GUIContent(LABEL_RETRY_ORDER));
79+
}
80+
81+
serializedObject.ApplyModifiedProperties();
82+
}
83+
}
84+
85+
}
86+
#endif

Editor/Menu/BacktraceConfigurationEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#if UNITY_EDITOR
2+
using System.IO;
3+
using UnityEditor;
4+
using UnityEngine;
5+
using Backtrace.Unity.Model;
6+
using Backtrace.Unity.Types;
7+
8+
namespace Backtrace.Unity.Editor
9+
{
10+
[CustomEditor(typeof(BacktraceDatabaseConfiguration))]
11+
public class BacktraceDatabaseConfigurationEditor : BacktraceClientConfigurationEditor
12+
{
13+
public const string LABEL_PATH = "Backtrace database path";
14+
public const string LABEL_AUTO_SEND_MODE = "Automatically send";
15+
public const string LABEL_CREATE_DATABASE_DIRECTORY = "Create database directory";
16+
public const string LABEL_MAX_REPORT_COUNT = "Maximum number of records";
17+
public const string LABEL_MAX_DATABASE_SIZE = "Maximum database size (mb)";
18+
public const string LABEL_RETRY_INTERVAL = "Retry interval";
19+
public const string LABEL_RETRY_LIMIT = "Maximum retries";
20+
public const string LABEL_RETRY_ORDER = "Retry order (Stack/Queue)";
21+
22+
public override void OnInspectorGUI()
23+
{
24+
base.OnInspectorGUI();
25+
var settings = (BacktraceDatabaseConfiguration)target;
26+
27+
EditorGUILayout.LabelField("Backtrace Database settings.");
28+
EditorGUILayout.LabelField("If path doesn't exist or is empty, database will be disabled");
29+
settings.DatabasePath = EditorGUILayout.TextField(LABEL_PATH, settings.DatabasePath);
30+
if (!settings.ValidDatabasePath())
31+
{
32+
EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error);
33+
}
34+
settings.AutoSendMode = EditorGUILayout.Toggle(LABEL_AUTO_SEND_MODE, settings.AutoSendMode);
35+
settings.CreateDatabase = EditorGUILayout.Toggle(LABEL_CREATE_DATABASE_DIRECTORY, settings.CreateDatabase);
36+
settings.MaxRecordCount = EditorGUILayout.IntField(LABEL_MAX_REPORT_COUNT, settings.MaxRecordCount);
37+
if(settings.MaxRecordCount< 0)
38+
{
39+
settings.MaxRecordCount = 0;
40+
}
41+
settings.MaxDatabaseSize = EditorGUILayout.LongField(LABEL_MAX_DATABASE_SIZE, settings.MaxDatabaseSize);
42+
if(settings.MaxDatabaseSize < 0)
43+
{
44+
settings.MaxDatabaseSize = 0;
45+
}
46+
47+
48+
settings.RetryInterval = EditorGUILayout.IntField(LABEL_RETRY_INTERVAL, settings.RetryInterval);
49+
EditorGUILayout.LabelField("Backtrace database require at least one retry.");
50+
settings.RetryLimit = EditorGUILayout.IntField(LABEL_RETRY_LIMIT, settings.RetryLimit);
51+
if (settings.RetryLimit < 0)
52+
{
53+
settings.RetryLimit = 1;
54+
}
55+
settings.RetryOrder = (RetryOrder)EditorGUILayout.EnumPopup(LABEL_RETRY_ORDER, settings.RetryOrder);
56+
}
57+
}
58+
59+
}
60+
61+
#endif

Editor/Menu/BacktraceDatabaseConfigurationEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)