void SetDeviceType() { Camera mainCamera = GetComponent <Camera> (); float aspect = mainCamera.aspect; if (aspect > 0.56f && aspect < 0.57f) { deviceAspect = DeviceAspect.NewIphone; } else if (aspect > 0.66f && aspect < 0.67f) { deviceAspect = DeviceAspect.OldIphone; } else if (aspect > 0.74f && aspect < 0.76f) { deviceAspect = DeviceAspect.Ipad; } else if (aspect > 0.59 && aspect < 0.61) { deviceAspect = DeviceAspect.Android3by5; } else if (aspect > 0.62 && aspect < 0.63) { deviceAspect = DeviceAspect.Android10by16; } }
void Awake() { if (SystemInfo.deviceModel.Contains("Unknown")) { // Unknown iOS device Debug.Log("Device is unknown. Aspect ratio is: " + Camera.main.aspect); aspect = DeviceAspect.Unknown; } else if (SystemInfo.deviceModel.Contains("iPad")) { // iPad or iPad mini device aspect = DeviceAspect.iPad; } else if (SystemInfo.deviceModel.Contains("5") || SystemInfo.deviceModel.Contains("6")) { // iPhone 5 or iPhone 6 device aspect = DeviceAspect.iPhone5; } else { // iPhone 4 or iPod Touch or older aspect = DeviceAspect.iPhone4; } }
void Start() { if (Camera.main.aspect >= iPhone5Aspect) { // 16:9 aspect = DeviceAspect.iPhone5; } else if (Camera.main.aspect >= iPhone4Aspect) { // 3:2 aspect = DeviceAspect.iPhone4; } else if (Camera.main.aspect >= iPadAspect) { // 4:3 aspect = DeviceAspect.iPad; } else { // Unknown Debug.Log("Device aspect ratio is unknown. Aspect ratio is: " + Camera.main.aspect); aspect = DeviceAspect.Unknown; } }
/// <summary> /// Bereitet die Anzeige des Dialogs vor. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void LegacyEditor_Load(object sender, EventArgs e) { // Find the legacy provider DeviceAspect type = Profile.DeviceAspects.Find(a => string.IsNullOrEmpty(a.Aspekt)); // Find the device if (null != type) { foreach (LegacyDeviceInformation device in selDevice.Items) { if (Equals(type.Value, device.DriverType)) { // Select selDevice.SelectedItem = device; // Force refresh selDevice_SelectionChangeCommitted(selDevice, EventArgs.Empty); // Done break; } } } }