Skip to content

Commit

Permalink
Change ref from quest to table sheet when ordering the quest list
Browse files Browse the repository at this point in the history
  • Loading branch information
boscohyun committed Nov 18, 2021
1 parent c245ef9 commit 5ad1a64
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions nekoyume/Assets/_Scripts/UI/Module/GuidedQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ private class ViewModel
private static readonly ViewModel SharedViewModel = new ViewModel();

[SerializeField]
private List<GuidedQuestCell> cells = null;
private List<GuidedQuestCell> cells;

[SerializeField]
private AnchoredPositionSingleTweener showingAndHidingTweener = null;
private AnchoredPositionSingleTweener showingAndHidingTweener;

#region Subjects

Expand Down Expand Up @@ -158,8 +158,6 @@ private void OnDisable()
/// GuidedQuest를 초기화하면서 노출시킵니다.
/// 이미 초기화되어 있다면 `avatarState` 인자에 따라 재초기화를 하거나 새로운 가이드 퀘스트를 더하는 AddNewGuidedQuest 상태로 진입합니다.
/// </summary>
/// <param name="avatarState"></param>
/// <param name="ignoreAnimation"></param>
public void Show(AvatarState avatarState, System.Action onComplete = null, bool ignoreAnimation = false)
{
if (avatarState is null)
Expand Down Expand Up @@ -467,7 +465,7 @@ private void EnterToHidden()

private static WorldQuest GetTargetWorldQuest(QuestList questList)
{
#pragma warning disable 0162
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (GameConfig.RequireClearedStageLevel.UIMainMenuStage > 0)
{
if (SharedViewModel.avatarState is null ||
Expand All @@ -478,7 +476,6 @@ private static WorldQuest GetTargetWorldQuest(QuestList questList)
return null;
}
}
#pragma warning restore 0162

var targetQuest = questList?
.OfType<WorldQuest>()
Expand Down Expand Up @@ -506,11 +503,16 @@ private static CombinationEquipmentQuest GetTargetCombinationEquipmentQuest(
return null;
}

var recipeSheet = Game.Game.instance.TableSheets.EquipmentItemRecipeSheet;
return questList?
.OfType<CombinationEquipmentQuest>()
.Where(quest => !quest.Complete &&
quest.StageId <= lastClearedStageId)
.OrderBy(quest => quest.StageId)
.Select(quest => recipeSheet.TryGetValue(quest.RecipeId, out var recipeRow)
? (quest, unlockStageId: recipeRow.UnlockStage)
: (quest, unlockStageId: int.MaxValue))
.Where(tuple => !tuple.quest.Complete &&
tuple.unlockStageId <= lastClearedStageId)
.OrderBy(tuple => tuple.unlockStageId)
.Select(tuple => tuple.quest)
.FirstOrDefault();
}

Expand Down

0 comments on commit 5ad1a64

Please sign in to comment.