From: Erik V. <eri...@hc...> - 2005-05-04 16:16:20
|
I have implemented OperatingRound to include most of the actions that a player can do in that round. Track and token cost and train buying is still a matter of just moving cash from a company to the bank, though. Also the revenue must be entered manually, but payout and withholding work, as does buying private companies. This class and StockRound intend to become the prime interface for the UI to get the status and allowed actions, and to execute the player's actions. Direct access to lower classes will in most cases only be needed to get the display details (cash, owned certificates, etc.). Other responsibilities of these middle-layer classes are: - all validation of player actions (though many invalid actions will be impossible if the UI is set up correctly - see below). - logging messages and errors (both retrievable for UI display from the Log class). - keeping track of who has the turn (I have not used the Turn class, I think we don't need it). I have (of course) changed GameTestServlet to use these classes, have a look there if you want examples of usage. Maybe I'll publish some updated screenshots shortly. Switching rounds is not implemented yet, this should currently be done externally, simply by creating a new StockRound or OperatingRound object. Handling that will become the duty of GameManager. These classes allow marking allowed actions in the UI in detail. For instance, to check if the current Player can buy a share of a given company from the Pool you could call isCompanyBuyable (company, pool); This method does not yet include a check that the player has enough money (this is checked, though, in buyShare), but I will add such checks later. My suggestion would be to mark the background of clickable fields with a light colour (e.g. pale yellow), and those that are have been selected (or pre-selected: the player or company that has the turn) with a darker colour (e.g. green). I have not touched the XML in a while: there is a lot hardcoded now. This is high on my list to do, but I'll first try to complete the round/turn management, as this deeply affects the UI code that Brett is currently working so hard on. Erik. |