Example #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);
    }
Example #2
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));
     }
 }
Example #3
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);

        ////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
        //{
        //    //
        //}
    }