Add entry sounds to LineEditor

Signed-off-by: Ritchie Frodomar <alkalinethunder@gmail.com>
This commit is contained in:
Ritchie Frodomar 2024-08-16 14:07:48 -04:00
parent 685e611c8a
commit ad4aa04497
2 changed files with 1 additions and 59 deletions

View file

@ -72,13 +72,7 @@ namespace SociallyDistant.Core.DataManagement
{
return narrativeIdLookup.ContainsKey(narrativeId);
}
public void Remove(ObjectId instanceId)
{
var data = this.First(x => x.InstanceId == instanceId);
Remove(data);
}
public void Remove(ObjectId instanceId)
{
var data = this.First(x => x.InstanceId == instanceId);

View file

@ -273,58 +273,6 @@ public sealed class CraftingProgramController : ProgramController
itemBannerText.Text = $"<b><size=32>{data.Title.ToUpper()}</size></b>{Environment.NewLine}{data.Category}";
itemDescription.Text = data.Description;
}
private async void OnInteract()
{
if (currentItem != null)
{
interactionButton.Visibility = Visibility.Hidden;
interactionPanel.Visibility = Visibility.Visible;
await DoInteractProgress(0.2f);
currentItem.Value.Recipe.DisassembleComponents(SociallyDistantGame.Instance);
WorldManager.Instance.World.Inventory.Remove(currentItem.Value.WorldItem);
this.currentItem = null;
interactionPanel.Visibility = Visibility.Hidden;
RefreshInterface();
}
else if (currentRecipe != null)
{
interactionButton.Visibility = Visibility.Hidden;
interactionPanel.Visibility = Visibility.Visible;
await DoInteractProgress(0.5f);
if (currentRecipe.TryCraft(SociallyDistantGame.Instance))
{
var data = new WorldInventoryItem() { InstanceId = WorldManager.Instance.GetNextObjectId(), RecipeId = currentRecipe.Id, Quantity = 1, };
WorldManager.Instance.World.Inventory.Add(data);
this.currentItem = new InventoryItemModel { WorldItem = data.InstanceId, Recipe = currentRecipe };
currentRecipe = null;
}
interactionPanel.Visibility = Visibility.Hidden;
RefreshInterface();
}
}
private async Task DoInteractProgress(float duration)
{
var progress = 0f;
while (progress < duration)
{
interactionProgress.Value = progress / duration;
interactionPercentage.Text = $"{Math.Round((progress / duration) * 100)}%";
await Task.Delay(10);
progress += 0.010f;
}
}
private async void OnInteract()
{