Beispiel #1
0
 public static void PostfixStart(ref SaberBurnMarkArea __instance)
 {
     if (!(__instance is SiraSaberBurnMarkArea))
     {
         __instance.gameObject.AddComponent <SiraSaberBurnMarkArea>();
     }
 }
Beispiel #2
0
        private void InstallSaberArea(MutationContext ctx, SaberBurnMarkArea burnArea)
        {
            var siraBurnArea = burnArea.Upgrade <SaberBurnMarkArea, SiraSaberBurnMarkArea>();

            ctx.Container.QueueForInject(siraBurnArea);
            ctx.Container.Bind <SaberBurnMarkArea>().To <SiraSaberBurnMarkArea>().FromInstance(siraBurnArea).AsCached();
        }
Beispiel #3
0
 public static bool PrefixCancelMethod(ref SaberBurnMarkArea __instance)
 {
     if (!(__instance is SiraSaberBurnMarkArea))
     {
         return(false);
     }
     return(true);
 }
Beispiel #4
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Prefix
        /// </summary>
        /// <param name="__instance">SaberBurnMarkArea instance</param>
        internal static void Postfix(ref SaberBurnMarkArea __instance)
        {
            m_SaberBurnMarkArea = __instance;

            if (Config.GameTweaker.Enabled)
            {
                /// Apply
                SetRemoveSaberBurnMarks(Config.GameTweaker.RemoveSaberBurnMarks);
            }
        }
Beispiel #5
0
        public SiraSaberBurnMarkArea()
        {
            SaberBurnMarkArea original = GetComponent <SaberBurnMarkArea>();

            foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic))
            {
                info.SetValue(this, info.GetValue(original));
            }
            Destroy(original);
        }
Beispiel #6
0
            internal void SetSaberColor(Color?colorNullable)
            {
                if (colorNullable.HasValue)
                {
                    Color color = colorNullable.Value;

                    SaberColorOverride[(int)_saberType] = color;

                    SaberTrail saberTrail = _saberWeaponTrail;
                    _saberTrailColorAccessor(ref saberTrail) = (color * _trailTintColor).linear;
                    if (_saberLight != null)
                    {
                        _saberLight.color = color;
                    }

                    foreach (SetSaberGlowColor setSaberGlowColor in _setSaberGlowColors)
                    {
                        setSaberGlowColor.SetColors();
                    }

                    foreach (SetSaberFakeGlowColor setSaberFakeGlowColor in _setSaberFakeGlowColors)
                    {
                        setSaberFakeGlowColor.SetColors();
                    }

                    SaberBurnMarkArea saberBurnMarkArea = SaberBurnMarkArea;
                    LineRenderer[]    lineRenderers     = _lineRenderersAccessor(ref saberBurnMarkArea);
                    lineRenderers[(int)_saberType].startColor = color;
                    lineRenderers[(int)_saberType].endColor   = color;

                    // Custom sabers suck
                    IEnumerable <Renderer> renderers = _bsm.transform.parent.GetComponentsInChildren <Renderer>();
                    foreach (Renderer renderer in renderers)
                    {
                        foreach (Material material in renderer.materials)
                        {
                            if (material.HasProperty("_Color"))
                            {
                                if (material.HasProperty("_CustomColors"))
                                {
                                    if (material.GetFloat("_CustomColors") > 0)
                                    {
                                        material.SetColor("_Color", color);
                                    }
                                }
                                else if ((material.HasProperty("_Glow") && material.GetFloat("_Glow") > 0) || (material.HasProperty("_Bloom") && material.GetFloat("_Bloom") > 0))
                                {
                                    material.SetColor("_Color", color);
                                }
                            }
                        }
                    }
                }
            }
Beispiel #7
0
            internal void SetSaberColor(Color?colorNullable)
            {
                if (colorNullable.HasValue)
                {
                    Color color = colorNullable.Value;

                    _bsm.ChangeColor(color);

                    SaberBurnMarkArea saberBurnMarkArea = SaberBurnMarkArea;
                    LineRenderer[]    lineRenderers     = _lineRenderersAccessor(ref saberBurnMarkArea);
                    lineRenderers[(int)_saberType].startColor = color;
                    lineRenderers[(int)_saberType].endColor   = color;
                }
            }
Beispiel #8
0
            internal void SetSaberColor(Color color)
            {
                if (color == _lastColor)
                {
                    return;
                }

                _bsm.ChangeColor(color);
                _lastColor = color;

                SaberBurnMarkArea saberBurnMarkArea = SaberBurnMarkArea;

                LineRenderer[] lineRenderers = _lineRenderersAccessor(ref saberBurnMarkArea);
                lineRenderers[(int)_saberType].startColor = color;
                lineRenderers[(int)_saberType].endColor   = color;
            }
        internal SiraSaberEffectManager([InjectOptional] IGamePause gamePause, SaberManager saberManager, SaberClashChecker saberClashChecker, SaberBurnMarkArea saberBurnMarkArea,
                                        SaberBurnMarkSparkles saberBurnMarkSparkles, ObstacleSaberSparkleEffectManager obstacleSaberSparkleEffectManager)
        {
            _gamePause    = gamePause;
            _saberManager = saberManager;
            saberClashChecker.Init(saberManager);
            _saberManagers.Add(saberClashChecker as SiraSaberClashChecker);
            _saberManagers.Add(saberBurnMarkArea as SiraSaberBurnMarkArea);
            _saberManagers.Add(saberBurnMarkSparkles as SiraSaberBurnMarkSparkles);
            _saberManagers.Add(obstacleSaberSparkleEffectManager as SiraObstacleSaberSparkleEffectManager);

            _siraSaberClashChecker = saberClashChecker as SiraSaberClashChecker;
            _siraObstacleSaberSparkleEffectManager = obstacleSaberSparkleEffectManager as SiraObstacleSaberSparkleEffectManager;
        }
