예제 #1
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
 private void conductNpcSpecificActionsIfNecessary(BoardElement newPosition)
 {
     if (gameEngine.getNpcForCurrentPosition() != null && newPosition != null && !(newPosition is Door) && !(newPosition is ExitDoor) && !(newPosition is Room))
     {
         npcButton.IsEnabled = true;
     }
 }
예제 #2
0
파일: Board.cs 프로젝트: paeh/OTMA
        /// <summary>
        /// Prepares the exit door to end the game.
        /// </summary>
        /// <param name="map3x5">The position of the end door</param>
        /// <returns></returns>
        private ExitDoor createExitDoor(BoardElement map3x5)
        {
            var coordinate = new Coordinate(3, 5);
            var exitDoor = new ExitDoor(coordinate, "/OTMA;component/Images/door.png");
            var exitEvent = new Event("Finish", "Finish", "img");
            var exitRoom = new Room(coordinate, "/OTMA;component/Images/finish.png");

            exitDoor.setRoomEvent(exitEvent);
            exitDoor.setBoundaryItems(exitRoom, null, map3x5, null);
            doors.Add(coordinate, exitDoor);

            exitRoom.setHints(ConfigStub.FINAL_HINTS);
            exitRoom.setStories(ConfigStub.FINAL_STORIES);
            exitRoom.setEvent(exitEvent);
            rooms.Add(coordinate, exitRoom);

            return exitDoor;
        }
예제 #3
0
파일: Board.cs 프로젝트: paeh/OTMA
        private BoardElement createAndAddBoardElement(int x, int y, String img)
        {
            var coordinate = new Coordinate(x, y);
            var element = new BoardElement(coordinate, img);
            board.Add(coordinate, element);

            return element;
        }
예제 #4
0
파일: BoardElement.cs 프로젝트: paeh/OTMA
 /// <summary>
 /// Set the surrounding BoardElements.
 /// </summary>
 /// <param name="north">North neighbour</param>
 /// <param name="east">East neighbour</param>
 /// <param name="south">South neighbour</param>
 /// <param name="west">West neighbour</param>
 public void setBoundaryItems(BoardElement north, BoardElement east, BoardElement south, BoardElement west)
 {
     this.directions.Add(Direction.North, north);
     this.directions.Add(Direction.East, east);
     this.directions.Add(Direction.South, south);
     this.directions.Add(Direction.West, west);
 }
예제 #5
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
 private void doDoorRelatedActionsIfNecessary(BoardElement newPosition)
 {
     if (isDoor(newPosition) && hasEvent(newPosition))
         doorLabel.Text = (newPosition as Door).roomEvent.shortTitle;
     else
         doorLabel.Text = "";
 }
예제 #6
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private Boolean isRoom(BoardElement element)
        {
            if (element is Room)
                return true;

            return false;
        }
예제 #7
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private Boolean isDoor(BoardElement element)
        {
            if (element is Door)
                return true;

            return false;
        }
예제 #8
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private Boolean hasEvent(BoardElement element)
        {
            if (isDoor(element) && (element as Door).roomEvent != null)
                return true;

            if (isRoom(element) && (element as Room).roomEvent != null)
                return true;

            return false;
        }
예제 #9
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private void handleNpcs(BoardElement newPosition)
        {
            if (!isDoor(newPosition) && !isRoom(newPosition))
            {
                var npc = gameEngine.getNpcForCurrentPosition();
                if (npc != null)
                {
                    var imageUri = new Uri(npc.picture, UriKind.Relative);
                    npcImage.Source = new BitmapImage(imageUri);
                    return;
                }
            }

            npcImage.Source = null;
        }
예제 #10
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private void handleButtons(BoardElement newPosition)
        {
            disableAllMoveButtons();

            foreach (Direction possibleDirection in newPosition.getAvailableDirections())
            {
                enableMoveButton(possibleDirection);
            }
        }
예제 #11
0
파일: GamePage.xaml.cs 프로젝트: paeh/OTMA
        private void doRoomRelatedActionsIfNecessary(BoardElement newPosition)
        {
            if (isRoom(newPosition) && hasEvent(newPosition))
            {
                var room = (newPosition as Room);
                eventNameLabel.Text = room.roomEvent.title;
                eventNameLabel.Height = calculateTextboxHeightForCaption(eventNameLabel);

                eventDesciption.Text = room.roomEvent.description;
                eventDesciption.Height = calculateTextboxHeight(eventDesciption);

                eventHintLabel.Text = getRandomRoomContent(room);
                contentTimer.Change(CONTENT_TIMEOUT_IN_SECONDS * 1000, CONTENT_TIMEOUT_IN_SECONDS * 1000);
            }
            else
            {
                eventNameLabel.Text = "";
                eventHintLabel.Text = "";
                eventDesciption.Text = "";
                contentTimer.Change(Timeout.Infinite, Timeout.Infinite);
            }
        }