-
Notifications
You must be signed in to change notification settings - Fork 2
Main menu button, and some scrolling #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c13e9da
Better pickup of rimworld paths, with env var option
keyz182 ba095a5
Allow opening from the main menu. Could do with an icon.
keyz182 1e76bc2
Cleanup ready for main menu button
keyz182 e5ac43f
Path cleanup
keyz182 d80b2b2
Update 1.5/Source/.run/RimWorld.run.xml
feldoh 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
Binary file not shown.
This file contains hidden or 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,11 @@ | ||
| <component name="ProjectRunConfigurationManager"> | ||
| <configuration default="false" name="RimWorld" type="RimworldRunConfiguration" factoryName="RimworldRunConfiguration"> | ||
| <option name="commandLineOptions" value="" /> | ||
| <option name="modListPath" value="$PROJECT_DIR$/modlist.xml" /> | ||
| <option name="saveFilePath" value="" /> | ||
| <option name="scriptName" value="$RIMWORLD_PATH/RimWorldWin64.exe" /> | ||
| <method v="2"> | ||
| <option name="Build Solution" enabled="true" /> | ||
| </method> | ||
| </configuration> | ||
| </component> |
This file contains hidden or 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 hidden or 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,136 @@ | ||
| using RimWorld; | ||
| using UnityEngine; | ||
| using Verse; | ||
|
|
||
| namespace FactionLoadout; | ||
|
|
||
| public class Dialog_FactionLoadout : Window | ||
| { | ||
| public override Vector2 InitialSize => new Vector2(800f, 600f); | ||
| public Vector2 scrollPosition = Vector2.zero; | ||
|
|
||
| public Dialog_FactionLoadout() | ||
| { | ||
| doCloseButton = true; | ||
| doCloseX = true; | ||
| forcePause = true; | ||
| absorbInputAroundWindow = true; | ||
| } | ||
|
|
||
| public override void DoWindowContents(Rect inRect) | ||
| { | ||
| int presetHeight = (Preset.LoadedPresets.Count + 1) * 30; | ||
| int restHeight = 300; // Adjust this value as needed | ||
|
|
||
| float scrollViewHeight = presetHeight + restHeight; | ||
|
|
||
| Rect viewRect = new Rect(0, 0, inRect.width - 20, scrollViewHeight); | ||
| Rect viewPortRect = new Rect(0, 30, inRect.width, inRect.height-70); | ||
| scrollPosition = GUI.BeginScrollView(viewPortRect, scrollPosition, viewRect); | ||
| Listing_Standard ui = new Listing_Standard(); | ||
|
|
||
| try{ | ||
|
|
||
| ui.Begin(viewRect); | ||
|
|
||
| ui.Label("FactionLoadout_Settings_FactionPresetDesc".Translate()); | ||
| ui.GapLine(); | ||
|
|
||
|
|
||
| ui.CheckboxLabeled( | ||
| "FactionLoadout_Settings_VanillaRestrictions".Translate(), | ||
| ref MySettings.VanillaRestrictions, | ||
| "FactionLoadout_Settings_VanillaRestrictionsDesc".Translate() | ||
| ); | ||
| ui.GapLine(); | ||
| ui.CheckboxLabeled( | ||
| "FactionLoadout_Settings_Verbose".Translate(), | ||
| ref MySettings.VerboseLogging, | ||
| "FactionLoadout_Settings_VerboseDesc".Translate() | ||
| ); | ||
| ui.CheckboxLabeled( | ||
| "FactionLoadout_Settings_PatchKindInRequests".Translate(), | ||
| ref MySettings.PatchKindInRequests, | ||
| "FactionLoadout_Settings_PatchKindInRequestsDesc".Translate() | ||
| ); | ||
| ui.GapLine(); | ||
| ui.Label("FactionLoadout_Settings_FactionPresetDesc".Translate()); | ||
| ui.GapLine(); | ||
|
|
||
| bool deleteMode = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); | ||
| Preset toDelete = null; | ||
|
|
||
| foreach (Preset preset in Preset.LoadedPresets) | ||
| { | ||
| Rect area = ui.GetRect(30); | ||
| area.width = 80; | ||
|
|
||
| bool active = MySettings.ActivePreset == preset.GUID; | ||
|
|
||
| GUI.color = active ? Color.green : Color.red; | ||
| bool currentActive = active; | ||
| Widgets.CheckboxLabeled(area, "Active".Translate().CapitalizeFirst(), ref active, | ||
| placeCheckboxNearText: true); | ||
| if (currentActive != active) | ||
| MySettings.ActivePreset = active ? preset.GUID : null; | ||
|
|
||
| GUI.color = Color.white; | ||
| area.x += 90; | ||
| GUI.color = deleteMode ? Color.red : Color.white; | ||
| if (Widgets.ButtonText(area, | ||
| deleteMode ? "Delete".Translate().CapitalizeFirst() : "Edit".Translate().CapitalizeFirst())) | ||
| { | ||
| if (!deleteMode) | ||
| { | ||
| PresetUI.OpenEditor(preset); | ||
| Find.WindowStack.WindowOfType<Dialog_ModSettings>()?.Close(); | ||
| Find.WindowStack.WindowOfType<Dialog_Options>()?.Close(); | ||
| } | ||
| else | ||
| { | ||
| toDelete = preset; | ||
| } | ||
| } | ||
|
|
||
| GUI.color = Color.white; | ||
|
|
||
| area.x += 90; | ||
| area.width = 9999; | ||
| Widgets.Label(area, preset.Name); | ||
| } | ||
|
|
||
| if (toDelete != null) | ||
| Preset.DeletePreset(toDelete); | ||
|
|
||
| if (Preset.LoadedPresets.EnumerableNullOrEmpty()) | ||
| ui.Label("FactionLoadout_NothingHere".Translate()); | ||
|
|
||
| ui.GapLine(); | ||
| if (ui.ButtonText("FactionLoadout_CreateNewPreset".Translate())) | ||
| { | ||
| Preset preset = new(); | ||
| Preset.AddNewPreset(preset); | ||
| preset.Save(); | ||
|
|
||
| MySettings.ActivePreset = preset.GUID; | ||
|
|
||
| PresetUI.OpenEditor(preset); | ||
|
|
||
| Find.WindowStack.WindowOfType<Dialog_ModSettings>()?.Close(); | ||
| Find.WindowStack.WindowOfType<Dialog_Options>()?.Close(); | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| ui.End(); | ||
| GUI.EndScrollView(); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| public override void PostClose() | ||
| { | ||
| base.PostClose(); | ||
| Find.WindowStack.WindowOfType<PresetUI>()?.Close(); | ||
| } | ||
| } |
This file contains hidden or 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
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.
This whole class confuses me, this is damn near a copy paste of the main ModCore DoSettingsWindowContents but without the settings at the top?
a) why the lack of settings
b) why the copy pasta? if it's just being triggered from two different places, extract that into a separate method and just call it from both places?
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.
First pass just to get it working, and a base for cleanup.
For the settings specifically, I figured semantically they belong in the settings so would putting them here make sense? But in that vein, I guess this is all settings, so maybe it doesn't matter.
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.
Basically, this class can be ignored for now as I intend to overhaul it. Then when it's good, I can redirect the settings to the same place.