Beispiel #10
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Postfix(SaberBurnMarkArea __instance)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            Colorizer.SaberColorizer.SaberBurnMarkArea = __instance;
        }
Beispiel #11
0
 private static void Postfix(SaberBurnMarkArea __instance)
 {
     Colorizer.SaberColorizer.SaberBurnMarkArea = __instance;
 }
        private IEnumerator OnGameCoreCoroutine()
        {
            if (_audioTimeSyncController == null)
            {
                _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
                _audioSource             = _audioTimeSyncController.GetPrivateField <AudioSource>("_audioSource");
            }
            _originalTimeScale = _audioTimeSyncController.timeScale;

            if (_gamePause == null)
            {
                _gamePause = Resources.FindObjectsOfTypeAll <GamePause>().FirstOrDefault();
            }
            _gamePause.didResumeEvent += OnPauseResume;

            // wait for CustomSaber mod
            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <Saber>().Any()));

            yield return(new WaitForSecondsRealtime(0.1f));

            if (_playerController == null)
            {
                _playerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault();
            }
            if (_rightSaberTransform == null)
            {
                _rightSaberTransform = _playerController.rightSaber.transform;
            }
            if (_leftSaberTransform == null)
            {
                _leftSaberTransform = _playerController.leftSaber.transform;
            }
            if (_saberClashChecker == null)
            {
                _saberClashChecker = Resources.FindObjectsOfTypeAll <SaberClashChecker>().FirstOrDefault();
            }
            if (_saberBurnMarkArea == null)
            {
                _saberBurnMarkArea = Resources.FindObjectsOfTypeAll <SaberBurnMarkArea>().FirstOrDefault();
            }
            if (_saberBurnMarkSparkles == null)
            {
                _saberBurnMarkSparkles = Resources.FindObjectsOfTypeAll <SaberBurnMarkSparkles>().FirstOrDefault();
            }

            // need some wait to GetNoteOffset
            if (Config.centering)
            {
                if (_beatmapObjectSpawnController == null)
                {
                    _beatmapObjectSpawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault();
                }
                BeatmapObjectSpawnMovementData beatmapObjectSpawnMovementData = _beatmapObjectSpawnController.GetPrivateField <BeatmapObjectSpawnMovementData>("_beatmapObjectSpawnMovementData");
                Vector3 leftBase = beatmapObjectSpawnMovementData.GetNoteOffset(0, NoteLineLayer.Base);
                Vector3 rightTop = beatmapObjectSpawnMovementData.GetNoteOffset(3, NoteLineLayer.Top);
                NoteJumpManualUpdate.center = (leftBase + rightTop) / 2;
                //Logger.log.Debug($"leftBase={leftBase.x}, {leftBase.y}, {leftBase.z}");
                //Logger.log.Debug($"rightTop={rightTop.x}, {rightTop.y}, {rightTop.z}");
            }

            if (Config.hideSabers)
            {
                SetSaberVisible(_playerController.rightSaber, false);
                SetSaberVisible(_playerController.leftSaber, false);
                SetTrailWidth(0f);
                _saberClashChecker.enabled     = false;
                _saberBurnMarkArea.enabled     = false;
                _saberBurnMarkSparkles.enabled = false;
            }

            if (Config.hideSaberEffects)
            {
                SetTrailWidth(0f);
                _saberClashChecker.enabled     = false;
                _saberBurnMarkArea.enabled     = false;
                _saberBurnMarkSparkles.enabled = false;
            }

            if (Config.boxing)
            {
                SetTrailWidth(0.05f);
            }

            if (Config.headbang)
            {
                SetTrailWidth(0f);
            }

            if (Config.vacuum)
            {
                if (_gameEnergyCounter == null)
                {
                    _gameEnergyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().FirstOrDefault();
                }
                _gameEnergyCounter.SetPrivateField("_hitBombEnergyDrain", 0f);
            }

            if (GameObject.Find("vacuum_saber_right"))
            {
                SetTrailWidth(0f);
            }

            if (Config.feetAvatar)
            {
                StartCoroutine(FindAvatarCoroutine());
            }

            UpdateSaberActive();

            _init = true;
        }
        public SiraSaberEffectManager(IGamePause gamePause, SaberManager saberManager, SaberClashChecker saberClashChecker, SaberBurnMarkArea saberBurnMarkArea,
                                      SaberBurnMarkSparkles saberBurnMarkSparkles, ObstacleSaberSparkleEffectManager obstacleSaberSparkleEffectManager)
        {
            _gamePause = gamePause;
            saberClashChecker.Init(saberManager);
            _saberManagers.Add(saberClashChecker as SiraSaberClashChecker);
            _saberManagers.Add(saberBurnMarkArea as SiraSaberBurnMarkArea);
            _saberManagers.Add(saberBurnMarkSparkles as SiraSaberBurnMarkSparkles);
            _saberManagers.Add(obstacleSaberSparkleEffectManager as SiraObstacleSaberSparkleEffectManager);

            _siraSaberClashChecker = saberClashChecker as SiraSaberClashChecker;
        }