Beispiel #1
0
        protected static GameObjectReference BuildReference(ReferenceWrapper obj)
        {
            GameObjectReference reference = new GameObjectReference();

            List <Item> rawList;

            if (!sRawList.TryGetValue(obj.mObject.GetType(), out rawList))
            {
                rawList = new List <Item>();
                sRawList.Add(obj.mObject.GetType(), rawList);
            }

            int count = 0;

            foreach (Item item in rawList)
            {
                if (object.ReferenceEquals(obj.mObject, item.mChild))
                {
                    reference.Add(new KeyValuePair <object, FieldInfo>(item.mParent, item.mField));
                }

                count++;
                if (count > 10000)
                {
                    Common.Sleep();
                    count = 0;
                }
            }

            if (count > 0)
            {
                Common.Sleep();
            }

            return(reference);
        }