Exemplo n.º 1
0
        private void Construct(
            PluginConfig config,
            SiraLog logger,
            [InjectOptional] PauseController pauseController,
            MovementController movementController,
            InputManager inputManager,
            SaberControllerBearer saberControllerBearer,
            SaberType saberType,
            SaberTrickModel saberTrickModel,
            AudioTimeSyncController audioTimeSyncController,
            Trick.Factory trickFactory)
        {
            _config                  = config;
            _logger                  = logger;
            _pauseController         = pauseController;
            _movementController      = movementController;
            _inputManager            = inputManager;
            _audioTimeSyncController = audioTimeSyncController;
            SaberTrickModel          = saberTrickModel;

            _saber        = saberControllerBearer[saberType].Saber;
            _vrController = saberControllerBearer[saberType].VRController;

            _trickFactory = trickFactory;
        }
Exemplo n.º 2
0
 public static void SetSaberColor(this SaberType saberType, Color?color)
 {
     foreach (BSMColorManager bsmColorManager in BSMColorManager.GetBSMColorManager(saberType))
     {
         bsmColorManager.SetSaberColor(color);
     }
 }
Exemplo n.º 3
0
        public void SetPartEventList(List <PartEvents> partEventsList, SaberType saberType)
        {
            _partEventsList = partEventsList;
            _saberType      = saberType;

            if (!_pluginConfig.EnableEvents)
            {
                return;
            }

            _didInit = true;

            // OnSlice LevelEnded Combobreak
            _beatmapObjectManager.noteWasCutEvent    += OnNoteCut;
            _beatmapObjectManager.noteWasMissedEvent += OnNoteMiss;

            // Sabers clashing
            //if (_obstacleSaberSparkleEffectManager == null)
            //{
            //    _obstacleSaberSparkleEffectManager = _monoKernel.GetComponentInChildren<ObstacleSaberSparkleEffectManager>();
            //}
            //_obstacleSaberSparkleEffectManager.sparkleEffectDidStartEvent += SaberStartCollide;
            //_obstacleSaberSparkleEffectManager.sparkleEffectDidEndEvent += SaberEndCollide;

            // OnLevelFail
            _energyCounter.gameEnergyDidReach0Event += InvokeOnLevelFail;

            // MultiplierUp
            _scoreController.multiplierDidChangeEvent += MultiplayerDidChange;

            // Combo changed
            _scoreController.comboDidChangeEvent += InvokeComboChanged;

            InvokeOnLevelStart();
        }
Exemplo n.º 4
0
 static void Prefix(ref SaberType type)
 {
     if (Config.oneColorRed && type == SaberType.SaberB && NalulunaModifierController.instance?.inGame == true)
     {
         type = SaberType.SaberA;
     }
 }
Exemplo n.º 5
0
        /*
         * BSM ColorSO holders
         */

        internal static void BSMStart(Saber bcm, SaberType saberType)
        {
            if (saberType == SaberType.SaberA || saberType == SaberType.SaberB)
            {
                BSMColorManager.CreateBSMColorManager(bcm, saberType);
            }
        }
Exemplo n.º 6
0
        public void Init(SaberType type, VRControllersInputManager vrControllersInputManager)
        {
            OVRInput.Controller oculusController;
            XRNode node;

            if (type == SaberType.SaberA)
            {
                oculusController = OVRInput.Controller.LTouch;
                node             = XRNode.LeftHand;
            }
            else
            {
                oculusController = OVRInput.Controller.RTouch;
                node             = XRNode.RightHand;
            }

            var controllerInputDevice = InputDevices.GetDeviceAtXRNode(node);

            var vrSystem = OVRInput.IsControllerConnected(oculusController) ? VRSystem.Oculus : VRSystem.SteamVR;

            var dir = _config.ThumstickDirection;

            var triggerHandler = new TriggerHandler(node, _config.TriggerThreshold, _config.ReverseTrigger);
            var gripHandler    = new GripHandler(vrSystem, oculusController, controllerInputDevice,
                                                 _config.GripThreshold, _config.ReverseGrip);
            var thumbstickAction = new ThumbstickHandler(node, _config.ThumbstickThreshold, dir, _config.ReverseThumbstick);

            _trickInputHandler.Add(_config.TriggerAction, triggerHandler);
            _trickInputHandler.Add(_config.GripAction, gripHandler);
            _trickInputHandler.Add(_config.ThumbstickAction, thumbstickAction);

            _logger.Debug("Started Input Manager using " + vrSystem);
        }
