Example #1
0
        public void NotifyObservers(ICommand gameCommand)
        {
            IteratorForList <IObserver> iterator = new IteratorForList <IObserver>(observers);

            while (iterator.HasNext())
            {
                iterator.Next().HandleEvent(gameCommand);
            }
        }
Example #2
0
        internal void DrawFigure(int[] coordinates, string figureName, string color)
        {
            IteratorForList <IFigure> iterator = new IteratorForList <IFigure>(flyweightFigures);
            IFigure tmp;

            while (iterator.HasNext())
            {
                tmp = iterator.Next();
                if ((tmp.ToString() == figureName) && (tmp.GetColor() == color))
                {
                    //tmp.Draw(coordinates);
                    return;
                }
            }
            tmp = Create(figureName, color);
            ///tmp.Draw(coordinates);
            flyweightFigures.Add(tmp);
        }