<DefaultWindow xmlns="https://spacestation14.io"
MinSize="650 290">
<BoxContainer Orientation="Vertical">
+ <!-- Privileged and target IDs, crew manifest button. -->
<GridContainer Columns="2">
<GridContainer Columns="3" HorizontalExpand="True">
<Label Text="{Loc 'id-card-console-window-privileged-id'}" />
</BoxContainer>
</GridContainer>
<Control MinSize="0 8" />
+ <!-- Full name and job title editing. -->
<GridContainer Columns="3" HSeparationOverride="4">
<Label Name="FullNameLabel" Text="{Loc 'id-card-console-window-full-name-label'}" />
<LineEdit Name="FullNameLineEdit" HorizontalExpand="True" />
<Button Name="JobTitleSaveButton" Text="{Loc 'id-card-console-window-save-button'}" Disabled="True" />
</GridContainer>
<Control MinSize="0 8" />
- <GridContainer Columns="2">
- <Label Text="{Loc 'id-card-console-window-job-selection-label'}" />
- <OptionButton Name="JobPresetOptionButton" />
- </GridContainer>
+ <!-- Job preset selection, grant/revoke all access buttons. -->
+ <BoxContainer Margin="0 8 0 4">
+ <BoxContainer>
+ <Label Text="{Loc 'id-card-console-window-job-selection-label'}" />
+ <OptionButton Name="JobPresetOptionButton" />
+ </BoxContainer>
+ <Control HorizontalExpand="True"/>
+ <BoxContainer>
+ <Button Name="SelectAllButton" Text="{Loc 'id-card-console-window-select-all-button'}" />
+ <Button Name="DeselectAllButton" Text="{Loc 'id-card-console-window-deselect-all-button'}" />
+ </BoxContainer>
+ </BoxContainer>
+ <!-- Individual access buttons -->
<Control Name="AccessLevelControlContainer" />
</BoxContainer>
</DefaultWindow>
JobPresetOptionButton.AddItem(Loc.GetString(job.Name), _jobPrototypeIds.Count - 1);
}
+ SelectAllButton.OnPressed += _ =>
+ {
+ SetAllAccess(true);
+ SubmitData();
+ };
+
+ DeselectAllButton.OnPressed += _ =>
+ {
+ SetAllAccess(false);
+ SubmitData();
+ };
+
JobPresetOptionButton.OnItemSelected += SelectJobPreset;
_accessButtons.Populate(accessLevels, prototypeManager);
AccessLevelControlContainer.AddChild(_accessButtons);
}
}
- private void ClearAllAccess()
+ /// <param name="enabled">If true, every individual access button will be pressed. If false, each will be depressed.</param>
+ private void SetAllAccess(bool enabled)
{
foreach (var button in _accessButtons.ButtonsList.Values)
{
- if (button.Pressed)
- {
- button.Pressed = false;
- }
+ if (!button.Disabled && button.Pressed != enabled)
+ button.Pressed = enabled;
}
}
JobTitleLineEdit.Text = Loc.GetString(job.Name);
args.Button.SelectId(args.Id);
- ClearAllAccess();
+ SetAllAccess(false);
// this is a sussy way to do this
foreach (var access in job.Access)
id-card-console-window-job-title-label = Job title:
id-card-console-window-eject-button = Eject
id-card-console-window-insert-button = Insert
-id-card-console-window-job-selection-label = Job presets (sets department and job icon):
+id-card-console-window-job-selection-label = Job preset (sets department and job icon):
+id-card-console-window-select-all-button = Grant all
+id-card-console-window-deselect-all-button = Revoke all
access-id-card-console-component-no-hands-error = You have no hands.
id-card-console-privileged-id = Privileged ID