Skip to content
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

Project Refactoring #59

Open
wants to merge 37 commits into
base: dev
Choose a base branch
from
Open

Project Refactoring #59

wants to merge 37 commits into from

Conversation

mzxrules
Copy link

@mzxrules mzxrules commented Jun 23, 2019

This expands on the code from #55

  • Split UI and business logic into separate projects "WinForms" and "MMR Lib" respectively
  • Changed WinForms to target .net Framework 4.8, and changed MMR Lib to target .net standard 2.0. This breaks XP support, but opens up the possibility of supporting non-Windows platforms
  • Rewrite MainForm.cs ui to be data driven, interfacing with the Settings object
  • The Settings object has been overhauled to support the data driven main form, save serialization, and seed "salting"
    • MainForm settings can now be saved, as settings.json
      • Because of this, loading in a settings string has been temporarily removed
    • Random is no longer initialized directly by the seed. Instead it is seeded by computing a hash of Setting's base class GenerationSettings, which stores all settings that should be used to force a new randomization
  • Refactor sequence randomization code to no longer use staticly defined lists
  • Refactor SEQ.txt to sequence.json

@@ -19,7 +19,7 @@ public class ValueSwap
public static void ReadEnemyList()
{
EnemyList = new List<Enemy>();
string[] lines = Properties.Resources.ENEMIES.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
string[] lines = Resources.GetTextFile("ENEMIES.txt").Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean ENEMIES.txt (and other resource files) are now included as files instead of being part of the application? Not sure I like the idea of people fiddling with the resource files.

Copy link
Author

@mzxrules mzxrules Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In general, I think most people will avoid touching them out of fear of breaking the program. I also haven't heard of it being a huge problem in OoTR, even though most releases have always distributed the entire source code because the program is coded in Python (though I also don't pay attention to the support channels at all, so I could be wrong on that).

Still, i could make it an embedded file and do some reflection magic to retrieve it

Casual,
[Description("Glitched Logic")]
Glitched,
[Description("Vanilla Logic")]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is "Vanilla Logic" an appropriate name? the old name was "Vanilla Layout" which makes sense since none of the items are moved.

Copy link
Author

@mzxrules mzxrules Jun 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it because it seemed like a consistency thing, but you're right. I think changing it to "Vanilla Item Placement" would be more descriptive.

mmr-lib/Models/Settings/LogicMode.cs Outdated Show resolved Hide resolved
{
SetField(ref useCustomItemList, value);

//Todo: enable/disable ui elements instead, then have a "validate" stage for generating settings
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an important todo to do?

Copy link
Author

@mzxrules mzxrules Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a "validate" stage right now is not super important because we only have the one gui for now, but technically with the core logic being in it's own library now, it should be more responsible in managing it's own state within the mmr lib, and not the gui.

Edit: i see the segment of code this comment is on. So the issue here is that ui wise toggling the UseCustomItemList element will cause the ui to forget the user's settings for the other options, which is unexpected and undesirable. A better way would be to instead make it so that toggling UseCustomItemList will toggle the dependent Enable properties on the UI to avoid altering the backing settings.

mmr-lib/Models/Settings/Settings.cs Outdated Show resolved Hide resolved
mmr-lib/Templates/T4Extensions.cs Show resolved Hide resolved
mmr-lib/Utils/SequenceUtils.cs Outdated Show resolved Hide resolved
mmr-lib/Utils/SpoilerUtils.cs Show resolved Hide resolved
@@ -38,14 +38,17 @@ private void InitializeComponent()
this.cUserItems = new System.Windows.Forms.CheckBox();
this.tSettings = new System.Windows.Forms.TabControl();
this.tabROMSettings = new System.Windows.Forms.TabPage();
this.cPatch = new System.Windows.Forms.CheckBox();
this.label9 = new System.Windows.Forms.Label();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer that labels have proper names.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried, but i'm not particularly motivated to give names to ui elements that aren't being altered programmatically.

winform/Forms/MainForm.Designer.cs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants