public static 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;
            }
Exemplo n.º 2
0
 void IRedeem.RedeemWithCode(RedeemParameter param, System.Action<RedeemResult, int, RedeemParameter> callback)
 {
     callbackContexts.Add(param.Code, new CallbackContext(callback, param));
     using (AndroidJavaClass klass = new AndroidJavaClass("com.cocoachina.runningcube.SDK_08"))
     {
         klass.CallStatic("RedeemWithCode", "GlobalObject", "OnRedeemResult", param.Code, param.Code);
     }
 }
Exemplo n.º 3
0
 void IExitHandler.OnExit(System.Action<ExitResult> callback)
 {
     string context = CallingIndex.ToString();
     this.callbackContexts.Add(context, new ExitContext());
     CallingIndex ++;
     using(AndroidJavaClass klass = new AndroidJavaClass("com.cocochina.runningcube.SDK_03"))
     {
         klass.CallStatic("Exit", this.gameObject.name, "OnExit", context);
     }
 }
Exemplo n.º 4
0
 void IShop.Buy(BuyParameter param, System.Action<BuyResult, BuyParameter> callback)
 {
     string context = CallingIndex.ToString();
     this.callbackContexts.Add(context, new PayContext(callback, param));
     CallingIndex ++;
     using(AndroidJavaClass klass = new AndroidJavaClass("com.cocochina.runningcube.SDK_03"))
     {
         klass.CallStatic("Pay", this.gameObject.name, "OnPay", context);
     }
 }
