-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
#324 User defined auto ally presets #329
base: develop
Are you sure you want to change the base?
Conversation
cfd9e35
to
893fcd6
Compare
Nightly build for this pull request:
|
893fcd6
to
a121293
Compare
|
||
namespace DTAClient.DXGUI.Multiplayer.CnCNet | ||
{ | ||
public class TeamStartMappingPresetsWindow : XNAWindow |
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 not sure but maybe it's better to use the new INItializable window?
private void RefreshDefaultCheckBox() | ||
{ | ||
chkBoxSetDefault.Checked = SelectedTeamStartMappingPreset?.IsDefaultForMap ?? false; | ||
} |
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.
Expression body would be good here.
"Are you sure you want to delete this preset?".L10N("UI:AutoAllyPresetWindow:ConfirmPresetDeleteText") + "\n\n" + selectedItem.Text); | ||
messageBox.YesClickedAction = box => |
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.
"Are you sure you want to delete this preset?".L10N("UI:AutoAllyPresetWindow:ConfirmPresetDeleteText") + "\n\n" + selectedItem.Text); | |
messageBox.YesClickedAction = box => | |
"Are you sure you want to delete this preset?".L10N("UI:AutoAllyPresetWindow:ConfirmPresetDeleteText") + "\n\n" + selectedItem.Text); | |
messageBox.YesClickedAction = box => |
btnEditCustomPreset = new XNAClientButton(WindowManager); | ||
btnEditCustomPreset.Name = nameof(btnEditCustomPreset); | ||
btnEditCustomPreset.ClientRectangle = new Rectangle(ddTeamStartMappingPreset.Right + 2, ddTeamStartMappingPreset.Y, 22, 22); | ||
btnEditCustomPreset.SetToolTipText("Edit".L10N("UI:Main:BtnEditAutoAllyPresetTooltip")); |
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.
Probably Edit
is generic enough to not have such a complex L10N key.
var teamStartMappings = GetTeamStartMappings(); | ||
if (!teamStartMappings.Any()) | ||
{ | ||
XNAMessageBox.Show(WindowManager, "Cannot Save Presets", "Cannot save auto ally presets without any locations assigned."); |
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.
L10N missing
btnSave = new XNAClientButton(WindowManager); | ||
btnSave.Name = nameof(btnSave); | ||
btnSave.LeftClick += BtnSave_LeftClick; | ||
btnSave.Text = "Save".L10N("UI:AutoAllyPresetWindow:ButtonSave"); |
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.
Probably could use the simple save key as the meaning is pretty generic.
|
||
btnDelete = new XNAClientButton(WindowManager); | ||
btnDelete.Name = nameof(btnDelete); | ||
btnDelete.Text = "Delete".L10N("UI:AutoAllyPresetWindow:ButtonDelete"); |
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.
Ditto
|
||
var btnCancel = new XNAClientButton(WindowManager); | ||
btnCancel.Name = nameof(btnCancel); | ||
btnCancel.Text = "Cancel".L10N("UI:AutoAllyPresetWindow:ButtonCancel"); |
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.
Ditto
ddiCreatePresetItem.Text = "[Create New]".L10N("UI:AutoAllyPresetWindow:CreateNewPreset"); | ||
|
||
ddiSelectPresetItem = new XNADropDownItem(); | ||
ddiSelectPresetItem.Text = "[Select Preset]".L10N("UI:AutoAllyPresetWindow:SelectPreset"); |
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 don't think [
and ]
need to be included in translation.
List<string> mapNames = TeamStartMappingPresets.Keys.ToList(); | ||
for (int i = 0; i < mapNames.Count; i++) |
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.
List<string> mapNames = TeamStartMappingPresets.Keys.ToList(); | |
for (int i = 0; i < mapNames.Count; i++) | |
List<string> mapNames = TeamStartMappingPresets.Keys.ToList(); | |
for (int i = 0; i < mapNames.Count; i++) |
AddOrUpdate(map.IniSafeName, preset); | ||
if (!map.TeamStartMappingPresets.Contains(preset)) | ||
map.TeamStartMappingPresets.Add(preset); | ||
Save(); |
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.
AddOrUpdate(map.IniSafeName, preset); | |
if (!map.TeamStartMappingPresets.Contains(preset)) | |
map.TeamStartMappingPresets.Add(preset); | |
Save(); | |
AddOrUpdate(map.IniSafeName, preset); | |
if (!map.TeamStartMappingPresets.Contains(preset)) | |
map.TeamStartMappingPresets.Add(preset); | |
Save(); |
a121293
to
61360a4
Compare
Summary
Currently, users are limited to auto ally presets where pre-defined (whether in mpmaps.ini or in the .map files). This allows the user to create "user defined" presets as well as mark any preset (user defined or map) as the default for a given map.
User defined presets are prefixed with
[U]
.When a user has specified the
default
preset for a given map, that map will be auto selected when the map is changed and auto allying is enabled.Custom user auto ally presets are stored at
Client/AutoAllyUserPresets.ini
Drop down with custom preset and settings button
Example
AutoAllyUserPresets.ini
contents:Drop down opened with differing preset options
Edit preset with "create" option selected
Edit preset with existing option selected
Edit preset window drop down options
Edit button is disabled when auto allying is disabled
Help window: