コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: UIFrame.cs プロジェクト: jesenzhang/GameBase
        internal UIFrame(int id, string name, List <string> atlas, List <string> texs)
        {
            _name = name;
            uiID  = id;

            if (atlas != null)
            {
                short index = -1;
                for (int i = 0, count = atlas.Count; i < count; i++)
                {
                    index = GetAtlasIndex(atlas[i]);
                    if (index < 0)
                    {
                        Debugger.LogError("ui atlas is invalid->" + atlas[i]);
                    }
                    else
                    {
                        atlases.Add(index);
                    }
                }
            }

            if (texs != null)
            {
                short index = -1;
                for (int i = 0, count = texs.Count; i < count; i++)
                {
                    index = GetTextureIndex(texs[i]);
                    if (index < 0)
                    {
                        Debugger.LogError("ui texture is invalid->" + texs[i]);
                    }
                    else
                    {
                        textures.Add(index);
                    }
                }
            }


#if LUASCRIPT
            LuaManager.Require("UI/" + name);
#endif
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 internal void SetLuaRecvCallFunc(string className, string funcName)
 {
     LuaManager.Require(className);
     recvMsgCall = LuaManager.GetFunction(funcName);
 }
コード例 #5
0
ファイル: InnerNetNode.cs プロジェクト: jesenzhang/GameBase
        /*
         * internal void Connect(InnerNetNode node)
         * {
         * }
         */

#if LUASCRIPT
        //internal struct RecvData
        //{
        //    internal InnerNetNode node;
        //    internal NetAdapter.DeserializationData data;
        //}

        internal void SetLuaRecvCallFunc(string className, string funcName)
        {
            LuaManager.Require(className);
            recvMsgCall = LuaManager.GetFunction(funcName);
            //Debugger.Log("set lua call->" + (recvMsgCall == null));
        }
コード例 #6
0
 internal static void SetHttpBackProtoBufCall(string className, string funcName)
 {
     LuaManager.Require(className);
     protoBufCall = LuaManager.GetFunction(funcName);
 }