Ejemplo n.º 1
0
 void OnApplicationPause(bool isPaused)
 {
     if (HTTPUpdateDelegator.OnApplicationForegroundStateChanged != null)
     {
         HTTPUpdateDelegator.OnApplicationForegroundStateChanged(isPaused);
     }
 }
Ejemplo n.º 2
0
        public static void Setup()
        {
            if (IsSetupCalled)
            {
                return;
            }
            IsSetupCalled = true;
            IsQuitting    = false;

            HTTPManager.Logger.Information("HTTPManager", "Setup called! UserAgent: " + UserAgent);

            HTTPUpdateDelegator.CheckInstance();

#if !BESTHTTP_DISABLE_CACHING
            HTTPCacheService.CheckSetup();
#endif

#if !BESTHTTP_DISABLE_COOKIES
            Cookies.CookieJar.SetupFolder();
            Cookies.CookieJar.Load();
#endif
#if UNITY_IOS
            AddBackgroundAudioPlayer();
#endif

            HostManager.Load();
        }
Ejemplo n.º 3
0
        void OnApplicationPause(bool isPaused)
        {
            HTTPManager.Logger.Information("HTTPUpdateDelegator", "OnApplicationPause isPaused: " + isPaused);

            if (HTTPUpdateDelegator.OnApplicationForegroundStateChanged != null)
            {
                HTTPUpdateDelegator.OnApplicationForegroundStateChanged(isPaused);
            }
        }
Ejemplo n.º 4
0
        public static void Setup()
        {
            HTTPUpdateDelegator.CheckInstance();

#if !BESTHTTP_DISABLE_CACHING && (!UNITY_WEBGL || UNITY_EDITOR)
            HTTPCacheService.CheckSetup();
#endif

#if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR)
            Cookies.CookieJar.SetupFolder();
#endif
        }
Ejemplo n.º 5
0
        public static void Setup()
        {
            HTTPUpdateDelegator.CheckInstance();

#if !BESTHTTP_DISABLE_CACHING
            HTTPCacheService.CheckSetup();
#endif

#if !BESTHTTP_DISABLE_COOKIES
            Cookies.CookieJar.SetupFolder();
#endif
        }
Ejemplo n.º 6
0
 public static HTTPRequest SendRequest(HTTPRequest request)
 {
     HTTPUpdateDelegator.CheckInstance();
     if (IsCallingCallbacks)
     {
         RequestQueue.Add(request);
     }
     else
     {
         SendRequestImpl(request);
     }
     return(request);
 }
Ejemplo n.º 7
0
        void OnPlayModeStateChanged(UnityEditor.PlayModeStateChange playMode)
        {
            if (playMode == UnityEditor.PlayModeStateChange.EnteredPlayMode)
            {
                UnityEditor.EditorApplication.update -= Update;
            }
            else if (playMode == UnityEditor.PlayModeStateChange.EnteredEditMode)
            {
                UnityEditor.EditorApplication.update -= Update;
                UnityEditor.EditorApplication.update += Update;

                HTTPUpdateDelegator.ResetSetup();
                HTTPManager.ResetSetup();
            }
        }
Ejemplo n.º 8
0
 public static void CheckInstance()
 {
     //IL_0019: Unknown result type (might be due to invalid IL or missing references)
     //IL_001e: Expected O, but got Unknown
     //IL_003c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0041: Expected O, but got Unknown
     if (!Object.op_Implicit(instance))
     {
         instance = (Object.FindObjectOfType(typeof(HTTPUpdateDelegator)) as HTTPUpdateDelegator);
         if (!Object.op_Implicit(instance))
         {
             GameObject val = new GameObject("HTTP Update Delegator");
             val.set_hideFlags(3);
             Object.DontDestroyOnLoad(val);
             instance = val.AddComponent <HTTPUpdateDelegator>();
         }
     }
 }
Ejemplo n.º 9
0
        public static void CheckInstance()
        {
            try
            {
                if (!IsCreated)
                {
                    GameObject go = GameObject.Find("HTTP Update Delegator");
                    if (go != null)
                    {
                        instance = go.GetComponent <HTTPUpdateDelegator>();
                    }

                    if (instance == null)
                    {
                        go           = new GameObject("HTTP Update Delegator");
                        go.hideFlags = HideFlags.HideAndDontSave;
                        //go.hideFlags = HideFlags.DontSave;
                        GameObject.DontDestroyOnLoad(go);

                        instance = go.AddComponent <HTTPUpdateDelegator>();
                    }
                    IsCreated = true;

#if UNITY_EDITOR
                    if (!UnityEditor.EditorApplication.isPlaying)
                    {
                        UnityEditor.EditorApplication.update -= instance.Update;
                        UnityEditor.EditorApplication.update += instance.Update;
                    }

                    UnityEditor.EditorApplication.playmodeStateChanged -= instance.OnPlayModeStateChanged;
                    UnityEditor.EditorApplication.playmodeStateChanged += instance.OnPlayModeStateChanged;
#endif
                }
            }
            catch
            {
                HTTPManager.Logger.Error("HTTPUpdateDelegator", "Please call the BestHTTP.HTTPManager.Setup() from one of Unity's event(eg. awake, start) before you send any request!");
            }
        }
