Add metadata for new gacha assets and implement gacha system scaffolding.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6c581de5a6bcbc73a451ce3906547bc
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73880a4e893003d719622694aa5ffc02
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b02ec0c6f7df1d3aa8211567c3ec2a3
|
||||
@@ -0,0 +1,487 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using KernelPanic.Data;
|
||||
using KernelPanic.Meta;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace KernelPanic.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Renders banner selection and pull controls for the gacha screen.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class GachaScreenController
|
||||
{
|
||||
private const string SelectedClassName = "selected";
|
||||
|
||||
private readonly List<VisualElement> bannerRows = new();
|
||||
private readonly string[] bannerIds =
|
||||
{
|
||||
GachaService.BeginnerBannerId,
|
||||
GachaService.StandardBannerId,
|
||||
GachaService.LimitedBannerId
|
||||
};
|
||||
|
||||
private VisualElement bannerList;
|
||||
private VisualElement bannerDetail;
|
||||
private DistroDatabase distroDatabase;
|
||||
private FontAsset monospaceFont;
|
||||
private GachaService gachaService;
|
||||
private PlayerCollection playerCollection;
|
||||
private EntropyWallet wallet;
|
||||
private Action onChanged;
|
||||
private Action requestRootCreditExchange;
|
||||
private int selectedBannerIndex;
|
||||
private int pendingPullCount;
|
||||
private int pendingMissingTokens;
|
||||
private bool hasOpened;
|
||||
private string resultBannerId;
|
||||
private string resultText;
|
||||
|
||||
public void Bind(VisualElement root, DistroDatabase database, FontAsset artFont, GachaService service, PlayerCollection collection, EntropyWallet entropyWallet, Action changedCallback, Action rootCreditExchangeCallback)
|
||||
{
|
||||
distroDatabase = database;
|
||||
monospaceFont = artFont;
|
||||
gachaService = service;
|
||||
playerCollection = collection;
|
||||
wallet = entropyWallet;
|
||||
onChanged = changedCallback;
|
||||
requestRootCreditExchange = rootCreditExchangeCallback;
|
||||
bannerList = root.Q<VisualElement>("GachaBannerList");
|
||||
bannerDetail = root.Q<VisualElement>("GachaBannerDetail");
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
if (!hasOpened)
|
||||
{
|
||||
selectedBannerIndex = 0;
|
||||
hasOpened = true;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (bannerList == null || bannerDetail == null || gachaService == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bannerRows.Clear();
|
||||
bannerList.Clear();
|
||||
|
||||
for (int i = 0; i < bannerIds.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
VisualElement row = BuildBannerRow(bannerIds[i]);
|
||||
row.RegisterCallback<ClickEvent>(_ => SelectBanner(index));
|
||||
bannerList.Add(row);
|
||||
bannerRows.Add(row);
|
||||
}
|
||||
|
||||
selectedBannerIndex = Mathf.Clamp(selectedBannerIndex, 0, bannerRows.Count - 1);
|
||||
ApplySelectedBanner();
|
||||
}
|
||||
|
||||
public void HandleKeyDown(KeyDownEvent evt)
|
||||
{
|
||||
// Pulls are deliberately click-only to avoid accidental currency spend.
|
||||
}
|
||||
|
||||
private VisualElement BuildBannerRow(string bannerId)
|
||||
{
|
||||
VisualElement row = new();
|
||||
row.AddToClassList("gacha-banner-row");
|
||||
|
||||
row.Add(new Label(">") { name = $"GachaBannerCursor_{bannerId}" });
|
||||
row.ElementAt(0).AddToClassList("command-cursor");
|
||||
|
||||
row.Add(new Label(GetBannerTitle(bannerId)) { name = $"GachaBannerName_{bannerId}" });
|
||||
row.ElementAt(1).AddToClassList("command-text");
|
||||
|
||||
row.Add(new Label(GetBannerStatus(bannerId)) { name = $"GachaBannerStatus_{bannerId}" });
|
||||
row.ElementAt(2).AddToClassList("command-description");
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
private void SelectBanner(int index)
|
||||
{
|
||||
if (bannerRows.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
selectedBannerIndex = (index + bannerRows.Count) % bannerRows.Count;
|
||||
ApplySelectedBanner();
|
||||
}
|
||||
|
||||
private void ApplySelectedBanner()
|
||||
{
|
||||
for (int i = 0; i < bannerRows.Count; i++)
|
||||
{
|
||||
bool selected = i == selectedBannerIndex;
|
||||
bannerRows[i].EnableInClassList(SelectedClassName, selected);
|
||||
bannerRows[i].Q<Label>(className: "command-cursor").visible = selected;
|
||||
}
|
||||
|
||||
RenderSelectedBanner();
|
||||
}
|
||||
|
||||
private void RenderSelectedBanner()
|
||||
{
|
||||
bannerDetail.Clear();
|
||||
string bannerId = bannerIds[selectedBannerIndex];
|
||||
if (bannerId == GachaService.BeginnerBannerId)
|
||||
{
|
||||
RenderBeginnerBanner();
|
||||
return;
|
||||
}
|
||||
|
||||
RenderFutureBanner(bannerId);
|
||||
}
|
||||
|
||||
private void RenderBeginnerBanner()
|
||||
{
|
||||
GachaBannerState state = gachaService.BeginnerState;
|
||||
bannerDetail.Add(BuildBannerHero("beginner install media"));
|
||||
|
||||
Label title = new("beginner install media");
|
||||
title.AddToClassList("gacha-detail-title");
|
||||
bannerDetail.Add(title);
|
||||
|
||||
bannerDetail.Add(BuildInfoLine("entropy", wallet == null ? "--" : wallet.Balance.ToString()));
|
||||
bannerDetail.Add(BuildInfoLine("pulls", $"{state.totalPulls}/{GachaService.BeginnerMaxPulls}"));
|
||||
bannerDetail.Add(BuildInfoLine("4-star pity", $"{state.pityCounter}/{GachaService.FourStarHardPity}"));
|
||||
bannerDetail.Add(BuildInfoLine("ten pull", $"{GachaService.BeginnerTenPullCost} stable-pull-tokens for 10 pulls"));
|
||||
bannerDetail.Add(BuildInfoLine("guarantees", FormatBeginnerGuarantees()));
|
||||
|
||||
Label rules = new("Base result is a 3-star equipment cache. A 4-star equipment cache or starter distro can appear early, with one 4-star+ result guaranteed every 10 pulls.");
|
||||
rules.AddToClassList("gacha-rules");
|
||||
bannerDetail.Add(rules);
|
||||
|
||||
VisualElement actions = new();
|
||||
actions.AddToClassList("gacha-actions");
|
||||
|
||||
Button singleButton = new(() => RequestPullSelectedBanner(1))
|
||||
{
|
||||
text = $"git pull --single\n1x {GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)}"
|
||||
};
|
||||
singleButton.AddToClassList("terminal-button");
|
||||
singleButton.AddToClassList("gacha-action-button");
|
||||
singleButton.SetEnabled(CanAttemptBeginnerPull(1));
|
||||
actions.Add(singleButton);
|
||||
|
||||
Button tenButton = new(() => RequestPullSelectedBanner(10))
|
||||
{
|
||||
text = $"git pull --ten\n8x {GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)}"
|
||||
};
|
||||
tenButton.AddToClassList("terminal-button");
|
||||
tenButton.AddToClassList("gacha-action-button");
|
||||
tenButton.SetEnabled(CanAttemptBeginnerPull(10));
|
||||
actions.Add(tenButton);
|
||||
|
||||
bannerDetail.Add(actions);
|
||||
|
||||
if (pendingPullCount > 0)
|
||||
{
|
||||
bannerDetail.Add(BuildEntropyPrompt());
|
||||
}
|
||||
|
||||
if (resultBannerId == GachaService.BeginnerBannerId && !string.IsNullOrWhiteSpace(resultText))
|
||||
{
|
||||
Label result = new(resultText);
|
||||
result.AddToClassList("gacha-result");
|
||||
bannerDetail.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderFutureBanner(string bannerId)
|
||||
{
|
||||
bannerDetail.Add(BuildBannerHero(GetBannerTitle(bannerId)));
|
||||
|
||||
Label title = new(GetBannerTitle(bannerId));
|
||||
title.AddToClassList("gacha-detail-title");
|
||||
bannerDetail.Add(title);
|
||||
|
||||
string currency = bannerId == GachaService.StandardBannerId
|
||||
? GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)
|
||||
: GachaService.FormatCurrencyName(GachaCurrencyType.LimitedPull);
|
||||
bannerDetail.Add(BuildInfoLine("pull currency", currency));
|
||||
bannerDetail.Add(BuildInfoLine("status", "not implemented yet"));
|
||||
bannerDetail.Add(BuildInfoLine("pity", "own counter, 10-pull 4-star+ guarantee"));
|
||||
bannerDetail.Add(new Label("Use the beginner implementation as the template: define the banner pool, persist a separate GachaBannerState, then route single/ten pulls through GachaService.") { name = "FutureBannerHint" });
|
||||
bannerDetail.ElementAt(bannerDetail.childCount - 1).AddToClassList("gacha-rules");
|
||||
|
||||
if (resultBannerId == bannerId && !string.IsNullOrWhiteSpace(resultText))
|
||||
{
|
||||
Label result = new(resultText);
|
||||
result.AddToClassList("gacha-result");
|
||||
bannerDetail.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void PullSelectedBanner(int pullCount, int entropyTokenCount)
|
||||
{
|
||||
string bannerId = bannerIds[selectedBannerIndex];
|
||||
if (bannerId != GachaService.BeginnerBannerId)
|
||||
{
|
||||
resultBannerId = bannerId;
|
||||
resultText = $"git pull origin {bannerId}: remote not implemented yet";
|
||||
RenderSelectedBanner();
|
||||
return;
|
||||
}
|
||||
|
||||
GachaPullResult result = gachaService.PerformBeginnerPull(pullCount, wallet, entropyTokenCount);
|
||||
if (!result.Success)
|
||||
{
|
||||
resultBannerId = bannerId;
|
||||
resultText = $"git pull failed: {result.FailureReason}";
|
||||
RenderSelectedBanner();
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> lines = new();
|
||||
lines.Add($"git pull complete: spent {result.CurrencySpent} {GachaService.FormatCurrencyName(result.CurrencyType)}");
|
||||
if (result.EntropySpent > 0)
|
||||
{
|
||||
lines.Add($"entropy fallback: spent {result.EntropySpent} entropy");
|
||||
}
|
||||
|
||||
for (int i = 0; i < result.Rewards.Count; i++)
|
||||
{
|
||||
GachaReward reward = result.Rewards[i];
|
||||
bool duplicate = reward.Distro != null && playerCollection.GetOwnedCount(reward.Distro.Id) > 0;
|
||||
if (reward.Distro != null)
|
||||
{
|
||||
playerCollection.Add(reward.Distro);
|
||||
}
|
||||
|
||||
string suffix = reward.Guaranteed ? " guaranteed" : reward.PityTriggered ? " pity" : string.Empty;
|
||||
string duplicateText = duplicate ? " duplicate" : string.Empty;
|
||||
lines.Add($"{i + 1:00}: {reward.StarRating}-star {reward.DisplayName}{suffix}{duplicateText}");
|
||||
}
|
||||
|
||||
resultBannerId = bannerId;
|
||||
resultText = string.Join("\n", lines);
|
||||
onChanged?.Invoke();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void RequestPullSelectedBanner(int pullCount)
|
||||
{
|
||||
string bannerId = bannerIds[selectedBannerIndex];
|
||||
if (bannerId != GachaService.BeginnerBannerId)
|
||||
{
|
||||
PullSelectedBanner(pullCount, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = gachaService.GetBeginnerPullCost(pullCount);
|
||||
int missingTokens = gachaService.GetMissingPullTokens(GachaCurrencyType.StandardPull, cost);
|
||||
if (missingTokens <= 0)
|
||||
{
|
||||
ClearEntropyPrompt();
|
||||
PullSelectedBanner(pullCount, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gachaService.CanCoverMissingPullTokensWithEntropy(wallet, missingTokens))
|
||||
{
|
||||
if (gachaService.RootCredits > 0)
|
||||
{
|
||||
requestRootCreditExchange?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
resultBannerId = bannerId;
|
||||
resultText = $"git pull failed: need {missingTokens} {GachaService.FormatCurrencyName(GachaCurrencyType.StandardPull)} or {missingTokens * GachaService.EntropyPerPullToken} entropy";
|
||||
RenderSelectedBanner();
|
||||
return;
|
||||
}
|
||||
|
||||
pendingPullCount = pullCount;
|
||||
pendingMissingTokens = missingTokens;
|
||||
resultBannerId = bannerId;
|
||||
resultText = null;
|
||||
RenderSelectedBanner();
|
||||
}
|
||||
|
||||
private VisualElement BuildEntropyPrompt()
|
||||
{
|
||||
VisualElement prompt = new();
|
||||
prompt.AddToClassList("gacha-entropy-prompt");
|
||||
|
||||
int entropyCost = pendingMissingTokens * GachaService.EntropyPerPullToken;
|
||||
Label copy = new($"missing {pendingMissingTokens} stable-pull-token(s). spend {entropyCost} entropy to complete git pull?");
|
||||
copy.AddToClassList("gacha-result");
|
||||
prompt.Add(copy);
|
||||
|
||||
VisualElement actions = new();
|
||||
actions.AddToClassList("gacha-actions");
|
||||
|
||||
Button cancel = new(() =>
|
||||
{
|
||||
ClearEntropyPrompt();
|
||||
RenderSelectedBanner();
|
||||
})
|
||||
{
|
||||
text = "git pull --abort"
|
||||
};
|
||||
cancel.AddToClassList("terminal-button");
|
||||
cancel.AddToClassList("gacha-action-button");
|
||||
actions.Add(cancel);
|
||||
|
||||
Button confirm = new(() =>
|
||||
{
|
||||
int pullCount = pendingPullCount;
|
||||
int missingTokens = pendingMissingTokens;
|
||||
ClearEntropyPrompt();
|
||||
PullSelectedBanner(pullCount, missingTokens);
|
||||
})
|
||||
{
|
||||
text = $"git pull --use-entropy={entropyCost}"
|
||||
};
|
||||
confirm.AddToClassList("terminal-button");
|
||||
confirm.AddToClassList("gacha-action-button");
|
||||
actions.Add(confirm);
|
||||
|
||||
prompt.Add(actions);
|
||||
return prompt;
|
||||
}
|
||||
|
||||
private bool CanAttemptBeginnerPull(int pullCount)
|
||||
{
|
||||
if (gachaService.CanPullBeginner(pullCount, out _))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!gachaService.IsBeginnerBannerAvailable || pullCount > GachaService.BeginnerMaxPulls - gachaService.BeginnerState.totalPulls)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int missingTokens = gachaService.GetMissingPullTokens(GachaCurrencyType.StandardPull, gachaService.GetBeginnerPullCost(pullCount));
|
||||
return missingTokens > 0 &&
|
||||
(gachaService.CanCoverMissingPullTokensWithEntropy(wallet, missingTokens) ||
|
||||
gachaService.RootCredits > 0);
|
||||
}
|
||||
|
||||
private void ClearEntropyPrompt()
|
||||
{
|
||||
pendingPullCount = 0;
|
||||
pendingMissingTokens = 0;
|
||||
}
|
||||
|
||||
private VisualElement BuildBannerHero(string bannerTitle)
|
||||
{
|
||||
VisualElement hero = new();
|
||||
hero.AddToClassList("gacha-hero");
|
||||
|
||||
VisualElement artRow = new();
|
||||
artRow.AddToClassList("gacha-hero-art-row");
|
||||
|
||||
IReadOnlyList<DistroDefinition> distros = distroDatabase == null ? Array.Empty<DistroDefinition>() : distroDatabase.AllDistros;
|
||||
int artCount = Mathf.Min(3, distros.Count);
|
||||
for (int i = 0; i < artCount; i++)
|
||||
{
|
||||
artRow.Add(BuildDistroArtCard(distros[i]));
|
||||
}
|
||||
|
||||
if (artCount == 0)
|
||||
{
|
||||
Label empty = new("ascii art unavailable");
|
||||
empty.AddToClassList("gacha-rules");
|
||||
artRow.Add(empty);
|
||||
}
|
||||
|
||||
Label title = new(bannerTitle);
|
||||
title.AddToClassList("gacha-hero-title");
|
||||
|
||||
hero.Add(artRow);
|
||||
hero.Add(title);
|
||||
return hero;
|
||||
}
|
||||
|
||||
private VisualElement BuildDistroArtCard(DistroDefinition distro)
|
||||
{
|
||||
VisualElement card = new();
|
||||
card.AddToClassList("gacha-art-card");
|
||||
|
||||
VisualElement artShell = new();
|
||||
artShell.AddToClassList("gacha-art-shell");
|
||||
|
||||
Label artLabel = new();
|
||||
DistroArtPresenter.ConfigureArtLabel(artLabel, monospaceFont);
|
||||
artLabel.AddToClassList("gacha-ascii-art");
|
||||
VisualElement placeholder = DistroArtPresenter.CreatePlaceholder();
|
||||
placeholder.AddToClassList("gacha-ascii-placeholder");
|
||||
AsciiArtFitter artFitter = new(artLabel, monospaceFont);
|
||||
artFitter.SetArt(DistroArtPresenter.Render(artLabel, placeholder, distro));
|
||||
if (distro != null)
|
||||
{
|
||||
artLabel.style.color = new StyleColor(distro.AccentColor);
|
||||
}
|
||||
|
||||
artShell.Add(placeholder);
|
||||
artShell.Add(artLabel);
|
||||
card.Add(artShell);
|
||||
|
||||
Label name = new(distro == null ? "--" : DistroPresentation.DisplayName(distro));
|
||||
name.AddToClassList("gacha-art-name");
|
||||
if (distro != null)
|
||||
{
|
||||
name.style.color = new StyleColor(distro.AccentColor);
|
||||
}
|
||||
|
||||
card.Add(name);
|
||||
return card;
|
||||
}
|
||||
|
||||
private string FormatBeginnerGuarantees()
|
||||
{
|
||||
IReadOnlyList<string> ids = gachaService.BeginnerState.guaranteedDistroIds;
|
||||
string first = ids.Count > 0 ? ids[0] : "--";
|
||||
string second = ids.Count > 1 ? ids[1] : "--";
|
||||
return $"20={first}, 40={second}, 50=future standard 5-star";
|
||||
}
|
||||
|
||||
private static VisualElement BuildInfoLine(string key, string value)
|
||||
{
|
||||
VisualElement row = new();
|
||||
row.AddToClassList("kv-row");
|
||||
row.Add(new Label(key) { name = $"Gacha{key}Key" });
|
||||
row.ElementAt(0).AddToClassList("kv-key");
|
||||
row.Add(new Label(value) { name = $"Gacha{key}Value" });
|
||||
row.ElementAt(1).AddToClassList("kv-value");
|
||||
return row;
|
||||
}
|
||||
|
||||
private string GetBannerStatus(string bannerId)
|
||||
{
|
||||
return bannerId switch
|
||||
{
|
||||
GachaService.BeginnerBannerId => gachaService.IsBeginnerBannerAvailable ? $"{gachaService.BeginnerState.totalPulls}/{GachaService.BeginnerMaxPulls}" : "closed",
|
||||
GachaService.StandardBannerId => "soon",
|
||||
GachaService.LimitedBannerId => "soon",
|
||||
_ => "--"
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetBannerTitle(string bannerId)
|
||||
{
|
||||
return bannerId switch
|
||||
{
|
||||
GachaService.BeginnerBannerId => "beginner install media",
|
||||
GachaService.StandardBannerId => "stable branch",
|
||||
GachaService.LimitedBannerId => "feature branch",
|
||||
_ => bannerId
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0915991bbd2d4fb08d438e4fdae30935
|
||||
@@ -34,13 +34,16 @@ namespace KernelPanic.UI
|
||||
bootIntroPlayed = false;
|
||||
}
|
||||
|
||||
[SerializeField] private FontAsset monospaceFont; // TODO: Assign a real monospace FontAsset when typography assets exist.
|
||||
[SerializeField]
|
||||
private FontAsset monospaceFont; // TODO: Assign a real monospace FontAsset when typography assets exist.
|
||||
|
||||
[SerializeField] private string motdBody = "unstable userspace detected; keep a rollback shell open.";
|
||||
[SerializeField] private DistroDatabase distroDatabase;
|
||||
[SerializeField] private CardDatabase cardDatabase;
|
||||
[SerializeField] private FeaturedUnitPanel featuredUnitPanel = new();
|
||||
[SerializeField] private CollectionScreenController collectionScreen = new();
|
||||
[SerializeField] private StarterSelectionController starterSelection = new();
|
||||
[SerializeField] private GachaScreenController gachaScreen = new();
|
||||
|
||||
private readonly List<CommandMenuEntry> commandEntries = new();
|
||||
private readonly List<VisualElement> packageRows = new();
|
||||
@@ -66,6 +69,20 @@ namespace KernelPanic.UI
|
||||
private Label bootIntroLogLabel;
|
||||
private Label motdBodyLabel;
|
||||
private VisualElement motdBlock;
|
||||
private Button rootCreditsToEntropyButton;
|
||||
private VisualElement rootCreditExchangeModal;
|
||||
private Label rootCreditExchangeBalanceLabel;
|
||||
private Label rootCreditExchangePreviewLabel;
|
||||
private Label rootCreditExchangeMessageLabel;
|
||||
private TextField rootCreditExchangeInput;
|
||||
private Button rootCreditExchangeMinusHundredButton;
|
||||
private Button rootCreditExchangeMinusOneButton;
|
||||
private Button rootCreditExchangeNoneButton;
|
||||
private Button rootCreditExchangePlusOneButton;
|
||||
private Button rootCreditExchangePlusHundredButton;
|
||||
private Button rootCreditExchangeMaxButton;
|
||||
private Button rootCreditExchangeConfirmButton;
|
||||
private Button rootCreditExchangeCancelButton;
|
||||
private Button collectionUnitsButton;
|
||||
private Button collectionCardsButton;
|
||||
private readonly ScreenFrameController runSetupFrame = new();
|
||||
@@ -89,7 +106,12 @@ namespace KernelPanic.UI
|
||||
private bool cursorVisible;
|
||||
private bool suppressNextClick;
|
||||
private bool warnedUnresolvedSaveId;
|
||||
private bool rootCreditExchangeOpen;
|
||||
private string bootIntroCopy;
|
||||
private Action rootCreditExchangeMinusHundredClicked;
|
||||
private Action rootCreditExchangeMinusOneClicked;
|
||||
private Action rootCreditExchangePlusOneClicked;
|
||||
private Action rootCreditExchangePlusHundredClicked;
|
||||
private IVisualElementScheduledItem blinkSchedule;
|
||||
private IVisualElementScheduledItem bootIntroSchedule;
|
||||
|
||||
@@ -104,7 +126,8 @@ namespace KernelPanic.UI
|
||||
document = GetComponent<UIDocument>();
|
||||
saveService = new SaveService();
|
||||
gachaService = new GachaService();
|
||||
playerCollection = new PlayerCollection(); // TODO: Replace with persistent player-collection service composition.
|
||||
playerCollection =
|
||||
new PlayerCollection(); // TODO: Replace with persistent player-collection service composition.
|
||||
cardLoadout = new CardLoadout(playerCollection.OwnedUnits);
|
||||
Initialize(new EntropyWallet()); // TODO: Replace with persistent wallet service composition.
|
||||
BindElements();
|
||||
@@ -114,9 +137,11 @@ namespace KernelPanic.UI
|
||||
collectionScreen.Bind(root, monospaceFont);
|
||||
BindScreenFrames();
|
||||
starterSelection.Bind(root, distroDatabase, HandleStarterConfirmed);
|
||||
gachaScreen.Bind(root, distroDatabase, monospaceFont, gachaService, playerCollection, wallet,
|
||||
HandleMetaStateChanged, OpenRootCreditExchange);
|
||||
LoadMetaState();
|
||||
playerCollection.Changed += HandleMetaStateChanged;
|
||||
gachaService.BannerPoolChanged += HandleMetaStateChanged;
|
||||
gachaService.Changed += HandleMetaStateChanged;
|
||||
ApplyOptionalFont();
|
||||
}
|
||||
|
||||
@@ -130,6 +155,7 @@ namespace KernelPanic.UI
|
||||
RefreshEventBanner();
|
||||
featuredUnitPanel.Refresh(playerCollection.OwnedUnits, playerCollection.FeaturedUnit);
|
||||
collectionScreen.RefreshUnits(playerCollection.OwnedUnits);
|
||||
gachaScreen.Refresh();
|
||||
SelectCommand(0);
|
||||
ShowMainMenu();
|
||||
StartAmbientSchedules();
|
||||
@@ -170,15 +196,36 @@ namespace KernelPanic.UI
|
||||
bootIntroLogLabel = root.Q<Label>("BootIntroLogLabel");
|
||||
motdBodyLabel = root.Q<Label>("MotdBodyLabel");
|
||||
|
||||
rootCreditsToEntropyButton = root.Q<Button>("RootCreditsToEntropyButton");
|
||||
if (rootCreditsToEntropyButton != null)
|
||||
{
|
||||
rootCreditsToEntropyButton.focusable = false;
|
||||
}
|
||||
|
||||
rootCreditExchangeModal = root.Q<VisualElement>("RootCreditExchangeModal");
|
||||
rootCreditExchangeBalanceLabel = root.Q<Label>("RootCreditExchangeBalanceLabel");
|
||||
rootCreditExchangePreviewLabel = root.Q<Label>("RootCreditExchangePreviewLabel");
|
||||
rootCreditExchangeMessageLabel = root.Q<Label>("RootCreditExchangeMessageLabel");
|
||||
rootCreditExchangeInput = root.Q<TextField>("RootCreditExchangeInput");
|
||||
rootCreditExchangeMinusHundredButton = root.Q<Button>("RootCreditExchangeMinusHundredButton");
|
||||
rootCreditExchangeMinusOneButton = root.Q<Button>("RootCreditExchangeMinusOneButton");
|
||||
rootCreditExchangeNoneButton = root.Q<Button>("RootCreditExchangeNoneButton");
|
||||
rootCreditExchangePlusOneButton = root.Q<Button>("RootCreditExchangePlusOneButton");
|
||||
rootCreditExchangePlusHundredButton = root.Q<Button>("RootCreditExchangePlusHundredButton");
|
||||
rootCreditExchangeMaxButton = root.Q<Button>("RootCreditExchangeMaxButton");
|
||||
rootCreditExchangeConfirmButton = root.Q<Button>("RootCreditExchangeConfirmButton");
|
||||
rootCreditExchangeCancelButton = root.Q<Button>("RootCreditExchangeCancelButton");
|
||||
collectionUnitsButton = root.Q<Button>("CollectionUnitsButton");
|
||||
collectionCardsButton = root.Q<Button>("CollectionCardsButton");
|
||||
}
|
||||
|
||||
private void BindScreenFrames()
|
||||
{
|
||||
runSetupFrame.Bind(runSetupPanel, "$ ./start_run --configure", "[esc] back [arrows] navigate [enter] select [b] boot run", ShowMainMenu);
|
||||
collectionFrame.Bind(collectionPanel, "$ ls ~/collection", "[esc] back [left/right] tabs [tab] tabs [arrows] navigate [enter] select", ShowMainMenu);
|
||||
gachaFrame.Bind(gachaPanel, "$ curl gacha.sh | sh", "[esc] back", ShowMainMenu);
|
||||
runSetupFrame.Bind(runSetupPanel, "$ ./start_run --configure",
|
||||
"[esc] back [arrows] navigate [enter] select [b] boot run", ShowMainMenu);
|
||||
collectionFrame.Bind(collectionPanel, "$ ls ~/collection",
|
||||
"[esc] back [left/right] tabs [tab] tabs [arrows] navigate [enter] select", ShowMainMenu);
|
||||
gachaFrame.Bind(gachaPanel, "$ curl gacha.sh | sh", "[esc] back click banner click pull", ShowMainMenu);
|
||||
settingsFrame.Bind(settingsPanel, "$ dpkg-reconfigure kernel-panic", "[esc] back", ShowMainMenu);
|
||||
}
|
||||
|
||||
@@ -206,6 +253,60 @@ namespace KernelPanic.UI
|
||||
{
|
||||
root.RegisterCallback<KeyDownEvent>(HandleKeyDown);
|
||||
root.RegisterCallback<PointerDownEvent>(HandlePointerDown);
|
||||
if (rootCreditsToEntropyButton != null)
|
||||
{
|
||||
rootCreditsToEntropyButton.clicked += HandleRootCreditsToEntropyClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeInput != null)
|
||||
{
|
||||
rootCreditExchangeInput.RegisterValueChangedCallback(HandleRootCreditExchangeInputChanged);
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMinusHundredButton != null)
|
||||
{
|
||||
rootCreditExchangeMinusHundredClicked ??= () => AddRootCreditExchangeAmount(-100);
|
||||
rootCreditExchangeMinusHundredButton.clicked += rootCreditExchangeMinusHundredClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMinusOneButton != null)
|
||||
{
|
||||
rootCreditExchangeMinusOneClicked ??= () => AddRootCreditExchangeAmount(-1);
|
||||
rootCreditExchangeMinusOneButton.clicked += rootCreditExchangeMinusOneClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeNoneButton != null)
|
||||
{
|
||||
rootCreditExchangeNoneButton.clicked += SetRootCreditExchangeNone;
|
||||
}
|
||||
|
||||
if (rootCreditExchangePlusOneButton != null)
|
||||
{
|
||||
rootCreditExchangePlusOneClicked ??= () => AddRootCreditExchangeAmount(1);
|
||||
rootCreditExchangePlusOneButton.clicked += rootCreditExchangePlusOneClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangePlusHundredButton != null)
|
||||
{
|
||||
rootCreditExchangePlusHundredClicked ??= () => AddRootCreditExchangeAmount(100);
|
||||
rootCreditExchangePlusHundredButton.clicked += rootCreditExchangePlusHundredClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMaxButton != null)
|
||||
{
|
||||
rootCreditExchangeMaxButton.clicked += SetRootCreditExchangeMax;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeConfirmButton != null)
|
||||
{
|
||||
rootCreditExchangeConfirmButton.clicked += ConfirmRootCreditExchange;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeCancelButton != null)
|
||||
{
|
||||
rootCreditExchangeCancelButton.clicked += CloseRootCreditExchange;
|
||||
}
|
||||
|
||||
collectionUnitsButton.RegisterCallback<ClickEvent>(HandleCollectionUnitsTabClicked);
|
||||
collectionCardsButton.RegisterCallback<ClickEvent>(HandleCollectionCardsTabClicked);
|
||||
}
|
||||
@@ -214,10 +315,194 @@ namespace KernelPanic.UI
|
||||
{
|
||||
root.UnregisterCallback<KeyDownEvent>(HandleKeyDown);
|
||||
root.UnregisterCallback<PointerDownEvent>(HandlePointerDown);
|
||||
if (rootCreditsToEntropyButton != null)
|
||||
{
|
||||
rootCreditsToEntropyButton.clicked -= HandleRootCreditsToEntropyClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeInput != null)
|
||||
{
|
||||
rootCreditExchangeInput.UnregisterValueChangedCallback(HandleRootCreditExchangeInputChanged);
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMinusHundredButton != null)
|
||||
{
|
||||
rootCreditExchangeMinusHundredButton.clicked -= rootCreditExchangeMinusHundredClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMinusOneButton != null)
|
||||
{
|
||||
rootCreditExchangeMinusOneButton.clicked -= rootCreditExchangeMinusOneClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeNoneButton != null)
|
||||
{
|
||||
rootCreditExchangeNoneButton.clicked -= SetRootCreditExchangeNone;
|
||||
}
|
||||
|
||||
if (rootCreditExchangePlusOneButton != null)
|
||||
{
|
||||
rootCreditExchangePlusOneButton.clicked -= rootCreditExchangePlusOneClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangePlusHundredButton != null)
|
||||
{
|
||||
rootCreditExchangePlusHundredButton.clicked -= rootCreditExchangePlusHundredClicked;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeMaxButton != null)
|
||||
{
|
||||
rootCreditExchangeMaxButton.clicked -= SetRootCreditExchangeMax;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeConfirmButton != null)
|
||||
{
|
||||
rootCreditExchangeConfirmButton.clicked -= ConfirmRootCreditExchange;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeCancelButton != null)
|
||||
{
|
||||
rootCreditExchangeCancelButton.clicked -= CloseRootCreditExchange;
|
||||
}
|
||||
|
||||
collectionUnitsButton.UnregisterCallback<ClickEvent>(HandleCollectionUnitsTabClicked);
|
||||
collectionCardsButton.UnregisterCallback<ClickEvent>(HandleCollectionCardsTabClicked);
|
||||
}
|
||||
|
||||
private void HandleRootCreditsToEntropyClicked()
|
||||
{
|
||||
if (gachaService == null || wallet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenRootCreditExchange();
|
||||
}
|
||||
|
||||
private void OpenRootCreditExchange()
|
||||
{
|
||||
if (rootCreditExchangeModal == null || gachaService == null || wallet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rootCreditExchangeOpen = true;
|
||||
rootCreditExchangeModal.RemoveFromClassList(HiddenClassName);
|
||||
rootCreditExchangeMessageLabel?.AddToClassList(HiddenClassName);
|
||||
SetRootCreditExchangeAmount(Math.Min(100, gachaService.RootCredits));
|
||||
RefreshRootCreditExchange();
|
||||
rootCreditExchangeInput?.Focus();
|
||||
}
|
||||
|
||||
private void CloseRootCreditExchange()
|
||||
{
|
||||
rootCreditExchangeOpen = false;
|
||||
rootCreditExchangeModal?.AddToClassList(HiddenClassName);
|
||||
root.Focus();
|
||||
}
|
||||
|
||||
private void HandleRootCreditExchangeInputChanged(ChangeEvent<string> evt)
|
||||
{
|
||||
RefreshRootCreditExchange();
|
||||
}
|
||||
|
||||
private void AddRootCreditExchangeAmount(int amount)
|
||||
{
|
||||
SetRootCreditExchangeAmount(GetRootCreditExchangeAmount() + amount);
|
||||
}
|
||||
|
||||
private void SetRootCreditExchangeMax()
|
||||
{
|
||||
SetRootCreditExchangeAmount(gachaService == null ? 0 : gachaService.RootCredits);
|
||||
}
|
||||
|
||||
private void SetRootCreditExchangeNone()
|
||||
{
|
||||
SetRootCreditExchangeAmount(0);
|
||||
}
|
||||
|
||||
private void SetRootCreditExchangeAmount(int amount)
|
||||
{
|
||||
int max = gachaService == null ? 0 : gachaService.RootCredits;
|
||||
int clamped = Mathf.Clamp(amount, 0, max);
|
||||
if (rootCreditExchangeInput != null)
|
||||
{
|
||||
rootCreditExchangeInput.value = clamped.ToString();
|
||||
}
|
||||
|
||||
RefreshRootCreditExchange();
|
||||
}
|
||||
|
||||
private int GetRootCreditExchangeAmount()
|
||||
{
|
||||
if (rootCreditExchangeInput == null || string.IsNullOrWhiteSpace(rootCreditExchangeInput.value))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!int.TryParse(rootCreditExchangeInput.value, out int amount))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int max = gachaService == null ? 0 : gachaService.RootCredits;
|
||||
return Mathf.Clamp(amount, 0, max);
|
||||
}
|
||||
|
||||
private void RefreshRootCreditExchange()
|
||||
{
|
||||
if (gachaService == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int amount = GetRootCreditExchangeAmount();
|
||||
if (rootCreditExchangeInput != null && rootCreditExchangeInput.value != amount.ToString())
|
||||
{
|
||||
rootCreditExchangeInput.SetValueWithoutNotify(amount.ToString());
|
||||
}
|
||||
|
||||
if (rootCreditExchangeBalanceLabel != null)
|
||||
{
|
||||
rootCreditExchangeBalanceLabel.text = gachaService.RootCredits.ToString();
|
||||
}
|
||||
|
||||
if (rootCreditExchangePreviewLabel != null)
|
||||
{
|
||||
rootCreditExchangePreviewLabel.text = $"+{amount} entropy";
|
||||
}
|
||||
|
||||
int max = gachaService.RootCredits;
|
||||
rootCreditExchangeMinusHundredButton?.SetEnabled(amount > 0);
|
||||
rootCreditExchangeMinusOneButton?.SetEnabled(amount > 0);
|
||||
rootCreditExchangeNoneButton?.SetEnabled(amount > 0);
|
||||
rootCreditExchangePlusOneButton?.SetEnabled(amount < max);
|
||||
rootCreditExchangePlusHundredButton?.SetEnabled(amount < max);
|
||||
rootCreditExchangeMaxButton?.SetEnabled(max > 0 && amount < max);
|
||||
rootCreditExchangeConfirmButton?.SetEnabled(amount > 0);
|
||||
}
|
||||
|
||||
private void ConfirmRootCreditExchange()
|
||||
{
|
||||
int amount = GetRootCreditExchangeAmount();
|
||||
if (!gachaService.ConvertRootCreditsToEntropy(wallet, amount, out string failureReason))
|
||||
{
|
||||
if (rootCreditExchangeMessageLabel != null)
|
||||
{
|
||||
rootCreditExchangeMessageLabel.text = $"exchange failed: {failureReason}";
|
||||
rootCreditExchangeMessageLabel.RemoveFromClassList(HiddenClassName);
|
||||
}
|
||||
|
||||
RefreshRootCreditExchange();
|
||||
return;
|
||||
}
|
||||
|
||||
SaveCurrentState();
|
||||
RefreshCurrencyReadouts();
|
||||
gachaScreen.Refresh();
|
||||
CloseRootCreditExchange();
|
||||
}
|
||||
|
||||
private void HandleCollectionUnitsTabClicked(ClickEvent evt)
|
||||
{
|
||||
ShowCollectionUnits();
|
||||
@@ -234,6 +519,7 @@ namespace KernelPanic.UI
|
||||
{
|
||||
saveData = saveService.Load();
|
||||
saveData.EnsureLists();
|
||||
wallet.SetBalance(saveData.entropyBalance);
|
||||
|
||||
for (int i = 0; i < saveData.ownedUnitIds.Count; i++)
|
||||
{
|
||||
@@ -253,9 +539,35 @@ namespace KernelPanic.UI
|
||||
}
|
||||
}
|
||||
|
||||
gachaService.LoadProgress(saveData);
|
||||
|
||||
if (saveData.starterChosen)
|
||||
{
|
||||
AddAllFourStarDistrosToBeginnerBannerPool();
|
||||
}
|
||||
|
||||
if (gachaService.BeginnerState.guaranteedDistroIds.Count == 0 && saveData.bannerPoolIds.Count > 0)
|
||||
{
|
||||
gachaService.BeginnerState.guaranteedDistroIds.AddRange(saveData.bannerPoolIds);
|
||||
}
|
||||
|
||||
SaveCurrentState();
|
||||
}
|
||||
|
||||
private void AddAllFourStarDistrosToBeginnerBannerPool()
|
||||
{
|
||||
if (distroDatabase == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IReadOnlyList<DistroDefinition> distros = distroDatabase.AllDistros;
|
||||
for (int i = 0; i < distros.Count; i++)
|
||||
{
|
||||
gachaService.AddToBannerPool(distros[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private DistroDefinition ResolveSavedDistro(string id)
|
||||
{
|
||||
DistroDefinition unit = distroDatabase == null ? null : distroDatabase.FindById(id);
|
||||
@@ -273,28 +585,31 @@ namespace KernelPanic.UI
|
||||
SaveCurrentState();
|
||||
featuredUnitPanel.Refresh(playerCollection.OwnedUnits, playerCollection.FeaturedUnit);
|
||||
collectionScreen.RefreshUnits(playerCollection.OwnedUnits);
|
||||
gachaScreen.Refresh();
|
||||
RefreshCurrencyReadouts();
|
||||
}
|
||||
|
||||
private void HandleStarterConfirmed(DistroDefinition picked, IReadOnlyList<DistroDefinition> remaining)
|
||||
{
|
||||
playerCollection.Add(picked);
|
||||
for (int i = 0; i < remaining.Count; i++)
|
||||
{
|
||||
gachaService.AddToBannerPool(remaining[i]);
|
||||
}
|
||||
AddAllFourStarDistrosToBeginnerBannerPool();
|
||||
|
||||
gachaService.SetBeginnerGuaranteedDistros(remaining);
|
||||
saveData.starterChosen = true;
|
||||
SaveCurrentState();
|
||||
featuredUnitPanel.Refresh(playerCollection.OwnedUnits, playerCollection.FeaturedUnit);
|
||||
collectionScreen.RefreshUnits(playerCollection.OwnedUnits);
|
||||
gachaScreen.Refresh();
|
||||
}
|
||||
|
||||
private void SaveCurrentState()
|
||||
{
|
||||
saveData ??= SaveData.CreateDefault();
|
||||
saveData.EnsureLists();
|
||||
saveData.entropyBalance = wallet == null ? 0 : wallet.Balance;
|
||||
saveData.ownedUnitIds.Clear();
|
||||
saveData.bannerPoolIds.Clear();
|
||||
gachaService.WriteProgress(saveData);
|
||||
|
||||
for (int i = 0; i < playerCollection.OwnedUnits.Count; i++)
|
||||
{
|
||||
@@ -358,7 +673,12 @@ namespace KernelPanic.UI
|
||||
}
|
||||
|
||||
entropyLabel.text = $"entropy={wallet.Balance}";
|
||||
pullTokensLabel.text = $"pulls={gachaService.PullTokens}";
|
||||
rootCreditsToEntropyButton?.SetEnabled(true);
|
||||
bool showPullTokens = IsGachaVisible();
|
||||
pullTokensLabel.text = showPullTokens
|
||||
? $"stable-pull-token={gachaService.PullTokens} feature-pull-token={gachaService.LimitedPullTokens}"
|
||||
: string.Empty;
|
||||
pullTokensLabel.EnableInClassList(HiddenClassName, !showPullTokens);
|
||||
}
|
||||
|
||||
private void RefreshEventBanner()
|
||||
@@ -418,7 +738,8 @@ namespace KernelPanic.UI
|
||||
private void UpdateBootIntro()
|
||||
{
|
||||
bootIntroElapsed += 0.016f;
|
||||
int targetCount = Mathf.Clamp(Mathf.CeilToInt(bootIntroCopy.Length * (bootIntroElapsed / BootIntroSeconds)), 0, bootIntroCopy.Length);
|
||||
int targetCount = Mathf.Clamp(Mathf.CeilToInt(bootIntroCopy.Length * (bootIntroElapsed / BootIntroSeconds)),
|
||||
0, bootIntroCopy.Length);
|
||||
if (targetCount != bootIntroCharacterCount)
|
||||
{
|
||||
bootIntroCharacterCount = targetCount;
|
||||
@@ -468,6 +789,26 @@ namespace KernelPanic.UI
|
||||
return;
|
||||
}
|
||||
|
||||
if (rootCreditExchangeOpen)
|
||||
{
|
||||
if (evt.keyCode == KeyCode.Escape)
|
||||
{
|
||||
CloseRootCreditExchange();
|
||||
evt.StopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter)
|
||||
{
|
||||
ConfirmRootCreditExchange();
|
||||
evt.StopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
evt.StopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.keyCode == KeyCode.Escape && IsSubScreenVisible())
|
||||
{
|
||||
ShowMainMenu();
|
||||
@@ -509,6 +850,12 @@ namespace KernelPanic.UI
|
||||
}
|
||||
}
|
||||
|
||||
if (IsGachaVisible())
|
||||
{
|
||||
gachaScreen.HandleKeyDown(evt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.keyCode == KeyCode.UpArrow)
|
||||
{
|
||||
SelectCommand(selectedCommandIndex - 1);
|
||||
@@ -557,10 +904,15 @@ namespace KernelPanic.UI
|
||||
return collectionPanel != null && !collectionPanel.ClassListContains(HiddenClassName);
|
||||
}
|
||||
|
||||
private bool IsGachaVisible()
|
||||
{
|
||||
return gachaPanel != null && !gachaPanel.ClassListContains(HiddenClassName);
|
||||
}
|
||||
|
||||
private bool IsSubScreenVisible()
|
||||
{
|
||||
return IsRunSetupVisible() || IsCollectionVisible() ||
|
||||
(gachaPanel != null && !gachaPanel.ClassListContains(HiddenClassName)) ||
|
||||
IsGachaVisible() ||
|
||||
(settingsPanel != null && !settingsPanel.ClassListContains(HiddenClassName));
|
||||
}
|
||||
|
||||
@@ -581,7 +933,8 @@ namespace KernelPanic.UI
|
||||
if (playerCollection.OwnedUnits.Count == 0)
|
||||
{
|
||||
runSetupDetail.Add(new Label("no units installed") { name = "RunSetupEmptyTitle" });
|
||||
runSetupDetail.Add(new Label("install a starter or summon a unit before starting a run") { name = "RunSetupEmptyHint" });
|
||||
runSetupDetail.Add(new Label("install a starter or summon a unit before starting a run")
|
||||
{ name = "RunSetupEmptyHint" });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -611,7 +964,9 @@ namespace KernelPanic.UI
|
||||
summary.Add(meta);
|
||||
|
||||
row.Add(summary);
|
||||
string passiveTitle = unit.Passive == null || string.IsNullOrWhiteSpace(unit.Passive.Name) ? "--" : unit.Passive.Name;
|
||||
string passiveTitle = unit.Passive == null || string.IsNullOrWhiteSpace(unit.Passive.Name)
|
||||
? "--"
|
||||
: unit.Passive.Name;
|
||||
row.Add(new Label($"passive: {passiveTitle}")
|
||||
{
|
||||
name = $"RunSetupDescription{index}"
|
||||
@@ -652,7 +1007,8 @@ namespace KernelPanic.UI
|
||||
{
|
||||
runSetupDetail?.Clear();
|
||||
loadoutRows.Clear();
|
||||
if (runSetupDetail == null || selectedPackageIndex < 0 || selectedPackageIndex >= playerCollection.OwnedUnits.Count)
|
||||
if (runSetupDetail == null || selectedPackageIndex < 0 ||
|
||||
selectedPackageIndex >= playerCollection.OwnedUnits.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -678,7 +1034,10 @@ namespace KernelPanic.UI
|
||||
|
||||
if (equippedCardIds.Count < CardLoadout.MaxEquippedCards)
|
||||
{
|
||||
packageList.Add(new Label($"select {CardLoadout.MaxEquippedCards - equippedCardIds.Count} more card(s) before booting") { name = "RunSetupIncompleteNotice" });
|
||||
packageList.Add(
|
||||
new Label(
|
||||
$"select {CardLoadout.MaxEquippedCards - equippedCardIds.Count} more card(s) before booting")
|
||||
{ name = "RunSetupIncompleteNotice" });
|
||||
packageList.ElementAt(packageList.childCount - 1).AddToClassList("package-notice");
|
||||
}
|
||||
|
||||
@@ -994,6 +1353,7 @@ namespace KernelPanic.UI
|
||||
|
||||
private void ShowGacha()
|
||||
{
|
||||
gachaScreen.Open();
|
||||
ShowPanel(gachaPanel);
|
||||
}
|
||||
|
||||
@@ -1022,6 +1382,8 @@ namespace KernelPanic.UI
|
||||
{
|
||||
eventBanner.AddToClassList(HiddenClassName);
|
||||
}
|
||||
|
||||
RefreshCurrencyReadouts();
|
||||
}
|
||||
|
||||
private sealed class CommandMenuEntry
|
||||
@@ -1050,4 +1412,4 @@ namespace KernelPanic.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bfa65b8d497538499a5b84a4d7a4e9f
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14c81f7c3ea7de425b5ba4adf237c460
|
||||
Reference in New Issue
Block a user