Exemple #1
0
        //4.1 获取屏幕亮度值:
        /// <summary>
        /// Get system's brightness value
        /// </summary>
        /// <returns></returns>
        public int GetBrightnessValue()
        {
            int BrightnessValue = 0;

#if UNITY_ANDROID
            BaseAndroidDevice.CallObjectMethod <int>(ref BrightnessValue, nibiruOsServiceObject, "getBrightnessValue");
#endif
            return(BrightnessValue);
        }
Exemple #2
0
        //4.2 调节屏幕亮度:
        /// <summary>
        /// Set system's brightness value
        /// </summary>
        /// <returns></returns>
        public void SetBrightnessValue(int value)
        {
            if (nibiruOsServiceObject == null)
            {
                return;
            }
#if UNITY_ANDROID
            RunOnUIThread(androidActivity,
                          new AndroidJavaRunnable(() =>
            {
                BaseAndroidDevice.CallObjectMethod(nibiruOsServiceObject, "setBrightnessValue", value, 200.01f);
            }));
#endif
        }