public static void AddScriptListener(int rMessageType, int rFilter, string scriptClassName, string scriptMethodName, bool rImmediate, bool staticBinding = true) { #if JSSCRIPT #elif LUASCRIPT LuaManager.Require(scriptClassName); LuaFunction func = LuaManager.GetFunction(scriptMethodName); if (func == null) { Debugger.LogError("register script listener func is null->" + scriptClassName + "^" + scriptMethodName); return; } #endif MessageDispatcher.AddListener(rMessageType, rFilter, (message) => { #if JSSCRIPT JsRepresentClass jsRepresent = JsRepresentClassManager.Instance.AllocJsRepresentClass(JSClassName, staticBinding); if (message != null) { jsRepresent.CallFunctionByFunName(JSMethodName, message.Data); } #elif LUASCRIPT LuaManager.CallFunc_VX(func, message.Data); #endif }, rImmediate); }
private static IEnumerator _HttpGetSendBackString(string url, string ob, string className, string functionName) { WWW www = new WWW(url + "?" + ob); yield return(www); if (www.error != null) { Debugger.LogError("http get send error->" + www.error); } else { if (www.bytes != null) { string data = System.Text.Encoding.UTF8.GetString(www.bytes); if (!string.IsNullOrEmpty(data)) { #if JSSCRIPT JsRepresentClass jsRepresentClass = JsRepresentClassManager.Instance.AllocJsRepresentClass(className, true); jsRepresentClass.CallFunctionByFunName(functionName, data); #elif LUASCRIPT LuaManager.Require(className); LuaInterface.LuaFunction func = LuaManager.GetFunction(functionName); LuaManager.CallFunc_VX(func, data); #endif } } else { Debugger.LogError("http get response data is null"); } } www.Dispose(); }
private void OnEnable() { if (uiData == null) { return; } if (lowLayerAlpha < 1) { UIManager.SetLessLayerUIAlpha(layer, lowLayerAlpha); } UIManager.ProcessUIAlpha(this); UISpriteData data = null; for (int i = 0, count = uiData.sprites.Count; i < count; i++) { data = uiData.sprites[i]; SetAtlas(data, true); } UITextureData utd = null; for (int i = 0, count = uiData.textures.Count; i < count; i++) { utd = uiData.textures[i]; SetTexture(utd, true); } #if JSSCRIPT jsRepresentClass.CallFunctionByFunName("OnEnable", this); #elif LUASCRIPT if (lua_OnEnable == null) { lua_OnEnable = LuaManager.GetFunction(name + ".OnEnable"); } if (lua_OnEnable != null) { LuaManager.CallFunc_V(lua_OnEnable, this); } #endif }