ch.sahits.game.graphic.display.gameplay
Class TradeDialog

java.lang.Object
  extended by ch.sahits.game.graphic.display.gameplay.OpenPatricianGameDialog
      extended by ch.sahits.game.graphic.display.gameplay.TradeDialog
All Implemented Interfaces:
ch.sahits.game.event.IEventListener, ch.sahits.game.rendering.Renderable, ch.sahits.game.rendering.RenderablePart

public class TradeDialog
extends OpenPatricianGameDialog
implements ch.sahits.game.rendering.RenderablePart, ch.sahits.game.event.IEventListener

Trade dialog for buying/selling from/to the city involving either a ship or the branch office.

Author:
Andi Hotz, (c) Sahits GmbH, 2011 Created on Nov 18, 2011

Nested Class Summary
private  class TradeDialog.City2ShipAction
          Action of buying stuff from the city onto the ship
private static class TradeDialog.DialogPositions
          This class holds the positions where different elements are placed on the dialog.
private static class TradeDialog.ETransferAmount
          Enumeration over the transferable amount
private  class TradeDialog.Ship2CityAction
          Action of selling stuff to the city from the ship
private  class TradeDialog.TransferAmountChangeAction
          Action to change the chunck size that is to be moved.
 
Nested classes/interfaces inherited from class ch.sahits.game.graphic.display.gameplay.OpenPatricianGameDialog
OpenPatricianGameDialog.CloseAction
 
Field Summary
private  CityPlayerProxy city
          Reference to the city view model
private  boolean enabled
           
private  ClickablePolygons footerPolygons
           
private  TradeDialog.ETransferAmount movableAmount
          The amount that is moved with one click
private  ClickablePolygons polygons
           
private  TradeDialog.DialogPositions positions
          Hold all the positiononing information, initialized in initBackgroundImage
 
Fields inherited from class ch.sahits.game.graphic.display.gameplay.OpenPatricianGameDialog
loader
 
Constructor Summary
TradeDialog(Point topLeft, ch.sahits.game.graphic.image.ImagesLoader loader, double scale, CityPlayerProxy CityPlayerProxy)
           
 
Method Summary
 void gameRender(Graphics gScr)
           
 void gameUpdate(ch.sahits.game.event.Event e, Object notice)
           
private  int getAmount(int maxMount)
          Retrieve the amount that is to be transferred.
protected  BufferedImage initBackgroundImage(ch.sahits.game.graphic.image.ImagesLoader loader, Point topLeft)
          Initialize the background image that is stored as a reference.
protected  void initiatePolygons()
          Instanciate the any polygon member variables
 boolean isEnabled()
           
 void setEnabled(boolean flag)
           
 
Methods inherited from class ch.sahits.game.graphic.display.gameplay.OpenPatricianGameDialog
getBounds, getInset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.sahits.game.rendering.RenderablePart
getBounds
 

Field Detail

enabled

private boolean enabled

city

private final CityPlayerProxy city
Reference to the city view model


movableAmount

private TradeDialog.ETransferAmount movableAmount
The amount that is moved with one click


polygons

private ClickablePolygons polygons

footerPolygons

private ClickablePolygons footerPolygons

positions

private TradeDialog.DialogPositions positions
Hold all the positiononing information, initialized in initBackgroundImage

Constructor Detail

TradeDialog

public TradeDialog(Point topLeft,
                   ch.sahits.game.graphic.image.ImagesLoader loader,
                   double scale,
                   CityPlayerProxy CityPlayerProxy)
Method Detail

initiatePolygons

protected void initiatePolygons()
Description copied from class: OpenPatricianGameDialog
Instanciate the any polygon member variables

Overrides:
initiatePolygons in class OpenPatricianGameDialog

getAmount

private int getAmount(int maxMount)
Retrieve the amount that is to be transferred. This method does not consider how much is available.

Parameters:
maxMount -
Returns:

gameUpdate

public void gameUpdate(ch.sahits.game.event.Event e,
                       Object notice)
Specified by:
gameUpdate in interface ch.sahits.game.event.IEventListener
Specified by:
gameUpdate in interface ch.sahits.game.rendering.Renderable

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface ch.sahits.game.rendering.Renderable

setEnabled

public void setEnabled(boolean flag)
Specified by:
setEnabled in interface ch.sahits.game.rendering.Renderable

initBackgroundImage

protected BufferedImage initBackgroundImage(ch.sahits.game.graphic.image.ImagesLoader loader,
                                            Point topLeft)
Description copied from class: OpenPatricianGameDialog
Initialize the background image that is stored as a reference. This method should be overridden by any subclass that contains static elements in the dialog.

Overrides:
initBackgroundImage in class OpenPatricianGameDialog
Parameters:
loader - ImageLoader to retrieve images
Returns:
Image that will be stored as background

gameRender

public void gameRender(Graphics gScr)
Specified by:
gameRender in interface ch.sahits.game.rendering.Renderable
Overrides:
gameRender in class OpenPatricianGameDialog


Copyright © 2011 Sahits GmbH. All Rights Reserved.