/// <summary>
 /// Initializes navigator.
 /// </summary>
 /// <param name="squareMap">The square map this navigator should operate upon.</param>
 /// <param name="current">The square map item this navigator is pointing to.</param>
 public void Initialize(ISquareMapElement squareMap, ISquareMapItemElement current)
 {
     this.squareMap = squareMap;
     this.current = current;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes component.
        /// </summary>
        protected override void OnInitializeComponent()
        {
            /* create flow */
            this.flow = new GameFlow();

            /* first get element service to create member objects */
            IElementService elements = this.GetElementService();

            if (elements != null)
            {
                this.countDown = elements.CreateCountDown();

                this.pipeQueue = elements.CreatePipeQueue();
                this.squareMap = elements.CreateSquareMap();

                this.squareMap.ActiveItemChanged += new EventHandler<EventArgs<ISquareMapItemElement>>(OnSquareMapActiveItemChanged);
            }

            /* second get game service and initialize bindings */
            IGameService game = this.GetGameService();

            if (game != null)
            {
                this.startBinding = game.CreateBinding(GameCommands.Game.Start);
                if (this.startBinding != null)
                {
                    this.startBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGameStart);
                }

                this.presentCompleteBinding = game.CreateBinding(GameCommands.Game.PresentComplete);
                if (this.presentCompleteBinding != null)
                {
                    this.presentCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGamePresentComplete);
                }

                this.readyToPlayCompleteBinding = game.CreateBinding(GameCommands.Game.ReadyToPlayComplete);
                if (this.readyToPlayCompleteBinding != null)
                {
                    this.readyToPlayCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGameReadyToPlayComplete);
                }

                this.playAgainCompleteBinding = game.CreateBinding(GameCommands.Game.PlayAgainComplete);
                if (this.playAgainCompleteBinding != null)
                {
                    this.playAgainCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGamePlayAgainComplete);
                }
            }

            /* call base to finalize */
            base.OnInitializeComponent();
        }