Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new loading for aura and rune #3691

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
392 changes: 252 additions & 140 deletions nekoyume/Assets/AddressableAssets/Character/NPC/300001/300001.atlas.txt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions nekoyume/Assets/_Scripts/Game/Character/NPCAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public enum Type
Loop,
Loop_02,
Loop_03,
Loop_Aura,
Loop_Rune,
Disappear,
Disappear_02,
Disappear_03,
Over,
Click,
}

public static readonly List<Type> List = new List<Type>();

static NPCAnimation()
Expand All @@ -46,9 +48,9 @@ static NPCAnimation()
{
List.Add((Type) value);
}
}
}
}

public class InvalidNPCAnimationTypeException : Exception
{
public InvalidNPCAnimationTypeException(string message) : base(message)
Expand Down
9 changes: 7 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/Craft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ private IEnumerator CoCombineNPCAnimation(
{
var loadingScreen = Find<CombinationLoadingScreen>();
loadingScreen.Show();
loadingScreen.SetItemMaterial(new Item(itemBase), isConsumable);
loadingScreen.SpeechBubbleWithItem.SetItemMaterial(new Item(itemBase), isConsumable);
loadingScreen.SetCloseAction(null);
loadingScreen.OnDisappear = OnNPCDisappear;
canvasGroup.interactable = false;
Expand All @@ -738,7 +738,12 @@ private IEnumerator CoCombineNPCAnimation(
var quote = string.Format(format, blockIndex);
var itemType = itemBase.ItemType != ItemType.Material
? itemBase.ItemType : ItemType.Consumable;
loadingScreen.AnimateNPC(itemType, quote);
loadingScreen.AnimateNPC(itemType switch
{
ItemType.Equipment => CombinationLoadingScreen.SpeechBubbleItemType.Equipment,
ItemType.Consumable => CombinationLoadingScreen.SpeechBubbleItemType.Consumable,
_ => CombinationLoadingScreen.SpeechBubbleItemType.Equipment
}, quote);
}

private void OnNPCDisappear()
Expand Down
4 changes: 2 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/Enhancement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ private IEnumerator CoCombineNPCAnimation(ItemBase itemBase,
{
var loadingScreen = Find<CombinationLoadingScreen>();
loadingScreen.Show();
loadingScreen.SetItemMaterial(new Item(itemBase), isConsumable);
loadingScreen.SpeechBubbleWithItem.SetItemMaterial(new Item(itemBase), isConsumable);
loadingScreen.SetCloseAction(action);
Push();
yield return new WaitForSeconds(.5f);

var format = L10nManager.Localize("UI_COST_BLOCK");
var quote = string.Format(format, blockIndex);
loadingScreen.AnimateNPC(itemBase.ItemType, quote);
loadingScreen.AnimateNPC(CombinationLoadingScreen.SpeechBubbleItemType.Equipment, quote);
}

private void SliderGageEffect(Equipment equipment, long targetExp, int targetLevel)
Expand Down
4 changes: 2 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/Popup/SuperCraftPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ private IEnumerator CoCombineNpcAnimation(ItemBase itemBase)
{
var loadingScreen = Find<CombinationLoadingScreen>();
loadingScreen.Show();
loadingScreen.SetItemMaterial(new Item(itemBase));
loadingScreen.SpeechBubbleWithItem.SetItemMaterial(new Item(itemBase), false);
loadingScreen.SetCloseAction(null);
loadingScreen.OnDisappear = () => Close();
yield return new WaitForSeconds(.5f);

var format = L10nManager.Localize("UI_COST_BLOCK");
var quote = string.Format(format, SuperCraftIndex);
loadingScreen.AnimateNPC(itemBase.ItemType, quote);
loadingScreen.AnimateNPC(CombinationLoadingScreen.SpeechBubbleItemType.Equipment, quote);
}

// Invoke from TutorialController.PlayAction() by TutorialTargetType
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ namespace Nekoyume.UI
{
public class CombinationLoadingScreen : ScreenWidget
{
public enum SpeechBubbleItemType
{
Equipment,
Consumable,
Rune,
Aura,
}

[SerializeField] private Button button = null;

[SerializeField] private CanvasGroup _buttonCanvasGroup = null;
Expand All @@ -40,6 +48,7 @@ public class CombinationLoadingScreen : ScreenWidget
private CombinationSparkVFX _sparkVFX = null;

public System.Action OnDisappear { get; set; }
public SpeechBubbleWithItem SpeechBubbleWithItem => speechBubble;

private const int ContinueTime = 5;
private System.Action _closeAction;
Expand Down Expand Up @@ -88,46 +97,50 @@ private void HideButton()
_bgAlphaTweener.PlayReverse();
}

public void AnimateNPC(Nekoyume.Model.Item.ItemType itemType, string quote)
public void AnimateNPC(SpeechBubbleItemType itemType, string quote)
{
_npcAppearCoroutine = StartCoroutine(CoAnimateNPC(itemType, quote));
}

public void SetItemMaterial(Item item, bool isConsumable = false)
{
speechBubble.SetItemMaterial(item, isConsumable);
}

public void SetCurrency(long ncg, long crystal)
{
speechBubble.SetCurrency(ncg, crystal);
}

public void SetCloseAction(System.Action closeAction)
{
_closeAction = closeAction;
}

private IEnumerator CoAnimateNPC(Nekoyume.Model.Item.ItemType itemType, string quote = null)
private IEnumerator CoAnimateNPC(SpeechBubbleItemType itemType, string quote = null)
{
var pos = ActionCamera.instance.Cam.transform.position;
_sparkVFX = VFXController.instance.CreateAndChaseCam<CombinationSparkVFX>(pos);
npcSkeletonGraphic.gameObject.SetActive(true);
switch (itemType)
{
case ItemType.Equipment:
case SpeechBubbleItemType.Equipment:
npcSkeletonGraphic.AnimationState.SetAnimation(0,
NPCAnimation.Type.Appear_02.ToString(), false);
npcSkeletonGraphic.AnimationState.AddAnimation(0,
NPCAnimation.Type.Loop.ToString(), true, 0f);
break;

case ItemType.Consumable:
case SpeechBubbleItemType.Consumable:
npcSkeletonGraphic.AnimationState.SetAnimation(0,
NPCAnimation.Type.Appear_03.ToString(), false);
npcSkeletonGraphic.AnimationState.AddAnimation(0,
NPCAnimation.Type.Loop_02.ToString(), true, 0f);
break;

case SpeechBubbleItemType.Rune:
npcSkeletonGraphic.AnimationState.SetAnimation(0,
NPCAnimation.Type.Appear_02.ToString(), false);
npcSkeletonGraphic.AnimationState.AddAnimation(0,
NPCAnimation.Type.Loop_Rune.ToString(), true, 0f);
break;

case SpeechBubbleItemType.Aura:
npcSkeletonGraphic.AnimationState.SetAnimation(0,
NPCAnimation.Type.Appear_02.ToString(), false);
npcSkeletonGraphic.AnimationState.AddAnimation(0,
NPCAnimation.Type.Loop_Aura.ToString(), true, 0f);
break;
}

yield return new WaitForSeconds(1f);
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
Loading