本文整理汇总了C#中UnityEngine.AndroidJavaClass.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# AndroidJavaClass.Dispose方法的具体用法?C# AndroidJavaClass.Dispose怎么用?C# AndroidJavaClass.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AndroidJavaClass
的用法示例。
在下文中一共展示了AndroidJavaClass.Dispose方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDeviceName
/// <summary>
/// 获取设备名称
/// </summary>
/// <returns></returns>
public static string GetDeviceName()
{
if (_deviceNameInitialized)
{
return _deviceName;
}
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
_deviceName = SystemInfo.deviceName;
#elif UNITY_ANDROID
using (AndroidJavaClass deviceUtils = new AndroidJavaClass(CLASS_DEVICES_UTILS))
{
_deviceName = deviceUtils.CallStatic<string>("GetDeviceName");
deviceUtils.Dispose();
}
#elif UNITY_IPHONE
//_deviceName = _IOS_GetDeviceName();
#endif
_deviceNameInitialized = true;
return _deviceName;
}
示例2: _Init
int _Init()
{
AndroidJavaClass _androidJC = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
if(_androidJC != null){
_AndroidPluginObj = _androidJC.GetStatic<AndroidJavaObject> ("currentActivity");
_androidJC.Dispose ();
if(_AndroidPluginObj == null){
return -1;
}
return 0;
}
return -1;
}
示例3: OnLaunchApp
private void OnLaunchApp(JObject msg) {
Debug.Log("onLaunchApp");
string gameId = (string)msg ["game_id"];
string gameVersion = (string)msg ["game_version"];
if (gameId != Application.bundleIdentifier || gameVersion != AirConsole.instance.androidTvGameVersion) {
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");
AndroidJavaObject launchIntent = null;
try {
launchIntent = packageManager.Call<AndroidJavaObject>("getLeanbackLaunchIntentForPackage", gameId);
} catch (Exception) {
Debug.Log("getLeanbackLaunchIntentForPackage for " + gameId + " failed");
}
if (launchIntent == null) {
try {
launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", gameId);
} catch (Exception) {
Debug.Log("getLaunchIntentForPackage for " + gameId + " failed");
}
}
if (launchIntent != null && gameId != Application.bundleIdentifier) {
ca.Call("startActivity", launchIntent);
} else {
Application.OpenURL("market://details?id=" + gameId);
}
up.Dispose();
ca.Dispose();
packageManager.Dispose();
launchIntent.Dispose();
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
示例4: Awake
void Awake() {
if (sdk == null) {
sdk = this;
} else {
Debug.LogWarning("Cardboard SDK object should be a singleton.");
enabled = false;
}
config.initialize();
#if ANDROID_DEVICE
try {
AndroidJavaClass player = new AndroidJavaClass(cardboardClass);
cardboardActivity = player.CallStatic<AndroidJavaObject>("getActivity");
player.Dispose();
cardboardActivity.Call("initFromUnity", gameObject.name);
config.canAccessActivity = true;
} catch (AndroidJavaException e) {
Debug.LogError("Cannot access UnityCardboardActivity. "
+ "Verify that the jar is in Assets/Plugins/Android. " + e);
}
// Force side-effectful initialization using serialized values.
EnableAlignmentMarker = enableAlignmentMarker;
EnableSettingsButton = enableSettingsButton;
TapIsTrigger = tapIsTrigger;
#endif
if (config.canApplyDistortionCorrection()) {
Debug.Log("Creating new cardboard screen texture");
StereoScreen = new RenderTexture(Screen.width, Screen.height, 16,
RenderTextureFormat.RGB565);
StereoScreen.Create();
InitFromUnity(StereoScreen.GetNativeTextureID());
} else {
if (!Application.isEditor) {
Debug.LogWarning("Lens distortion-correction disabled. Causes: ["
+ config.getDistortionCorrectionDiagnostic() + "]");
}
}
InCardboard = newInCardboard = false;
#if UNITY_EDITOR
if (VRModeEnabled && Application.isPlaying) {
SetInCardboard(true);
}
#endif
StartCoroutine("EndOfFrame");
}
示例5: GetMac
/// <summary>
/// 获取Mac地址
/// </summary>
/// <returns></returns>
public static string GetMac()
{
if (_macInitialized)
{
return _mac;
}
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
#elif UNITY_ANDROID
using (AndroidJavaClass unityClass = new AndroidJavaClass(CLASS_UNITYPLAYER_ACTIVITY))
{
using (AndroidJavaObject activity = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
{
using (AndroidJavaClass deviceUtils = new AndroidJavaClass(CLASS_DEVICES_UTILS))
{
_mac = deviceUtils.CallStatic<string>("GetMac", activity);
deviceUtils.Dispose();
}
activity.Dispose();
}
unityClass.Dispose();
}
#elif UNITY_IPHONE
//_mac = _IOS_GetMac();
#endif
_macInitialized = true;
return _mac;
}
示例6: GetExternalStorageDirectory
/// <summary>
/// 获取外置储存路径
/// </summary>
/// <returns>返回外置储存目录路径,没有则返回null</returns>
public static string GetExternalStorageDirectory()
{
if (_externalStorageDirectoryInitialized)
{
return _externalStorageDirectory;
}
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
_externalStorageDirectory = Application.dataPath;
#elif UNITY_ANDROID
using (AndroidJavaClass deviceUtils = new AndroidJavaClass(CLASS_DEVICES_UTILS))
{
_externalStorageDirectory = deviceUtils.CallStatic<string>("GetExternalStorageDirectory");
deviceUtils.Dispose();
}
#elif UNITY_IPHONE
//_externalStorageDirectory = _IOS_GetExternalStorageDirectory();
#endif
_externalStorageDirectoryInitialized = true;
return _externalStorageDirectory;
}
示例7: GetOSVersion
/// <summary>
/// 获取系统版本
/// </summary>
/// <returns></returns>
public static string GetOSVersion()
{
if (_osVersionInitialized)
{
return _osVersion;
}
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
#elif UNITY_ANDROID
using (AndroidJavaClass deviceUtils = new AndroidJavaClass(CLASS_DEVICES_UTILS))
{
_osVersion = deviceUtils.CallStatic<string>("GetAPIVersion");
deviceUtils.Dispose();
}
#elif UNITY_IPHONE
//_osVersion = _IOS_GetOSVersion();
#endif
_osVersionInitialized = true;
return _osVersion;
}