Displays a possible action for the player. BuildUIs sit at the top of the screen just below the ControlsUI and MessageUI. Each BuildUI represents one type of object the player can build or buy (such as stock items or dev cards), or an action the user can trigger (such as moving a ship or knight). A bitmap is displayed in the BuildUI representing the action the user can take with that BuildUI.
Each BuildUI is created with a piece of BuildData, located in the loaded RuleSets, that tells the BuildUI how to draw the object it handles, what ILogic updates it, and what IRule to call when the user clicks on the BuildUI to build, buy, or perform the action. BuildUI can be updated by transmitting a DataObject to the eventBuildUI Event via the Controller. The transmitted DataObject must have a bool as its first parameter, and the current Game object as its second parameter. If the bool value is false, the Build hides itself; if the bool value is true, the BuildUI calls its internal ILogic to see if can be shown. If it can be shown, the color of the displayed bitmap is updated based on the current player in the Game object. If the player clicks the visible BuildUI, the BuildUI calls the RuleEngine with its internal IRule to execute the player’s action.
BuildUI.h
Displays a possible action for the player. | |
The BuildUI constructor. | |
The BuildUI destructor. | |
Initializes the BuildUI. | |
The wxWidgets event table declaration. | |
Paints the BuildUI. | |
Provides the TraitsUI object for the BuildUI. | |
Resizes the BuildUI. | |
Updates the BuildUI. | |
Handles clicking the displayedbitmap. | |
Whether the BuildUI is first in a new row of BuildUIs on screen. | |
The index of the most recently current player when the BuildUI was last updated. | |
The internal wxWidgets ID of the displayed bitmap. | |
Pointer to the window the BuildUI is offset from. | |
The name of the IRule to be called when the BuildUI is clicked. | |
The name of the ILogic that determines if the BuildUI should be visible. | |
The displayed bitmap of the object the BuildUI represents. | |
The bitmap helper that creates the displayed bitmap based on the original BuildData the BuildUI was created with. |
|
The BuildUI constructor. Stores the IRule and ILogic names to use. Creates the bitmap handler for display. Adds OnUpdate as a receiver of the eventBuildUI Event.
| parent | The parent window. Must not be NULL. |
| resizeLink | The window used to calculate offset properly. Must not be NULL. |
| build | The BuildData used to construct the BuildUI. |
| newRow | Whether this BuildUI is the first in a row of BuildUIs on screen. |
| ~BuildUI() |
The BuildUI destructor. Removes OnUpdate as a receiver of the eventBuildUI Event.
|
Initializes the BuildUI. Creates the internal TraitsUI object and then the bitmap window displaying the type of object the BuildUI represents. Calls ResizeUI to set the size of the UI properly.
Paints the BuildUI. | |
Provides the TraitsUI object for the BuildUI. | |
Resizes the BuildUI. | |
Updates the BuildUI. | |
Handles clicking the displayedbitmap. | |
Whether the BuildUI is first in a new row of BuildUIs on screen. | |
The index of the most recently current player when the BuildUI was last updated. | |
The internal wxWidgets ID of the displayed bitmap. | |
Pointer to the window the BuildUI is offset from. | |
The name of the IRule to be called when the BuildUI is clicked. | |
The name of the ILogic that determines if the BuildUI should be visible. | |
The displayed bitmap of the object the BuildUI represents. | |
The bitmap helper that creates the displayed bitmap based on the original BuildData the BuildUI was created with. |
|
Updates the BuildUI. Triggered by the eventBuildUI Event. The given DataObject must have a bool as its first parameter. If the bool is true, the BuildUI calls its internal ILogic to see if it can be shown on screen. If so, updates the color of its bitmap and redisplays it, then shows itself.
| object | The DataObject containing the update information. Must have a bool as its first parameter and the current Game object as its second. |
|
Handles clicking the displayedbitmap. Calls the RuleEngine with the internal IRule.
| event | The button click event. |
| wxString mRule |
The name of the IRule to be called when the BuildUI is clicked.
| wxString mLogic |
The name of the ILogic that determines if the BuildUI should be visible.
| BuildBitmapPtr mBuildBitmap |
The bitmap helper that creates the displayed bitmap based on the original BuildData the BuildUI was created with.
|
| ~BuildUI() |
|
|
| virtual const TraitsUIPtr &GetTraitsUI() |
| virtual void ResizeUI() |
|
|
| bool mNewRow |
| wxInt32 mLastIndex |
| wxInt32 mButtonID |
| const wxWindow *mResizeLink |
| wxString mRule |
| wxString mLogic |
| boost::shared_ptr<wxBitmapButton> mBitmap |
| BuildBitmapPtr mBuildBitmap |