Skip to content

Commit

Permalink
Ignore case
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Aug 21, 2022
1 parent 6b0e7a4 commit 5f471ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions API/RichPresenceAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ public void SetRichPresence(string message, int imageKey)
=> OWRichPresence.SetPresence(message, (ImageKey)imageKey);

public void SetRichPresence(string message, string imageKey)
=> OWRichPresence.SetPresence(message, (ImageKey)Enum.Parse(typeof(ImageKey), imageKey));
=> OWRichPresence.SetPresence(message, (ImageKey)Enum.Parse(typeof(ImageKey), imageKey, true));

public void SetTriggerActivation(bool active)
=> OWRichPresence.TriggersActive = active;

public GameObject CreateTrigger(GameObject parent, string message, string imageKey)
{
if (!Enum.TryParse(imageKey, out ImageKey imageKeyEnum)) imageKeyEnum = ImageKey.sun;
if (!Enum.TryParse(imageKey, true, out ImageKey imageKeyEnum)) imageKeyEnum = ImageKey.sun;

return OWRichPresence.CreateTrigger(parent, message, imageKeyEnum)?.gameObject;
}

public GameObject CreateTrigger(GameObject parent, Sector sector, string message, string imageKey)
{
if (!Enum.TryParse(imageKey, out ImageKey imageKeyEnum)) imageKeyEnum = ImageKey.sun;
if (!Enum.TryParse(imageKey, true, out ImageKey imageKeyEnum)) imageKeyEnum = ImageKey.sun;

var trigger = OWRichPresence.CreateTrigger(parent, message, imageKeyEnum);
trigger.SetSector(sector);
return trigger.gameObject;
}

public void SetCurrentRootPresence(string message, string imageKey)
=> OWRichPresence.Instance.SetRootPresence(message, (ImageKey)Enum.Parse(typeof(ImageKey), imageKey));
=> OWRichPresence.Instance.SetRootPresence(message, (ImageKey)Enum.Parse(typeof(ImageKey), imageKey, true));
}

0 comments on commit 5f471ce

Please sign in to comment.