Skip to main content

InterfaceResolver

A class in Root.Township, Features.Meta.Resolvers.

Obsolete static service locator for platform services, used until dependency injection covers them. In this build only IVoiceChat gets a real instance; the shop, Oculus, purchase and friend services resolve to null unless overridden.

Constructors​

MemberWhat it is
InterfaceResolver()Creates an InterfaceResolver with default values.

Fields​

6 private and internal fields
MemberWhat it is
private static readonly HashSet<Type> instanceOverridesService types replaced through SetInstanceOverride.
private static IOculusWrapper iOculusWrapperBacking field for IOculusWrapper.
private static IPlatformFriendService iPlatformFriendServiceBacking field for IPlatformFriendService.
private static IPurchaseConsumer iPurchaseConsumerBacking field for IPurchaseConsumer.
private static IShopController iShopControllerBacking field for IShopController.
private static IVoiceChat iVoiceChatBacking field for IVoiceChat.

Properties​

MemberWhat it is
static IOculusWrapper IOculusWrapper { get; }The Oculus wrapper, created on first use. Null in this build unless overridden.
static IPlatformFriendService IPlatformFriendService { get; }The platform friend service, created on first use. Null in this build unless overridden.
static IPurchaseConsumer IPurchaseConsumer { get; }The purchase consumer, created on first use. Null in this build unless overridden.
static IShopController IShopController { get; }The shop controller, created on first use. Null in this build unless overridden.
static IVoiceChat IVoiceChat { get; }The voice chat service, a VoiceChat created on first use.

Methods​

MemberWhat it is
static void ClearInstanceOverrides()Resets every service that was overridden back to null, so it is created again on next use.
static void SetInstanceOverride<T>(object instance)Replaces the service of type T with the given instance, by reflection over the static fields. Meant for tests, handy for mods.
5 private and internal methods
MemberWhat it is
private static IOculusWrapper CreateOculusWrapper()Returns null in this build.
private static IPlatformFriendService CreatePlatformFriendService()Returns null in this build.
private static IPurchaseConsumer CreatePurchaseConsumer()Returns null in this build.
private static IShopController CreateShopController()Returns null in this build.
private static IVoiceChat CreateVoiceChat()Creates a new VoiceChat.