Пример #1
0
        /// <summary>
        /// Displays dialogbox if needed
        /// </summary>
        /// <param name="cell"></param>
        public void HandleCell(MapCell cell)
        {
            if (cell.HasItem) {
                if (cell.Item is DoorKey) {
                    Game.Map.Adventurer.ApplyItem(cell.Item);
                    updateHeroDetails();
                }
                if (cell.Item is Door) {
                    //Had to cast to compare
                    Door mapDoor = (Door)cell.Item;
                    frmGameOver gameOver = new frmGameOver();
                    gameOver.ShowDialog();
                    return;
                }
                displayMap(Game.Map);
                frmItem founditem = new frmItem(cell.Item);
                founditem.ShowDialog();

                updateHeroDetails();
            }
            if (cell.HasMonster) {
                displayMap(Game.Map);
                frmMonster foundmonster = new frmMonster(cell.Monster);
                foundmonster.ShowDialog();

                updateHeroDetails();
                checkGameState();
            }
        }
Пример #2
0
 /// <summary>
 /// Displays frmItem if hero's location contains an item, or frmMonster if hero's location contains a monster.
 /// </summary>
 /// <param name="needsToAct">Whether or not hero needs to act in this cell. Get from Game.Map.moveHero().</param>
 private static void displayForm(bool needsToAct)
 {
     if (needsToAct)                                                   // if hero's cell contains an item or monster, display frmItem or frmMonster.
     {
         if (Game.Map.HeroLocation.HasItem)                            // if the cell contains an item, disply frmItem.
         {
             if (Game.Map.HeroLocation.Item.GetType() == typeof(Door)) // but, if the item is a door, display the Game Over screen.
             {
                 frmGameOver frmGameOver = new frmGameOver();
                 frmGameOver.ShowDialog();
             }
             else   // cell has item, which is not a door. display frmItem.
             {
                 frmItem frmItem = new frmItem(Game.Map.HeroLocation.Item);
                 frmItem.ShowDialog();
             }
         }
         else // cell doesn't have item, but does need attention.  display frmMonster.
         {
             // open new monster form window.
             frmMonster frmMonster = new frmMonster(Game.Map.HeroLocation.Monster);
             frmMonster.ShowDialog();
         }
     }
 }
Пример #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.frmItem1 = ((Deliverable6.frmItem)(target));
                return;

            case 2:
                this.stkItemDetails = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.tbItemQuestion = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.tbItemName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.tbItemStrength = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.tbItemPenalty = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.btnItemYes = ((System.Windows.Controls.Button)(target));

            #line 25 "..\..\frmItem.xaml"
                this.btnItemYes.Click += new System.Windows.RoutedEventHandler(this.btnItemYes_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.btnItemNo = ((System.Windows.Controls.Button)(target));

            #line 26 "..\..\frmItem.xaml"
                this.btnItemNo.Click += new System.Windows.RoutedEventHandler(this.btnItemNo_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }