当前位置: 首页>>代码示例>>C#>>正文


C# AndroidJavaClass.Call方法代码示例

本文整理汇总了C#中UnityEngine.AndroidJavaClass.Call方法的典型用法代码示例。如果您正苦于以下问题:C# AndroidJavaClass.Call方法的具体用法?C# AndroidJavaClass.Call怎么用?C# AndroidJavaClass.Call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.AndroidJavaClass的用法示例。


在下文中一共展示了AndroidJavaClass.Call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _getNonConsumableItems

 protected override List<NonConsumableItem> _getNonConsumableItems()
 {
     List<NonConsumableItem> nonConsumableItems = new List<NonConsumableItem>();
     AndroidJNI.PushLocalFrame(100);
     using(AndroidJavaObject jniNonConsumableItems = new AndroidJavaClass("com.soomla.store.data.StoreInfo").CallStatic<AndroidJavaObject>("getNonConsumableItems")) {
         for(int i=0; i<jniNonConsumableItems.Call<int>("size"); i++) {
             using(AndroidJavaObject jniNon = jniNonConsumableItems.Call<AndroidJavaObject>("get", i)) {
                 nonConsumableItems.Add(new NonConsumableItem(jniNon));
             }
         }
     }
     AndroidJNI.PopLocalFrame(IntPtr.Zero);
     return nonConsumableItems;
 }
开发者ID:qtbon,项目名称:unity3d-store,代码行数:14,代码来源:StoreInfoAndroid.cs

示例2: exit

 public static void exit()
 {
     AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
     activity.Call("runOnUiThread", new object[]
     {
         new AndroidJavaRunnable(delegate
         {
             activity.Call("finish", new object[0]);
             SdkU3d.callSdkApi("exit", new object[0]);
             new AndroidJavaClass("java.lang.System").CallStatic("exit", new object[]
             {
                 0
             });
         })
     });
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:16,代码来源:SdkU3d.cs

示例3: AcquireMulticastLock

 public static void AcquireMulticastLock()
 {
     AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
       AndroidJavaObject wifi = activity.Call<AndroidJavaObject>("getSystemService", "wifi");
       androidMulticastLock = wifi.Call<AndroidJavaObject>("createMulticastLock", "udpkit");
       androidMulticastLock.Call("acquire");
 }
开发者ID:zond,项目名称:dogspace-old-2,代码行数:7,代码来源:NativePlatform.cs

示例4: AddOSSpecificExternalDatasetSearchDirs

        public override void AddOSSpecificExternalDatasetSearchDirs()
        {
    #if UNITY_ANDROID
            if (Application.platform == RuntimePlatform.Android)
            {
                // Get the external storage directory
                AndroidJavaClass jclassEnvironment = new AndroidJavaClass("android.os.Environment");
                AndroidJavaObject jobjFile = jclassEnvironment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory");
                string externalStorageDirectory = jobjFile.Call<string>("getAbsolutePath");

                // Get the package name
                AndroidJavaObject jobjActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
                string packageName = jobjActivity.Call<string>("getPackageName");

                // Add some best practice search directories
                //
                // Assumes just Vufroria datasets extracted to the files directory
                AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/");

                // Assume entire StreamingAssets dir is extracted here and our datasets are in the "Vuforia/DeviceDatabases" directory
                AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/Vuforia/DeviceDatabases/");

                // Assume entire StreamingAssets dir is extracted here and our datasets are in the "QCAR" directory
                AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/QCAR/");
            }
#endif //UNITY_ANDROID
        }
开发者ID:nus-mtp,项目名称:ar-design-tool,代码行数:27,代码来源:DatabaseLoadBehaviour.cs

示例5: onSdkStopped

		void onSdkStopped () {
			var activity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject> ("currentActivity");
			activity.Call ("runOnUiThread", new AndroidJavaRunnable (() => {
				AndroidJavaObject toast = new AndroidJavaClass ("android.widget.Toast").CallStatic<AndroidJavaObject>("makeText", activity, "sdk stop.", 1);
				toast.Call ("show");
			}));
		}
开发者ID:godbrush-dmk,项目名称:cafe-sdk-unity,代码行数:7,代码来源:GLinkAndroid.cs

示例6: onClickAppSchemeBanner

		void onClickAppSchemeBanner (string appScheme) {
			var activity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject> ("currentActivity");
			activity.Call ("runOnUiThread", new AndroidJavaRunnable (() => {
				AndroidJavaObject toast = new AndroidJavaClass ("android.widget.Toast").CallStatic<AndroidJavaObject>("makeText", activity, appScheme, 1);
				toast.Call ("show");
			}));
		}
开发者ID:godbrush-dmk,项目名称:cafe-sdk-unity,代码行数:7,代码来源:GLinkAndroid.cs

示例7: Init

    /// Init class with given site id and domain name
    public static void Init()
    {
        analyticsPlugin = new AndroidJavaClass("com.unityrealm.uranalytics.AnalyticsActivity");
        unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");

        analyticsPlugin.Call("intialize", currentActivity);
    }
开发者ID:CoderBear,项目名称:AAUnity,代码行数:9,代码来源:GoogleAnalyticsHelper.cs

示例8: Update

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape)) {
            #if UNITY_ANDROID

            // Get the unity player activity
            AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");

            activity.Call<bool>("moveTaskToBack", true);
            #endif
        }
    }
