improvements
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
@namespace Faraon.Client.Components
|
||||
@using Faraon.Core.AI
|
||||
|
||||
<div class="lobby-screen">
|
||||
<div class="lobby-container">
|
||||
<div class="lobby-header">
|
||||
<div class="lobby-logo-wrapper">
|
||||
<img src="assets/logo/logo_2_modern.jpg" class="lobby-logo-img" alt="FARAÓN Logo" />
|
||||
</div>
|
||||
<h1 class="lobby-title">FARAÓN</h1>
|
||||
<div class="lobby-subtitle">Tradičná mariášová kartová hra s moderným nábojom</div>
|
||||
</div>
|
||||
@@ -43,13 +47,14 @@
|
||||
<option value="@PlayerType.AI">🤖 AI Počítač</option>
|
||||
</select>
|
||||
|
||||
<!-- Obtiažnosť AI (ak je AI) -->
|
||||
<!-- Výber AI osobnosti a obtiažnosti (ak je AI) -->
|
||||
@if (p.Type == PlayerType.AI)
|
||||
{
|
||||
<select class="player-setup-select" @bind="p.Difficulty">
|
||||
<option value="@AIDifficulty.Easy">🌱 Začiatočník (Ľahký)</option>
|
||||
<option value="@AIDifficulty.Medium">⚔️ Taktik (Stredný)</option>
|
||||
<option value="@AIDifficulty.Hard">🔥 Veľmajster (Ťažký)</option>
|
||||
<select class="player-setup-select" style="font-weight: 700; color: var(--gold);" value="@(p.PersonalityId ?? "fox")" @onchange="(e) => SelectPersonality(idx, e.Value?.ToString())">
|
||||
@foreach (var pers in AIPersonality.All)
|
||||
{
|
||||
<option value="@pers.Id">@pers.BaseAvatar @pers.Name (@GetDiffLabel(pers.Difficulty))</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</div>
|
||||
@@ -255,9 +260,9 @@
|
||||
private List<Player> PlayerConfigs = new()
|
||||
{
|
||||
new Player("Ty (Hráč 1)", PlayerType.Human, "👑"),
|
||||
new Player("AI Jano", PlayerType.AI, "🦊", AIDifficulty.Medium),
|
||||
new Player("AI Zuzka", PlayerType.AI, "👸", AIDifficulty.Hard),
|
||||
new Player("AI Mišo", PlayerType.AI, "🤖", AIDifficulty.Easy)
|
||||
new Player(AIPersonality.Fox.Name, PlayerType.AI, AIPersonality.Fox.BaseAvatar, AIPersonality.Fox.Difficulty, AIPersonality.Fox.Id),
|
||||
new Player(AIPersonality.Queen.Name, PlayerType.AI, AIPersonality.Queen.BaseAvatar, AIPersonality.Queen.Difficulty, AIPersonality.Queen.Id),
|
||||
new Player(AIPersonality.Robot.Name, PlayerType.AI, AIPersonality.Robot.BaseAvatar, AIPersonality.Robot.Difficulty, AIPersonality.Robot.Id)
|
||||
};
|
||||
|
||||
private void SetPlayerCount(int count)
|
||||
@@ -272,10 +277,27 @@
|
||||
PlayerConfigs[index].Avatar = Avatars[nextIdx];
|
||||
}
|
||||
|
||||
private void SelectPersonality(int index, string? personalityId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(personalityId)) return;
|
||||
var pers = AIPersonality.GetById(personalityId);
|
||||
PlayerConfigs[index].PersonalityId = pers.Id;
|
||||
PlayerConfigs[index].Name = pers.Name;
|
||||
PlayerConfigs[index].Avatar = pers.BaseAvatar;
|
||||
PlayerConfigs[index].Difficulty = pers.Difficulty;
|
||||
}
|
||||
|
||||
private string GetDiffLabel(AIDifficulty diff) => diff switch
|
||||
{
|
||||
AIDifficulty.Easy => "Ľahký",
|
||||
AIDifficulty.Hard => "Veľmajster",
|
||||
_ => "Taktik"
|
||||
};
|
||||
|
||||
private async Task StartGame()
|
||||
{
|
||||
var activePlayers = PlayerConfigs.Take(SelectedPlayerCount).Select(p =>
|
||||
new Player(p.Name, p.Type, p.Avatar, p.Difficulty)
|
||||
new Player(p.Name, p.Type, p.Avatar, p.Difficulty, p.PersonalityId)
|
||||
).ToList();
|
||||
|
||||
await OnStartGame.InvokeAsync((activePlayers, Rules));
|
||||
|
||||
Reference in New Issue
Block a user