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


C# AndroidJavaClass.CallStatic方法代碼示例

本文整理匯總了C#中UnityEngine.AndroidJavaClass.CallStatic方法的典型用法代碼示例。如果您正苦於以下問題:C# AndroidJavaClass.CallStatic方法的具體用法?C# AndroidJavaClass.CallStatic怎麽用?C# AndroidJavaClass.CallStatic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.AndroidJavaClass的用法示例。


在下文中一共展示了AndroidJavaClass.CallStatic方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Init

	/// <summary>
	/// Description:
	/// Start Crittercism for Unity, will start crittercism for android if it is not already active.
	/// Parameters:
	/// appID: Crittercisms Provided App ID for this application
	/// </summary>
	public static void Init(string appID, bool bDelay, bool bSendLogcat, string customVersion, string callbackObjectName, string callbackObjectMethod)
	{
#if (UNITY_ANDROID && !UNITY_EDITOR) || FORCE_DEBUG
		try
		{
			_IsPluginInited	= IsInited();
			if(_IsPluginInited && _IsUnityPluginInited)	{	return;	}
			
			if(!_IsUnityPluginInited)
			{
				AndroidJavaClass cls_UnityPlayer	= new AndroidJavaClass("com.unity3d.player.UnityPlayer");
				AndroidJavaObject objActivity		= cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
				mCrittercismsPlugin	= new AndroidJavaClass("com.crittercism.unity.CrittercismAndroid");
				if(mCrittercismsPlugin == null)
				{
					CLog("To find Crittercism Plugin");
					throw new System.Exception("ExitError");
				}
				
				mCrittercismsPlugin.CallStatic("SetConfig", bDelay, bSendLogcat, customVersion);
				mCrittercismsPlugin.CallStatic("Init", objActivity, appID, callbackObjectName, callbackObjectMethod);
			}
			
			EnableDebugLog(_ShowDebugOnOnRelease);
		}
		catch(System.Exception e)
		{
			CLog("Failed to initialize Crittercisms: " + e.Message);
			_IsUnityPluginInited	= false;
		}
		CLog(string.Format("Init complete, _IsPluginInited={0}, _IsUnityPluginInited={1}", _IsPluginInited, _IsUnityPluginInited));
#endif
	}
開發者ID:roughcookie,項目名稱:crittercism-unity-android,代碼行數:39,代碼來源:CrittercismAndroid.cs

示例2: CheckReward

    public static string CheckReward()
    {
        #if UNITY_IPHONE && !UNITY_EDITOR
        return UnityShimOAD_CheckReward ();
        #endif
        #if UNITY_ANDROID
        AndroidJavaClass oadClass = new AndroidJavaClass("com.openadadapter.OpenAdAdapter");
        if (oadClass != null){

            bool b1 = oadClass.CallStatic<bool>("hasReward");

            if(!b1){
                return null;
            }

            AndroidJavaClass rwdClass = new AndroidJavaClass("com.openadadapter.Reward");
            if(rwdClass != null){
                AndroidJavaObject r1 = oadClass.CallStatic<AndroidJavaObject>("fetchReward");
                if (r1.GetRawObject().ToInt32() == 0){
                    return null;
                }
                //		float height = oadClass.CallStatic<float>("getBannerHeightInPoints");
                float amount = r1.Call<float>("getAmount");
                string network = r1.Call<string>("getNetwork");
                string currency = r1.Call<string>("getCurrency");

                return "amount\t" + amount + "\nnetwork\t" + network + "\ncurrency\t" + currency;
            }
        }
        #endif
        return null;
    }
開發者ID:OpenAdAdapter,項目名稱:OAD-Unity-src,代碼行數:32,代碼來源:OpenAdAdapter.cs

示例3: SendEmail

		public static void SendEmail(Email email)
		{
#if UNITY_IOS && !UNITY_EDITOR
			_opencodingConsoleBeginEmail(email.ToAddress, email.Subject, email.Message, email.IsHTML);
			foreach (var attachment in email.Attachments)
			{
				_opencodingConsoleAddAttachment(attachment.Data, attachment.Data.Length, attachment.MimeType, attachment.Filename);
			}
			_opencodingConsoleFinishEmail();
#elif UNITY_ANDROID && !UNITY_EDITOR
			AndroidJavaClass androidEmailClass = new AndroidJavaClass("net.opencoding.console.Email");
			
			androidEmailClass.CallStatic("beginEmail", email.ToAddress, email.Subject, email.Message, email.IsHTML);
			var emailAttachmentsDirectory = Path.Combine(Application.temporaryCachePath, "EmailAttachments");
			Directory.CreateDirectory(emailAttachmentsDirectory);
			foreach (var attachment in email.Attachments)
			{
				var attachmentPath = Path.Combine(emailAttachmentsDirectory, attachment.Filename);
				File.WriteAllBytes(attachmentPath, attachment.Data);
				androidEmailClass.CallStatic("addAttachment", attachmentPath);
			}

			androidEmailClass.CallStatic("finishEmail");
#else
			throw new InvalidOperationException("Emailing is not supported on this platform. Please contact [email protected] and I'll do my best to support it!");
#endif
		}
