-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified crew assignments; Ships can have crew manifests of player ch…
…aracters
- Loading branch information
Showing
8 changed files
with
194 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,75 @@ | ||
@inject AppData Data; | ||
|
||
<Popup @ref="popup"> | ||
<div class="w3-panel typeface"> | ||
Characters can be assigned to different roles onboard various vessels throughout starfleet. Use this dialog to change a character's assignment or assigned vessel among the various player vessels. | ||
</div> | ||
<div class="w3-padding" style="max-height: 50vh; overflow: auto;"> | ||
<label>Role</label> | ||
<select @bind="nextAssignment" class="w3-black w3-input lcars-border-primary"> | ||
@foreach (var group in Assignments.EnumerateByDepartment()) { | ||
<optgroup label=@group.Key> | ||
@foreach (var assignment in group.Value) { | ||
<option>@assignment.Name</option> | ||
} | ||
</optgroup> | ||
} | ||
</select> | ||
<p class="w3-container"> | ||
@Assignments.EnumerateAll().Where(a => a.Name == nextAssignment).FirstOrDefault()?.Description | ||
</p> | ||
<label>Onboard</label> | ||
<select @bind="assignmentVessel" class="w3-black w3-input lcars-border-primary"> | ||
<option value="null" selected>no vessel</option> | ||
@foreach (var vessel in Data.Ships) { | ||
<option>@vessel.Name</option> | ||
} | ||
</select> | ||
</div> | ||
<div class="w3-row"> | ||
<div class="w3-col s6 w3-left-align"> | ||
<button class="w3-red" @onclick=@(() => Close())> | ||
Cancel | ||
</button> | ||
</div> | ||
<div class="w3-col s6 w3-right-align"> | ||
<button class="w3-green" @onclick=@(() => Save())> | ||
Change Assignment | ||
</button> | ||
</div> | ||
</div> | ||
</Popup> | ||
|
||
@code { | ||
Popup popup; | ||
private Character Character {get; set;} | ||
[Parameter] public Action OnSave {get; set;} | ||
|
||
private string nextAssignment; | ||
private string assignmentVessel; | ||
|
||
public void Open(Character character) { | ||
this.Character = character; | ||
nextAssignment = character.Assignment; | ||
assignmentVessel = character.VesselAssignedTo; | ||
popup.Open(); | ||
StateHasChanged(); | ||
} | ||
|
||
public void Close() { | ||
popup.Close(); | ||
StateHasChanged(); | ||
} | ||
|
||
private void Save() { | ||
if (Character != null && !string.IsNullOrEmpty(nextAssignment)) { | ||
Character.Assignment = nextAssignment; | ||
if (assignmentVessel == "null") { | ||
assignmentVessel = null; | ||
} | ||
Character.VesselAssignedTo = assignmentVessel; | ||
Close(); | ||
OnSave?.Invoke(); | ||
} | ||
} | ||
} |
This file contains 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 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.