Exemplo n.º 5
0
            public static bool ForceLoadLowLevelBinary()
            {
                // This is a hack that forces Android to load the .so libraries in the correct order
                #if UNITY_ANDROID && !UNITY_EDITOR

                if (FMOD.VERSION.number >= 0x00010500)
                {
                    AndroidJavaObject activity = null;

                    // First, obtain the current activity context
                    using (var actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                    {
                        activity = actClass.GetStatic<AndroidJavaObject>("currentActivity");
                    }

                    UnityEngine.Debug.Log("FMOD ANDROID AUDIOTRACK: " + (activity == null ? "ERROR NO ACTIVITY" : "VALID ACTIVITY!"));

                    using (var fmodJava = new AndroidJavaClass("org.fmod.FMOD"))
                    {
                        if (fmodJava != null)
                        {
                            UnityEngine.Debug.Log("FMOD ANDROID AUDIOTRACK: assigning activity to fmod java");

                            fmodJava.CallStatic("init", activity);
                        }
                        else
                        {
                            UnityEngine.Debug.Log("FMOD ANDROID AUDIOTRACK: ERROR NO FMOD JAVA");
                        }
                    }
                }

                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;
            }
Exemplo n.º 6
0
        private static jvalue[] CreateVibrationEffect(long durationMs, int amplitude)
        {
            if (!IsAndroid())
            {
                return(null);
            }

            if (!VibrateEffectArgsCache.TryGetValue((durationMs, amplitude), out var args))
            {
                var effect = VibrationEffectClass?.CallStatic <AndroidJavaObject>("createOneShot", durationMs, amplitude);

                if (effect != null)
                {
                    GlobalReferences.Add(effect);
                }

                args = new[] { new jvalue {
                                   l = effect?.GetRawObject() ?? IntPtr.Zero
                               } };
                VibrateEffectArgsCache[(durationMs, amplitude)] = args;
 public void ShowNewAppVersionInAppStore(string url, string content, string confirm, string cancle)
 {
     ptcustom.CallStatic("ShowNewAppVersionInAppStore", new object[] { jo, url, content, confirm, cancle });
 }
Exemplo n.º 8
0
 public static void StopPlugin()
 {
     AndroidPlugin.CallStatic("stopPluginService");
 }
 public bool IsNotchScreen()
 {
     return(notchChecker.CallStatic <bool>("hasNotchScreen", jo));
 }
Exemplo n.º 10
0
 public void Cancel(int notificationId)
 {
     canceler.CallStatic("Cancel", context, notificationId);
 }
    // Use this for initialization
    void Start()
    {
        StartText.text = "Loading...";
        CancelButton.onClick.AddListener(() =>
        {
            Header.text  = string.Empty;
            Message.text = string.Empty;
            SmallWindow.SetActive(false);
        });

        ShowFriendsButton.onClick.AddListener(() =>
        {
            if (!FriendsWindow.activeInHierarchy)
            {
                foreach (Transform tr in FriendListContent.transform)
                {
                    Destroy(tr.gameObject);
                }
                FriendsWindow.SetActive(true);
                _network.Send(GameServerMsgTypes.RequestForFriendList, new AskForFriendListMessage()
                {
                    PlayfabId = PlayFabId
                });
            }
        });

        ShowChatButton.onClick.AddListener(() =>
        {
            ChatWindow.SetActive(true);
        });

        HideChatButton.onClick.AddListener(() =>
        {
            ChatWindow.SetActive(false);
        });


        if (string.IsNullOrEmpty(TitleId))
        {
            Debug.LogError("Please Enter your Title Id on the ClientExampleGameObject");
            return;
        }

        PlayFabSettings.TitleId = TitleId;
#if UNITY_ANDROID && !UNITY_EDITOR
        AndroidJavaClass  up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = up.GetStatic <AndroidJavaObject>("currentActivity");
        AndroidJavaObject contentResolver = currentActivity.Call <AndroidJavaObject>("getContentResolver");
        AndroidJavaClass  secure          = new AndroidJavaClass("android.provider.Settings$Secure");
        string            androidId       = secure.CallStatic <string>("getString", contentResolver, "android_id");

        PlayFabClientAPI.LoginWithAndroidDeviceID(new LoginWithAndroidDeviceIDRequest()
        {
            TitleId         = TitleId,
            AndroidDevice   = SystemInfo.deviceModel,
            AndroidDeviceId = androidId,
            OS            = SystemInfo.operatingSystem,
            CreateAccount = true
        }, (result) =>
        {
            PlayFabId     = result.PlayFabId;
            SessionTicket = result.SessionTicket;

            Debug.Log("PlayFab Logged In Successfully");
            StartText.text = "PlayFab Logged In Successfully";
            //If you want to test locally where you are running the server in the Unity Editor
            if (IsLocalNetwork)
            {
                ConnectNetworkClient();
            }
            else
            {
                PlayFabClientAPI.Matchmake(new MatchmakeRequest()
                {
                    BuildVersion = BuildVersion,
                    GameMode     = GameMode,
                    Region       = GameRegion
                }, (matchMakeResult) =>
                {
                    int port             = matchMakeResult.ServerPort ?? 7777;
                    GameServerAuthTicket = matchMakeResult.Ticket;
                    ConnectNetworkClient(matchMakeResult.ServerHostname, port);
                }, PlayFabErrorHandler.HandlePlayFabError);
            }
        }, PlayFabErrorHandler.HandlePlayFabError);
#else
        var randomId = UnityEngine.Random.Range(0, 100);
        PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest()
        {
            TitleId       = TitleId,
            CustomId      = string.Format("{0}-{1}", SystemInfo.deviceUniqueIdentifier, randomId),
            CreateAccount = true
        }, (result) =>
        {
            PlayFabId     = result.PlayFabId;
            SessionTicket = result.SessionTicket;

            Debug.Log("PlayFab Logged In Successfully");
            StartText.text = "PlayFab Logged In Successfully";
            //If you want to test locally where you are running the server in the Unity Editor
            if (IsLocalNetwork)
            {
                ConnectNetworkClient();
            }
            else
            {
                PlayFabClientAPI.Matchmake(new MatchmakeRequest()
                {
                    BuildVersion = BuildVersion,
                    GameMode     = GameMode,
                    Region       = GameRegion
                }, (matchMakeResult) =>
                {
                    int port             = matchMakeResult.ServerPort ?? 7777;
                    GameServerAuthTicket = matchMakeResult.Ticket;
                    ConnectNetworkClient(matchMakeResult.ServerHostname, port);
                }, PlayFabErrorHandler.HandlePlayFabError);
            }
        }, PlayFabErrorHandler.HandlePlayFabError);
#endif
    }
Exemplo n.º 12
0
 public void Initialize(string gameId, bool testMode, bool enablePerPlacementLoad, IUnityAdsInitializationListener initializationListener)
 {
     m_UnityAdsPurchase = new Purchase();
     m_UnityAdsPurchase?.Initialize(this);
     m_UnityAds?.CallStatic("initialize", m_CurrentActivity, gameId, testMode, enablePerPlacementLoad, new AndroidInitializationListener(m_Platform, initializationListener));
 }
Exemplo n.º 13
0
 public void StartLevel(int level)
 {
     jc?.CallStatic("startLevel", level);
 }
Exemplo n.º 14
0
    private void _sendBangToReceiver(string receiverName)
    {
        AndroidJavaClass jc = new AndroidJavaClass("org.puredata.core.PdBase");

        jc.CallStatic <int>("sendBang", receiverName);
    }
Exemplo n.º 15
0
    private void _sendFloat(float val, string receiverName)
    {
        AndroidJavaClass jc = new AndroidJavaClass("org.puredata.core.PdBase");

        jc.CallStatic <int>("sendFloat", receiverName, val);
    }
Exemplo n.º 16
0
 private static void enable_log(bool enableLog)
 {
     sdkClass.CallStatic("enableTrackLog", enableLog);
 }
Exemplo n.º 17
0
    IEnumerator Save(byte[] bytes, string fileName, string path, ImageType imageType)
    {
        int        count = 0;
        SaveStatus saved = SaveStatus.NOTSAVED;

                #if UNITY_IOS
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            System.IO.File.WriteAllBytes(path, bytes);

            while (saved == SaveStatus.NOTSAVED)
            {
                count++;
                if (count > 30)
                {
                    saved = SaveStatus.TIMEOUT;
                }
                else
                {
                    saved = (SaveStatus)saveToGallery(path);
                }

                yield return(Instance.StartCoroutine(Instance.Wait(.5f)));
            }

            UnityEngine.iOS.Device.SetNoBackupFlag(path);
        }
                #elif UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            System.IO.File.WriteAllBytes(path, bytes);

            while (saved == SaveStatus.NOTSAVED)
            {
                count++;
                if (count > 30)
                {
                    saved = SaveStatus.TIMEOUT;
                }
                else
                {
                    saved = (SaveStatus)obj.CallStatic <int>("addImageToGallery", path);
                }

                yield return(Instance.StartCoroutine(Instance.Wait(.5f)));
            }
        }
                #elif UNITY_WP8
        if (Application.platform == RuntimePlatform.WP8Player)
        {
            WP8Screenshot.Main.SaveImage(bytes, fileName);

            saved = SaveStatus.SAVED;

            yield return(null);
        }
                #else
        yield return(null);

        Debug.Log("Gallery Manager: Save file only available in iOS/Android/WP8 modes");

        saved = SaveStatus.SAVED;
                #endif

        switch (saved)
        {
        case SaveStatus.DENIED:
            path = "DENIED";
            break;

        case SaveStatus.TIMEOUT:
            path = "TIMEOUT";
            break;
        }

        switch (imageType)
        {
        case ImageType.IMAGE:
            if (OnImageSaved != null)
            {
                OnImageSaved(path);
            }
            break;

        case ImageType.SCREENSHOT:
            if (OnScreenshotSaved != null)
            {
                OnScreenshotSaved(path);
            }
            break;
        }
    }