开发者ID:YuvalFeldman,项目名称:JetCat,代码行数:13,代码来源:AndroidButton.cs

示例9: AddOSSpecificExternalDatasetSearchDirs

        public override void AddOSSpecificExternalDatasetSearchDirs()
        {
            #if UNITY_ANDROID
            if (Application.platform == RuntimePlatform.Android)
            {
                // Get the external storage directory
                AndroidJavaClass jclassEnvironment = new AndroidJavaClass("android.os.Environment");
                AndroidJavaObject jobjFile = jclassEnvironment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory");
                string externalStorageDirectory = jobjFile.Call<string>("getAbsolutePath");

                // Get the package name
                AndroidJavaObject jobjActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
                string packageName = jobjActivity.Call<string>("getPackageName");

                // Add some best practice search directories
                //
                // Assumes just Vufroria datasets extracted to the files directory
                AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/");
                // Assume entire StreamingAssets dir is extracted here and our datasets are in the "QCAR" directory
                AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/QCAR/");

                //float x = 2.0 * .1 / (100.0 - 0.0);
                //float y = 2.0 * .1 / (100.0 - 0.0);
                //float a = (100.0 + 0.0) / (100.0 - 0.0);
                //float b = (100.0 + 0.0) / (100.0 - 0.0);
                //float c = -(100.0 + .1) / (100.0 - .1);
                //float d = -(2.0 * 100.0 * .1) / (100 - .1);
                //float e = -1.0;
                //Matrix4x4 m = new Matrix4x4();
                //m[0, 0] = x;
                //m[0, 1] = 0;
                //m[0, 2] = a;
                //m[0, 3] = 0;
                //m[1, 0] = 0;
                //m[1, 1] = y;
                //m[1, 2] = b;
                //m[1, 3] = 0;
                //m[2, 0] = 0;
                //m[2, 1] = 0;
                //m[2, 2] = c;
                //m[2, 3] = d;
                //m[3, 0] = 0;
                //m[3, 1] = 0;
                //m[3, 2] = e;
                //m[3, 3] = 0;

                //cam.projectionMatrix = m;
            }
            #endif //UNITY_ANDROID
        }
开发者ID:krm104,项目名称:vuforia_unity,代码行数:50,代码来源:DataSetLoadBehaviour.cs

