Skip to content

Commit

Permalink
Merge pull request #6525 from planetarium/feature/fix-thor-schedule-n…
Browse files Browse the repository at this point in the history
…ull-check

fix thor schedule null check
  • Loading branch information
eugene-doobu authored Nov 28, 2024
2 parents bd67aea + 41c76fb commit 5abdae8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion nekoyume/Assets/_Scripts/Game/LiveAsset/LiveAssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Collections;
using System.Text.Json.Serialization;
using System.Threading;
using JetBrains.Annotations;
using Nekoyume.L10n;

namespace Nekoyume.Game.LiveAsset
Expand Down Expand Up @@ -69,14 +70,15 @@ private enum InitializingState
public IReadOnlyList<NoticeData> NoticeData => _notices.NoticeData;
public GameConfig GameConfig { get; private set; }
public CommandLineOptions CommandLineOptions { get; private set; }
[CanBeNull]
public ApiClient.ThorSchedule ThorSchedule { get; private set; }
public EventRewardPopupData EventRewardPopupData { get; private set; }
public Sprite StakingLevelSprite { get; private set; }
public Sprite StakingRewardSprite { get; private set; }
public int[] StakingArenaBonusValues { get; private set; }
public bool IsInitialized => _state == InitializingState.Initialized;

public System.Action<Nekoyume.ApiClient.ThorSchedule> OnChangedThorSchedule;
public Action<ApiClient.ThorSchedule> OnChangedThorSchedule;

public void InitializeData()
{
Expand Down
18 changes: 10 additions & 8 deletions nekoyume/Assets/_Scripts/UI/Widget/LobbyMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ public override void Show(bool ignoreShowAnimation = false)
stakingLevelIcon.sprite =
stakeIconData.GetIcon(States.Instance.StakingLevel, IconType.Bubble);

var thorSchedule = Game.LiveAsset.LiveAssetManager.instance.ThorSchedule;
var thorSchedule = LiveAssetManager.instance.ThorSchedule;
thorSeasonButton.gameObject.SetActive(thorSchedule?.IsOpened == true);

var isInEventDate = LiveAssetManager.instance.EventRewardPopupData.EventRewards.Any();
Expand All @@ -780,19 +780,21 @@ private void SubscribeAtShow()
value.currentTickets.ToString(CultureInfo.InvariantCulture);
}).AddTo(_disposablesAtShow);

var thorSchedule = Game.LiveAsset.LiveAssetManager.instance.ThorSchedule;
if (thorSchedule.IsOpened)
var thorSchedule = LiveAssetManager.instance.ThorSchedule;
if (thorSchedule?.IsOpened != true)
{
Observable.Interval(TimeSpan.FromMinutes(1))
.Subscribe(_ => UpdateThorScheduleText())
.AddTo(_disposablesAtShow);
UpdateThorScheduleText();
return;
}

Observable.Interval(TimeSpan.FromMinutes(1))
.Subscribe(_ => UpdateThorScheduleText())
.AddTo(_disposablesAtShow);
UpdateThorScheduleText();
}

private void UpdateThorScheduleText()
{
var thorSchedule = Game.LiveAsset.LiveAssetManager.instance.ThorSchedule;
var thorSchedule = LiveAssetManager.instance.ThorSchedule;
if (thorSchedule is null || !thorSchedule.IsOpened)
{
return;
Expand Down

0 comments on commit 5abdae8

Please sign in to comment.