Exemplo n.º 18
0
        private void track(ThinkingAnalyticsEvent taEvent)
        {
            AndroidJavaObject javaEvent = null;

            switch (taEvent.EventType)
            {
            case ThinkingAnalyticsEvent.Type.FIRST:
                javaEvent = new AndroidJavaObject("cn.thinkingdata.android.TDFirstEvent",
                                                  taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)));

                string extraId = taEvent.ExtraId;
                if (!string.IsNullOrEmpty(extraId))
                {
                    javaEvent.Call("setFirstCheckId", extraId);
                }

                break;

            case ThinkingAnalyticsEvent.Type.UPDATABLE:
                javaEvent = new AndroidJavaObject("cn.thinkingdata.android.TDUpdatableEvent",
                                                  taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)), taEvent.ExtraId);
                break;

            case ThinkingAnalyticsEvent.Type.OVERWRITABLE:
                javaEvent = new AndroidJavaObject("cn.thinkingdata.android.TDOverWritableEvent",
                                                  taEvent.EventName, getJSONObject(getFinalEventProperties(taEvent.Properties)), taEvent.ExtraId);
                break;
            }
            if (null == javaEvent)
            {
                TD_Log.w("Unexpected java event object. Returning...");
                return;
            }

            if (taEvent.EventTime != DateTime.MinValue)
            {
                AndroidJavaObject date    = getDate(taEvent.EventTime);
                AndroidJavaClass  tzClass = new AndroidJavaClass("java.util.TimeZone");
                AndroidJavaObject tz      = null;

                if (token.timeZone == ThinkingAnalyticsAPI.TATimeZone.Local)
                {
                    switch (taEvent.EventTime.Kind)
                    {
                    case DateTimeKind.Local:
                        tz = tzClass.CallStatic <AndroidJavaObject>("getDefault");
                        break;

                    case DateTimeKind.Utc:
                        tz = tzClass.CallStatic <AndroidJavaObject>("getTimeZone", "UTC");
                        break;

                    case DateTimeKind.Unspecified:
                        break;
                    }
                }
                else
                {
                    tz = tzClass.CallStatic <AndroidJavaObject>("getTimeZone", token.getTimeZoneId());
                }
                javaEvent.Call("setEventTime", date, tz);
            }
            instance.Call("track", javaEvent);
        }
Exemplo n.º 19
0
 public string GetRegion()
 {
     return(_preciseLocale.CallStatic <string>("getRegion", Array.Empty <object>()));
 }
