示例#1
0
 private void HandleSceneChange()
 {
     foreach (LightRotationEventEffect rotEffect in lightRotationEffects)
     {
         rotEffect.transform.localRotation = ReflectionUtil.GetPrivateField <Quaternion>(rotEffect, "_startRotation");
         rotEffect.enabled = false;
     }
 }
示例#2
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     if (isMenuScene(scene))
     {
         _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
         var _menuMasterViewController = Resources.FindObjectsOfTypeAll <StandardLevelSelectionFlowCoordinator>().First();
         prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController");
     }
 }
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            UpdateSongController();

            // reset position on new scene
            foreach (LightRotationEventEffect rotEffect in lightRotationEffects)
            {
                rotEffect.transform.localRotation = ReflectionUtil.GetPrivateField <Quaternion>(rotEffect, "_startRotation");
                rotEffect.enabled = false;
            }
        }
        /// <summary>
        /// Resets the rotation of every LightRotationEventEffect to its original rotation, so it's ready for the next level.
        /// </summary>
        private void HandleSceneChange()
        {
            foreach (LightRotationEventEffect rotEffect in lightRotationEffects)
            {
                // Restore the start rotation of the object.
                rotEffect.transform.localRotation = ReflectionUtil.GetPrivateField <Quaternion>(rotEffect, "_startRotation");

                // The effect needs to be enabled so its Start is called when the platform loads, and the _startRotation is saved properly.
                rotEffect.enabled = true;
            }
        }
 private void Start()
 {
     // make sure the rings are parented to this transform
     foreach (TrackLaneRingsManager trackLaneRingsManager in trackLaneRingsManagers)
     {
         TrackLaneRing[] rings = ReflectionUtil.GetPrivateField <TrackLaneRing[]>(trackLaneRingsManager, "_rings");
         foreach (TrackLaneRing ring in rings)
         {
             ring.transform.parent = transform;
         }
     }
 }
示例#6
0
 public static void UpdateEventTubeLightList()
 {
     LightSwitchEventEffect[] lightSwitchEvents = Resources.FindObjectsOfTypeAll <LightSwitchEventEffect>();
     foreach (LightSwitchEventEffect switchEffect in lightSwitchEvents)
     {
         ReflectionUtil.SetPrivateField(
             switchEffect,
             "_lights",
             BloomPrePass.GetLightsWithID(ReflectionUtil.GetPrivateField <int>(switchEffect, "_lightsID"))
             );
     }
 }
示例#7
0
        public static void FixUnregisterErrors()
        {
            var managers = Resources.FindObjectsOfTypeAll <LightWithIdManager>();

            foreach (var m in managers)
            {
                var _lights = ReflectionUtil.GetPrivateField <List <LightWithId>[]>(m, "_lights");
                for (int i = 0; i < 16; i++)
                {
                    if (_lights[i] == null)
                    {
                        _lights[i] = new List <LightWithId>(10);
                    }
                }
            }
        }
        /// <summary>
        /// Resets the rotation of every LightPairRotationEventEffect to its original rotation, so it's ready for the next level.
        /// </summary>
        private void HandleSceneChange()
        {
            // Since LightPairRotationEventEffect.RotationData is a private internal member, we need to get its type dynamically.
            Type RotationData = Type.GetType("LightPairRotationEventEffect+RotationData,MainAssembly");

            // The reflection method to get the rotation data must have its generic method created dynamically, so as to use the dynamic type.
            MethodInfo GetPrivateFieldM = typeof(ReflectionUtil).GetMethod("GetPrivateField", BindingFlags.Public | BindingFlags.Static, null, new Type[] { typeof(object), typeof(string) }, null);

            GetPrivateFieldM = GetPrivateFieldM.MakeGenericMethod(RotationData);

            foreach (LightPairRotationEventEffect rotEffect in lightRotationEffects)
            {
                Vector3 rotationVector = ReflectionUtil.GetPrivateField <Vector3>(rotEffect, "_rotationVector");
                float   startRotation  = ReflectionUtil.GetPrivateField <float>(rotEffect, "_startRotation");

                // Reset the rotation of the objects.
                var rotationDataL = GetPrivateFieldM.Invoke(null, new object[] { rotEffect, "_rotationDataL" });
                if (rotationDataL != null)
                {
                    Transform transformL = rotationDataL.GetField <Transform>("transform");

                    // Restore the start rotation of the object.
                    transformL.localRotation = rotationDataL.GetField <Quaternion>("startRotation");

                    // Undo the rotation applied by default, so the object is back to its initial rotation.
                    transformL.Rotate(rotationVector, -startRotation, Space.Self);
                }

                var rotationDataR = GetPrivateFieldM.Invoke(null, new object[] { rotEffect, "_rotationDataR" });
                if (rotationDataR != null)
                {
                    Transform transformR = rotationDataR.GetField <Transform>("transform");

                    // Restore the start rotation of the object.
                    transformR.localRotation = rotationDataR.GetField <Quaternion>("startRotation");

                    // Undo the rotation applied by default, so the object is back to its initial rotation.
                    transformR.Rotate(rotationVector, startRotation, Space.Self);
                }

                rotEffect.enabled = true;
            }
        }