Ejemplo n.º 1
0
    public static void HttpRequest(string url, HttpDoneCallback callback, byte[] postData)
    {
                #if UNITY_EDITOR
        Debug.Log("httpRequest, url=" + url + ", postData=" + postData);
                #endif

        for (int i = 0, max = m_httpAddList.Count; i < max; ++i)
        {
            if (m_httpAddList[i].HttpCallBack == callback && m_httpAddList[i].URL.Equals(url))
            {
#if UNITY_EDITOR
                Debug.LogWarning("same httpRequest have been requested!, url=" + url);
#endif
                return;
            }
        }

        for (int i = 0, max = m_https.Count; i < max; ++i)
        {
            if (m_https[i].HttpCallBack == callback && m_https[i].URL.Equals(url))
            {
#if UNITY_EDITOR
                Debug.LogWarning("same httpRequest have been requested!, url=" + url);
#endif
                return;
            }
        }

        m_httpRequestNum++;
        HttpInterface Ihttp = new HttpInterface();
        Ihttp.HttpCallBack = callback;
        Ihttp.requestID    = m_httpRequestNum;
        m_httpAddList.Add(Ihttp);
        Ihttp.request(url, postData);
    }
Ejemplo n.º 2
0
    protected void SendData <K>(K msg, HttpDoneCallback callback, bool openWait = false, bool askNet = false) where K : IExtensible
    {
        if (askNet)
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                Main.Instance.SDKManager.OpenNet();
                return;
            }
        }

        if (openWait)
        {
            Main.Instance.GameNetwork.OpenWaitWindow(callback);
        }

        HttpLite.HttpRequest <K>(Main.Instance.GameNetwork.Url + ServiceUrl, callback, msg);
    }
Ejemplo n.º 3
0
    public static void CancelHttpRequest(string url, HttpDoneCallback callback)
    {
        for (int i = 0, max = m_httpAddList.Count; i < max; ++i)
        {
            if (m_httpAddList[i].HttpCallBack == callback && m_httpAddList[i].URL == url)
            {
                m_httpAddList[i].m_removed = true;
            }
        }

        for (int i = 0, max = m_https.Count; i < max; ++i)
        {
            if (m_https[i].HttpCallBack == callback && m_https[i].URL == url)
            {
                m_https[i].m_removed = true;
            }
        }
    }
Ejemplo n.º 4
0
 public void OpenWaitWindow(HttpDoneCallback callback)
 {
     callb = callback;
     //waitWindow = (WaitWindow)WindowManager.OpenWindow ((int)WindowType.WaitWin);
 }
Ejemplo n.º 5
0
    public void Send(string serviceUrl, HttpDoneCallback callback, byte[] data)
    {
        string url = Url + serviceUrl;

        HttpLite.HttpRequest(url, callback, data);
    }
Ejemplo n.º 6
0
    public static void HttpRequest <T>(string url, HttpDoneCallback callback, T instance)
    {
        byte[] msg = Protocol.ProtoBufSerialize <T>(instance);

        HttpRequest(url, callback, msg);
    }
Ejemplo n.º 7
0
 public static void HttpRequest(string url, HttpDoneCallback callback)
 {
     HttpRequest(url, callback, null);
 }