當前位置: 首頁>>代碼示例>>C#>>正文


C# AndroidJavaClass.Dispose方法代碼示例

本文整理匯總了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;
        }
開發者ID:xinfushe,項目名稱:AndroidUtils-for-Unity3D,代碼行數:31,代碼來源:DeviceUtils.cs

示例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;
    }
開發者ID:gunsct,項目名稱:final_project,代碼行數:17,代碼來源:Plugin_Mgr.cs

示例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();
			}
        }
開發者ID:AirConsole,項目名稱:airconsole-unity-plugin,代碼行數:34,代碼來源:AirConsole.cs

示例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");
  }
開發者ID:conrad,項目名稱:Google-Cardboard,代碼行數:48,代碼來源:Cardboard.cs

示例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;
        }
開發者ID:xinfushe,項目名稱:AndroidUtils-for-Unity3D,代碼行數:37,代碼來源:DeviceUtils.cs

示例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;

        }
開發者ID:xinfushe,項目名稱:AndroidUtils-for-Unity3D,代碼行數:33,代碼來源:DeviceUtils.cs

示例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;
        }
開發者ID:xinfushe,項目名稱:AndroidUtils-for-Unity3D,代碼行數:28,代碼來源:DeviceUtils.cs


注:本文中的UnityEngine.AndroidJavaClass.Dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。