-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug switches UI #1696
Merged
Merged
debug switches UI #1696
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
46f95db
debug switches UI
kianzarrin 6700cbb
Merge branch 'master' into DebugSwitches
kianzarrin 108eef9
fix release build
kianzarrin d15c386
Merge branch 'DebugSwitches' of https://github.com/CitiesSkylinesMods…
kianzarrin 9223446
undo change to version
kianzarrin 80a0add
include name space
kianzarrin 4d107d0
bugfix: handler to change actual debug switches.
kianzarrin 50ead20
81795c1
merge
kianzarrin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,26 @@ | ||
#if DEBUG | ||
namespace TrafficManager.UI.DebugSwitches { | ||
using ColossalFramework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using TrafficManager.State; | ||
using TrafficManager.State.ConfigData; | ||
using TrafficManager.UI.Helpers; | ||
|
||
internal class DebugSwitchCheckboxOption : CheckboxOption { | ||
internal DebugSwitch DebugSwitch; | ||
public DebugSwitchCheckboxOption(DebugSwitch sw) | ||
: base(sw.ToString(), Options.PersistTo.Global) { | ||
krzychu124 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DebugSwitch = sw; | ||
Translator = val => val; | ||
Handler = val => DebugSettings.DebugSwitches = DebugSettings.DebugSwitches.SetFlags(DebugSwitch, val); | ||
Label = sw.ToString(); | ||
Refresh(); | ||
} | ||
|
||
public void Refresh() => Value = DebugSwitch.Get(); | ||
} | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why bit flags and not multiple boolean? Is there any need to pack all bits into 1 integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes more sense this way. why to write extra code? why to have code duplication?
and we are not serializing anything anymore so there is no need for array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason is that checking a processor-register wide boolean (64 bit) is faster than reading and masking a bit, with same result. Not important if all code for this is deleted in a Release build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that code won't run in Release build, at least it shouldn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am just trying to keep it simple.