Exemplo n.º 1
0
 void _decrementReferenceCount(_InspectorReferenceData reference)
 {
     reference.count -= 1;
     D.assert(reference.count >= 0);
     if (reference.count == 0)
     {
         string id;
         this._objectToId.TryGetValue(reference.obj, out id);
         D.assert(id != null);
         this._objectToId.Remove(reference.obj);
         this._idToReferenceData.Remove(id);
     }
 }
Exemplo n.º 2
0
        string toId(object obj, string groupName)
        {
            if (obj == null)
            {
                return(null);
            }

            HashSet <_InspectorReferenceData> group;

            this._groups.TryGetValue(groupName, out group);
            if (group == null)
            {
                group = new HashSet <_InspectorReferenceData>();
                this._groups.Add(groupName, group);
            }

            string id;

            this._objectToId.TryGetValue(obj, out id);

            _InspectorReferenceData referenceData;

            if (id == null)
            {
                id = $"inspector-{this._nextId}";
                this._nextId++;
                this._objectToId[obj]       = id;
                referenceData               = new _InspectorReferenceData(obj);
                this._idToReferenceData[id] = referenceData;
                group.Add(referenceData);
            }
            else
            {
                referenceData = this._idToReferenceData[id];
                if (group.Add(referenceData))
                {
                    referenceData.count += 1;
                }
            }

            return(id);
        }