コード例 #1
0
ファイル: LuaMisc.cs プロジェクト: midgithub/OverLord-Client
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(func == null && self == null);
            }
            LuaDelegate ld = o as LuaDelegate;

            if (ld == null || ld.func != func || ld.self != self)
            {
                return(false);
            }

            return(ld.func != null);
        }
コード例 #2
0
 private static bool CompareLuaDelegate(LuaDelegate a, LuaDelegate b)
 {
     if (object.ReferenceEquals(a, b))
     {
         return(true);
     }
     if (a == null && b != null)
     {
         return(b.func == null && b.self == null);
     }
     if (a != null && b == null)
     {
         return(a.func == null && b.self == null);
     }
     return(!(a.func != b.func) && !(a.self != b.self) && a.func != null);
 }
コード例 #3
0
 static public Delegate Create(LuaFunction func)
 {
     if (func != null)
     {
         LuaState luaState = func.GetLuaState();
         // 是否有保存
         LuaDelegate luaDelegate = luaState.GetLuaDelegate(func);
         if (luaDelegate != null)
         {
             return(Delegate.CreateDelegate(typeof(T), luaDelegate, luaDelegate.method));
         }
         Delegate d = _Create(func, null, false);
         luaDelegate        = d.Target as LuaDelegate;
         luaDelegate.method = d.Method;
         luaState.AddLuaDelegate(luaDelegate, func);
         return(d);
     }
     return(_Create(null, null, false));
 }
コード例 #4
0
 public static bool operator !=(LuaDelegate a, LuaDelegate b)
 {
     return(!LuaDelegate.CompareLuaDelegate(a, b));
 }