void OnGUI_Value() { if (curValue != null) { GUI.color = new Color(1, 1, 1, 1); if ((currentStep != 11) && (currentStep != 16)) { if (Event.current.type == EventType.Repaint) { Drawing.DrawLine(curValueBigLocation, curValueSmallLocation, curZoomLineColor, 2.0f, true); } } float x = curValueBigLocation.x; float y = curValueBigLocation.y; GUI.Label(new Rect(x - curValue.width / 2, y - curValue.height / 2, curValue.width, curValue.height), curValue); if (curValue2 != null) { x += curValue.width; GUI.Label(new Rect(x - curValue.width / 2, y - curValue.height / 2, curValue2.width, curValue2.height), curValue2); } } if (curAdditional != null) { float newAdditionalHeight = HOVContainer.textureHistoryHeight * 0.9f; float newAdditionalWidth = newAdditionalHeight; //newAdditionalHeight * curAdditional.width / curAdditional.height; float spaceBetweenTitlebarAndAdditional = (HOVContainer.textureHistoryHeight - newAdditionalHeight) / 2; float x = DisplayMetricsUtil.GetLongSide() - Master.globalContentPadding - newAdditionalWidth; float y = Master.getTitleBarHeight() + HOVContainer.spaceBetweenTitlebarAndHistoryTexture + spaceBetweenTitlebarAndAdditional; if (curAdditional2 != null) { float x2 = x - newAdditionalWidth; GUI.Label(new Rect(x2, y, newAdditionalWidth, newAdditionalHeight), curAdditional2, alignmentStyleForCirclePictures); } GUI.Label(new Rect(x, y, newAdditionalWidth, newAdditionalHeight), curAdditional, alignmentStyleForCirclePictures); } }
public static void init(int textureHistoryOrigWidth, int textureHistoryOrigHeight) { float percentWidthOfScreen = 0.97f; textureHistoryWidth = DisplayMetricsUtil.GetLongSide() * percentWidthOfScreen; textureHistoryHeight = textureHistoryWidth * textureHistoryOrigHeight / textureHistoryOrigWidth; textureHistoryScale = textureHistoryWidth / textureHistoryOrigWidth; valuePos1 = new Vector2(valuePos1.x * scale1750To1024 * textureHistoryScale, valuePos1.y * scale1750To1024 * textureHistoryScale); valuePos2 = new Vector2(valuePos2.x * scale1750To1024 * textureHistoryScale, valuePos2.y * scale1750To1024 * textureHistoryScale); valuePos3 = new Vector2(valuePos3.x * scale1750To1024 * textureHistoryScale, valuePos3.y * scale1750To1024 * textureHistoryScale); valuePos4 = new Vector2(valuePos4.x * scale1750To1024 * textureHistoryScale, valuePos4.y * scale1750To1024 * textureHistoryScale); timeAgeTextY = Mathf.RoundToInt(timeAgeTextY * scale1750To1024 * textureHistoryScale); timeAgeTextX1 = Mathf.RoundToInt(timeAgeTextX1 * scale1750To1024 * textureHistoryScale); timeAgeTextX2 = Mathf.RoundToInt(timeAgeTextX2 * scale1750To1024 * textureHistoryScale); timeAgeTextX3 = Mathf.RoundToInt(timeAgeTextX3 * scale1750To1024 * textureHistoryScale); timeAgeTextX4 = Mathf.RoundToInt(timeAgeTextX4 * scale1750To1024 * textureHistoryScale); timeAgeTextX5 = Mathf.RoundToInt(timeAgeTextX5 * scale1750To1024 * textureHistoryScale); Vector2 size = Master.styleTextDefault.CalcSize(new GUIContent("Altertum")); timeAgeTextRect1 = calcTimeAgeTextRect(timeAgeTextX2, timeAgeTextX1, size.y); timeAgeTextRect2 = calcTimeAgeTextRect(timeAgeTextX3, timeAgeTextX2, size.y); timeAgeTextRect3 = calcTimeAgeTextRect(timeAgeTextX4, timeAgeTextX3, size.y); timeAgeTextRect4 = calcTimeAgeTextRect(timeAgeTextX5, timeAgeTextX4, size.y); float tmp = DisplayMetricsUtil.GetLongSideInDP() / 8f; if (tmp >= 100) { textureValuesWidth = Mathf.RoundToInt(DisplayMetricsUtil.DpToPixel(100)); } else { textureValuesWidth = Mathf.RoundToInt(DisplayMetricsUtil.DpToPixel(tmp)); } textureAdditionalHeight = Mathf.RoundToInt(DisplayMetricsUtil.DpToPixel(100)); textureAdditionalWidth = Mathf.RoundToInt(DisplayMetricsUtil.DpToPixel(80)); }
public static int GetLongSideInDP() { return(DisplayMetricsUtil.PixelToDp(DisplayMetricsUtil.GetLongSide())); }
private void OnGUI_debugInfo() { GUILayout.Label("\n\n\n\nDEBUG MODE\n", Master.styleTextStartSceneBig); GUILayout.BeginVertical(); GUILayout.Label("Current display settings", Master.styleTextHeader); GUILayout.Label(" DPI (in use)______: " + DisplayMetricsUtil.GetDPI_Debug(), Master.styleTextDefault); GUILayout.Label(" DPI by Unity______: " + Screen.dpi, Master.styleTextDefault); if (DisplayMetricsAndroid.IsAndroid) { GUILayout.Label(" DPI by Android____: " + DisplayMetricsAndroid.DensityDPI, Master.styleTextDefault); } GUILayout.Label(" Resolution type__: " + DisplayMetricsUtil.GetResolutionType(), Master.styleTextDefault); GUILayout.Label(" Scale____________: " + DisplayMetricsUtil.GetScale_DEBUG(), Master.styleTextDefault); GUILayout.Label(" Screensize_______: " + DisplayMetricsUtil.GetScreenSize_DEBUG(), Master.styleTextDefault); GUILayout.Label(" Short Side: " + DisplayMetricsUtil.GetShortSideInDP() + " dp = " + DisplayMetricsUtil.GetShortSide() + " pixel = " + DisplayMetricsUtil.GetShortSideInInch() + " inch = " + DisplayMetricsUtil.GetShortSideInCentimeters() + " cm", Master.styleTextDefault); GUILayout.Label(" Long Side: " + DisplayMetricsUtil.GetLongSideInDP() + " dp = " + DisplayMetricsUtil.GetLongSide() + " pixel = " + DisplayMetricsUtil.GetLongSideInInch() + " inch = " + DisplayMetricsUtil.GetLongSideInCentimeters() + " cm", Master.styleTextDefault); GUILayout.Label("Member information:", Master.styleTextHeader); GUILayout.Label(" Was there an internet connection(at last check) " + Member.internetConnectionExists, Master.styleTextDefault); GUILayout.Label(" Error message(In case an error occurred): " + Member.errorMessage, Master.styleTextDefault); if (GUILayout.Button("Delete Member information")) { Member.DeleteMember(); } GUILayout.Label("\n\n", Master.styleTextDefault); if (debugTouchCounter > debugTouchCountActiv * 4) { GUILayout.Label("Touch Data: \n" + debugTouchEnd, Master.styleTextDefault); GUILayout.Label("\n\n", Master.styleTextDefault); GUILayout.Label("How often was Update() called: " + countUpdate, Master.styleTextDefault); GUILayout.Label("\n\n\n", Master.styleTextDefault); GUILayout.Label("DisplayMetricsAndroid says", Master.styleTextHeader); GUILayout.Label(" IsAndroid=" + DisplayMetricsAndroid.IsAndroid, Master.styleTextDefault); if (DisplayMetricsAndroid.IsAndroid) { GUILayout.Label(" " + DisplayMetricsAndroid.HeightPixels + "x" + DisplayMetricsAndroid.WidthPixels + " (Screen size)", Master.styleTextDefault); GUILayout.Label(" Density=" + DisplayMetricsAndroid.Density, Master.styleTextDefault); GUILayout.Label(" DensityDPI=" + DisplayMetricsAndroid.DensityDPI, Master.styleTextDefault); GUILayout.Label(" X-DPI=" + DisplayMetricsAndroid.XDPI, Master.styleTextDefault); GUILayout.Label(" Y-DPI=" + DisplayMetricsAndroid.YDPI, Master.styleTextDefault); float widthInch2 = DisplayMetricsAndroid.HeightPixels / DisplayMetricsAndroid.DensityDPI; float heightInch2 = DisplayMetricsAndroid.WidthPixels / DisplayMetricsAndroid.DensityDPI; GUILayout.Label(" " + widthInch2 + "x" + heightInch2 + " inch", Master.styleTextDefault); GUILayout.Label(" " + System.Math.Round(widthInch2 * 2.54f, 1) + "x" + System.Math.Round(heightInch2 * 2.54f, 1) + " (Calculated cm)", Master.styleTextDefault); } GUILayout.Label("\n\n\n", Master.styleTextDefault); GUILayout.Label("What is the right dpi for this display?", Master.styleTextDefault); GUILayout.Label("Measure below which grey line has 5.08 cm(+/-0.1; equal to 2 inch).", Master.styleTextDefault); GUILayout.Label("The line which matches is the right dpi:", Master.styleTextDefault); GUILayout.Label("The line should match the first grey line - if not then UI might not be as perfect as possible:", Master.styleTextDefault); GUILayout.Button("MATCH THIS", GUILayout.Height(15), GUILayout.Width(DisplayMetricsUtil.DpToPixel(160 * 2))); GUILayout.Button(" 96 dpi", GUILayout.Height(15), GUILayout.Width(96 * 2)); GUILayout.Button("101 dpi", GUILayout.Height(15), GUILayout.Width(101 * 2)); GUILayout.Button("160 dpi", GUILayout.Height(15), GUILayout.Width(160 * 2)); GUILayout.Button("213 dpi", GUILayout.Height(15), GUILayout.Width(213 * 2)); GUILayout.Button("234 dpi", GUILayout.Height(15), GUILayout.Width(234 * 2)); GUILayout.Button("240 dpi", GUILayout.Height(15), GUILayout.Width(240 * 2)); GUILayout.Button("267 dpi", GUILayout.Height(15), GUILayout.Width(267 * 2)); GUILayout.Button("285 dpi", GUILayout.Height(15), GUILayout.Width(285 * 2)); GUILayout.Button("294 dpi", GUILayout.Height(15), GUILayout.Width(294 * 2)); GUILayout.Button("312 dpi", GUILayout.Height(15), GUILayout.Width(312 * 2)); GUILayout.Button("326 dpi", GUILayout.Height(15), GUILayout.Width(326 * 2)); GUILayout.Button("342 dpi", GUILayout.Height(15), GUILayout.Width(342 * 2)); GUILayout.Button("367 dpi", GUILayout.Height(15), GUILayout.Width(367 * 2)); GUILayout.Button("380 dpi", GUILayout.Height(15), GUILayout.Width(380 * 2)); } GUILayout.EndVertical(); }