開發者ID:smclallen,項目名稱:Galactic_Parcel_Service,代碼行數:27,代碼來源:NativeMethods.cs

示例4: ForceLoadLowLevelBinary

			static public bool ForceLoadLowLevelBinary()
			{
				// This is a hack that forces Android to load the .so libraries in the correct order
#if UNITY_ANDROID && !UNITY_EDITOR
				FMOD.Studio.UnityUtil.Log("loading binaries: " + FMOD.Studio.STUDIO_VERSION.dll + " and " + FMOD.VERSION.dll);
				AndroidJavaClass jSystem = new AndroidJavaClass("java.lang.System");
				jSystem.CallStatic("loadLibrary", FMOD.VERSION.dll);
				jSystem.CallStatic("loadLibrary", FMOD.Studio.STUDIO_VERSION.dll);
#endif

				// Hack: force the low level binary to be loaded before accessing Studio API
#if !UNITY_IPHONE || UNITY_EDITOR
				FMOD.Studio.UnityUtil.Log("Attempting to call Memory_GetStats");
				int temp1, temp2;
				if (!ERRCHECK(FMOD.Memory.GetStats(out temp1, out temp2)))
				{
					FMOD.Studio.UnityUtil.LogError("Memory_GetStats returned an error");
					return false;
				}
		
				FMOD.Studio.UnityUtil.Log("Calling Memory_GetStats succeeded!");
#endif
		
				return true;
			}
開發者ID:Backman,項目名稱:Hellbound,代碼行數:25,代碼來源:FMOD_StudioSystem.cs

示例5: OnClickButton

 public void OnClickButton()
 {
     using (AndroidJavaClass javaCalss = new AndroidJavaClass("com.example.yoon.lib.NativePlugin"))
     {
         javaCalss.CallStatic("showToast", "Test");
         javaCalss.CallStatic("onCreate");
     }
 }
開發者ID:YoonDaewon,項目名稱:cash-walk,代碼行數:8,代碼來源:plugin.cs

示例6: OpenShareDialog

        public static void OpenShareDialog(string title, string text, Texture2D image = null)
        {
            AndroidJavaClass sharingClass = new AndroidJavaClass("net.agasper.unitysharingplugin.Sharing");
            if (image != null)
            {
                byte[] bytes = image.EncodeToPNG();
                File.WriteAllBytes(sharingClass.CallStatic<string>("GetImagePath"), bytes);
            }

            sharingClass.CallStatic("Share", title, text, image != null ? 1 : 0);
        }
開發者ID:Agasper,項目名稱:unity-android-sharing-plugin,代碼行數:11,代碼來源:Share.cs

示例7: Initialize

	protected override void Initialize() 
	{
		if(pushwoosh != null)
			return;
		
		using(var pluginClass = new AndroidJavaClass("com.pushwoosh.PushwooshProxy")) {
		pluginClass.CallStatic("initialize", Pushwoosh.ApplicationCode, Pushwoosh.GcmProjectNumber);
			pushwoosh = pluginClass.CallStatic<AndroidJavaObject>("instance");
		}
		
		pushwoosh.Call("setListenerName", this.gameObject.name);
	}
開發者ID:divad4686,項目名稱:pushwoosh-unity,代碼行數:12,代碼來源:PushNotificationsAndroid.cs

示例8: InitPushwoosh

    void InitPushwoosh()
    {
        if(pushwoosh != null)
            return;

        using(var pluginClass = new AndroidJavaClass("com.pushwoosh.PushwooshProxy")) {
            pluginClass.CallStatic("initialize", Pushwoosh.APP_CODE, Pushwoosh.GCM_PROJECT_NUMBER);
            pushwoosh = pluginClass.CallStatic<AndroidJavaObject>("instance");
        }

        pushwoosh.Call("setListenerName", this.gameObject.name);
    }
開發者ID:ArcHuman,項目名稱:pushwoosh-unity,代碼行數:12,代碼來源:PushNotificationsAndroid.cs

示例9: OnApplicationPause

	void OnApplicationPause (bool pauseStatus){
        if (pauseStatus) {
			plugin.CallStatic("stopIconAd", activity); 
		}else{
	       	unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
			activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
	
			plugin = new AndroidJavaClass("jp.basicinc.gamefeat.android.unity.GameFeatUnityPlugin");
			plugin.CallStatic("activateGF", activity, true, true, true);
			plugin.CallStatic("startIconAd", activity); 
		}
	}	
