diff --git a/Assets/Scripts/DeckEditor/CardSearchMenu.cs b/Assets/Scripts/DeckEditor/CardSearchMenu.cs index 4fb0fa9c8..00e852803 100644 --- a/Assets/Scripts/DeckEditor/CardSearchMenu.cs +++ b/Assets/Scripts/DeckEditor/CardSearchMenu.cs @@ -80,9 +80,9 @@ void LateUpdate() Search(); Hide(); } - else if (Input.GetButtonDown(CardIn.FocusName) || Input.GetButtonDown(CardIn.FocusText)) + else if (Input.GetButtonDown(CardIn.FocusNameInput) || Input.GetButtonDown(CardIn.FocusTextInput)) FocusInputField(); - else if (Input.GetButtonDown(CardIn.Vertical) || Input.GetButtonDown(CardIn.Horizontal)) + else if (Input.GetButtonDown(CardIn.VerticalInput) || Input.GetButtonDown(CardIn.HorizontalInput)) FocusToggle(); else if (Input.GetButtonDown(CardIn.NewInput) && ActiveToggle != null) ToggleEnum(); diff --git a/Assets/Scripts/ScreenRotationManager.cs b/Assets/Scripts/ScreenRotationManager.cs index 450db1f57..3bd5f46a8 100644 --- a/Assets/Scripts/ScreenRotationManager.cs +++ b/Assets/Scripts/ScreenRotationManager.cs @@ -8,26 +8,28 @@ void OnApplicationFocus(bool haveFocus) ToggleAutoRotation(); } - static void ToggleAutoRotation() + public static void ToggleAutoRotation() { - AutoRotationOn = DeviceAutoRotationIsOn(); - Screen.autorotateToPortrait = AutoRotationOn; - Screen.autorotateToPortraitUpsideDown = AutoRotationOn; - Screen.autorotateToLandscapeLeft = AutoRotationOn; - Screen.autorotateToLandscapeRight = AutoRotationOn; + bool autoRotationOn = IsAutoRotationOn; + Screen.autorotateToPortrait = autoRotationOn; + Screen.autorotateToPortraitUpsideDown = autoRotationOn; + Screen.autorotateToLandscapeLeft = autoRotationOn; + Screen.autorotateToLandscapeRight = autoRotationOn; Screen.orientation = ScreenOrientation.AutoRotation; } - static bool DeviceAutoRotationIsOn() + public static bool IsAutoRotationOn { + get { #if UNITY_ANDROID && !UNITY_EDITOR - using (AndroidJavaClass actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { - AndroidJavaObject context = actClass.GetStatic("currentActivity"); - AndroidJavaClass systemGlobal = new AndroidJavaClass("android.provider.Settings$System"); - int rotationOn = systemGlobal.CallStatic("getInt", context.Call("getContentResolver"), "accelerometer_rotation"); - return rotationOn==1; - } + using (AndroidJavaClass actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { + AndroidJavaObject context = actClass.GetStatic("currentActivity"); + AndroidJavaClass systemGlobal = new AndroidJavaClass("android.provider.Settings$System"); + int rotationOn = systemGlobal.CallStatic("getInt", context.Call("getContentResolver"), "accelerometer_rotation"); + return rotationOn==1; + } #endif - return true; + return true; + } } } diff --git a/Assets/Scripts/ScreenRotationManager.cs.meta b/Assets/Scripts/ScreenRotationManager.cs.meta new file mode 100644 index 000000000..e325c7545 --- /dev/null +++ b/Assets/Scripts/ScreenRotationManager.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 3196a10ecc192d0498acb20855dfbcf4 +timeCreated: 1518065689 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: