4 using System.Security.Cryptography.X509Certificates;
8 public static IEnumerator loadImageFromFileWithSizeAndTexture(
string path,
System.Action<
int,
int, Texture2D> complete)
10 WWW img_load =
new WWW(
"file://" + path);
12 yield
return img_load;
14 Texture2D texture = (Texture2D)img_load.texture;
20 complete(texture.width, texture.height, texture);
24 public static string changeNewLine(
string originalText)
26 return originalText.Replace(
"\\n",
"\n");
29 public static string deleteNewLine(
string originalText)
31 return originalText.Replace(
"\\n",
"");
34 public const int TYPE_WIDTH = 0;
35 public const int TYPE_HEIGHT = 1;
37 public static float GetPixelFromInch(
int type,
float inch)
42 float wScale = (float)Screen.width / (
float)Screen.currentResolution.width;
43 return inch * Screen.dpi / (wScale) * (1920f / Screen.currentResolution.width);
45 float hScale = (float)Screen.height / (
float)Screen.currentResolution.height;
46 return inch * Screen.dpi / (hScale) * (1920f / Screen.currentResolution.width);
52 public static float DeviceDiagonalSizeInInches()
54 float screenWidth = Screen.width / Screen.dpi;
55 float screenHeight = Screen.height / Screen.dpi;
56 float diagonalInches = Mathf.Sqrt(Mathf.Pow(screenWidth, 2) + Mathf.Pow(screenHeight, 2));
57 return diagonalInches;