Skip to content

Commit

Permalink
Merge pull request #525 from kremnev8/fix-chat-bug
Browse files Browse the repository at this point in the history
Fix chat breaking if player loads the save multiple times.
  • Loading branch information
sp00ktober authored Feb 17, 2022
2 parents 4ad6b6e + 681362b commit 6786903
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NebulaWorld/Chat/EmojiDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Emoji(Dictionary<string, object> dict)
public static class EmojiDataManager
{
public static Dictionary<string, List<Emoji>> emojies = new Dictionary<string, List<Emoji>>();
private static bool isLoaded = false;

private static void Add(Emoji emoji)
{
Expand All @@ -49,6 +50,8 @@ private static void Add(Emoji emoji)

public static void ParseData(TextAsset asset)
{
if (isLoaded) return;

string json = "{\"frames\":" + asset.text + "}";

if (MiniJson.Deserialize(json) is Dictionary<string, object> jObject)
Expand All @@ -74,6 +77,8 @@ public static void ParseData(TextAsset asset)
{
kv.Value.Sort((emoji1, emoji2) => emoji1.SortOrder.CompareTo(emoji2.SortOrder));
}

isLoaded = true;
}
}
}

0 comments on commit 6786903

Please sign in to comment.