// Using the magical power of Zenject™, we magically find ourselves with an instance of
        // our HUDConfigModel and the CoreGameHUDController.
        internal CanvasUtility(HUDConfigModel hudConfig,
                               MainConfigModel mainConfig,
                               [Inject(Optional = true)] GameplayCoreSceneSetupData data,
                               [Inject(Optional = true)] CoreGameHUDController coreGameHUD)
        {
            this.mainConfig = mainConfig;
            if (coreGameHUD != null)
            {
                hudWidth  = Mathf.Abs(coreGameHUD.GetComponentInChildren <ComboUIController>().transform.position.x);
                hudDepth  = Mathf.Abs(coreGameHUD.GetComponentInChildren <ComboUIController>().transform.position.z);
                hudHeight = Mathf.Abs(coreGameHUD.GetComponentInChildren <ComboUIController>().transform.position.y) - 1.5f;

                energyCanvas = EnergyPanelGO(ref coreGameHUD).GetComponent <Canvas>();

                // Hide Canvas and Multiplier if needed
                if (mainConfig.HideCombo)
                {
                    HideBaseGameHUDElement <ComboUIController>(coreGameHUD);
                }
                if (mainConfig.HideMultiplier)
                {
                    HideBaseGameHUDElement <ScoreMultiplierUIController>(coreGameHUD);
                }
            }
            if (data != null)
            {
                // HUDType = GetGameplayCoreHUDTypeForEnvironmentSize(data.environmentInfo.environmentType);
            }

            RefreshAllCanvases(hudConfig, data, coreGameHUD);
        }
Exemple #2
0
        // Using the magical power of Zenject™, we magically find ourselves with an instance of
        // our HUDConfigModel and the CoreGameHUDController.
        internal CanvasUtility(HUDConfigModel hudConfig,
                               MainConfigModel mainConfig,
                               [Inject(Optional = true)] GameplayCoreSceneSetupData data,
                               [Inject(Optional = true)] CoreGameHUDController coreGameHUD)
        {
            this.mainConfig = mainConfig;
            if (coreGameHUD != null)
            {
                var comboPos = coreGameHUD.GetComponentInChildren <ComboUIController>().transform.position;

                hudWidth  = Mathf.Abs(comboPos.x);
                hudHeight = comboPos.y;
                hudDepth  = comboPos.z;

                energyCanvas = EnergyPanelGO(ref coreGameHUD).GetComponent <Canvas>();

                // Hide Canvas and Multiplier if needed
                if (mainConfig.HideCombo)
                {
                    HideBaseGameHUDElement <ComboUIController>(coreGameHUD);
                }
                if (mainConfig.HideMultiplier)
                {
                    HideBaseGameHUDElement <ScoreMultiplierUIController>(coreGameHUD);
                }
            }

            RefreshAllCanvases(hudConfig, data, coreGameHUD);
        }
Exemple #3
0
        // Using the magical power of Zenject™, we magically find ourselves with an instance of
        // our HUDConfigModel and the CoreGameHUDController.
        internal CanvasUtility(HUDConfigModel hudConfig,
                               MainConfigModel mainConfig,
                               [Inject(Optional = true)] GameplayCoreSceneSetupData data,
                               [Inject(Optional = true)] CoreGameHUDController coreGameHUD)
        {
            this.mainConfig = mainConfig;
            if (coreGameHUD != null)
            {
                energyCanvas = EnergyPanelGO(ref coreGameHUD).GetComponent <Canvas>();

                // Hide Canvas and Multiplier if needed
                if (mainConfig.HideCombo)
                {
                    HideBaseGameHUDElement <ComboUIController>(coreGameHUD);
                }
                if (mainConfig.HideMultiplier)
                {
                    HideBaseGameHUDElement <ScoreMultiplierUIController>(coreGameHUD);
                }
            }
            if (data != null)
            {
                HUDType = GetGameplayCoreHUDTypeForEnvironmentSize(data.environmentInfo.environmentSizeData.width);
            }

            RefreshAllCanvases(hudConfig, data, coreGameHUD);
        }
Exemple #4
0
 private static bool CheckIgnoreOption(HUDConfigModel hud, ConfigModel model)
 {
     if (model.CanvasID == -1)
     {
         return(hud.MainCanvasSettings.IgnoreNoTextAndHUDOption);
     }
     return(hud.OtherCanvasSettings[model.CanvasID].IgnoreNoTextAndHUDOption);
 }
        public override void InstallBindings()
        {
            MainConfigModel mainConfig = Plugin.MainConfig;

            hudConfig = Container.Resolve <HUDConfigModel>();
            dataModel = Container.Resolve <PlayerDataModel>();

            if (!mainConfig.Enabled)
            {
                return;
            }

            /// LOADING IMPORTANT SHIT LIKE CANVASES AND STUFF ///
            Container.Bind <CanvasUtility>().AsSingle();

            Container.Bind <NoteCountProcessor>().To <GenericNoteCountProcessor>().AsSingle();

            /// LOADING COUNTERS ///
            Plugin.Logger.Notice("Loading counters...");

            AddCounter <MissedConfigModel, MissedCounter>();
            AddCounter <NoteConfigModel, NotesCounter>();

            if (mainConfig.ProgressConfig.Mode != ProgressMode.BaseGame)
            {
                AddCounter <ProgressConfigModel, ProgressCounter>();
            }
            else
            {
                AddCounter <ProgressConfigModel, ProgressBaseGameCounter>();
            }

            AddCounter <ScoreConfigModel, ScoreCounter>();
            AddCounter <CutConfigModel, CutCounter>();
            AddCounter <FailConfigModel, FailCounter>();
            AddCounter <NotesLeftConfigModel, NotesLeftCounter>();
            AddCounter <SpeedConfigModel, SpeedCounter>();
            AddCounter <SpinometerConfigModel, Spinometer>();


            AddCounter <PBConfigModel, PBCounter>((settings) => {
                ScoreConfigModel scoreConfig = Container.Resolve <ScoreConfigModel>();
                HUDCanvas canvasSettings     = scoreConfig.CanvasID == -1 ? hudConfig.MainCanvasSettings : hudConfig.OtherCanvasSettings[scoreConfig.CanvasID];
                return(scoreConfig.Enabled && settings.UnderScore && (dataModel.playerData.playerSpecificSettings.noTextsAndHuds ? canvasSettings.IgnoreNoTextAndHUDOption : true));
            });

            foreach (Custom.CustomCounter customCounter in Plugin.LoadedCustomCounters.Values)
            {
                AddCustomCounter(customCounter, customCounter.CounterType);
            }

            /// LOADING BROADCASTERS WITH BROADCAST IN-GAME EVENTS TO COUNTERS AND STUFF ///
            Container.BindInterfacesAndSelfTo <CounterEventBroadcaster>().AsSingle().NonLazy();
            Container.BindInterfacesAndSelfTo <NoteEventBroadcaster>().AsSingle().NonLazy();
            Container.BindInterfacesAndSelfTo <ScoreEventBroadcaster>().AsSingle().NonLazy();
            Plugin.Logger.Notice("Counters loaded!");
        }
