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

Color picker update - built-in mod colors and a user palette #13072

Closed
wants to merge 4 commits into from
Closed

Color picker update - built-in mod colors and a user palette #13072

wants to merge 4 commits into from

Conversation

drogoganor
Copy link
Contributor

Hi,

I had a go at updating the color picker. Now it has:

  • A set of preset color swatches for RA1 and TD, (defined in mod.yaml: TeamColorPresets: C4B060, 4494E4, ....)

  • A user-defined palette defined in settings.yaml (Player: CustomColors: 3B99CA, A33BCA, ....)

openra color picker

This is my first time contributing to this project so hopefully I have done it correctly and haven't broken any rules.

I'd also like to know what preset colors were available in d2k, TS, and RA2 so I can add them into the mod.yaml for each of these mods. Does anyone happen to know?

Cheers

Copy link
Member

@atlimit8 atlimit8 left a comment

Choose a reason for hiding this comment

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

You should not have separate commits for fixing the commits you want merged. You can squash commits and amend (to amend to previous commits, use git rebase -i). Every commit is added when a PR is merged and the fix-ups would just be noise.

Aside from tabs/spaces, StyleCop actually complains about a number of things in the Travis continuous integration test.

Judging from all the StyleCop errors and the StyleCop fix-up commit, it appears that you may not have StyleCop/your code editor configured correctly.

You can run make check from the command line in the top directory of your OpenRA clone to find StyleCop format errors.

StyleCop errors from travis-ci log:

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L27: [SA1512] A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L38: [SA1512] A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L80: [SA1515] A single-line comment must be preceded by a blank line or another single-line comment, or must be the first item in its scope. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L88: [SA1508] A closing curly bracket must not be preceded by a blank line.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L27: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L37: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L38: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L80: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L81: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L84: [SA1005] The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.

OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L67: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L97: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L97: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L98: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L98: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L99: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L99: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L100: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L100: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L101: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L101: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L102: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L102: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L103: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L103: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L104: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L104: [SA1001] Invalid spacing around the comma.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L69: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L93: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L123: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L191: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L205: [SP2000] Invalid spacing at the end of the line.

OpenRA.Mods.Common/Widgets/Logic/ColorPickerLogic.cs:L225: [SP2000] Invalid spacing at the end of the line.

Thanks for contributing.


readonly string[] reservedModuleNames = { "Metadata", "Folders", "MapFolders", "Packages", "Rules",
readonly string[] reservedModuleNames = { "Metadata", "Folders", "MapFolders", "Packages", "Rules",
Copy link
Member

Choose a reason for hiding this comment

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

Please don't include tab to space changes. They are not even style fixes, but are comparison noise (extra changes to review).


if (yaml.ContainsKey("TeamColorPresets"))
TeamColorPresets = FieldLoader.GetValue<string[]>("TeamColorPresets", yaml["TeamColorPresets"].Value);
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here for tab -> spaces.

@@ -149,7 +149,8 @@ public class PlayerSettings
public string Name = "Newbie";
public HSLColor Color = new HSLColor(75, 255, 180);
public string LastServer = "localhost:1234";
}
public string[] CustomColors;
}
Copy link
Member

Choose a reason for hiding this comment

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

Same here for tab -> spaces.

int maxCustomColors = 10;

var clearCustomPaletteButton = widget.GetOrNull<ButtonWidget>("CLEAR_CUSTOM_BUTTON");
if (clearCustomPaletteButton != null)
Copy link
Member

Choose a reason for hiding this comment

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

Here is a reason to use tabs; the indentation for if here does not lined up with the rest.


public Action OnClick = () => { };

//protected bool CtrlPressed = false;
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have commented-out code?
If you are unsure about adding code then ask.
If you want to include the commented-out stuff, you can put it in a separate commit here or in a separate branch.

{
presetColors = defaultColorPresets.ToList();
}

Copy link
Member

Choose a reason for hiding this comment

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

The spaces on empty line 123 should be removed.

};

widget.AddChild(newSwatch);

Copy link
Member

Choose a reason for hiding this comment

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

The spaces on empty line 191 should be removed.

int startY = 158;

addSwatchesAction(presetColors, startX, startY, "COLORPRESET", false);

Copy link
Member

Choose a reason for hiding this comment

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

The spaces on empty line 205 should be removed.

i++;
}
}

Copy link
Member

Choose a reason for hiding this comment

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

The spaces on empty line 225 should be removed.


if (mi.Event == MouseInputEvent.Down && !TakeMouseFocus(mi))
return false;

Copy link
Member

Choose a reason for hiding this comment

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

The spaces on empty line 67 should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comprehensive comments. I'll sort these out and give it another go.

return false;
}

}
Copy link
Member

Choose a reason for hiding this comment

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

I missed OpenRA.Mods.Common/Widgets/ColorPaletteSwatchWidget.cs:L88: [SA1508] A closing curly bracket must not be preceded by a blank line. Line 87 should be deleted.

@pchote
Copy link
Member

pchote commented Apr 17, 2017

Any progress here @drogoganor?

It looks like you're having some issues with rebasing, feel free to drop in to the IRC channel if you need some help.

I will have some comments and requests on the UI, but lets get the current set of issues out of the way first.

@drogoganor
Copy link
Contributor Author

drogoganor commented Apr 17, 2017 via email

@pchote
Copy link
Member

pchote commented Apr 26, 2017

Yeah, it's actually quite simple to fix if you know how.
Drop by IRC and someone should be able to help. IRC is mainly active during european evenings, so if nobody is around just try again later.

@GraionDilach
Copy link
Contributor

This will fix #10591.

@pchote
Copy link
Member

pchote commented May 13, 2017

@drogoganor are you still interested in working on this feature?
If not, we can move it to the future milestone for someone else to pick up when they have time and interest.

@drogoganor
Copy link
Contributor Author

drogoganor commented May 15, 2017 via email

@abcdefg30
Copy link
Member

No problem. Just let us know if you want to work on this again.

@abcdefg30 abcdefg30 closed this May 15, 2017
@abcdefg30 abcdefg30 added this to the Future milestone May 15, 2017
@pchote pchote removed this from the Future milestone May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants