示例#1
0
文件: UserData.cs 项目: prepare/box2c
        public uint PinDataToHandle(object obj)
        {
            foreach (var x in _resolve)
            {
                if (x.Value.Object == obj)
                {
                    x.Value.ReferenceCount++;
                    return(x.Key);
                }
            }

            var handle = GetFreeHandle();

            _resolve[handle] = new UserDataPin(obj);
            _resolve[handle].ReferenceCount++;

            return(handle);
        }
示例#2
0
        public uint PinDataToHandle(object obj)
        {
            foreach (var x in _resolve)
            {
                if (x.Value.Object == obj)
                {
                    x.Value.ReferenceCount++;
                    return x.Key;
                }
            }

            var handle = GetFreeHandle();
            _resolve[handle] = new UserDataPin(obj);
            _resolve[handle].ReferenceCount++;

            return handle;
        }