Exemplo n.º 20
0
    public void CheckPermission()
    {
        AndroidJavaClass adjClass = new AndroidJavaClass("com.example.beaconlibrary.BeaconTestLibrary");

        adjClass.CallStatic("_cl_checkPermission");
    }
Exemplo n.º 21
0
        private static bool StaticInitAndroid()
        {
#if UNITY_ANDROID
            Debug.Log(LOG_PREFIX + "Initialize android specific plugin");
            bool successful;
            try
            {
                //get context from unity activity
                AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject activity    = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
                AndroidJavaObject context     = activity.Call <AndroidJavaObject>("getApplicationContext");

                //get the java plugin
                AndroidJavaClass wrtc = new AndroidJavaClass("com.because_why_not.wrtc.WrtcAndroid");
                //Debug.Log("Using context " + context.GetHashCode());
                //initialize the java side
                bool javaSideSuccessful;
                javaSideSuccessful = wrtc.CallStatic <bool>("init", context);
                //2019-05-22: Any V0.984 and higher after this date won't need the workaround below.
                //Pre 2019-05-22: Workaround for Bug0117: If Application.Quit is used unity destroys the C# side
                //but java/C++ side remains initialized causing an error during the next init process.
                //In this case the error can be ignored with the side effect
                //that a real error might be ignored as well:
                //if(javaSideSuccessful == false)
                //{
                //    Debug.LogWarning("WORKAROUND to avoid problems with Application.Quit. Error of the java library ignored");
                //    javaSideSuccessful = true;
                //}
                if (javaSideSuccessful)
                {
                    Debug.Log(LOG_PREFIX + "android java plugin initialized");
                }
                else
                {
                    Debug.LogError(LOG_PREFIX + "Failed to initialize android java plugin. See android logcat output for error information!");
                    return(false);
                }

                //initialize the c++ side
                bool cppSideSuccessful = WebRtcCSharp.RTCPeerConnectionFactory.InitAndroidContext(context.GetRawObject());
                if (cppSideSuccessful)
                {
                    Debug.Log(LOG_PREFIX + "android cpp plugin successful initialized.");
                }
                else
                {
                    Debug.LogError(LOG_PREFIX + "Failed to initialize android native plugin. See android logcat output for error information!");
                }
                successful = true;
            }
            catch (Exception e)
            {
                successful = false;
                Debug.LogError(LOG_PREFIX + "Android specific init process failed due to an exception.");
                Debug.LogException(e);
            }

            return(successful);
#else
            return(false);
#endif
        }
Exemplo n.º 22
0
 public void SaveImage(string path, sbyte[] data)
 {
     galleryHelper?.CallStatic("saveImage", path, data);
 }
Exemplo n.º 23
0
 public string GetDefaultPlacement()
 {
     return(m_Placement?.CallStatic <string>("getDefaultPlacement"));
 }
Exemplo n.º 24
0
    public void OnPointerDown(PointerEventData eventData)
    {
        Debug.Log("login press down");

        /*
         * AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
         * AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
         * //jo.Call("startMyActivity");
         * AndroidJavaObject joPackageManager = jo.Call<AndroidJavaObject>("getPackageManager");
         *
         * AndroidJavaObject joIntent = joPackageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", "com.github.ont.cyanowallet");
         */

        /*
         *
         * if (null != joIntent)
         * {
         *  jo.Call("startActivity", joIntent);
         * }
         *
         * object number = 18616627871;
         * AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
         * AndroidJavaClass Intent = new AndroidJavaClass("android.content.Intent");
         * AndroidJavaClass Uri = new AndroidJavaClass("android.net.Uri");
         * AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", Intent.GetStatic<AndroidJavaObject>("ACTION_SENDTO"), Uri.CallStatic<AndroidJavaObject>("parse", "smsto:" + number.ToString()));
         * intent.Call<AndroidJavaObject>("putExtra", "sms_body", "");
         * AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
         * currentActivity.Call("startActivity", intent);
         *
         */
        //http://www.manew.com/blog-50742-37586.html
        JObject code = new JObject {
            { "action", "login" },
            { "version", "v1.0.0" },
            { "id", "10ba038e-48da-487b-96e8-8d3b99b6d18a" },
            { "params", new JObject {
                  { "type", "account" },
                  { "dappName", "dapp Name" },
                  { "dappIcon", "dapp Icon" },
                  { "message", "helloworld" },
                  { "callback", "http://101.132.193.149:4027/blockchain/v1/common/test-onto-login" }
              } }
        };

        string encode = "";

        byte[] bytes = System.Text.Encoding.GetEncoding("utf-8").GetBytes(code.ToString());
        try
        {
            encode = Convert.ToBase64String(bytes);
        }
        catch
        {
            encode = code.ToString();
        }

        AndroidJavaClass  UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaClass  Intent      = new AndroidJavaClass("android.content.Intent");
        AndroidJavaClass  Uri         = new AndroidJavaClass("android.net.Uri");
        AndroidJavaObject intent      = new AndroidJavaObject("android.content.Intent", "android.intent.action.VIEW", Uri.CallStatic <AndroidJavaObject>("parse", "ontprovider://ont.io?param=" + encode));

        //intent.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
        //intent.Call<AndroidJavaObject>("setData", Uri.CallStatic<AndroidJavaObject>("parse", "ontprovider://ont.io?param=" + encode));
        AndroidJavaObject currentActivity = UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

        currentActivity.Call("startActivity", intent);
    }
