Пример #1
0
        public static void RemoveAllMimics(object on, IokeObject message, IokeObject context)
        {
            IokeObject me = As(on, context);

            me.CheckFrozen("removeAllMimics!", message, context);

            if (me.body.mimicCount == 1)
            {
                Hook.FireMimicsChanged(me, message, context, me.body.mimic);
                Hook.FireMimicRemoved(me, message, context, me.body.mimic);
                me.body.mimicCount--;
            }
            else
            {
                while (me.body.mimicCount > 0)
                {
                    Hook.FireMimicsChanged(me, message, context, me.body.mimics[me.body.mimicCount - 1]);
                    Hook.FireMimicRemoved(me, message, context, me.body.mimics[me.body.mimicCount - 1]);
                    me.body.mimicCount--;
                }
            }

            me.body.mimic  = null;
            me.body.mimics = null;
        }
Пример #2
0
        public static void RemoveMimic(object on, object other, IokeObject message, IokeObject context)
        {
            IokeObject me = As(on, context);

            me.CheckFrozen("removeMimic!", message, context);
            int ix = me.MimicIndex(other);

            if (ix != -1)
            {
                me.RemoveMimicAt(ix);
                if (me.body.hooks != null)
                {
                    Hook.FireMimicsChanged(me, message, context, other);
                    Hook.FireMimicRemoved(me, message, context, other);
                }
            }
        }