public bool init() { #if UNITY_IPHONE GPG_Init(appID + ".apps.googleusercontent.com"); GPG_SetGameObjectName(name); return(true); #elif UNITY_ANDROID AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); mCurrentActivity = unityPlayer.GetStatic <AndroidJavaObject> ("currentActivity"); Debug.Log("Current activity " + mCurrentActivity); mNerdGPG = new AndroidJavaObject("com.nerdiacs.nerdgpgplugin.NerdGPG"); if (mCurrentActivity != null && mNerdGPG != null) { mNerdGPG.Set <bool>("mDebugLog", true); // enable logging mNerdGPG.SetStatic <string>("gameObjectName", name); mNerdGPG.Call <bool>("init", mCurrentActivity); return(true); } else { return(false); } #endif return(false); }
public void SetStatic <FieldType>(string fieldName, FieldType type) { if (Application.platform == RuntimePlatform.Android) { jo.SetStatic <FieldType>(fieldName, type); } }
public bool init(string clientId, string gameObjectName) { // clientId is only needed for iOS #if UNITY_IPHONE GPG_Init(clientId); GPG_SetGameObjectName(gameObjectName); return(true); #elif UNITY_ANDROID AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); mCurrentActivity = unityPlayer.GetStatic <AndroidJavaObject> ("currentActivity"); mNerdGPG = new AndroidJavaObject("com.nerdiacs.nerdgpgplugin.NerdGPG"); if (mCurrentActivity != null && mNerdGPG != null) { mNerdGPG.Set <bool>("mDebugLog", true); // enable logging mNerdGPG.SetStatic <string>("gameObjectName", gameObjectName); mNerdGPG.Call <bool>("init", mCurrentActivity); return(true); } else { return(false); } #endif return(true); }
public void setGameObjectName(string gameObjectName) { #if UNITY_IPHONE GPG_SetGameObjectName(gameObjectName); #elif UNITY_ANDROID mNerdGPG.SetStatic <string>("gameObjectName", gameObjectName); #endif }
public void SetStatic <FieldType>(string fieldName, FieldType type) { #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android) { jo.SetStatic <FieldType>(fieldName, type); } #endif }
/// <summary> /// 设置是否为debug模式 /// </summary> /// <param name="debugFlag"></param> public void setDebugMode(Boolean debugFlag) { #if UNITY_ANDROID if (utilsJavaObject == null) { utilsJavaObject = new AndroidJavaObject("com.example.u3d.AndroidUtils"); } utilsJavaObject.SetStatic("debugFlag", debugFlag); #endif }
public void InitialisePlugin() { if (ev3Plugin == null) { return; } ev3Plugin.SetStatic <string>("deviceName", EV3Name); ev3Plugin.Call("initialisePlugin"); }
public void InitialisePlugin() { Debug.Log("In intitialization"); Debug.Log(Application.persistentDataPath); if (nxtPlugin == null) { return; } nxtPlugin.SetStatic <string>("deviceName", NXTName); nxtPlugin.Call("initialisePlugin"); }
/// <summary> /// Call a static Java setter on a class. /// </summary> /// <param name="fieldName">Specific which setter to call.</param> /// <param name="val">Update value.</param> /// <typeparam name="T">Return type.</typeparam> public void SetStatic <T>(string fieldName, T val) { nativeObj.SetStatic(fieldName, val); }