Skip to content

Commit

Permalink
add CombinationLoadingScreen.Show() at rune crafting and aura summoning
Browse files Browse the repository at this point in the history
  • Loading branch information
sonohoshi committed Nov 27, 2023
1 parent 328c2c7 commit 670d88b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions nekoyume/Assets/_Scripts/UI/Widget/Rune.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
Expand Down Expand Up @@ -296,6 +297,7 @@ private void Enhancement()
Animator.Play(HashToMaterialUse);
ActionManager.Instance.RuneEnhancement(runeId, TryCount.Value);
LoadingHelper.RuneEnhancement.Value = true;
StartCoroutine(CoShowLoadingScreen());
}

private void Set(RuneItem item)
Expand Down Expand Up @@ -520,6 +522,22 @@ private void UpdateSlider(RuneItem item)
}
}

private IEnumerator CoShowLoadingScreen()
{
if (RuneFrontHelper.TryGetRuneIcon(_selectedRuneItem.Row.Id, out var runeIcon))
{
var loadingScreen = Find<CombinationLoadingScreen>();
loadingScreen.Show();
loadingScreen.SpeechBubbleWithItem.SetRune(runeIcon);
loadingScreen.SetCloseAction(null);
yield return new WaitForSeconds(.5f);

var format = L10nManager.Localize("UI_COST_BLOCK");
var quote = string.Format(format, 1);
loadingScreen.AnimateNPC(CombinationLoadingScreen.SpeechBubbleItemType.Rune, quote);
}
}

// Invoke from TutorialController.PlayAction() by TutorialTargetType
public void TutorialActionClickCombinationRuneCombineButton()
{
Expand Down
33 changes: 33 additions & 0 deletions nekoyume/Assets/_Scripts/UI/Widget/Summon.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Lib9c.Renderers;
using Libplanet.Action;
using Libplanet.Crypto;
using Nekoyume.Action;
using Nekoyume.Blockchain;
using Nekoyume.Game;
using Nekoyume.Helper;
using Nekoyume.L10n;
using Nekoyume.Model.Item;
using Nekoyume.Model.Mail;
using Nekoyume.Model.State;
using Nekoyume.State;
using Nekoyume.TableData.Summon;
using Nekoyume.UI.Model;
using Nekoyume.UI.Module;
using Nekoyume.UI.Scroller;
using TMPro;
Expand Down Expand Up @@ -133,6 +136,7 @@ private void AuraSummonAction(int groupId, int summonCount)
ActionManager.Instance.AuraSummon(groupId, summonCount).Subscribe();
LoadingHelper.Summon.Value = new Tuple<int, int>(summonRow.CostMaterial, totalCost);
SetMaterialAssets();
StartCoroutine(CoShowLoadingScreen(summonRow.Recipes.Select(r => r.Item1).ToList()));
}

public void OnActionRender(ActionEvaluation<AuraSummon> eval)
Expand Down Expand Up @@ -189,6 +193,35 @@ private void SetMaterialAssets()
}
}

private IEnumerator CoShowLoadingScreen(List<int> recipes)
{
var loadingScreen = Find<CombinationLoadingScreen>();
IEnumerator CoChangeItem()
{
while (isActiveAndEnabled)
{
foreach (var recipe in recipes)
{
loadingScreen.SpeechBubbleWithItem.SetItemMaterial(
new Item(ItemFactory.CreateItem(
TableSheets.Instance.EquipmentItemRecipeSheet[recipe]
.GetResultEquipmentItemRow(),
new ActionRenderHandler.LocalRandom(0))), false);
yield return new WaitForSeconds(.1f);
}
}
}

loadingScreen.Show();
loadingScreen.SetCloseAction(null);
StartCoroutine(CoChangeItem());
yield return new WaitForSeconds(.5f);

var format = L10nManager.Localize("UI_COST_BLOCK");
var quote = string.Format(format, 1);
loadingScreen.AnimateNPC(CombinationLoadingScreen.SpeechBubbleItemType.Aura, quote);
}

public static void ButtonSubscribe(SimpleCostButton[] buttons, GameObject gameObject)
{
foreach (var button in buttons)
Expand Down

0 comments on commit 670d88b

Please sign in to comment.