本文整理汇总了C#中UnityEngine.AndroidJavaObject.Set方法的典型用法代码示例。如果您正苦于以下问题:C# AndroidJavaObject.Set方法的具体用法?C# AndroidJavaObject.Set怎么用?C# AndroidJavaObject.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AndroidJavaObject
的用法示例。
在下文中一共展示了AndroidJavaObject.Set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(bool rawEnabled){
#if UNITY_IPHONE
TGAM_Init(rawEnabled);
#elif UNITY_ANDROID
jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
jo.Set<bool>("sendRawEnable", rawEnabled);
#endif
}
示例2: init
public void init(Options options) {
if (!IsDevice()) return;
using (var j_options = new AndroidJavaObject("org.onepf.oms.OpenIabHelper$Options")) {
j_options.Set<int>("discoveryTimeoutMs", options.discoveryTimeoutMs);
j_options.Set<bool>("checkInventory", options.checkInventory);
j_options.Set<int>("checkInventoryTimeoutMs", options.checkInventoryTimeoutMs);
j_options.Set<int>("verifyMode", (int) options.verifyMode);
AndroidJavaObject j_storeKeys = CreateJavaHashMap(options.storeKeys);
j_options.Set("storeKeys", j_storeKeys);
j_storeKeys.Dispose();
j_options.Set("prefferedStoreNames", AndroidJNIHelper.ConvertToJNIArray(options.prefferedStoreNames));
_plugin.Call("initWithOptions", j_options);
}
}
示例3: init
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;
}
示例4: init
public void init(Options options)
{
if (!IsDevice())
{
// Fake init process in the editor. For test purposes
OpenIAB.EventManager.SendMessage("OnBillingSupported", "");
return;
}
using (var j_options = new AndroidJavaObject("org.onepf.oms.OpenIabHelper$Options"))
{
j_options.Set<int>("discoveryTimeoutMs", options.discoveryTimeoutMs);
j_options.Set<bool>("checkInventory", options.checkInventory);
j_options.Set<int>("checkInventoryTimeoutMs", options.checkInventoryTimeoutMs);
j_options.Set<int>("verifyMode", (int) options.verifyMode);
AndroidJavaObject j_storeKeys = CreateJavaHashMap(options.storeKeys);
j_options.Set("storeKeys", j_storeKeys);
j_storeKeys.Dispose();
j_options.Set("prefferedStoreNames", AndroidJNIHelper.ConvertToJNIArray(options.prefferedStoreNames));
_plugin.Call("initWithOptions", j_options);
}
}
示例5: init
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
}
示例6: TakePhotoSuccess
public IEnumerator TakePhotoSuccess(string imagePath)
{
Debug.Log("### STRING RETURNED >>"+imagePath+"<< ###");
if(GameObject.Find("MainScene").GetComponent<GUIStart>().enabled == false)
yield return false;
GameObject.Find("camPivot").GetComponent<gyroControl_v2>().enabled = false;
GameObject.Find("LightPivot").GetComponent<LightConfiguration>().setCompassActive(false);
Debug.Log("Calling native android functions to get the image size");
AndroidJavaObject options = new AndroidJavaObject("android/graphics/BitmapFactory$Options");
// Debug.Log("options set injustdecodebounds");
options.Set<bool>("inJustDecodeBounds", true);
// Debug.Log("factory class");
AndroidJavaClass factory = new AndroidJavaClass("android.graphics.BitmapFactory");
//Debug.Log("factorydecodeFile");
factory.CallStatic<AndroidJavaObject>("decodeFile",imagePath, options);
int imgWidth = options.Get<int>("outWidth");
int imgHeight = options.Get<int>("outHeight");
Debug.Log("imgWidth=" + imgWidth);
Debug.Log("imgHeight=" + imgHeight);
float scaleMax = 1;
//Debug.Log("javaobjects end");
if (imgWidth > Screen.width)
{
scaleMax = ((float)Screen.width) / imgWidth;
}
if (imgHeight > Screen.height)
{
scaleMax = Mathf.Min(scaleMax, ((float)Screen.height) / imgHeight);
}
//Redimensione la photo si elle est plus grande que l'écran
if(scaleMax<1){
Debug.Log("Photo too big, scaling the photo taken : ratio="+scaleMax);
EtceteraAndroid.scaleImageAtPath(imagePath,scaleMax);
}
WWW www = new WWW("file://" + imagePath);
yield return www;
Texture2D tex = www.texture;
// AndroidCommons.Toast("Texture loaded !!!!!");
//EditorUtility.CompressTexture(tex, TextureFormat.RGBA32,TextureCompressionQuality.Fast);
//tex.Compress(true);
//ImgUtils.Bilinear(tex, tex.width / 2, tex.height / 2, true);
/*
int k = 0;
while ((tex.width > 4096 || tex.height > 4096) && k < 2)
{
k++;
Debug.Log("Texture of the photo ist too big !!!! tex.width= " + tex.width + " tex.height= " + tex.height);
TextureScale.Bilinear(tex, tex.width / 2, tex.height / 2);
}
*/
//StartCoroutine(AndroidLoadPhoto(imagePath));
Montage.sm.updateFond(tex, false,"");
// Montage.sm.updateFond(tex, false,"");
//GetComponent<GUIMenuMain>().setStarter(true, true);
StartCoroutine (loadImg());
// if(System.IO.File.Exists(imagePath))
// {
// Debug.Log("IMG STILL EXISTS: Deleting ...");
// System.IO.File.Delete(imagePath);
// }
Debug.Log("setting background tex");
GameObject.Find("backgroundImage").GetComponent<BgImgManager>().SetBackgroundTexture(tex);
GameObject.Find("mainCam").GetComponent<MainCamManager>().FitViewportToScreen();
}
示例7: ResizeTexAtPath
private void ResizeTexAtPath(string imagePath)
{
AndroidJavaObject options = new AndroidJavaObject("android/graphics/BitmapFactory$Options");
// Debug.Log("options set injustdecodebounds");
options.Set<bool>("inJustDecodeBounds", true);
// Debug.Log("factory class");
AndroidJavaClass factory = new AndroidJavaClass("android.graphics.BitmapFactory");
//Debug.Log("factorydecodeFile");
factory.CallStatic<AndroidJavaObject>("decodeFile", imagePath, options);
int imgWidth = options.Get<int>("outWidth");
int imgHeight = options.Get<int>("outHeight");
Debug.Log("imgWidth=" + imgWidth);
Debug.Log("imgHeight=" + imgHeight);
float scaleMax = 1;
//Debug.Log("javaobjects end");
if (imgWidth > Screen.width)
{
scaleMax = ((float)Screen.width) / imgWidth;
}
if (imgHeight > Screen.height)
{
scaleMax = Mathf.Min(scaleMax, ((float)Screen.height) / imgHeight);
}
//Redimensione la photo si elle est plus grande que l'écran
if (scaleMax < 1)
{
Debug.Log("Photo too big, scaling the photo taken : ratio=" + scaleMax);
#if UNITY_ANDROID
EtceteraAndroid.scaleImageAtPath(imagePath, scaleMax);
#endif
}
}