Exemple #1
0
    /// <summary>
    /// //////
    /// </summary>
    private void OnWebRequestSuccess(object sender, GameEventArgs e)
    {
        UnityGameFramework.Runtime.WebRequestSuccessEventArgs ne = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)e;
        // 获取回应的数据
        string responseJson = GameFramework.Utility.Converter.GetString(ne.GetWebResponseBytes());

        Log.Warning("OnWebRequestSuccess:" + responseJson);
    }
        /// <summary>
        /// 创建 Web 请求成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的 Web 请求成功事件。</returns>
        public static WebRequestSuccessEventArgs Create(GameFramework.WebRequest.WebRequestSuccessEventArgs e)
        {
            WWWFormInfo wwwFormInfo = (WWWFormInfo)e.UserData;
            WebRequestSuccessEventArgs webRequestSuccessEventArgs = ReferencePool.Acquire <WebRequestSuccessEventArgs>();

            webRequestSuccessEventArgs.SerialId           = e.SerialId;
            webRequestSuccessEventArgs.WebRequestUri      = e.WebRequestUri;
            webRequestSuccessEventArgs.m_WebResponseBytes = e.GetWebResponseBytes();
            webRequestSuccessEventArgs.UserData           = wwwFormInfo.UserData;
            ReferencePool.Release(wwwFormInfo);
            return(webRequestSuccessEventArgs);
        }
Exemple #3
0
 static int Clear(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.WebRequestSuccessEventArgs));
         obj.Clear();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #4
0
 static int GetWebResponseBytes(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.WebRequestSuccessEventArgs));
         byte[] o = obj.GetWebResponseBytes();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #5
0
 static int Fill(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj  = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.WebRequestSuccessEventArgs));
         GameFramework.WebRequest.WebRequestSuccessEventArgs   arg0 = (GameFramework.WebRequest.WebRequestSuccessEventArgs)ToLua.CheckObject(L, 2, typeof(GameFramework.WebRequest.WebRequestSuccessEventArgs));
         UnityGameFramework.Runtime.WebRequestSuccessEventArgs o    = obj.Fill(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #6
0
    static int get_UserData(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)o;
            object ret = obj.UserData;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index UserData on a nil value" : e.Message));
        }
    }
Exemple #7
0
    static int get_WebRequestUri(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)o;
            string ret = obj.WebRequestUri;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index WebRequestUri on a nil value" : e.Message));
        }
    }
Exemple #8
0
    static int _CreateUnityGameFramework_Runtime_WebRequestSuccessEventArgs(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityGameFramework.Runtime.WebRequestSuccessEventArgs obj = new UnityGameFramework.Runtime.WebRequestSuccessEventArgs();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityGameFramework.Runtime.WebRequestSuccessEventArgs.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    /// <summary>
    /// //////
    /// </summary>
    private void OnWebRequestSuccess(object sender, GameEventArgs e)
    {
        UnityGameFramework.Runtime.WebRequestSuccessEventArgs ne = (UnityGameFramework.Runtime.WebRequestSuccessEventArgs)e;
        // 获取回应的数据
        string responseJson = GameFramework.Utility.Converter.GetString(ne.GetWebResponseBytes());

        Log.Warning("OnWebRequestSuccess:" + responseJson);

        ////post
        //if (responseJson != "404 Not found")
        //{
        //    WebRequestComponent WebRequest = UnityGameFramework.Runtime.GameEntry.GetComponent<WebRequestComponent>();
        //    string url = "http://localhost:9091/";
        //    responseJson = "{\"UserName\": \"kitty\"}";
        //    byte[] content = System.Text.Encoding.Default.GetBytes(responseJson);
        //    WebRequest.AddWebRequest(url, content, this);
        //}
        //else
        //{
        //    //
        //}
    }
Exemple #10
0
 private void OnWebRequestSuccess(object sender, GameFramework.WebRequest.WebRequestSuccessEventArgs e)
 {
     m_EventComponent.Fire(this, WebRequestSuccessEventArgs.Create(e));
 }