Esempio n. 1
0
    static void GenFunctions()
    {
        HashSet <string> set = new HashSet <string>();

        for (int i = 0; i < methods.Count; i++)
        {
            _MethodBase m = methods[i];

            if (IsGenericMethod(m.Method))
            {
                Debugger.Log("Generic Method {0}.{1} cannot be export to lua", LuaMisc.GetTypeName(type), m.GetTotalName());
                continue;
            }

            string name = GetMethodName(m.Method);

            if (nameCounter[name] > 1)
            {
                if (!set.Contains(name))
                {
                    _MethodBase mi = GenOverrideFunc(name);

                    if (mi == null)
                    {
                        set.Add(name);
                        continue;
                    }
                    else
                    {
                        m = mi;     //非重载函数,或者折叠之后只有一个函数
                    }
                }
                else
                {
                    continue;
                }
            }

            set.Add(name);
            GenFunction(m);
        }
    }
Esempio n. 2
0
    static void Push(List <_MethodBase> list, _MethodBase r)
    {
        string name  = GetMethodName(r.Method);
        int    index = list.FindIndex((p) => { return(GetMethodName(p.Method) == name && CompareMethod(p, r) >= 0); });

        if (index >= 0)
        {
            if (CompareMethod(list[index], r) == 2)
            {
                Debugger.LogWarning("{0}.{1} has been dropped as function {2} more match lua", className, list[index].GetTotalName(), r.GetTotalName());
                list.RemoveAt(index);
                list.Add(r);
                return;
            }
            else
            {
                Debugger.LogWarning("{0}.{1} has been dropped as function {2} more match lua", className, r.GetTotalName(), list[index].GetTotalName());
                return;
            }
        }

        list.Add(r);
    }