本文整理汇总了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
}
示例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;
}
示例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
}
示例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;
}
示例5: OnClickButton
public void OnClickButton()
{
using (AndroidJavaClass javaCalss = new AndroidJavaClass("com.example.yoon.lib.NativePlugin"))
{
javaCalss.CallStatic("showToast", "Test");
javaCalss.CallStatic("onCreate");
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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"));
}
示例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
}
示例12: NativeGetCppVersion
public static void NativeGetCppVersion()
{
#if !UNITY_EDITOR && UNITY_ANDROID
AndroidJavaClass jc = new AndroidJavaClass("com.snow.plugin.NativeBridge");
jc.CallStatic("NativeGetCppVersion");
#endif
}
示例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
}
示例14: showAlertDialog
public static void showAlertDialog(String parameters)
{
AndroidJNI.AttachCurrentThread();
AndroidJavaClass uiClass = new AndroidJavaClass("com.gamedonia.utilities.GamedoniaUI");
uiClass.CallStatic("showAlertDialog",new object [] {parameters});
}
示例15: OnclickButton
// Use this for initialization
public void OnclickButton()
{
using (AndroidJavaClass jc = new AndroidJavaClass("com.example.yoon.newgps.BridgeActivity"))
{
jc.CallStatic("SetToast", "hello world");
}
}