Ejemplo n.º 1
0
        public Actor GetSynchronizedObject(float x, float y)
        {
            IIterator iter = NewIterator();
            Actor     tmp  = (Actor)iter.Next();

            if (tmp == null)
            {
                return(null);
            }
            int seq = tmp.GetLastPaintSeqNum();
            int idx = 0;

            for (; iter.HasNext();)
            {
                Actor actor = (Actor)iter.Next();
                if (actor.GetRectBox().Contains(x, y))
                {
                    int actorSeq = actor.GetLastPaintSeqNum();
                    if (actorSeq > seq)
                    {
                        tmp = actor;
                        seq = actorSeq;
                    }
                    idx++;
                }
            }
            if (idx == 0)
            {
                if (tmp.GetRectBox().Contains(x, y))
                {
                    return(tmp);
                }
                else
                {
                    return(null);
                }
            }
            return(tmp);
        }