Exemplo n.º 25
0
 public void Init(string appId, string responder)
 {
     jiverClass = new AndroidJavaClass("com.smilefam.jia.Jiver");
     jiverClass.CallStatic ("init", appId);
     jiverClass.CallStatic ("setUnityResponder", responder);
 }
Exemplo n.º 26
0
 public static void ShowToast(string message)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         using (AndroidJavaClass cls = new AndroidJavaClass("com.kskkbys.unitygcmplugin.Util")) {;
                                                                                                 cls.CallStatic("showToast", message); }
     }
 }
Exemplo n.º 27
0
    private void SilentlyAuthenticate(System.Action <LoginResult> callback = null)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        //Get the device id from native android
        AndroidJavaClass  up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = up.GetStatic <AndroidJavaObject>("currentActivity");
        AndroidJavaObject contentResolver = currentActivity.Call <AndroidJavaObject>("getContentResolver");
        AndroidJavaClass  secure          = new AndroidJavaClass("android.provider.Settings$Secure");
        string            deviceId        = secure.CallStatic <string>("getString", contentResolver, "android_id");

        //Login with the android device ID
        PlayFabClientAPI.LoginWithAndroidDeviceID(new LoginWithAndroidDeviceIDRequest()
        {
            TitleId               = PlayFabSettings.TitleId,
            AndroidDevice         = SystemInfo.deviceModel,
            OS                    = SystemInfo.operatingSystem,
            AndroidDeviceId       = deviceId,
            CreateAccount         = true,
            InfoRequestParameters = InfoRequestParams
        }, (result) => {
            //Store Identity and session
            _playFabId     = result.PlayFabId;
            _sessionTicket = result.SessionTicket;

            //check if we want to get this callback directly or send to event subscribers.
            if (callback == null && OnLoginSuccess != null)
            {
                //report login result back to the subscriber
                OnLoginSuccess.Invoke(result);
            }
            else if (callback != null)
            {
                //report login result back to the caller
                callback.Invoke(result);
            }
        }, (error) => {
            //report errro back to the subscriber
            if (callback == null && OnPlayFabError != null)
            {
                OnPlayFabError.Invoke(error);
            }
            else
            {
                //make sure the loop completes, callback with null
                callback.Invoke(null);
                //Output what went wrong to the console.
                Debug.LogError(error.GenerateErrorReport());
            }
        });
#elif UNITY_IPHONE || UNITY_IOS && !UNITY_EDITOR
        PlayFabClientAPI.LoginWithIOSDeviceID(new LoginWithIOSDeviceIDRequest()
        {
            TitleId               = PlayFabSettings.TitleId,
            DeviceModel           = SystemInfo.deviceModel,
            OS                    = SystemInfo.operatingSystem,
            DeviceId              = SystemInfo.deviceUniqueIdentifier,
            CreateAccount         = true,
            InfoRequestParameters = InfoRequestParams
        }, (result) => {
            //Store Identity and session
            _playFabId     = result.PlayFabId;
            _sessionTicket = result.SessionTicket;

            //check if we want to get this callback directly or send to event subscribers.
            if (callback == null && OnLoginSuccess != null)
            {
                //report login result back to the subscriber
                OnLoginSuccess.Invoke(result);
            }
            else if (callback != null)
            {
                //report login result back to the caller
                callback.Invoke(result);
            }
        }, (error) => {
            //report errro back to the subscriber
            if (callback == null && OnPlayFabError != null)
            {
                OnPlayFabError.Invoke(error);
            }
            else
            {
                //make sure the loop completes, callback with null
                callback.Invoke(null);
                //Output what went wrong to the console.
                Debug.LogError(error.GenerateErrorReport());
            }
        });
