Skip to content

Commit 40397d2

Browse files
committed
fix: Add methods to PlatformManager that enable the retrieval of the PlatformConfig for a given PlatformManager.Platform value.
1 parent e11fee9 commit 40397d2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

com.playeveryware.eos/Runtime/Core/PlatformManager.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,43 @@ public static PlatformInfo Create<T>(string fullName, string configFileName, str
9393
/// </summary>
9494
private static IDictionary<Platform, PlatformInfo> PlatformInformation = new Dictionary<Platform, PlatformInfo>();
9595

96+
/// <summary>
97+
/// Returns a list of platforms for which configuration values can be
98+
/// set.
99+
/// </summary>
100+
public static IEnumerable<Platform> ConfigurablePlatforms
101+
{
102+
get
103+
{
104+
return PlatformInformation.Keys;
105+
}
106+
}
107+
108+
/// <summary>
109+
/// Tries to retrieve an instance of the platform config for the
110+
/// indicated platform.
111+
/// </summary>
112+
/// <param name="platform">
113+
/// The platform to get the config for.
114+
/// </param>
115+
/// <param name="platformConfig">
116+
/// The PlatformConfig for the indicated platform.
117+
/// </param>
118+
/// <returns>
119+
/// True if a PlatformConfig instance was retrieved, false otherwise.
120+
/// </returns>
121+
public static bool TryGetConfig(Platform platform, out PlatformConfig platformConfig)
122+
{
123+
platformConfig = null;
124+
if (!PlatformInformation.TryGetValue(platform, out PlatformInfo info))
125+
{
126+
return false;
127+
}
128+
129+
platformConfig = info.GetConfigFunction();
130+
return true;
131+
}
132+
96133
/// <summary>
97134
/// Backing value for the CurrentPlatform property.
98135
/// </summary>

0 commit comments

Comments
 (0)