Skip to content

Commit

Permalink
Merge pull request #3622 from planetarium/feature/add-required-stage-…
Browse files Browse the repository at this point in the history
…to-ui

Add reqired stage to ui
  • Loading branch information
jonny-jeahyunchoi authored Nov 20, 2023
2 parents 8f2d556 + 8d54666 commit 39edc91
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 32 deletions.
15 changes: 5 additions & 10 deletions nekoyume/Assets/_Scripts/Game/Entrance/RoomEntering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,15 @@ private IEnumerator Act()
headerMenu.Show();
}

var worldInfo = States.Instance.CurrentAvatarState?.worldInformation;
if (worldInfo is not null)
const int requiredStage = LiveAsset.GameConfig.RequiredStage.ShowPopupRoomEntering;
if (States.Instance.CurrentAvatarState.worldInformation.IsStageCleared(requiredStage))
{
var clearedStageId = worldInfo.TryGetLastClearedStageId(out var id) ? id : 1;
const int requiredStageId = LiveAsset.GameConfig.RequiredStage.ShowPopupRoomEntering;

var eventReleaseNotePopup = Widget.Find<EventReleaseNotePopup>();
if (eventReleaseNotePopup.HasUnread && clearedStageId >= requiredStageId)
if (eventReleaseNotePopup.HasUnread)
{
var avatarInfo = Game.instance.SeasonPassServiceManager.AvatarInfo;
var seasonPassNewPopup = Widget.Find<SeasonPassNewPopup>();

if (seasonPassNewPopup.HasUnread && clearedStageId >= requiredStageId &&
Game.instance.SeasonPassServiceManager.AvatarInfo.HasValue &&
!Game.instance.SeasonPassServiceManager.AvatarInfo.Value.IsPremium)
if (seasonPassNewPopup.HasUnread && avatarInfo.HasValue && !avatarInfo.Value.IsPremium)
{
seasonPassNewPopup.Show();
}
Expand Down
3 changes: 2 additions & 1 deletion nekoyume/Assets/_Scripts/Game/LiveAsset/GameConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ public class RequiredStage
{
public const int WorkShop = 0;
public const int CraftConsumable = 0;
public const int Enhancement = 0;
public const int Enhancement = 35;
public const int Shop = 17;
public const int Arena = 15;
public const int Mimisbrunnr = 100;
public const int WorldBoss = 49;
public const int Adventure = 0;
public const int ChargeAP = 23;
public const int ShowPopupRoomEntering = 51;
public const int Sweep = 23;
}
}
}
18 changes: 4 additions & 14 deletions nekoyume/Assets/_Scripts/Helper/ShortcutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,14 @@ RxProps.EventDungeonInfo.Value is null ||
return true;
}

if (States.Instance.CurrentAvatarState.worldInformation
.TryGetLastClearedStageId(out var lastClearedStage))
{
return lastClearedStage >= Game.LiveAsset.GameConfig.RequiredStage.Shop;
}

return false;
return States.Instance.CurrentAvatarState.worldInformation
.IsStageCleared(Game.LiveAsset.GameConfig.RequiredStage.Shop);
}

case PlaceType.Arena:
{
if (States.Instance.CurrentAvatarState.worldInformation
.TryGetLastClearedStageId(out var lastClearedStage))
{
return lastClearedStage >= Game.LiveAsset.GameConfig.RequiredStage.Arena;
}

return false;
return States.Instance.CurrentAvatarState.worldInformation
.IsStageCleared(Game.LiveAsset.GameConfig.RequiredStage.Arena);
}
case PlaceType.Quest:
case PlaceType.Staking:
Expand Down
4 changes: 4 additions & 0 deletions nekoyume/Assets/_Scripts/UI/Module/Currency/ActionPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ public void ShowMaterialNavigationPopup()
if (!States.Instance.CurrentAvatarState.worldInformation.IsStageCleared(requiredStage) &&
IsRemained)
{
OneLineSystem.Push(
MailType.System,
L10nManager.Localize("UI_REQUIRE_CLEAR_STAGE", requiredStage),
NotificationCell.NotificationType.UnlockCondition);
return;
}

Expand Down
9 changes: 2 additions & 7 deletions nekoyume/Assets/_Scripts/UI/Widget/BattlePreparation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,11 @@ private void UpdateStartButton()
}
}

const int requiredStage = Game.LiveAsset.GameConfig.RequiredStage.Sweep;
var (equipments, costumes) = States.Instance.GetEquippedItems(BattleType.Adventure);
var consumables = information.GetEquippedConsumables().Select(x=> x.Id).ToList();
var canBattle = Util.CanBattle(equipments, costumes, consumables);
var canSweep = false;
const int sweepableStage = 23;
if (States.Instance.CurrentAvatarState.worldInformation.TryGetLastClearedStageId(
out var lastClearedStage))
{
canSweep = lastClearedStage >= sweepableStage;
}
var canSweep = States.Instance.CurrentAvatarState.worldInformation.IsStageCleared(requiredStage);

startButton.gameObject.SetActive(canBattle);

Expand Down
13 changes: 13 additions & 0 deletions nekoyume/Assets/_Scripts/UI/Widget/Tooltip/ItemTooltip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
using Nekoyume.Game.Character;
using Nekoyume.Game.Controller;
using Nekoyume.Helper;
using Nekoyume.L10n;
using Nekoyume.Model.Item;
using Nekoyume.Model.Mail;
using Nekoyume.State;
using Nekoyume.UI.Model;
using Nekoyume.UI.Module;
using Nekoyume.UI.Scroller;
using UnityEngine;
using ShopItem = Nekoyume.UI.Model.ShopItem;

Expand Down Expand Up @@ -77,6 +80,16 @@ protected override void Awake()
.AddTo(gameObject);
enhancementButton.onClick.AddListener(() =>
{
const int requiredStage = Game.LiveAsset.GameConfig.RequiredStage.Enhancement;
if (!States.Instance.CurrentAvatarState.worldInformation.IsStageCleared(requiredStage))
{
OneLineSystem.Push(
MailType.System,
L10nManager.Localize("UI_REQUIRE_CLEAR_STAGE", requiredStage),
NotificationCell.NotificationType.UnlockCondition);
return;
}

_onEnhancement?.Invoke();
Close(true);
});
Expand Down

0 comments on commit 39edc91

Please sign in to comment.