Exemple #6
0
        public static bool ShouldSkip(bool original)
        {
            HUDConfigModel      hudConfig = Plugin.MainConfig.HUDConfig;
            ProgressConfigModel progress  = Plugin.MainConfig.ProgressConfig;
            ScoreConfigModel    score     = Plugin.MainConfig.ScoreConfig;

            isOverriding = original && (
                (progress.Enabled && progress.Mode == ProgressMode.BaseGame && CheckIgnoreOption(hudConfig, progress)) ||
                (score.Enabled && CheckIgnoreOption(hudConfig, score)));
            return(isOverriding);
        }
Exemple #7
0
        public static bool ShouldSkip(PlayerSpecificSettings specificSettings, DiContainer container)
        {
            HUDConfigModel      hudConfig = container.Resolve <HUDConfigModel>();
            ProgressConfigModel progress  = container.Resolve <ProgressConfigModel>();
            ScoreConfigModel    score     = container.Resolve <ScoreConfigModel>();
            bool result = specificSettings.noTextsAndHuds && !(
                (progress.Enabled && progress.Mode == ProgressMode.BaseGame && CheckIgnoreOption(hudConfig, progress)) ||
                (score.Enabled && CheckIgnoreOption(hudConfig, score)));

            IsOverridingBaseGameHUD = specificSettings.noTextsAndHuds && !result;
            return(result);
        }
        public static void Patch(HarmonyObj obj, CanvasUtility canvas, HUDConfigModel hud, MenuUIInstaller menuUIInstaller)
        {
            if (obj.GetPatchedMethods().Any(x => x == menuTransitions))
            {
                obj.Unpatch(menuTransitions, transpiler);
            }

            canvasUtility = canvas;
            hudConfig     = hud;
            menuInstaller = menuUIInstaller;

            obj.Patch(menuTransitions, null, null, new HarmonyMethod(transpiler));
        }
Exemple #9
0
        public void RefreshAllCanvases(HUDConfigModel hudConfig, GameplayCoreSceneSetupData data = null, CoreGameHUDController coreGameHUD = null)
        {
            CanvasIDToCanvas.Clear();
            CanvasToSettings.Clear();
            CanvasIDToCanvas.Add(-1, CreateCanvasWithConfig(hudConfig.MainCanvasSettings));
            CanvasToSettings.Add(CanvasIDToCanvas[-1], hudConfig.MainCanvasSettings);
            if (coreGameHUD != null && hudConfig.MainCanvasSettings.ParentedToBaseGameHUD)
            {
                Transform parent = coreGameHUD.transform;
                if (HUDType == GameplayCoreHUDInstaller.HudType.Flying)
                {
                    parent = coreGameHUD.transform.GetChild(0);
                }
                SoftParent softParent = CanvasIDToCanvas[-1].gameObject.AddComponent <SoftParent>();
                softParent.AssignParent(parent);

                // Base Game HUD is rotated backwards, so we have to reflect our vector to match.
                Vector3    posOofset = Vector3.Reflect(hudConfig.MainCanvasSettings.Position, Vector3.back); // yknow what, f**k it, its posOofset now.
                Quaternion rotOofset = Quaternion.Euler(Vector3.Reflect(hudConfig.MainCanvasSettings.Rotation, Vector3.back));

                if (HUDType == GameplayCoreHUDInstaller.HudType.Flying) // Special case for Main HUD w/360 environments
                {
                    posOofset = parent.up;
                    rotOofset = Quaternion.identity;
                }

                softParent.AssignOffsets(posOofset, rotOofset);
            }
            for (int i = 0; i < hudConfig.OtherCanvasSettings.Count; i++)
            {
                HUDCanvas canvasSettings = hudConfig.OtherCanvasSettings[i];
                RegisterNewCanvas(canvasSettings, i);

                if (coreGameHUD != null && hudConfig.OtherCanvasSettings[i].ParentedToBaseGameHUD)
                {
                    Transform parent = coreGameHUD.transform;
                    if (HUDType == GameplayCoreHUDInstaller.HudType.Flying)
                    {
                        parent = coreGameHUD.transform.GetChild(0);
                    }
                    SoftParent softParent = CanvasIDToCanvas[i].gameObject.AddComponent <SoftParent>();
                    softParent.AssignParent(parent);
                }
            }
        }