Exemplo n.º 7
0
 private void SaberStartCollide(SaberType saberType)
 {
     if (saberType == _saberType)
     {
         InvokeSaberStartColliding();
     }
 }
Exemplo n.º 8
0
        public void Init(SaberType type, VRControllersInputManager vrControllersInputManager)
        {
            OVRInput.Controller oculusController;
            XRNode node;

            if (type == SaberType.SaberA)
            {
                oculusController = OVRInput.Controller.LTouch;
                node             = XRNode.LeftHand;
            }
            else
            {
                oculusController = OVRInput.Controller.RTouch;
                node             = XRNode.RightHand;
            }

            var controllerInputDevice = InputDevices.GetDeviceAtXRNode(node);

            var vrSystem = OVRInput.IsControllerConnected(oculusController) ? VRSystem.Oculus : VRSystem.SteamVR;

            var dir = (ThumstickDir)Enum.Parse(typeof(ThumstickDir), PluginConfig.Instance.ThumstickDirection, true);

            var triggerHandler = new TriggerHandler(node, PluginConfig.Instance.TriggerThreshold);
            var gripHandler    = new GripHandler(vrSystem, oculusController, controllerInputDevice,
                                                 PluginConfig.Instance.GripThreshold);
            var thumbstickAction = new ThumbstickHandler(node, PluginConfig.Instance.ThumbstickThreshold, dir);

            _trickInputHandler.Add(PluginConfig.Instance.TriggerAction.GetEnumValue <TrickAction>(), triggerHandler);
            _trickInputHandler.Add(PluginConfig.Instance.GripAction.GetEnumValue <TrickAction>(), gripHandler);
            _trickInputHandler.Add(PluginConfig.Instance.ThumbstickAction.GetEnumValue <TrickAction>(),
                                   thumbstickAction);

            Plugin.Log.Debug("Started Input Manager using " + vrSystem);
        }
 /// <summary>
 /// Gets a burn mark position for a specific saber type.
 /// </summary>
 /// <param name="saberType"></param>
 /// <returns></returns>
 public override Vector3 BurnMarkPosForSaberType(SaberType saberType)
 {
     return(_obstacleSparkleData.Count() >= 2
         ? _obstacleSparkleData[0].saber != null && saberType == _obstacleSparkleData[0].saber.saberType
             ? _obstacleSparkleData[0].burnMarkPosition
             : _obstacleSparkleData[1].burnMarkPosition
         : Vector3.zero);
 }
 private static UnityEngine.XR.XRNode SwapNode(SaberType saberType)
 {
     if (saberType == SaberType.SaberA)
     {
         return(UnityEngine.XR.XRNode.RightHand);
     }
     return(UnityEngine.XR.XRNode.LeftHand);
 }
Exemplo n.º 11
0
 private void BindTrickManager(SaberType saberType)
 {
     Container
     .Bind <SaberTrickManager>()
     .WithId(saberType)
     .FromNewComponentOn(GetSaber).AsCached()
     .WithArguments(saberType);
 }
Exemplo n.º 12
0
 internal static void OnSaberColorChanged(SaberType saberType, Color color)
 {
     if (_burnMarksPS != null)
     {
         ParticleSystem.MainModule main = _burnMarksPS[(int)saberType].main;
         main.startColor = color;
     }
 }
 /// <summary>
 /// Gets a burn mark position for a specific saber type.
 /// </summary>
 /// <param name="saberType"></param>
 /// <returns></returns>
 public override Vector3 BurnMarkPosForSaberType(SaberType saberType)
 {
     return(_sabers.Count() >= 2
         ? _sabers[0] != null && saberType == _sabers[0].saberType
             ? _burnMarkPositions[0]
             : _burnMarkPositions[1]
         : Vector3.zero);
 }
