mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add OWRichPresence support
This commit is contained in:
parent
647baf556f
commit
27dee5867b
@ -11,7 +11,8 @@
|
|||||||
"FREQ_WARP_CORE": "Anti-Graviton Flux",
|
"FREQ_WARP_CORE": "Anti-Graviton Flux",
|
||||||
"FREQ_UNKNOWN": "???",
|
"FREQ_UNKNOWN": "???",
|
||||||
"ENGAGE_WARP_PROMPT": "Engage Warp To {0}",
|
"ENGAGE_WARP_PROMPT": "Engage Warp To {0}",
|
||||||
"WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}"
|
"WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}",
|
||||||
|
"OWRP_EXPLORING": "Exploring {0}"
|
||||||
},
|
},
|
||||||
"AchievementTranslations": {
|
"AchievementTranslations": {
|
||||||
"NH_EATEN_OUTSIDE_BRAMBLE": {
|
"NH_EATEN_OUTSIDE_BRAMBLE": {
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
"INTERSTELLAR_MODE": "Mode Interstellaire",
|
"INTERSTELLAR_MODE": "Mode Interstellaire",
|
||||||
"FREQ_STATUE": "Statue Nomaï",
|
"FREQ_STATUE": "Statue Nomaï",
|
||||||
"FREQ_WARP_CORE": "Flux Anti-Gravitonique",
|
"FREQ_WARP_CORE": "Flux Anti-Gravitonique",
|
||||||
"FREQ_UNKNOWN": "???"
|
"FREQ_UNKNOWN": "???",
|
||||||
|
"OWRP_EXPLORING": "En train d'explorer {0}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Components.Achievement
|
namespace NewHorizons.Components.Achievement
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.AchievementsPlus.NH;
|
using NewHorizons.OtherMods.AchievementsPlus.NH;
|
||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components
|
||||||
{
|
{
|
||||||
|
|||||||
2
NewHorizons/External/Configs/AddonConfig.cs
vendored
2
NewHorizons/External/Configs/AddonConfig.cs
vendored
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using NewHorizons.Builder.Props;
|
|||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
|
using NewHorizons.OtherMods.OWRichPresence;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -446,6 +447,8 @@ namespace NewHorizons.Handlers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector);
|
||||||
|
|
||||||
Logger.LogVerbose($"Finished creating [{body.Config.name}]");
|
Logger.LogVerbose($"Finished creating [{body.Config.name}]");
|
||||||
|
|
||||||
return go;
|
return go;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.Builder.Atmosphere;
|
using NewHorizons.Builder.Atmosphere;
|
||||||
using NewHorizons.Builder.Body;
|
using NewHorizons.Builder.Body;
|
||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
@ -10,7 +10,7 @@ using NewHorizons.Handlers;
|
|||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using NewHorizons.Utility.DebugMenu;
|
using NewHorizons.Utility.DebugMenu;
|
||||||
using NewHorizons.Utility.DebugUtilities;
|
using NewHorizons.Utility.DebugUtilities;
|
||||||
using NewHorizons.VoiceActing;
|
using NewHorizons.OtherMods.VoiceActing;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using OWML.ModHelper;
|
using OWML.ModHelper;
|
||||||
using System;
|
using System;
|
||||||
@ -22,6 +22,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
using NewHorizons.OtherMods.OWRichPresence;
|
||||||
|
|
||||||
namespace NewHorizons
|
namespace NewHorizons
|
||||||
{
|
{
|
||||||
@ -198,6 +199,8 @@ namespace NewHorizons
|
|||||||
|
|
||||||
AchievementHandler.Init();
|
AchievementHandler.Init();
|
||||||
VoiceHandler.Init();
|
VoiceHandler.Init();
|
||||||
|
RichPresenceHandler.Init();
|
||||||
|
OnStarSystemLoaded.AddListener(RichPresenceHandler.SetUpSolarSystem);
|
||||||
|
|
||||||
LoadAddonManifest("Assets/addon-manifest.json", this);
|
LoadAddonManifest("Assets/addon-manifest.json", this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using OWML.ModHelper;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus
|
namespace NewHorizons.OtherMods.AchievementsPlus
|
||||||
{
|
{
|
||||||
public static class AchievementHandler
|
public static class AchievementHandler
|
||||||
{
|
{
|
||||||
@ -2,7 +2,7 @@ using NewHorizons.Builder.Props;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus
|
namespace NewHorizons.OtherMods.AchievementsPlus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Info for an achievement to be used with the Achievements+ mod.
|
/// Info for an achievement to be used with the Achievements+ mod.
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using OWML.ModHelper;
|
using OWML.ModHelper;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus
|
namespace NewHorizons.OtherMods.AchievementsPlus
|
||||||
{
|
{
|
||||||
public interface IAchievements
|
public interface IAchievements
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class EatenOutsideBrambleAchievement
|
public static class EatenOutsideBrambleAchievement
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class MultipleSystemAchievement
|
public static class MultipleSystemAchievement
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class NewFrequencyAchievement
|
public static class NewFrequencyAchievement
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class ProbeLostAchievement
|
public static class ProbeLostAchievement
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class VesselWarpAchievement
|
public static class VesselWarpAchievement
|
||||||
{
|
{
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.AchievementsPlus.NH
|
namespace NewHorizons.OtherMods.AchievementsPlus.NH
|
||||||
{
|
{
|
||||||
public static class WarpDriveAchievement
|
public static class WarpDriveAchievement
|
||||||
{
|
{
|
||||||
12
NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs
Normal file
12
NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.OWRichPresence
|
||||||
|
{
|
||||||
|
public interface IRichPresenceAPI
|
||||||
|
{
|
||||||
|
public void SetRichPresence(string message, int imageKey);
|
||||||
|
public void SetTriggerActivation(bool active);
|
||||||
|
public void CreateTrigger(GameObject parent, Sector sector, string details, string imageKey);
|
||||||
|
public void SetCurrentRootPresence(string message, string imageKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
55
NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs
Normal file
55
NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using NewHorizons.Components;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
using NewHorizons.Utility;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.OWRichPresence
|
||||||
|
{
|
||||||
|
public class RichPresenceHandler
|
||||||
|
{
|
||||||
|
public static bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
private static IRichPresenceAPI API;
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
API = Main.Instance.ModHelper.Interaction.TryGetModApi<IRichPresenceAPI>("MegaPiggy.OWRichPresence");
|
||||||
|
|
||||||
|
if (API == null)
|
||||||
|
{
|
||||||
|
Logger.LogVerbose("OWRichPresence isn't installed");
|
||||||
|
Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetUpPlanet(string name, GameObject go, Sector sector)
|
||||||
|
{
|
||||||
|
if (!Enabled) return;
|
||||||
|
|
||||||
|
Logger.LogVerbose($"Registering {go.name} to OWRichPresence");
|
||||||
|
|
||||||
|
var localizedName = TranslationHandler.GetTranslation(name, TranslationHandler.TextType.UI);
|
||||||
|
var localizedMessage = TranslationHandler.GetTranslation("OWRP_EXPLORING", TranslationHandler.TextType.UI);
|
||||||
|
var message = localizedMessage.Replace("{0}", localizedName);
|
||||||
|
|
||||||
|
API.CreateTrigger(go, sector, message, "sun");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetUpSolarSystem(string name)
|
||||||
|
{
|
||||||
|
if (name == "SolarSystem") return;
|
||||||
|
|
||||||
|
var localizedName = ShipLogStarChartMode.UniqueIDToName(name);
|
||||||
|
var localizedMessage = TranslationHandler.GetTranslation("OWRP_EXPLORING", TranslationHandler.TextType.UI);
|
||||||
|
var message = localizedMessage.Replace("{0}", localizedName);
|
||||||
|
|
||||||
|
API.SetCurrentRootPresence(message, "sun");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace NewHorizons.VoiceActing
|
namespace NewHorizons.OtherMods.VoiceActing
|
||||||
{
|
{
|
||||||
public interface IVoiceMod
|
public interface IVoiceMod
|
||||||
{
|
{
|
||||||
@ -2,7 +2,7 @@ using NewHorizons.Utility;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NewHorizons.VoiceActing
|
namespace NewHorizons.OtherMods.VoiceActing
|
||||||
{
|
{
|
||||||
public static class VoiceHandler
|
public static class VoiceHandler
|
||||||
{
|
{
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.AchievementsPlus.NH;
|
using NewHorizons.OtherMods.AchievementsPlus.NH;
|
||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.AchievementsPlus;
|
using NewHorizons.OtherMods.AchievementsPlus;
|
||||||
using NewHorizons.Builder.ShipLog;
|
using NewHorizons.Builder.ShipLog;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user