Skip to content

Commit

Permalink
Merge pull request #6684 from planetarium/feature/fix-stage-info-assets
Browse files Browse the repository at this point in the history
fix update assets
  • Loading branch information
eugene-doobu authored Jan 13, 2025
2 parents e8c1771 + 2da9a2f commit 27739b6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
17 changes: 15 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/StageInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cysharp.Threading.Tasks;
using Nekoyume.ApiClient;
using Nekoyume.Battle;
using Nekoyume.EnumType;
Expand Down Expand Up @@ -73,6 +74,16 @@ protected override void Awake()
CloseWidget = OnClickClose;
}

protected override void OnDisable()
{
base.OnDisable();
var worldMap = Find<WorldMap>();
if (worldMap.gameObject.activeSelf)
{
worldMap.UpdateAssets();
}
}

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -126,11 +137,13 @@ private void RefreshSeasonPassCourageAmount(bool isEventDungeon = false)
var expAmount = 0;
if (isEventDungeon)
{
expAmount = seasonPassServiceManager.ExpPointAmount(SeasonPassServiceClient.PassType.CouragePass, SeasonPassServiceClient.ActionType.event_dungeon);
expAmount = seasonPassServiceManager.ExpPointAmount(SeasonPassServiceClient.PassType.CouragePass,
SeasonPassServiceClient.ActionType.event_dungeon);
}
else
{
expAmount = seasonPassServiceManager.ExpPointAmount(SeasonPassServiceClient.PassType.CouragePass, SeasonPassServiceClient.ActionType.hack_and_slash);
expAmount = seasonPassServiceManager.ExpPointAmount(SeasonPassServiceClient.PassType.CouragePass,
SeasonPassServiceClient.ActionType.hack_and_slash);
}
seasonPassCourageAmount.text = $"+{expAmount}";
}
Expand Down
37 changes: 14 additions & 23 deletions nekoyume/Assets/_Scripts/UI/Widget/WorldMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public override void Initialize()

public void Show(WorldInformation worldInformation, bool blockWorldUnlockPopup = false)
{
SubscribeAtShow();
UpdateAssets();

HasNotification = false;
SetWorldInformation(worldInformation);
Expand All @@ -180,22 +180,14 @@ public void Show(WorldInformation worldInformation, bool blockWorldUnlockPopup =

public void Show(int worldId, int stageId, bool showWorld, bool callByShow = false)
{
SubscribeAtShow();
ShowWorld(worldId, stageId, showWorld, callByShow);
Show(true);
Find<AdventureBossRewardPopup>().Show();
}

private void SubscribeAtShow()
public void UpdateAssets(bool isForceSetBattle = false)
{
_disposablesAtShow.DisposeAllAndClear();
OnDisableStaticObservable
.Where(widget => widget is StageInformation)
.DelayFrame(1)
.Where(_ => gameObject.activeSelf)
.Subscribe(_ => SubscribeAtShow())
.AddTo(_disposablesAtShow);
TextMeshProUGUI eventDungeonRemainingTimeText = null;
RxProps.EventScheduleRowForDungeon.Subscribe(value =>
{
foreach (var eventDungeonObject in eventDungeonObjects)
Expand All @@ -204,7 +196,7 @@ private void SubscribeAtShow()
eventDungeonObject.remainingTimeObject.SetActive(false);
}

if (value is null)
if (isForceSetBattle || value is null)
{
Find<HeaderMenuStatic>()
.UpdateAssets(HeaderMenuStatic.AssetVisibleState.Battle);
Expand All @@ -221,15 +213,17 @@ private void SubscribeAtShow()
eventDungeonObject.button.HasNotification.Value = true;
eventDungeonObject.button.Unlock();
eventDungeonObject.remainingTimeObject.SetActive(true);
eventDungeonRemainingTimeText = eventDungeonObject.remainingTimeText;

if (eventDungeonObject.remainingTimeText == null)
{
return;
}

RxProps.EventDungeonRemainingTimeText
.SubscribeTo(eventDungeonObject.remainingTimeText)
.AddTo(_disposablesAtShow);
}
}).AddTo(_disposablesAtShow);
if (eventDungeonRemainingTimeText != null)
{
RxProps.EventDungeonRemainingTimeText
.SubscribeTo(eventDungeonRemainingTimeText)
.AddTo(_disposablesAtShow);
}
}

public override void Close(bool ignoreCloseAnimation = false)
Expand Down Expand Up @@ -343,7 +337,6 @@ private void ShowWorld(
SharedViewModel.IsWorldShown.SetValueAndForceNotify(showWorld);
}

SubscribeAtShow();

TableSheets.Instance.WorldSheet.TryGetValue(
worldId,
Expand All @@ -354,7 +347,7 @@ private void ShowWorld(
var stageInfo = Find<StageInformation>();
stageInfo.Show(SharedViewModel, worldRow, StageType.HackAndSlash);
UpdateNotificationInfo();
Find<HeaderMenuStatic>().UpdateAssets(HeaderMenuStatic.AssetVisibleState.Battle);
UpdateAssets(true);
Find<HeaderMenuStatic>().Show();
}

Expand All @@ -372,8 +365,6 @@ public void ShowEventDungeonStage(
SharedViewModel.IsWorldShown.SetValueAndForceNotify(showWorld);
}

SubscribeAtShow();

Show(true);
var openedStageId =
RxProps.EventDungeonInfo.Value is null ||
Expand All @@ -391,7 +382,7 @@ RxProps.EventDungeonInfo.Value is null ||
openedStageId,
openedStageId);
StageIdToNotify = openedStageId;
Find<HeaderMenuStatic>().UpdateAssets(HeaderMenuStatic.AssetVisibleState.EventDungeon);
UpdateAssets();
Find<HeaderMenuStatic>().Show();
}

Expand Down

0 comments on commit 27739b6

Please sign in to comment.