示例10: AndroidNativeAudio

	static AndroidNativeAudio()
	{
		AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
		
		if (Application.streamingAssetsPath.Substring(Application.streamingAssetsPath.Length - 12) == ".obb!/assets")
		{
			hasOBB = true;
			int versionCode = context.Call<AndroidJavaObject>("getPackageManager").Call<AndroidJavaObject>("getPackageInfo", context.Call<string>("getPackageName"), 0).Get<int>("versionCode");
			try
			{
				assets = new AndroidJavaClass("com.android.vending.expansion.zipfile.APKExpansionSupport").CallStatic<AndroidJavaObject>("getAPKExpansionZipFile", context, versionCode, 0);
			}
			catch(Exception e)
			{
				Debug.Log(e.ToString());
			}
		}
		else
		{
			hasOBB = false;
			assets = context.Call<AndroidJavaObject>("getAssets");
		}
	}
开发者ID:TripleLoopGames,项目名称:space-roaches,代码行数:23,代码来源:AndroidNativeAudio.cs

示例11: GetDeviceDefaultOrientation

	//adapted from http://stackoverflow.com/questions/4553650/how-to-check-device-natural-default-orientation-on-android-i-e-get-landscape/4555528#4555528
	public static string GetDeviceDefaultOrientation(){
		if (mConfig == null){
			using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").
			       GetStatic<AndroidJavaObject>("currentActivity")){
				mConfig = activity.Call<AndroidJavaObject>("getResources").Call<AndroidJavaObject>("getConfiguration");
			}
		}

		int dOrientation = mConfig.Get<int>("orientation");

		if( dOrientation == ORIENTATION_LANDSCAPE ){
			return ("LANDSCAPE");
		}else if(dOrientation == ORIENTATION_PORTRAIT ){
			return ("PORTRAIT");
		}

		return ("None");
	} 
开发者ID:Keyj1n,项目名称:BattlePong,代码行数:19,代码来源:NaturalOrientation.cs