Exemplo n.º 14
0
        private static bool Prefix(ColorManager __instance, SaberType type, ref Color __result)
        {
            Color rgbColor = __instance.ColorForSaberType(type);

            Color.RGBToHSV(rgbColor, out float h, out float s, out _);
            __result = Color.HSVToRGB(h, s, 1);
            return(false);
        }
Exemplo n.º 15
0
            internal static BSMColorManager CreateBSMColorManager(Saber bsm, SaberType saberType)
            {
                BSMColorManager bsmcm;

                bsmcm = new BSMColorManager(bsm, saberType);
                _bsmColorManagers.Add(bsmcm);
                return(bsmcm);
            }
Exemplo n.º 16
0
            internal static BSMColorManager GetBSMColorManager(SaberType saberType)
            {
                if (_bsmColorManagers.TryGetValue(saberType, out BSMColorManager colorManager))
                {
                    return(colorManager);
                }

                return(null);
            }
Exemplo n.º 17
0
 static bool Prefix(SaberType saberType, HapticFeedbackController ____hapticFeedbackController, HapticPresetSO ____rumblePreset)
 {
     //Logger.log.Debug($"NoteCutHapticEffect: strengh={____rumblePreset._strength}, duration={____rumblePreset._duration}, frequency={____rumblePreset._frequency}, continuous={____rumblePreset._continuous}");
     if ((Configuration.PluginConfig.Instance.strength > 0) && (Configuration.PluginConfig.Instance.duration > 0))
     {
         ____hapticFeedbackController.PlayHapticFeedback(saberType.Node(), rumblePreset);
     }
     return(false);
 }
Exemplo n.º 18
0
 internal static void OnSaberColorChanged(SaberType saberType, Color color)
 {
     if (_lineRenderers != null)
     {
         int intType = (int)saberType;
         _lineRenderers[intType].startColor = color;
         _lineRenderers[intType].endColor   = color;
     }
 }
Exemplo n.º 19
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static bool Prefix(ColorManager __instance, SaberType type, ref Color __result)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            Color rgbColor = __instance.ColorForSaberType(type);

            Color.RGBToHSV(rgbColor, out float h, out float s, out _);
            __result = Color.HSVToRGB(h, s, 1);
            return(false);
        }
Exemplo n.º 20
0
            private BSMColorManager(SaberModelController bsm, SaberType saberType)
            {
                _bsm       = bsm;
                _saberType = saberType;

                _saberWeaponTrail       = _saberWeaponTrailAccessor(ref _bsm);
                _trailTintColor         = _initDataAccessor(ref _bsm).trailTintColor;
                _setSaberGlowColors     = _setSaberGlowColorsAccessor(ref _bsm);
                _setSaberFakeGlowColors = _SetSaberFakeGlowAccessor(ref _bsm);
                _saberLight             = _saberLightAccessor(ref _bsm);
            }
Exemplo n.º 21
0
        private void OnSaberColorChanged(SaberType saberType, Color color)
        {
            _colors[(int)saberType] = color;

            Color average = Color.Lerp(_colors[0], _colors[1], 0.5f);

            ParticleSystem.MainModule sparkleMain = _sparkleParticleSystem !.main;
            sparkleMain.startColor = average;
            ParticleSystem.MainModule glowMain = _glowParticleSystem !.main;
            glowMain.startColor = average;
        }
Exemplo n.º 22
0
        public Transform CreateSaber(SaberType saberType, Vector3 pos, Quaternion rot)
        {
            var parent = new GameObject("SaberTester_" + saberType).transform;

            parent.localPosition = new Vector3(0, 0.6f, 0);
            parent.localRotation = Quaternion.Euler(90, 0, 0);
            _saber = _saberFactory.Spawn(saberType);
            _saber.transform.SetParent(parent, false);

            return(parent);
        }
