chicken_dy/Assets/HCMiniSdk/Scripts/Other/HCInfoUtils.cs

117 lines
2.6 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace HC
{
public class HCInfoUtils
{
public static string GetLanguage()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetLanguage();
#else
return HCLanguageUtils.GetLanguageCode(Application.systemLanguage);
#endif
}
public static string GetAppVersionCode()
{
return HCTools.GetVersionCode();
}
public static object GetAppVersion()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetVersion();
#else
return Application.version;
#endif
}
public static object GetDeviceType()
{
#if UNITY_ANDROID && !WEBGL_BYTEDANCE
return "Android";
#elif UNITY_IOS
return "iPhone";
#elif UNITY_WEBGL || WEBGL_BYTEDANCE
return "webgl";
#else
return "PC";
#endif
}
public static string GetChannel()
{
#if UNITY_ANDROID && !WEBGL_BYTEDANCE
return "googleplay";
#elif UNITY_IOS
return "AppStore";
#elif UNITY_WEBGL && WEBGL_WX
return "wechat";
#elif WEBGL_BYTEDANCE
return "douyin";
#else
return "Other";
#endif
}
public static string GetPlatform()
{
#if UNITY_ANDROID && !WEBGL_BYTEDANCE
return "android";
#elif UNITY_IOS
return "iOS";
#elif UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetPlatform();
#else
return "Other";
#endif
}
public static string GetBundleID()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetBundleID();
#else
return "";
#endif
}
public static string GetModel()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetModel();
#else
return "";
#endif
}
public static string GetBrand()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetBrand();
#else
return "";
#endif
}
public static string GetSystemName()
{
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetSystemName();
#else
return "";
#endif
}
public static Dictionary<string, object> GetBaseInfo()
{
var dictionary = new Dictionary<string, object>();
#if UNITY_WEBGL || WEBGL_BYTEDANCE
return HCWebGLSDKManager.AppInfo.GetBaseInfo();
#endif
return dictionary;
}
}
}