Пример #1
0
        public Plugin(Logger ipaLogger)
        {
            // can't inject at this point so just create it
            ILogger <Plugin> logger = new IPALogger <Plugin>(ipaLogger);

            logger.Info("Initializing Custom Avatars");

            Harmony harmony = new Harmony("com.nicoco007.beatsabercustomavatars");

            ZenjectHelper.Init(harmony, ipaLogger);
            BeatSaberEvents.ApplyPatches(harmony, ipaLogger);

            ZenjectHelper.BindSceneComponent <PCAppInit>();
            ZenjectHelper.BindSceneComponent <SmoothCamera>();
            ZenjectHelper.BindSceneComponent <ObstacleSaberSparkleEffectManager>();

            ZenjectHelper.Register <CustomAvatarsInstaller>().WithArguments(ipaLogger).OnMonoInstaller <PCAppInit>();
            ZenjectHelper.Register <UIInstaller>().OnMonoInstaller <MenuViewControllersInstaller>();

            ZenjectHelper.Register <LightingInstaller>().OnContext("HealthWarning", "SceneContext");
            ZenjectHelper.Register <LightingInstaller>().OnContext("MenuEnvironment", "SceneDecoratorContext");
            ZenjectHelper.Register <LightingInstaller>().OnContext("GameCore", "SceneContext");

            ZenjectHelper.Register <GameInstaller>().OnMonoInstaller <GameplayCoreInstaller>();

            ZenjectHelper.Register <CustomAvatarsLocalInactivePlayerInstaller>().OnMonoInstaller <MultiplayerLocalInactivePlayerInstaller>();
        }
Пример #2
0
        public Plugin(Logger ipaLogger)
        {
            // can't inject at this point so just create it
            ILogger <Plugin> logger = new IPALogger <Plugin>(ipaLogger);

            logger.Info("Initializing Custom Avatars");

            Harmony harmony = new Harmony("com.nicoco007.beatsabercustomavatars");

            ZenjectHelper.Init(harmony, ipaLogger);
            BeatSaberEvents.ApplyPatches(harmony, ipaLogger);

            ZenjectHelper.BindSceneComponent <PCAppInit>();
            ZenjectHelper.BindSceneComponent <ObstacleSaberSparkleEffectManager>();

            ZenjectHelper.AddComponentAlongsideExisting <MainCamera, CustomAvatarsMainCameraController>();
            ZenjectHelper.AddComponentAlongsideExisting <SmoothCamera, CustomAvatarsSmoothCameraController>();
            ZenjectHelper.AddComponentAlongsideExisting <VRCenterAdjust, AvatarCenterAdjust>(null, go => go.name == "Origin");

            // TODO there might be a better way to deal with this
            ZenjectHelper.AddComponentAlongsideExisting <MenuEnvironmentManager, EnvironmentObject>();
            ZenjectHelper.AddComponentAlongsideExisting <MultiplayerLocalActivePlayerFacade, EnvironmentObject>("IsActiveObjects/Lasers");
            ZenjectHelper.AddComponentAlongsideExisting <MultiplayerLocalActivePlayerFacade, EnvironmentObject>("IsActiveObjects/Construction");
            ZenjectHelper.AddComponentAlongsideExisting <MultiplayerLocalActivePlayerFacade, EnvironmentObject>("IsActiveObjects/CenterRings");
            ZenjectHelper.AddComponentAlongsideExisting <MultiplayerLocalInactivePlayerFacade, EnvironmentObject>("MultiplayerLocalInactivePlayerPlayerPlace/CirclePlayerPlace");
            ZenjectHelper.AddComponentAlongsideExisting <MultiplayerConnectedPlayerFacade, EnvironmentObject>();

            ZenjectHelper.Register <CustomAvatarsInstaller>().WithArguments(ipaLogger).OnMonoInstaller <PCAppInit>();
            ZenjectHelper.Register <UIInstaller>().OnMonoInstaller <MenuViewControllersInstaller>();

            ZenjectHelper.Register <LightingInstaller>().OnContext("HealthWarning", "SceneContext");
            ZenjectHelper.Register <LightingInstaller>().OnContext("MenuEnvironment", "SceneDecoratorContext");
            ZenjectHelper.Register <LightingInstaller>().OnContext("GameCore", "SceneContext");

            ZenjectHelper.Register <GameInstaller>().OnMonoInstaller <GameplayCoreInstaller>();
        }