Exemple #1
0
        public static IEnumerable <string> ClearAndGetOldObjectIds()
        {
            var notUpdated = new List <string>();

            var newDictionary = new Dictionary <object, ActorEntryValue>();

            foreach (var obj in objectIDs)
            {
                if (!obj.Value.updated && obj.Value.needsUpdating)
                {
                    notUpdated.Add(obj.Value.uniqueID);
                }
                else
                {
                    ActorEntryValue tmp = obj.Value;
                    tmp.Clear();
                    newDictionary[obj.Key] = tmp;
                }
            }
            objectIDs = newDictionary;

            /* Add the objects removed via patches */
            notUpdated.AddRange(removedObjectIDs);
            removedObjectIDs = new List <string>();

            return(notUpdated);
        }
Exemple #2
0
        public static void UpdateID(object obj, bool needsUpdating = true)
        {
            if (!objectIDs.ContainsKey(obj))
            {
                objectIDs[obj] = new ActorEntryValue(GenerateUniqueID());
            }
            ActorEntryValue tmp;

            objectIDs.TryGetValue(obj, out tmp);
            tmp.Update();
            tmp.needsUpdating = needsUpdating;
            objectIDs[obj]    = tmp;
        }