Fix form not able to be processed due to invalid values on multiplayer modes and actions
parent
4afafacab0
commit
6939db7829
|
@ -23,16 +23,19 @@
|
|||
|
||||
@foreach (var action in Actions)
|
||||
{
|
||||
|
||||
<tr>
|
||||
<td><input @bind="action.Name" name="Game.Actions[@i].Name" class="form-control" placeholder="Play" /></td>
|
||||
<td><input @bind="action.Path" name="Game.Actions[@i].Path" class="form-control" placeholder="Game.exe" /></td>
|
||||
<td><input @bind="action.Arguments" name="Game.Actions[@i].Arguments" class="form-control" placeholder="Launch Arguments" /></td>
|
||||
<td class="align-middle">
|
||||
<div class="form-check form-switch form-check-inline mb-0">
|
||||
<input @bind="action.PrimaryAction" name="Game.Actions[@i].PrimaryAction" class="form-check-input" type="checkbox" />
|
||||
<div class="form-check form-check-inline mb-0">
|
||||
<input name="Game.Actions[@i].PrimaryAction" class="form-check-input" type="checkbox" checked="@action.PrimaryAction" value="true" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input name="Game.Actions[@i].Game.Id" type="hidden" value="@GameId" />
|
||||
|
||||
<div class="btn-list flex-nowrap justify-content-end">
|
||||
<button class="btn btn-ghost-danger btn-icon" @onclick="() => RemoveAction(i)" type="button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-x" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
|
@ -58,6 +61,7 @@
|
|||
|
||||
@code {
|
||||
[Parameter] public ICollection<Data.Models.Action> Actions { get; set; }
|
||||
[Parameter] public Guid GameId { get; set; }
|
||||
|
||||
private void AddAction()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
<td><input @bind="multiplayerMode.MaxPlayers" name="Game.MultiplayerModes[@i].MaxPlayers" class="form-control" /></td>
|
||||
<td><input @bind="multiplayerMode.Description" name="Game.MultiplayerModes[@i].Description" class="form-control" /></td>
|
||||
<td>
|
||||
<input name="Game.MultiplayerModes[@i].Game.Id" type="hidden" value="@GameId" />
|
||||
|
||||
<div class="btn-list flex-nowrap justify-content-end">
|
||||
<button class="btn btn-ghost-danger btn-icon" @onclick="() => RemoveMode(i)" type="button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-x" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
|
@ -62,6 +64,7 @@
|
|||
|
||||
@code {
|
||||
[Parameter] public ICollection<MultiplayerMode> MultiplayerModes { get; set; }
|
||||
[Parameter] public Guid GameId { get; set; }
|
||||
|
||||
private void AddMode()
|
||||
{
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace LANCommander.Data.Models
|
|||
public class Action : BaseModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Arguments { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string WorkingDirectory { get; set; }
|
||||
public string? Arguments { get; set; }
|
||||
public string? Path { get; set; }
|
||||
public string? WorkingDirectory { get; set; }
|
||||
public bool PrimaryAction { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace LANCommander.Data.Models
|
|||
{
|
||||
public MultiplayerType Type { get; set; }
|
||||
public NetworkProtocol NetworkProtocol { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int MinPlayers { get; set; }
|
||||
public int MaxPlayers { get; set; }
|
||||
public int Spectators { get; set; }
|
||||
|
|
|
@ -84,13 +84,13 @@
|
|||
<h3 class="card-title">Actions</h3>
|
||||
</div>
|
||||
|
||||
<component type="typeof(ActionEditor)" render-mode="Server" param-Actions="Model.Game.Actions" />
|
||||
<component type="typeof(ActionEditor)" render-mode="Server" param-Actions="Model.Game.Actions" param-GameId="Model.Game.Id" />
|
||||
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Multiplayer Modes</h3>
|
||||
</div>
|
||||
|
||||
<component type="typeof(MultiplayerModeEditor)" render-mode="Server" param-MultiplayerModes="Model.Game.MultiplayerModes" />
|
||||
<component type="typeof(MultiplayerModeEditor)" render-mode="Server" param-MultiplayerModes="Model.Game.MultiplayerModes" param-GameId="Model.Game.Id" />
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="d-flex">
|
||||
|
|
Loading…
Reference in New Issue