#else
        PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest()
        {
            TitleId               = PlayFabSettings.TitleId,
            CustomId              = SystemInfo.deviceUniqueIdentifier,
            CreateAccount         = true,
            InfoRequestParameters = InfoRequestParams
        }, (result) =>
        {
            //Store Identity and session
            _playFabId     = result.PlayFabId;
            _sessionTicket = result.SessionTicket;

            //check if we want to get this callback directly or send to event subscribers.
            if (callback == null && OnLoginSuccess != null)
            {
                //report login result back to the subscriber
                OnLoginSuccess.Invoke(result);
            }
            else if (callback != null)
            {
                //report login result back to the caller
                callback.Invoke(result);
            }
        }, (error) =>
        {
            //report errro back to the subscriber
            if (callback == null && OnPlayFabError != null)
            {
                OnPlayFabError.Invoke(error);
            }
            else
            {
                //make sure the loop completes, callback with null
                callback.Invoke(null);
                //Output what went wrong to the console.
                Debug.LogError(error.GenerateErrorReport());
            }
        });
#endif
    }
    public void HasChanged()
    {
        cont_items_ubicados_correct = 0;
        cont_items_en_slots = 0;
        lista_objetos = new int[8];//OJO CADA FASE TIENE UN NUMERO DIFERENTE DE PASOS
        int contad = 0;
        Debug.Log ("Se ha notificado de un cambio en CanvasProcessManagerEval organizando pasos");
        foreach (Transform slotTransform in slots) {
            item_slot = slotTransform.GetComponent<SlotsBehaviourMenuStepsPhaseTwo>().slot_con_objeto_correcto;
            id_paso = slotTransform.GetComponent<SlotsBehaviourMenuStepsPhaseTwo>().id_of_step_in_slot;
            lista_objetos[contad] = id_paso;
            contad++;
            //Debug.Log ("Se ha obtenido el componente SlotsBehaviour en CanvasProcessManagerEval organizando pasos");
            if(item_slot){
                Debug.Log ("Los pasos estan correctamente ordenados en CanvasProcessManagerEval organizando pasos");
                cont_items_ubicados_correct++;
            }
            if(slotTransform.childCount > 0){
                cont_items_en_slots++;
            }
        }
        Debug.Log ("CanvasProcessPhasesManagEval: Cantidad de items correctamente ubicados: " + cont_items_ubicados_correct);
        Debug.Log ("Cantidad de items en slots:" + cont_items_en_slots);
        if (cont_items_ubicados_correct == 8)
            items_ubicados_correctamente = true;
        else
            items_ubicados_correctamente = false;

        Debug.Log ("CanvasProcessPhasesManagEval: Se va a definir en el manager organizacion correcta de fases = " + items_ubicados_correctamente);
        if (items_ubicados_correctamente) {
            if (tickCorrectOrder != null){
                tickCorrectOrder.GetComponent<Image>().sprite = img_tick;
                tickCorrectOrder.enabled = true;
            }
            this.NotifyStepsOrganized (true);

            if(!steps_organized_from_manager){
                Debug.Log ("Ingresa al metodo para bloquear los pasos por organizacion automatica del appmanager");
                //inactivando los pasos para que el estudiante no pueda acceder a cualquier otro sino al primero
                //inicialmente:

                if(imgs_gray_random.Length >= 8){
                    Debug.Log ("Ingresa a deshabilitar los botones ");
                    Debug.Log ("Numero step_btn_one=" + step_number_btn_one);
                    if(step_number_btn_one != 1)
                        this.btn_one_to_order.interactable = false;
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[0]);
                    if(img_gray_step != null)
                        this.btn_one_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_two=" + step_number_btn_two);
                    if(step_number_btn_two != 1){
                        this.btn_two_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[1]);
                    if(img_gray_step != null)
                        this.btn_two_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_three=" + step_number_btn_three);
                    if(step_number_btn_three != 1){
                        this.btn_three_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[2]);
                    if(img_gray_step != null)
                        this.btn_three_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_four=" + step_number_btn_four);
                    if(step_number_btn_four != 1){
                        this.btn_four_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[3]);
                    if(img_gray_step != null)
                        this.btn_four_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_five=" + step_number_btn_five);
                    if(step_number_btn_five != 1){
                        this.btn_five_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[4]);
                    if(img_gray_step != null)
                        this.btn_five_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_six=" + step_number_btn_six);
                    if(step_number_btn_six != 1){
                        this.btn_six_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[5]);
                    if(img_gray_step != null)
                        this.btn_six_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_seven=" + step_number_btn_seven);
                    if(step_number_btn_seven != 1){
                        this.btn_seven_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[6]);
                    if(img_gray_step != null)
                        this.btn_seven_to_order.GetComponent<Image>().sprite = img_gray_step;

                    Debug.Log ("Numero step_btn_eight=" + step_number_btn_eight);
                    if(step_number_btn_eight != 1){
                        this.btn_eight_to_order.interactable = false;
                    }
                    img_gray_step = Resources.Load<Sprite>(imgs_gray_random[7]);
                    if(img_gray_step != null)
                        this.btn_eight_to_order.GetComponent<Image>().sprite = img_gray_step;

                } else {
                    Debug.Log ("MenuOfStepsPhaseOneManager: El vector de imagenes en GRIS es NULO");
                }
            }//cierra if interno que valida si se ha pedido organizar los pasos desde el app-manager
        } else {
            if (tickCorrectOrder != null)
                tickCorrectOrder.enabled = false;
            if(cont_items_en_slots == 8){
                tickCorrectOrder.GetComponent<Image>().sprite = img_warning;
                tickCorrectOrder.enabled = true;
            }
            this.NotifyStepsOrganized (false);
        }

        Debug.Log ("MenuOfStepsPhaseTwoEval: Los items estan correctamente ubicados? = " + items_ubicados_correctamente);
        //se va a obtener la secuencia del orden de pasos
        secuencia_pasos = "";
        if (lista_objetos.Length >= 8 && cont_items_en_slots >= 8) {
            //recorriendo la secuencia de pasos como esta organizados actualmente:
            Debug.Log ("La capacidad de la lista es: " + lista_objetos.Length );
            for (int i=0; i<lista_objetos.Length; i++) {
                Debug.Log ("Secuencia de pasos en i= "+i+"= " + lista_objetos [i]);
                elemento_secuencia = lista_objetos [i].ToString();
                if (i == 0)
                    secuencia_pasos = secuencia_pasos + elemento_secuencia;
                else
                    secuencia_pasos = secuencia_pasos + "-" + elemento_secuencia;
            }

            //intentando guardar en la BD:
            Debug.Log ("Se va a solicitar guardar la secuencia en la BD:");
            var and_unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            var current_act = and_unity.GetStatic<AndroidJavaObject>("currentActivity");
            Debug.Log("Se ha obtenido current activity...");
            // Accessing the class to call a static method on it
            var save_todb_activity = new AndroidJavaClass("edu.udg.bcds.pintura.arapp.SaveDatabaseData");
            Debug.Log ("Se ha obtenido StartActivity...");
            Debug.Log ("Se va a intentar obtener la fecha...");
            string fecha = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Debug.Log ("La fecha obtenida es: " + fecha);

            object[] parameters = new object[3];
            parameters [0] = current_act; //pasando el argumento de la actividad actual que se debe reproducir
            parameters [1] = fecha; //pasando el argumento de la fecha y hora actual
            parameters [2] = secuencia_pasos; //enviando
            // Se llama al metodo estatico de android que almacena la secuencia en la base de datos:
            save_todb_activity.CallStatic("SaveStepsPhaseTwoSeqToDB", parameters);

        } else {
            Debug.Log ("La lista de elementos para la secuencia aun NO ESTA COMPLETA items_en_slots =" + cont_items_en_slots );
        }
    }
