Exemplo n.º 1
0
 private void LoadingDidFinishEvent()
 {
     try
     {
         Plugin.Log("One Color Activation Attempt", Plugin.LogLevel.Info);
         PlayerController _playerController = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault();
         var leftSaberType = _playerController.leftSaber.GetPrivateField <SaberTypeObject>("_saberType");
         leftSaberType.SetPrivateField("_saberType", Saber.SaberType.SaberB);
         rumble = model.controllersRumbleEnabled;
         model.controllersRumbleEnabled.value = false;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemplo n.º 2
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     try
     {
         if (scene.name == "MenuCore")
         {
             if (model == null)
             {
                 model  = Resources.FindObjectsOfTypeAll <MainSettingsModel>().FirstOrDefault();
                 rumble = model.controllersRumbleEnabled;
             }
             model.controllersRumbleEnabled = rumble;
         }
         if (SceneUtils.isGameScene(scene) && Settings.OneColour && TweakManager.IsPartyMode())
         {
             StartCoroutine(WaitForLoad());
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Tweaks (OneColour) done f****d up: " + e);
     }
 }
Exemplo n.º 3
0
        private void SpawnController_ScaleRemoveCut(BeatmapObjectSpawnController arg1, INoteController controller, NoteCutInfo arg3)
        {
            NoteData  note          = controller.noteData;
            Transform noteTransform = controller.noteTransform;

            //      Log("DESPAWN" + noteTransform.localScale.ToString());
            if (noteTransform.localScale.x != 1)
            {
                noteTransform.localScale = new Vector3(1f, 1f, 1f);
            }
            //          Log("DESPAWN" + noteTransform.localScale.ToString());



            //     if (modifiedNotes[note.id] != null)
            //          note = modifiedNotes[note.id];

            FloatBehavior behavior = noteTransform.gameObject.GetComponent <FloatBehavior>();

            if (behavior != null)
            {
                noteTransform.localPosition = new Vector3(behavior.originalX, behavior.originalY, noteTransform.localPosition.z);
                GameObject.Destroy(behavior);
            }


            if (GMPUI.oneColor)
            {
                if (!defaultRumble)
                {
                    return;
                }
                _noteCutEffectSpawner = UnityEngine.Object.FindObjectOfType <NoteCutEffectSpawner>();
                if (_noteCutEffectSpawner != null)
                {
                    _noteCutHapticEffect = ReflectionUtil.GetPrivateField <NoteCutHapticEffect>(_noteCutEffectSpawner, "_noteCutHapticEffect");
                }
                if (_noteCutHapticEffect != null)
                {
                    _hapticFeedbackController = ReflectionUtil.GetPrivateField <HapticFeedbackController>(_noteCutHapticEffect, "_hapticFeedbackController");
                }
                if (_hapticFeedbackController != null)
                {
                    _RumbleEnabledOneC = ReflectionUtil.GetPrivateField <BoolSO>(_hapticFeedbackController, "_controllersRumbleEnabled");
                }

                if (_RumbleEnabledOneC == null)
                {
                    return;
                }
                Vector3 notePos = controller.noteTransform.position;

                Vector3 leftPos = player.leftSaber.transform.position;
                leftPos += player.leftSaber.transform.forward * 0.5f;
                Vector3 rightPos = player.rightSaber.transform.position;
                rightPos += player.rightSaber.transform.forward * 0.5f;

                float leftDist  = Vector3.Distance(leftPos, notePos);
                float rightDist = Vector3.Distance(rightPos, notePos);
                // Log(leftDist.ToString() + "   " + rightDist.ToString());
                _RumbleEnabledOneC.value = true;
                Saber.SaberType targetType = (leftDist > rightDist) ? Saber.SaberType.SaberB : Saber.SaberType.SaberA;
                if (!(Mathf.Abs(leftDist - rightDist) <= 0.2f))
                {
                    _noteCutHapticEffect.HitNote(targetType);
                }
                else
                {
                    _noteCutHapticEffect.HitNote(Saber.SaberType.SaberA);
                    _noteCutHapticEffect.HitNote(Saber.SaberType.SaberB);
                }
                _RumbleEnabledOneC.value = false;
            }
        }
Exemplo n.º 4
0
 public void Construct(MaterialSwapper materialSwapper, [Inject(Id = "PostProcessEnabled")] BoolSO postProcessEnabled, [InjectOptional] LightWithIdManager lightWithIdManager)
 {
     _materialSwapper    = materialSwapper;
     _postProcessEnabled = postProcessEnabled;
     _lightWithIdManager = lightWithIdManager;
 }