コード例 #1
0
        static void Postfix(Vector3SO ____roomCenter, FloatSO ____roomRotation, MethodBase __originalMethod)
        {
            if (____roomCenter == null)
            {
                position = Vector3.zero;
            }
            else
            {
                position = ____roomCenter;
            }

            if (____roomRotation == null)
            {
                eulerAngles = Vector3.zero;
            }
            else
            {
                eulerAngles = new Vector3(0, ____roomRotation, 0);
            }
            rotation = Quaternion.Euler(eulerAngles);

#if DEBUG
            Plugin.Log.Warn("HookRoomAdjust.Postfix! " + __originalMethod.Name);
            Console.WriteLine("pos {0}, rot {1}", position, rotation);
#endif
        }
コード例 #2
0
        public static bool Prefix(ref bool __result, SmoothCameraSmoothnessSettingsController __instance, ref int idx, ref int numberOfElements)
        {
            var smoothnesses = new float[]
            {
                20f,
                18f,
                16f,
                14f,
                12f,
                10f,
                8f,
                6f,
                4f,
                2f,
                1f,
                0.75f,
                0.5f,
                0.25f,
                0.125f
            };

            __instance.SetPrivateField("_smoothnesses", smoothnesses);
            FloatSO cameraPositionSmooth = __instance.GetPrivateField <FloatSO>("_smoothCameraPositionSmooth");

            idx = 2;
            numberOfElements = smoothnesses.Length;
            for (int index = 0; index < smoothnesses.Length; ++index)
            {
                if ((double)(float)((ObservableVariableSO <float>)cameraPositionSmooth) == (double)smoothnesses[index])
                {
                    idx = index;
                    break;
                }
            }
            __result = true;
            return(false);
        }