Exemplo n.º 29
0
    private void _sendSymbol(string symbol, string receiverName)
    {
        AndroidJavaClass jc = new AndroidJavaClass("org.puredata.core.PdBase");

        jc.CallStatic <int>("sendSymbol", receiverName, symbol);
    }
Exemplo n.º 30
0
 private static void NotifyAndroid(string operation, string param)
 {
     _jc.CallStatic("NotifyAndroid", operation, param);
 }
Exemplo n.º 31
0
 private void initializeSDK(string key)
 {
     tapsellPlus?.CallStatic("initialize", key);
 }
Exemplo n.º 32
0
    private void _closeFile(int patchId)
    {
        AndroidJavaClass jc = new AndroidJavaClass("org.puredata.core.PdBase");

        jc.CallStatic("closePatch", patchId);
    }
    public static IEnumerator Save(string fileName, string albumName = "MyScreenshots", bool callback = false)
    {
        bool photoSaved = false;

        string date = System.DateTime.Now.ToString("dd-MM-yy");

        FaceScreenshotManager.ScreenShotNumber++;

        string screenshotFilename = fileName + "_" + FaceScreenshotManager.ScreenShotNumber + "_" + date + ".png";

        Debug.Log("Save screenshot " + screenshotFilename);

                #if UNITY_IPHONE
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            Debug.Log("iOS platform detected");

            string iosPath = Application.persistentDataPath + "/" + screenshotFilename;

            Application.CaptureScreenshot(screenshotFilename);

            while (!photoSaved)
            {
                photoSaved = saveToGallery(iosPath);

                yield return(new WaitForSeconds(.5f));
            }

            iPhone.SetNoBackupFlag(iosPath);
        }
        else
        {
            Application.CaptureScreenshot(screenshotFilename);
        }
                #elif UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            Debug.Log("Android platform detected");

            string androidPath = "/../../../../DCIM/" + albumName + "/" + screenshotFilename;
            string path        = Application.persistentDataPath + androidPath;
            string pathonly    = Path.GetDirectoryName(path);
            Directory.CreateDirectory(pathonly);
            ScreenCapture.CaptureScreenshot(androidPath);

            AndroidJavaClass obj = new AndroidJavaClass("com.ryanwebb.androidscreenshot.MainActivity");

            while (!photoSaved)
            {
                photoSaved = obj.CallStatic <bool>("scanMedia", path);

                yield return(new WaitForSeconds(.5f));
            }
        }
        else
        {
            ScreenCapture.CaptureScreenshot(screenshotFilename);
        }
                #else
        while (!photoSaved)
        {
            yield return(new WaitForSeconds(.5f));

            Debug.Log("Screenshots only available in iOS/Android mode!");

            photoSaved = true;
        }
                #endif

        if (callback)
        {
            ScreenshotFinishedSaving();
        }
    }
