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

add planet name to push text #6657

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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: 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
Loading