Ejemplo n.º 10
0
 public static void CheckInstance()
 {
     try
     {
         if (!HTTPUpdateDelegator.IsCreated)
         {
             HTTPUpdateDelegator.instance = (UnityEngine.Object.FindObjectOfType(typeof(HTTPUpdateDelegator)) as HTTPUpdateDelegator);
             if (HTTPUpdateDelegator.instance == null)
             {
                 GameObject gameObject = new GameObject("HTTP Update Delegator");
                 gameObject.hideFlags = (HideFlags.HideInHierarchy | HideFlags.HideInInspector);
                 UnityEngine.Object.DontDestroyOnLoad(gameObject);
                 HTTPUpdateDelegator.instance = gameObject.AddComponent <HTTPUpdateDelegator>();
             }
             HTTPUpdateDelegator.IsCreated = true;
         }
     }
     catch
     {
         HTTPManager.Logger.Error("HTTPUpdateDelegator", "Please call the BestHTTP.HTTPManager.Setup() from one of Unity's event(eg. awake, start) before you send any request!");
     }
 }
Ejemplo n.º 11
0
        public static void CheckInstance()
        {
            try
            {
                if (!IsCreated)
                {
                    GameObject go = GameObject.Find("HTTP Update Delegator");
                    if (go != null)
                        instance = go.GetComponent<HTTPUpdateDelegator>();

                    if (instance == null)
                    {
                        go = new GameObject("HTTP Update Delegator");
                        go.hideFlags = HideFlags.HideAndDontSave;
                        //go.hideFlags = HideFlags.DontSave;
                        GameObject.DontDestroyOnLoad(go);

                        instance = go.AddComponent<HTTPUpdateDelegator>();
                    }
                    IsCreated = true;

#if UNITY_EDITOR
                    if (!UnityEditor.EditorApplication.isPlaying)
                    {
                        UnityEditor.EditorApplication.update -= instance.Update;
                        UnityEditor.EditorApplication.update += instance.Update;
                    }

                    UnityEditor.EditorApplication.playmodeStateChanged -= instance.OnPlayModeStateChanged;
                    UnityEditor.EditorApplication.playmodeStateChanged += instance.OnPlayModeStateChanged;
#endif
                }
            }
            catch
            {
                HTTPManager.Logger.Error("HTTPUpdateDelegator", "Please call the BestHTTP.HTTPManager.Setup() from one of Unity's event(eg. awake, start) before you send any request!");
            }
        }
        public static void CheckInstance()
        {
            try
            {
                if (!IsCreated)
                {
                    instance = UnityEngine.Object.FindObjectOfType(typeof(HTTPUpdateDelegator)) as HTTPUpdateDelegator;

                    if (instance == null)
                    {
                        GameObject go = new GameObject("HTTP Update Delegator");
                        go.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;
                        UnityEngine.Object.DontDestroyOnLoad(go);

                        instance = go.AddComponent <HTTPUpdateDelegator>();
                    }
                    IsCreated = true;
                }
            }
            catch
            {
                Debug.LogError("Please call the BestHTTP.HTTPManager.Setup() from one of Unity's event(eg. awake, start) before you send any request!");
            }
        }
        public static void CheckInstance()
        {
            try
            {
                if (!IsCreated)
                {
                    instance = UnityEngine.Object.FindObjectOfType(typeof(HTTPUpdateDelegator)) as HTTPUpdateDelegator;

                    if (instance == null)
                    {
                        GameObject go = new GameObject("HTTP Update Delegator");
                        go.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;
                        UnityEngine.Object.DontDestroyOnLoad(go);

                        instance = go.AddComponent<HTTPUpdateDelegator>();
                    }
                    IsCreated = true;
                }
            }
            catch
            {
                HTTPManager.Logger.Error("HTTPUpdateDelegator", "Please call the BestHTTP.HTTPManager.Setup() from one of Unity's event(eg. awake, start) before you send any request!");
            }
        }
Ejemplo n.º 14
0
 public static void Setup()
 {
     HTTPUpdateDelegator.CheckInstance();
     HTTPCacheService.CheckSetup();
     Cookies.CookieJar.SetupFolder();
 }