Author: swd847
Date: 2010-03-06 02:50:27 -0500 (Sat, 06 Mar 2010)
New Revision: 12109
Modified:
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml
Log:
updated seam xml example
Modified:
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java
===================================================================
---
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java 2010-03-06
06:53:46 UTC (rev 12108)
+++
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java 2010-03-06
07:50:27 UTC (rev 12109)
@@ -56,30 +56,37 @@
{
gameOver = true;
}
- for (GameRoom g : getAdjacentRooms())
+ else
{
- gameMessage.add(g.getAdjacentMessage());
+ for (GameRoom g : getAdjacentRooms())
+ {
+ if (!g.isMonsterKilled())
+ {
+ gameMessage.add(g.getAdjacentMessage());
+ }
+ }
}
}
public void runShoot(GameRoom room)
{
- if (room.getRoomType() == RoomType.MONSTER)
+ if (room.getShootEffect() == ShootEffect.KILL)
{
+ room.setMonsterKilled(true);
+ }
+ else if (room.getShootEffect() == ShootEffect.ANNOY)
+ {
+ gameOver = true;
+ }
+ if (room.getShootMessage() != null)
+ {
gameMessage.add(room.getShootMessage());
- if (room.getShootEffect() == ShootEffect.KILL)
- {
- room.setMonsterKilled(true);
- }
- else if (room.getShootEffect() == ShootEffect.ANNOY)
- {
- gameOver = true;
- }
}
else
{
gameMessage.add(emptyRoomShootMessage);
}
+
}
private Set<GameRoom> getAdjacentRooms()
Modified:
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml
===================================================================
---
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml 2010-03-06
06:53:46 UTC (rev 12108)
+++
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml 2010-03-06
07:50:27 UTC (rev 12109)
@@ -28,7 +28,7 @@
<p:GameRoom>
<p:Room>emptyRoom1</p:Room>
- <!--
<p:north><Inject/><Room>emptyRoom3</Room></p:north> -->
+ <p:north><Inject/><p:Room>emptyRoom3</p:Room></p:north>
<p:west><Inject/><p:Room>dwarfRoom</p:Room></p:west>
<p:east><Inject/><p:Room>pitRoom1</p:Room></p:east>
<p:south><Inject/><p:Room>startRoom</p:Room></p:south>
@@ -39,7 +39,7 @@
<p:roomType>MONSTER</p:roomType>
<p:shootEffect>KILL</p:shootEffect>
<p:adjacentMessage>You hear drunken singing.</p:adjacentMessage>
- <p:message>You find a drunken dwarven miner. He belches in your direction,
falls over, and then seems to forget you are there.</p:message>
+ <p:message>You find a drunken dwarven miner. He belches in your direction,
falls over, then seems to forget you are there.</p:message>
<p:shootMessage>You hear a 'Thud', followed by a surprised
yell.</p:shootMessage>
<p:killedRoomMessage>You find a dead dwarven miner with something that looks
suspiciously like one of your arrows sticking out of his chest. Probably best you
don't mention this to anyone...</p:killedRoomMessage>
<p:east><Inject/><p:Room>emptyRoom1</p:Room></p:east>
@@ -52,5 +52,118 @@
<p:message>You fall into a bottomless pit. Game Over. </p:message>
<p:west><Inject/><p:Room>emptyRoom1</p:Room></p:west>
</p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom2</p:Room>
+ <p:north><Inject/><p:Room>emptyRoom4</p:Room></p:north>
+ <p:west><Inject/><p:Room>pitRoom1</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom3</p:Room>
+ <p:north><Inject/><p:Room>pitRoom2</p:Room></p:north>
+ <p:east><Inject/><p:Room>batRoom</p:Room></p:east>
+
<p:south><Inject/><p:Room>emptyRoom1</p:Room></p:south>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>batRoom</p:Room>
+ <p:adjacentMessage>You hear a screeching noise.</p:adjacentMessage>
+ <p:message>A swarm of bats lands on you and tries to pick you up. They fail
miserably. You swat them away with your bow.</p:message>
+ <p:shootMessage>You seem to have disturbed some bats, they fly past your head
in the dark.</p:shootMessage>
+ <p:north><Inject/><p:Room>emptyRoom6</p:Room></p:north>
+ <p:east><Inject/><p:Room>emptyRoom4</p:Room></p:east>
+ <p:south><Inject/><p:Room>pitRoom1</p:Room></p:south>
+ <p:west><Inject/><p:Room>emptyRoom3</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom4</p:Room>
+ <p:east><Inject/><p:Room>emptyRoom5</p:Room></p:east>
+
<p:south><Inject/><p:Room>emptyRoom2</p:Room></p:south>
+ <p:west><Inject/><p:Room>batRoom</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom5</p:Room>
+ <p:north><Inject/><p:Room>emptyRoom7</p:Room></p:north>
+ <p:east><Inject/><p:Room>dragonRoom</p:Room></p:east>
+ <p:west><Inject/><p:Room>emptyRoom4</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>dragonRoom</p:Room>
+ <p:adjacentMessage>You hear a snoring noise. With every snore you see a
flickering light, as if something were breathing flames from its
nostrils.</p:adjacentMessage>
+ <p:roomType>GAMEOVER</p:roomType>
+ <p:message>The dragon wakes up as you enter. 'Well this is fortunate, I was
feeling a bit peckish' are the last words you ever hear.</p:message>
+ <p:shootEffect>ANNOY</p:shootEffect>
+ <p:shootMessage>Your arrow wakes up the dragon, without appearing to do any
real damage. The last moments of your life are spent running from an angry
dragon.</p:shootMessage>
+
<p:north><Inject/><p:Room>princessRoom</p:Room></p:north>
+ <p:west><Inject/><p:Room>emptyRoom5</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>pitRoom2</p:Room>
+ <p:roomType>GAMEOVER</p:roomType>
+ <p:adjacentMessage>You feel a breeze.</p:adjacentMessage>
+ <p:message>You fall into a bottomless pit. Game Over. </p:message>
+
<p:south><Inject/><p:Room>emptyRoom3</p:Room></p:south>
+ <p:east><Inject/><p:Room>emptyRoom6</p:Room></p:east>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom6</p:Room>
+ <p:north><Inject/><p:Room>emptyRoom8</p:Room></p:north>
+ <p:west><Inject/><p:Room>pitRoom2</p:Room></p:west>
+ <p:south><Inject/><p:Room>batRoom</p:Room></p:south>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom7</p:Room>
+
<p:north><Inject/><p:Room>emptyRoom10</p:Room></p:north>
+
<p:east><Inject/><p:Room>princessRoom</p:Room></p:east>
+
<p:south><Inject/><p:Room>emptyRoom5</p:Room></p:south>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>princessRoom</p:Room>
+ <p:adjacentMessage>You hear a sobbing noise.</p:adjacentMessage>
+ <p:roomType>GAMEOVER</p:roomType>
+ <p:message>You find the princess and quickly free her, and then escape from the
dungeon. You both live happily ever after.</p:message>
+ <p:shootEffect>ANNOY</p:shootEffect>
+ <p:shootMessage>Your arrow clatters against the wall. You hear a cry 'Help
i'm being shot at'. The cry wakes the dragon in the room next door, which promptly
eats you.</p:shootMessage>
+
<p:south><Inject/><p:Room>dragonRoom</p:Room></p:south>
+ <p:west><Inject/><p:Room>emptyRoom7</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom8</p:Room>
+ <p:east><Inject/><p:Room>emptyRoom9</p:Room></p:east>
+
<p:south><Inject/><p:Room>emptyRoom6</p:Room></p:south>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom9</p:Room>
+ <p:north><Inject/><p:Room>wumpusRoom</p:Room></p:north>
+ <p:east><Inject/><p:Room>emptyRoom10</p:Room></p:east>
+ <p:west><Inject/><p:Room>emptyRoom8</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom10</p:Room>
+
<p:south><Inject/><p:Room>emptyRoom7</p:Room></p:south>
+ <p:west><Inject/><p:Room>emptyRoom9</p:Room></p:west>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:roomType>MONSTER</p:roomType>
+ <p:adjacentMessage>You smell a Wumpus</p:adjacentMessage>
+ <p:shootMessage>You hear a 'Thud', followed by a roar of
pain.</p:shootMessage>
+ <p:killedRoomMessage>You stumbe accross a dead Wumpus. Well that wasn't so
hard...</p:killedRoomMessage>
+ <p:message>You find a Wumpus. It eats you.</p:message>
+ <p:shootEffect>KILL</p:shootEffect>
+ <p:Room>wumpusRoom</p:Room>
+
<p:south><Inject/><p:Room>emptyRoom9</p:Room></p:south>
+ </p:GameRoom>
</Beans>
\ No newline at end of file
Show replies by date