Prev | Current Page 741 | Next

Frank Zammetti

"Practical DWR 2 Projects"

Oh look, the player and opponent have found a match at the same time!
I skipped a method there, namely the cycleOpponentExplosion() method. It??™s analogous
to the cyclePlayerExplosion() method, so I won??™t go over it here. Take a look and you??™ll see
though that it??™s very much similar. One difference you??™ll see is that instead of checkForWin()
being called at the end, a method called outcomeComplete() is called on a different class,
namely the Opponent class. All shall be revealed there, have no fear!
The next four methods are actually a little bit difficult to explain without looking at the
server-side code because they are in fact called from the server! They are executed in conjunction
with the reverse Ajax capability. Rather than explore them right now, I??™m going to skip
them and come back to them as we look at the server side. So, with that, only a single method
remains, and that??™s howToPlay():
CHAPTER 8 n DWR FOR FUN AND PROFIT (A DWR GAME!) 440
this.howToPlay = function() {
GameCore.howToPlay( {
callback : function(inResp) {
alert(inResp);
}
} );
} // End howToPlay().
As I??™m sure you can surmise, the howToPlay() method of the GameCore class on the server
returns a string, and also as I??™m sure you can guess, it??™s the contents of the howToPlay.


Pages:
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753