Пример #1
0
        public void RemoveMethodEntry(MethodEntry methodEntry)
        {
            if (methodEntry == null)
            {
                return;
            }
            string n = methodEntry.name;

            if (!DelegatorMethods.delegates.ContainsKey(n) || !DelegatorMethods.delegateTypes.ContainsKey(n))
            {
                return;
            }
            Type type = DelegatorMethods.delegateTypes[n];

            if (type == typeof(Action <Node>))
            {
                if (aSelfDelegates != null && aSelfDelegates.ContainsKey(n))
                {
                    aSelfDelegates.Remove(n);
                }
                if ((aSelfDelegates != null || aSelfDelegates.Count == 0) &&
                    (aSelfDelegatesDS == null || aSelfDelegatesDS.Count == 0))
                {
                    compType &= ~mtypes.affectself;
                }
            }
            else if (type == typeof(Action <Node, Node>))
            {
                if (aOtherDelegates != null && aOtherDelegates.ContainsKey(n))
                {
                    aOtherDelegates.Remove(n);
                }
                if ((aOtherDelegates == null || aOtherDelegates.Count == 0) &&
                    (aOtherDelegatesDS == null || aOtherDelegatesDS.Count == 0))
                {
                    compType &= ~mtypes.affectother;
                }
            }
            //else if (type == typeof (Action<Node, SpriteBatch>)) {
            //  if (drawDelegates != null && drawDelegates.ContainsKey(n)) drawDelegates.Remove(n);
            //  if ((drawDelegates == null || drawDelegates.Count == 0) &&
            //      (drawDelegatesDS == null || drawDelegatesDS.Count == 0)) compType &= ~(mtypes.draw);
            //}
            else
            {
                if (type == typeof(Action <Node, DataStore>))
                {
                    if (aSelfDelegatesDS != null && aSelfDelegatesDS.ContainsKey(n))
                    {
                        aSelfDelegatesDS.Remove(n);
                    }
                    if ((aSelfDelegatesDS == null || aSelfDelegatesDS.Count == 0) &&
                        (aSelfDelegates == null || aSelfDelegates.Count == 0))
                    {
                        compType &= ~mtypes.affectself;
                    }
                }
                else if (type == typeof(Action <Node, Node, DataStore>))
                {
                    if (aOtherDelegatesDS != null && aOtherDelegatesDS.ContainsKey(n))
                    {
                        aOtherDelegatesDS.Remove(n);
                    }
                    if ((aOtherDelegatesDS == null || aOtherDelegatesDS.Count == 0) &&
                        (aOtherDelegates == null || aOtherDelegates.Count == 0))
                    {
                        compType &= ~mtypes.affectother;
                    }
                }
                //else if (type == typeof (Action<Node, SpriteBatch, DataStore>)) {
                //  if (drawDelegatesDS != null && drawDelegatesDS.ContainsKey(n)) drawDelegatesDS.Remove(n);
                //  if ((drawDelegatesDS == null || drawDelegatesDS.Count == 0) &&
                //      (drawDelegates == null || drawDelegates.Count == 0)) compType &= ~(mtypes.draw);
                //}
            }
            if (datastores.ContainsKey(n))
            {
                datastores.Remove(n);
            }
        }