示例12: GetMacAddress

	static public string GetMacAddress()
	{
#if UNITY_IPHONE
		NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
		
		foreach( NetworkInterface adapter in nics)
		{
			PhysicalAddress address = adapter.GetPhysicalAddress();
			
			if( "" != address.ToString())
			{
				Debug.Log( address.ToString());
				return address.ToString();
			}
		}
		
		return "error lectura mac address";
#endif
		
#if UNITY_ANDROID
		string macAddr = null;
		AndroidJavaObject wifiMgr = null;
		
		using( AndroidJavaObject activity = new AndroidJavaClass( "com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>( "currentActivity"))
		{
			wifiMgr = activity.Call<AndroidJavaObject>( "getSystemService", "wifi");
		}
		
		macAddr = wifiMgr.Call<AndroidJavaObject>( "getConnectionInfo").Call<string>( "getMacAddress");
		macAddr = macAddr.Replace( ":", "");
		
		return macAddr;
#endif
		
		return null;//dopamin Complie error 
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:36,代码来源:AsUtil.cs

示例13: GetVirtualGoods

        public static List<VirtualGood> GetVirtualGoods()
        {
            StoreUtils.LogDebug(TAG, "Trying to fetch goods");
            List<VirtualGood> virtualGoods = new List<VirtualGood>();
            #if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJNI.PushLocalFrame(100);
            using(AndroidJavaObject jniVirtualGoods = new AndroidJavaClass("com.soomla.store.data.StoreInfo").CallStatic<AndroidJavaObject>("getGoods")) {
                for(int i=0; i<jniVirtualGoods.Call<int>("size"); i++) {
                    AndroidJNI.PushLocalFrame(100);
                    using(AndroidJavaObject jniGood = jniVirtualGoods.Call<AndroidJavaObject>("get", i)) {
                        virtualGoods.Add((VirtualGood)VirtualItem.factoryItemFromJNI(jniGood));
                    }
                    AndroidJNI.PopLocalFrame(IntPtr.Zero);
                }
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            #elif UNITY_IOS && !UNITY_EDITOR
            IntPtr p = IntPtr.Zero;
            int err = storeInfo_GetVirtualGoods(out p);

            IOS_ErrorCodes.CheckAndThrowException(err);

            string goodsJson = Marshal.PtrToStringAnsi(p);
            Marshal.FreeHGlobal(p);

            StoreUtils.LogDebug(TAG, "Got json: " + goodsJson);

            JSONObject goodsArr = new JSONObject(goodsJson);
            foreach(JSONObject obj in goodsArr.list) {
                virtualGoods.Add((VirtualGood)VirtualItem.factoryItemFromJSONObject(obj));
            }
            #endif
            return virtualGoods;
        }
开发者ID:jennydvr,项目名称:SimpleRunner,代码行数:34,代码来源:StoreInfo.cs

示例14: GetVirtualCurrencyPacks

        public static List<VirtualCurrencyPack> GetVirtualCurrencyPacks()
        {
            StoreUtils.LogDebug(TAG, "Trying to fetch packs");
            List<VirtualCurrencyPack> vcps = new List<VirtualCurrencyPack>();
            #if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJNI.PushLocalFrame(100);
            using(AndroidJavaObject jniVirtualCurrencyPacks = new AndroidJavaClass("com.soomla.store.data.StoreInfo").CallStatic<AndroidJavaObject>("getCurrencyPacks")) {
                for(int i=0; i<jniVirtualCurrencyPacks.Call<int>("size"); i++) {
                    using(AndroidJavaObject jnivcp = jniVirtualCurrencyPacks.Call<AndroidJavaObject>("get", i)) {
                        vcps.Add(new VirtualCurrencyPack(jnivcp));
                    }
                }
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            #elif UNITY_IOS && !UNITY_EDITOR
            IntPtr p = IntPtr.Zero;
            int err = storeInfo_GetVirtualCurrencyPacks(out p);

            IOS_ErrorCodes.CheckAndThrowException(err);

            string packsJson = Marshal.PtrToStringAnsi(p);
            Marshal.FreeHGlobal(p);

            StoreUtils.LogDebug(TAG, "Got json: " + packsJson);

            JSONObject packsArr = new JSONObject(packsJson);
            foreach(JSONObject obj in packsArr.list) {
                vcps.Add(new VirtualCurrencyPack(obj));
            }
            #endif
            return vcps;
        }
开发者ID:jennydvr,项目名称:SimpleRunner,代码行数:32,代码来源:StoreInfo.cs

示例15: GetNonConsumableItems

        public static List<NonConsumableItem> GetNonConsumableItems()
        {
            StoreUtils.LogDebug(TAG, "Trying to fetch noncons");
            List<NonConsumableItem> nonConsumableItems = new List<NonConsumableItem>();
            #if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJNI.PushLocalFrame(100);
            using(AndroidJavaObject jniNonConsumableItems = new AndroidJavaClass("com.soomla.store.data.StoreInfo").CallStatic<AndroidJavaObject>("getNonConsumableItems")) {
                for(int i=0; i<jniNonConsumableItems.Call<int>("size"); i++) {
                    using(AndroidJavaObject jniNon = jniNonConsumableItems.Call<AndroidJavaObject>("get", i)) {
                        nonConsumableItems.Add(new NonConsumableItem(jniNon));
                    }
                }
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            #elif UNITY_IOS && !UNITY_EDITOR
            IntPtr p = IntPtr.Zero;
            int err = storeInfo_GetNonConsumableItems(out p);

            IOS_ErrorCodes.CheckAndThrowException(err);

            string nonConsumableJson = Marshal.PtrToStringAnsi(p);
            Marshal.FreeHGlobal(p);

            StoreUtils.LogDebug(TAG, "Got json: " + nonConsumableJson);

            JSONObject nonConsArr = new JSONObject(nonConsumableJson);
            foreach(JSONObject obj in nonConsArr.list) {
                nonConsumableItems.Add(new NonConsumableItem(obj));
            }
            #endif
            return nonConsumableItems;
        }
开发者ID:jennydvr,项目名称:SimpleRunner,代码行数:32,代码来源:StoreInfo.cs


注:本文中的UnityEngine.AndroidJavaClass.Call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。