using UnityEngine;
public class Platformtool
{
public static bool IsAndroid
{
get
{
bool retValue = false;
#if UNITY_ANDROID
retValue = true;
#endif
return retValue;
}
}
public static bool IsEditor
{
get
{
bool retValue = false;
#if UNITY_EDITOR
retValue = true;
#endif
return retValue;
}
}
public static bool IsIOSiPhone
{
get
{
bool retValue = false;
#if UNITY_IOS
if ((float)Screen.width / (float)Screen.height >= 1.5f)
{
retValue = true;
}
else
{
retValue = false;
}
#endif
return retValue;
}
}
public static bool IsiOSIpad
{
get
{
bool retValue = false;
#if UNITY_IOS
if ((float)Screen.width / (float)Screen.height >= 1.5f)
{
retValue = false;
}
else
{
retValue = true;
}
#endif
return retValue;
}
}
public static bool IsWEB
{
get
{
bool retValue = false;
#if UNITY_WEBGL
retValue = true;
#endif
return retValue;
}
}
public static bool IsPad()
{
string type = SystemInfo.deviceModel.ToLower().Trim();
Debug.Log(type);
if (type.Substring(0, 3) == "iph")
{//iPhone机型
return false;
}
else if (type.Substring(0, 3) == "ipa")
{//iPad机型
return true;
}
else
{//其他
return false;
}
}
}