当前位置: 首页>>代码示例>>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;未经允许,请勿转载。