Set() public method

public Set ( string fieldName, FieldType val ) : void
fieldName string
val FieldType
return void
	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
	}
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
 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
 }
Ejemplo n.º 6
0
    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();
    }
Ejemplo n.º 7
0
    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
        }
    }