-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Include UnityDebugger * Remove Uberlogger * Replace old Uberlogger calls * gitignore ChannelSettings.asset * Add Scrollbar to window * Change to vertical orientation
- Loading branch information
Showing
149 changed files
with
384 additions
and
5,363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#region License | ||
// ==================================================== | ||
// Project Porcupine Copyright(C) 2016 Team Porcupine | ||
// This program comes with ABSOLUTELY NO WARRANTY; This is free software, | ||
// and you are welcome to redistribute it under certain conditions; See | ||
// file LICENSE, which is part of this source code package, for details. | ||
// ==================================================== | ||
#endregion | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public class DebuggerChannelControl : EditorWindow | ||
{ | ||
private EditorWindow window; | ||
|
||
private bool allState; | ||
private bool allPreveState; | ||
private ChannelSettingsSO channelSettings; | ||
private Vector2 scrollViewVector = Vector2.down; | ||
|
||
[MenuItem("Window/Debugger Channel Control")] | ||
public static void ShowWindow() | ||
{ | ||
GetWindow(typeof(DebuggerChannelControl)); | ||
} | ||
|
||
private void Awake() | ||
{ | ||
channelSettings = Resources.Load<ChannelSettingsSO>("ChannelSettings"); | ||
if (channelSettings == null) | ||
{ | ||
channelSettings = ScriptableObject.CreateInstance<ChannelSettingsSO>(); | ||
AssetDatabase.CreateAsset(channelSettings, "Assets/Resources/ChannelSettings.asset"); | ||
AssetDatabase.SaveAssets(); | ||
} | ||
|
||
allState = channelSettings.DefaultState; | ||
allPreveState = allState; | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
bool dirtySettings = false; | ||
scrollViewVector = GUILayout.BeginScrollView(scrollViewVector); | ||
EditorGUILayout.BeginVertical("Box"); | ||
bool allStateChanged = false; | ||
allState = GUILayout.Toggle(allState, "All"); | ||
|
||
if (allState != allPreveState) | ||
{ | ||
allPreveState = allState; | ||
allStateChanged = true; | ||
channelSettings.DefaultState = allState; | ||
dirtySettings = true; | ||
} | ||
|
||
if (UnityDebugger.Debugger.Channels != null) | ||
{ | ||
Dictionary<string, bool> toggleReturns = new Dictionary<string, bool>(); | ||
foreach (string channelName in UnityDebugger.Debugger.Channels.Keys.AsEnumerable()) | ||
{ | ||
toggleReturns.Add(channelName, GUILayout.Toggle(UnityDebugger.Debugger.Channels[channelName], channelName)); | ||
if (allStateChanged) | ||
{ | ||
toggleReturns[channelName] = allState; | ||
} | ||
} | ||
|
||
foreach (string channelName in toggleReturns.Keys.ToList()) | ||
{ | ||
UnityDebugger.Debugger.Channels[channelName] = toggleReturns[channelName]; | ||
|
||
if (channelSettings == null) | ||
{ | ||
// We're in a weird state with no channelSettings, just bail 'til we get it back. | ||
return; | ||
} | ||
|
||
if (!channelSettings.ChannelState.ContainsKey(channelName) && toggleReturns.ContainsKey(channelName)) | ||
{ | ||
bool theValueIWant = toggleReturns[channelName]; | ||
channelSettings.ChannelState.Add(channelName, theValueIWant); | ||
dirtySettings = true; | ||
} | ||
else if (channelSettings.ChannelState[channelName] != toggleReturns[channelName]) | ||
{ | ||
channelSettings.ChannelState[channelName] = toggleReturns[channelName]; | ||
dirtySettings = true; | ||
} | ||
} | ||
} | ||
|
||
if (dirtySettings) | ||
{ | ||
EditorUtility.SetDirty(channelSettings); | ||
} | ||
|
||
EditorGUILayout.EndVertical(); | ||
GUILayout.EndScrollView(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
Assets/UberLogger/UberLoggerFile.cs.meta → Assets/Editor/DebuggerChannelControl.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.