Exemplo n.º 23
0
 private void Patch(ref SaberType saberType)
 {
     if (saberType == SaberType.SaberA)
     {
         saberType = SaberType.SaberB;
     }
     else
     {
         saberType = SaberType.SaberA;
     }
 }
Exemplo n.º 24
0
        private static bool Prefix(SaberType type, ref Color __result)
        {
            Color?color = SaberColorizer.SaberColorOverride[(int)type];

            if (color.HasValue)
            {
                __result = color.Value;
                return(false);
            }

            return(true);
        }
Exemplo n.º 25
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static bool Prefix(SaberType type, ref Color __result)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            Color?color = SaberColorizer.SaberColorOverride[(int)type];

            if (color.HasValue)
            {
                __result = color.Value;
                return(false);
            }

            return(true);
        }
 static bool Prefix(GameNoteController __instance, Saber saber)
 {
     if (Config.ignoreBadColor)
     {
         NoteType  noteType    = __instance.noteData.noteType;
         SaberType saberType   = saber.saberType;
         bool      saberTypeOK = ((noteType == NoteType.NoteA && saberType == SaberType.SaberA) || (noteType == NoteType.NoteB && saberType == SaberType.SaberB));
         return(saberTypeOK);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 27
0
        internal static void ColorizeSaber(NoteController noteController, NoteCutInfo noteCutInfo)
        {
            if (ChromaController.DoColorizerSabers)
            {
                NoteData  noteData  = noteController.noteData;
                SaberType saberType = noteCutInfo.saberType;
                if ((int)noteData.colorType == (int)saberType)
                {
                    Color color = CNVColorManager.GetCNVColorManager(noteController).ColorForCNVManager();

                    SaberColorizer.SetSaberColor(saberType, color);
                }
            }
        }
Exemplo n.º 28
0
        public void SetPartEventList(List <PartEvents> partEventsList, SaberType saberType)
        {
            _partEventsList = partEventsList;
            _saberType      = saberType;

            if (!_pluginConfig.EnableEvents)
            {
                return;
            }

            if (_gameCoreSceneSetupData == null)
            {
                return;
            }

            IsActive = true;

            _lastNoteTime = _beatmapData.CastChecked <BeatmapData>()?.GetLastNoteTime();

            if (!_lastNoteTime.HasValue)
            {
                _logger.Warn("Couldn't get last note time. Certain level end events won't work");
            }

            // OnSlice LevelEnded Combobreak
            _beatmapObjectManager.noteWasCutEvent    += OnNoteCut;
            _beatmapObjectManager.noteWasMissedEvent += OnNoteMiss;

            // Sabers clashing
            if (_obstacleSaberSparkleEffectManager)
            {
                _obstacleSaberSparkleEffectManager.sparkleEffectDidStartEvent += SaberStartCollide;
                _obstacleSaberSparkleEffectManager.sparkleEffectDidEndEvent   += SaberEndCollide;
            }

            // OnLevelFail
            _energyCounter.gameEnergyDidReach0Event += InvokeOnLevelFail;

            // MultiplierUp
            _scoreController.multiplierDidChangeEvent += MultiplayerDidChange;

            // Accuracy changed
            _scoreCounter.relativeScoreOrImmediateRankDidChangeEvent += ScoreChanged;

            // Combo changed
            _comboController.comboDidChangeEvent += OnComboDidChangeEvent;

            InvokeOnLevelStart();
        }
Exemplo n.º 29
0
        private EventManager GetEventManagerByType(SaberType saberType)
        {
            EventManager eventManager = null;

            if (saberType == SaberType.SaberA)
            {
                eventManager = leftEventManager;
            }
            else if (saberType == SaberType.SaberB)
            {
                eventManager = rightEventManager;
            }

            return(eventManager);
        }
Exemplo n.º 30
0
        private GameObject GetCustomSaberByType(SaberType saberType)
        {
            GameObject saber = null;

            if (saberType == SaberType.SaberA)
            {
                saber = leftSaber;
            }
            else if (saberType == SaberType.SaberB)
            {
                saber = rightSaber;
            }

            return(saber);
        }