static int StartCoroutineLuaToC(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { BaseSceneLua obj = (BaseSceneLua)LuaScriptMgr.GetUnityObjectSelf(L, 1, "BaseSceneLua"); IEnumerator arg0 = (IEnumerator)LuaScriptMgr.GetNetObject(L, 2, typeof(IEnumerator)); obj.StartCoroutineLuaToC(arg0); return(0); } else if (count == 3) { BaseSceneLua obj = (BaseSceneLua)LuaScriptMgr.GetUnityObjectSelf(L, 1, "BaseSceneLua"); IEnumerator arg0 = (IEnumerator)LuaScriptMgr.GetNetObject(L, 2, typeof(IEnumerator)); DoneCoroutine arg1 = (DoneCoroutine)LuaScriptMgr.GetNetObject(L, 3, typeof(DoneCoroutine)); obj.StartCoroutineLuaToC(arg0, arg1); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: BaseSceneLua.StartCoroutineLuaToC"); } return(0); }
static int _CreateDoneCoroutine(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { DoneCoroutine obj = new DoneCoroutine(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: DoneCoroutine.New"); } return(0); }
static int set_isDoneCoroutine(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); DoneCoroutine obj = (DoneCoroutine)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name isDoneCoroutine"); } else { LuaDLL.luaL_error(L, "attempt to index isDoneCoroutine on a nil value"); } } obj.isDoneCoroutine = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int StartCoroutineLuaToC(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 1) { IEnumerator arg0 = (IEnumerator)LuaScriptMgr.GetNetObject(L, 1, typeof(IEnumerator)); StaticUtils.StartCoroutineLuaToC(arg0); return(0); } else if (count == 2) { IEnumerator arg0 = (IEnumerator)LuaScriptMgr.GetNetObject(L, 1, typeof(IEnumerator)); DoneCoroutine arg1 = (DoneCoroutine)LuaScriptMgr.GetNetObject(L, 2, typeof(DoneCoroutine)); StaticUtils.StartCoroutineLuaToC(arg0, arg1); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: StaticUtils.StartCoroutineLuaToC"); } return(0); }
IEnumerator CoroutineLuaToC(IEnumerator coroutine, DoneCoroutine done) { yield return(StartCoroutine(coroutine)); done.isDoneCoroutine = true; }
/// <summary> /// 监听 SocketReceiveMessage 的消息 /// </summary> /// <param name="path"></param> /// <param name="onReceiveAction">请求成功的回调,该值为空则不会添加该接受action</param> /// <param name="onErrorAction">请求出错的回调,该值为空则不会添加该接受action</param> //public void Receive(string path, System.Action<JSONObject> onReceiveAction, System.Action<string> onErrorAction) //{ // if (onReceiveAction != null) m_SocketRequestMap[path] = onReceiveAction; // if (onErrorAction != null) m_SocketRequestErrorMap[path] = onErrorAction; //} #region 已弃用,使用Receive_lua_fun替换 /// <summary> /// 监听 SocketReceiveMessage 的消息 /// 主要考虑lua中使用 /// </summary> /// <param name="path"></param> /// <param name="onReceiveAction">请求成功的回调,该值为空则不会添加该接受action</param> /// <param name="onErrorAction">请求出错的回调,该值为空则不会添加该接受action</param> //public void Receive_lua(string path, System.Action<string> onReceiveAction, System.Action<string> onErrorAction) //{ // if (onReceiveAction != null) m_SocketRequest_StrResult_Map[path] = onReceiveAction; // if (onErrorAction != null) m_SocketRequestErrorMap[path] = onErrorAction; //} #endregion 已弃用,使用Receive_lua_fun替换 /// <summary> /// 请求socket接口,处理 JSONObject 数据, onReceiveAction 直接处理body内容 /// </summary> /// <param name="path"></param> /// <param name="body">如果body为空,那么该项填空字符串, 如果该项为null,那么只会进行Receive操作</param> /// <param name="onReceiveAction">请求成功的回调,该值为空则不会添加该接受action</param> /// <param name="onErrorAction">请求出错的回调,该值为空则不会添加该接受action</param> //public void Request(string path, JSONObject body, System.Action<JSONObject> onReceiveAction, System.Action<string> onErrorAction) //{ // if (body != null) ProtocolHelper.Send(path, body); // Receive(path, onReceiveAction, onErrorAction); // if(body != null && (onReceiveAction != null || onErrorAction != null)) m_SocketReSendMap[path] = body.ToString(); //} #region 已弃用,lua的delegate在这里回调时存在问题,目前使用Request_lua_fun替换 /// <summary> /// 请求socket接口,直接处理string格式数据, onReceiveAction 直接处理body内容 /// 主要考虑lua中的使用string 比较方便 /// </summary> /// <param name="path"></param> /// <param name="bodyJsonStr">如果body为空,那么该项填空字符串, 如果该项为null,那么只会进行Receive操作</param> /// <param name="onReceiveAction">请求成功的回调,该值为空则不会添加该接受action</param> /// <param name="onErrorAction">请求出错的回调,该值为空则不会添加该接受action</param> //public void Request_lua(string path, string bodyJsonStr, System.Action<string> onReceiveAction, System.Action<string> onErrorAction) //{ // //UnityEngine.Debug.Log("CK : ------------------------------ path = " + path + ", bodyJsonStr = " + bodyJsonStr + ", onReceiveAction = " + onReceiveAction + ", onErrorAction = " + onErrorAction); // if (bodyJsonStr != null) ProtocolHelper.Send(path, new JSONObject(bodyJsonStr)); // Receive_lua(path, onReceiveAction, onErrorAction); // if (bodyJsonStr != null && (onReceiveAction != null || onErrorAction != null)) m_SocketReSendMap[path] = bodyJsonStr; //} #endregion 已弃用,lua的delegate在这里回调时存在问题,目前使用Request_lua_fun替换 #endregion 已弃用 #endregion 对socket请求和监听消息的结构处理 #endregion socket相关 /// <summary> /// Lua中等待C#中协程开始函数 /// </summary> /// <param name="coroutine">C#中要运行的协程</param> public void StartCoroutineLuaToC(IEnumerator coroutine, DoneCoroutine done) { StartCoroutine(CoroutineLuaToC(coroutine, done)); }
static IEnumerator CoroutineLuaToC(IEnumerator coroutine, DoneCoroutine done) { yield return(StaticUtils.GetGameManager().StartCoroutine(coroutine)); done.isDoneCoroutine = true; }
/// <summary> /// Lua中等待C#中协程开始函数 /// </summary> /// <param name="coroutine">C#中要运行的协程</param> public static void StartCoroutineLuaToC(IEnumerator coroutine, DoneCoroutine done) { StaticUtils.GetGameManager().StartCoroutine(CoroutineLuaToC(coroutine, done)); }