Skip to content

Commit

Permalink
add planet name to push text
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-doobu committed Dec 27, 2024
1 parent 5905547 commit 7af97ee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
17 changes: 17 additions & 0 deletions nekoyume/Assets/_Scripts/Multiplanetary/PlanetId.Define.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Nekoyume.L10n;

namespace Nekoyume.Multiplanetary
{
public partial struct PlanetId
Expand Down Expand Up @@ -48,6 +50,21 @@ public partial struct PlanetId
return Planet.Odin;
}

public static string GetLocalizationPlanetName(PlanetId planetId)
{
if (planetId == Heimdall || planetId == HeimdallInternal)
{
return L10nManager.Localize("PLANET_0x000000000001");
}

if (planetId == Thor || planetId == ThorInternal)
{
return L10nManager.Localize("PLANET_0x000000000003");
}

return L10nManager.Localize("PLANET_0x000000000000");
}

// TODO: Flag로 변경?
public static bool IsMainNet(PlanetId planetId)
{
Expand Down
4 changes: 2 additions & 2 deletions nekoyume/Assets/_Scripts/Multiplanetary/PlanetId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override bool Equals(object? obj)
{
return obj is PlanetId other && Equals(other);
}

public static bool operator ==(PlanetId obj1, PlanetId obj2)
{
return obj1.Equals(obj2);
Expand All @@ -79,7 +79,7 @@ public override bool Equals(object? obj)
{
return !obj1.Equals(obj2);
}

public override int GetHashCode()
{
return _value.GetHashCode();
Expand Down
8 changes: 8 additions & 0 deletions nekoyume/Assets/_Scripts/PushNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using UnityEngine;
using Random = UnityEngine.Random;
using Nekoyume.L10n;
using Nekoyume.Multiplanetary;

#if UNITY_ANDROID
using UnityEngine.Android;
Expand Down Expand Up @@ -147,6 +148,13 @@ public static string Push(string text, TimeSpan timespan, PushType pushType)
var title = L10nManager.Localize("TITLE");
var iconName = pushType.ToString().ToLower();

var currentPlanetId = Game.Game.instance.CurrentPlanetId;
if (currentPlanetId.HasValue)
{
var currentPlanet = PlanetId.GetLocalizationPlanetName(currentPlanetId.Value);
text = $"{currentPlanet} - {text}";
}

#if UNITY_ANDROID
var notification = new AndroidNotification()
{
Expand Down

0 comments on commit 7af97ee

Please sign in to comment.