開發者ID:hanahanaside,項目名稱:Wrestling,代碼行數:12,代碼來源:GameFeatObserver.cs

示例10: Init

    public static void Init()
    {
        using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
        {
            mPlayerActivityContext = actClass.GetStatic<AndroidJavaObject>("currentActivity");
        }

        mBridgeClass = new AndroidJavaClass("jwebview.JWebHelper");
        Debug.Log(mPlayerActivityContext);
        mBridgeClass.CallStatic("SetContext", mPlayerActivityContext);

        mIsReady = true;

        Debug.Log("Test: " + mBridgeClass.CallStatic<string>("WhoAreYou"));
    }
開發者ID:tinnguyenhuuletrong,項目名稱:Learning,代碼行數:15,代碼來源:JWebViewHelper.cs

示例11: GetRanking

		public static void GetRanking(string gameObjectName,
		                              string callbackMethodName,
		                              string rankingId,
		                              RankingRange type,
		                              RankingCursorOrigin origin,
		                              int cursor,
		                              int limit){
			#if UNITY_ANDROID
			AndroidJavaClass nakamapClass = new AndroidJavaClass("com.kayac.lobi.sdk.ranking.unity.LobiRankingBridge");  
			nakamapClass.CallStatic("getRanking", gameObjectName, callbackMethodName, "id", rankingId, (int)type, (int)origin, cursor, limit);
			#endif
			
			#if ((UNITY_IOS || UNITY_IPHONE) && ! UNITY_EDITOR)
			byte[] cGameObjectName     = System.Text.Encoding.UTF8.GetBytes(gameObjectName);
			byte[] cCallbackMethodName = System.Text.Encoding.UTF8.GetBytes(callbackMethodName);
			byte[] cRankingId          = System.Text.Encoding.UTF8.GetBytes(rankingId);
			LobiRanking_get_ranking_(cGameObjectName, cGameObjectName.Length,
			                         cCallbackMethodName, cCallbackMethodName.Length,
			                         cRankingId, cRankingId.Length,
			                         (int)type,
			                         (int)origin,
			                         cursor,
			                         limit);
			#endif
		}
開發者ID:3nan,項目名稱:unity_practice,代碼行數:25,代碼來源:LobiRankingAPIBridge.cs

示例12: NativeGetCppVersion

 public static void NativeGetCppVersion()
 {
     #if !UNITY_EDITOR && UNITY_ANDROID
     AndroidJavaClass jc = new AndroidJavaClass("com.snow.plugin.NativeBridge");
     jc.CallStatic("NativeGetCppVersion");
     #endif
 }
開發者ID:toxly,項目名稱:unity-app,代碼行數:7,代碼來源:PlatformTools.cs

示例13: Start

    IEnumerator Start()
    {
        #if UNITY_IPHONE
        ADBannerView banner = new ADBannerView();
        banner.autoSize = true;
        banner.autoPosition = ADPosition.Bottom;

        while (true) {
            if (banner.error != null) {
                Debug.Log("Error: " + banner.error.description);
                break;
            } else if (banner.loaded) {
                banner.Show();
                break;
            }
            yield return null;
        }
        #elif UNITY_ANDROID && !UNITY_EDITOR
        AndroidJavaClass plugin = new AndroidJavaClass("net.oira_project.adstirunityplugin.AdBannerController");
        AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
        while (true) {
            plugin.CallStatic("tryCreateBanner", activity, mAdStirMediaId, mAdStirSpotId);
            yield return new WaitForSeconds(Mathf.Max(30.0f, mRefreshTime));
        }
        #else
        return null;
        #endif
    }
開發者ID:yasuyuki-kamata,項目名稱:unity-adbanner-adstir,代碼行數:29,代碼來源:AdBannerObserver.cs

示例14: showAlertDialog

        public static void showAlertDialog(String parameters)
        {
            AndroidJNI.AttachCurrentThread();

                AndroidJavaClass uiClass = new AndroidJavaClass("com.gamedonia.utilities.GamedoniaUI");
                uiClass.CallStatic("showAlertDialog",new object [] {parameters});
        }
開發者ID:Derojo,項目名稱:Medical,代碼行數:7,代碼來源:GamedoniaUI.cs

示例15: OnclickButton

	// Use this for initialization
	public void OnclickButton()
    {
        using (AndroidJavaClass jc = new AndroidJavaClass("com.example.yoon.newgps.BridgeActivity"))
        {
            jc.CallStatic("SetToast", "hello world");
        }
    }
開發者ID:YoonDaewon,項目名稱:cash-walk,代碼行數:8,代碼來源:Plugin.cs


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