|
1 | | -using System.Collections; |
2 | | -using UnityEngine; |
3 | | -using UnityEngine.SceneManagement; |
4 | | -using UnityEngine.UI; |
5 | | - |
6 | | -namespace NatCorderWithOpenCVForUnityExample |
7 | | -{ |
8 | | - public class NatCorderWithOpenCVForUnityExample : MonoBehaviour |
9 | | - { |
10 | | - public static string GetNatCorderVersion() |
11 | | - { |
12 | | - return "1.8.1"; |
13 | | - } |
14 | | - |
15 | | - public Text exampleTitle; |
16 | | - public Text versionInfo; |
17 | | - public ScrollRect scrollRect; |
18 | | - private static float verticalNormalizedPosition = 1f; |
19 | | - |
20 | | - void Awake() |
21 | | - { |
22 | | - QualitySettings.vSyncCount = 0; |
23 | | - Application.targetFrameRate = 60; |
24 | | - } |
25 | | - |
26 | | - // Use this for initialization |
27 | | - IEnumerator Start() |
28 | | - { |
29 | | - exampleTitle.text = "NatCorderWithOpenCVForUnity Example " + Application.version; |
30 | | - |
31 | | - versionInfo.text = "NatCorder " + GetNatCorderVersion(); |
32 | | - versionInfo.text += " / " + OpenCVForUnity.CoreModule.Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.UnityUtils.Utils.getVersion() + " (" + OpenCVForUnity.CoreModule.Core.VERSION + ")"; |
33 | | - versionInfo.text += " / UnityEditor " + Application.unityVersion; |
34 | | - versionInfo.text += " / "; |
35 | | - |
36 | | -#if UNITY_EDITOR |
37 | | - versionInfo.text += "Editor"; |
38 | | -#elif UNITY_STANDALONE_WIN |
39 | | - versionInfo.text += "Windows"; |
40 | | -#elif UNITY_STANDALONE_OSX |
41 | | - versionInfo.text += "Mac OSX"; |
42 | | -#elif UNITY_STANDALONE_LINUX |
43 | | - versionInfo.text += "Linux"; |
44 | | -#elif UNITY_ANDROID |
45 | | - versionInfo.text += "Android"; |
46 | | -#elif UNITY_IOS |
47 | | - versionInfo.text += "iOS"; |
48 | | -#elif UNITY_WSA |
49 | | - versionInfo.text += "WSA"; |
50 | | -#elif UNITY_WEBGL |
51 | | - versionInfo.text += "WebGL"; |
52 | | -#endif |
53 | | - versionInfo.text += " "; |
54 | | -#if ENABLE_MONO |
55 | | - versionInfo.text += "Mono"; |
56 | | -#elif ENABLE_IL2CPP |
57 | | - versionInfo.text += "IL2CPP"; |
58 | | -#elif ENABLE_DOTNET |
59 | | - versionInfo.text += ".NET"; |
60 | | -#endif |
61 | | - |
62 | | - scrollRect.verticalNormalizedPosition = verticalNormalizedPosition; |
63 | | - |
64 | | - |
65 | | -#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR |
66 | | - RuntimePermissionHelper runtimePermissionHelper = GetComponent<RuntimePermissionHelper>(); |
67 | | - yield return runtimePermissionHelper.hasUserAuthorizedCameraPermission(); |
68 | | - yield return runtimePermissionHelper.hasUserAuthorizedMicrophonePermission(); |
69 | | - yield return runtimePermissionHelper.hasUserAuthorizedExternalStorageWritePermission(); |
70 | | -#endif |
71 | | - |
72 | | - yield break; |
73 | | - } |
74 | | - |
75 | | - // Update is called once per frame |
76 | | - void Update() |
77 | | - { |
78 | | - |
79 | | - } |
80 | | - |
81 | | - public void OnScrollRectValueChanged() |
82 | | - { |
83 | | - verticalNormalizedPosition = scrollRect.verticalNormalizedPosition; |
84 | | - } |
85 | | - |
86 | | - |
87 | | - public void OnShowSystemInfoButtonClick() |
88 | | - { |
89 | | - SceneManager.LoadScene("ShowSystemInfo"); |
90 | | - } |
91 | | - |
92 | | - public void OnShowLicenseButtonClick() |
93 | | - { |
94 | | - SceneManager.LoadScene("ShowLicense"); |
95 | | - } |
96 | | - |
97 | | - public void OnVideoRecordingExampleButtonClick() |
98 | | - { |
99 | | - SceneManager.LoadScene("VideoRecordingExample"); |
100 | | - } |
101 | | - } |
102 | | -} |
| 1 | +using System.Collections; |
| 2 | +using UnityEngine; |
| 3 | +using UnityEngine.SceneManagement; |
| 4 | +using UnityEngine.UI; |
| 5 | + |
| 6 | +namespace NatCorderWithOpenCVForUnityExample |
| 7 | +{ |
| 8 | + public class NatCorderWithOpenCVForUnityExample : MonoBehaviour |
| 9 | + { |
| 10 | + public static string GetNatCorderVersion() |
| 11 | + { |
| 12 | + return "1.8.2"; |
| 13 | + } |
| 14 | + |
| 15 | + public Text exampleTitle; |
| 16 | + public Text versionInfo; |
| 17 | + public ScrollRect scrollRect; |
| 18 | + private static float verticalNormalizedPosition = 1f; |
| 19 | + |
| 20 | + void Awake() |
| 21 | + { |
| 22 | + QualitySettings.vSyncCount = 0; |
| 23 | + Application.targetFrameRate = 60; |
| 24 | + } |
| 25 | + |
| 26 | + // Use this for initialization |
| 27 | + IEnumerator Start() |
| 28 | + { |
| 29 | + exampleTitle.text = "NatCorderWithOpenCVForUnity Example " + Application.version; |
| 30 | + |
| 31 | + versionInfo.text = "NatCorder " + GetNatCorderVersion(); |
| 32 | + versionInfo.text += " / " + OpenCVForUnity.CoreModule.Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.UnityUtils.Utils.getVersion() + " (" + OpenCVForUnity.CoreModule.Core.VERSION + ")"; |
| 33 | + versionInfo.text += " / UnityEditor " + Application.unityVersion; |
| 34 | + versionInfo.text += " / "; |
| 35 | + |
| 36 | +#if UNITY_EDITOR |
| 37 | + versionInfo.text += "Editor"; |
| 38 | +#elif UNITY_STANDALONE_WIN |
| 39 | + versionInfo.text += "Windows"; |
| 40 | +#elif UNITY_STANDALONE_OSX |
| 41 | + versionInfo.text += "Mac OSX"; |
| 42 | +#elif UNITY_STANDALONE_LINUX |
| 43 | + versionInfo.text += "Linux"; |
| 44 | +#elif UNITY_ANDROID |
| 45 | + versionInfo.text += "Android"; |
| 46 | +#elif UNITY_IOS |
| 47 | + versionInfo.text += "iOS"; |
| 48 | +#elif UNITY_WSA |
| 49 | + versionInfo.text += "WSA"; |
| 50 | +#elif UNITY_WEBGL |
| 51 | + versionInfo.text += "WebGL"; |
| 52 | +#endif |
| 53 | + versionInfo.text += " "; |
| 54 | +#if ENABLE_MONO |
| 55 | + versionInfo.text += "Mono"; |
| 56 | +#elif ENABLE_IL2CPP |
| 57 | + versionInfo.text += "IL2CPP"; |
| 58 | +#elif ENABLE_DOTNET |
| 59 | + versionInfo.text += ".NET"; |
| 60 | +#endif |
| 61 | + |
| 62 | + scrollRect.verticalNormalizedPosition = verticalNormalizedPosition; |
| 63 | + |
| 64 | + |
| 65 | +#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR |
| 66 | + RuntimePermissionHelper runtimePermissionHelper = GetComponent<RuntimePermissionHelper>(); |
| 67 | + yield return runtimePermissionHelper.hasUserAuthorizedCameraPermission(); |
| 68 | + yield return runtimePermissionHelper.hasUserAuthorizedMicrophonePermission(); |
| 69 | + yield return runtimePermissionHelper.hasUserAuthorizedExternalStorageWritePermission(); |
| 70 | +#endif |
| 71 | + |
| 72 | + yield break; |
| 73 | + } |
| 74 | + |
| 75 | + // Update is called once per frame |
| 76 | + void Update() |
| 77 | + { |
| 78 | + |
| 79 | + } |
| 80 | + |
| 81 | + public void OnScrollRectValueChanged() |
| 82 | + { |
| 83 | + verticalNormalizedPosition = scrollRect.verticalNormalizedPosition; |
| 84 | + } |
| 85 | + |
| 86 | + |
| 87 | + public void OnShowSystemInfoButtonClick() |
| 88 | + { |
| 89 | + SceneManager.LoadScene("ShowSystemInfo"); |
| 90 | + } |
| 91 | + |
| 92 | + public void OnShowLicenseButtonClick() |
| 93 | + { |
| 94 | + SceneManager.LoadScene("ShowLicense"); |
| 95 | + } |
| 96 | + |
| 97 | + public void OnVideoRecordingExampleButtonClick() |
| 98 | + { |
| 99 | + SceneManager.LoadScene("VideoRecordingExample"); |
| 100 | + } |
| 101 | + } |
| 102 | +} |
0 commit comments