Exemplo n.º 34
0
        private AndroidJavaObject handleImageOnKikKat(AndroidJavaObject uri)
        {
            AndroidJavaClass  DocumentsContract = new AndroidJavaClass("android.provider.DocumentsContract");
            AndroidJavaObject imgPath           = null;

            if (DocumentsContract.CallStatic <bool>("isDocumentUri", AndroidTools.UnityActivity, uri))
            {
                AndroidJavaObject docID = DocumentsContract.CallStatic <AndroidJavaObject>("getDocumentId", uri);
                if (uri.Call <AndroidJavaObject>("getAuthority").Call <bool>("equals", new AndroidJavaObject("java.lang.String", "com.android.providers.media.documents")))
                {
                    AndroidJavaObject id        = docID.Call <AndroidJavaObject[]>("split", new AndroidJavaObject("java.lang.String", ":"))[1];
                    AndroidJavaObject selection = new AndroidJavaObject("java.lang.String", "_id=").Call <AndroidJavaObject>("concat", id);

                    AndroidJavaClass Media = new AndroidJavaClass("android.provider.MediaStore$Images$Media");
                    imgPath = getImagePath(Media.GetStatic <AndroidJavaObject>("EXTERNAL_CONTENT_URI"), selection);
                }
                else if ((new AndroidJavaObject("java.lang.String", "com.android.providers.downloads.documents")).Call <bool>("equals", uri.Call <AndroidJavaObject>("getAuthority")))
                {
                    AndroidJavaClass  ContentUris = new AndroidJavaClass("android.content.ContentUris");
                    AndroidJavaClass  Long        = new AndroidJavaClass("java.lang.Long");
                    AndroidJavaObject contentUri  = ContentUris.CallStatic <AndroidJavaObject>("withAppendedId", Uri.CallStatic <AndroidJavaObject>("parse", new AndroidJavaObject("java.lang.String", "content://downloads/public_downloads")), Long.CallStatic <AndroidJavaObject>("valueOf", docID));
                    imgPath = getImagePath(contentUri, null);
                }
            }
            else if ((new AndroidJavaObject("java.lang.String", "content")).Call <bool>("equals", uri.Call <AndroidJavaObject>("getScheme")))
            {
                imgPath = getImagePath(uri, null);
            }
            return(imgPath);
        }
Exemplo n.º 35
0
 public void Success(string message)
 {
     _jc?.CallStatic("success", message);
 }
Exemplo n.º 36
0
 public static void ChangeInsets(string name, int top, int left, int bottom, int right)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         webView.CallStatic("_UniWebViewChangeInsets", name, top, left, bottom, right);
     }
 }
Exemplo n.º 37
0
 public void Initialize(string gameId, bool testMode, bool enablePerPlacementLoad)
 {
     m_UnityAdsPurchase = new Purchase();
     m_UnityAdsPurchase?.Initialize(this);
     m_UnityAds?.CallStatic("addListener", this);
     m_UnityAds?.CallStatic("initialize", m_CurrentActivity, gameId, testMode, enablePerPlacementLoad);
 }
Exemplo n.º 38
0
    void loadLowLevelBinary()
    {
        // This is a hack that forces Android to load the .so libraries in the correct order
        #if UNITY_ANDROID && !UNITY_EDITOR
        Debug.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

        // This is a hack that forces Unity to load the lowlevel dylib (required for mac)
        int temp1 = 0, temp2 = 0;
        #if !UNITY_IPHONE || UNITY_EDITOR
        //Debug.Log("calling memory getStats");
        FMOD.Memory.GetStats(ref temp1, ref temp2);
        #endif
    }