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

fix update assets #6684

Merged
merged 2 commits into from
Jan 13, 2025
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
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