Created
January 29, 2011 20:35
-
-
Save Stray/802167 to your computer and use it in GitHub Desktop.
New implementation gets rid of the conditionals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected function selectedHandler(option:IBudgetGameOption, vo:BudgetGameOptionVO):void | |
| { | |
| enable(vo.enables); | |
| disable(vo.disables); | |
| dispatchUpdate(vo.cost, vo.productivity); | |
| } | |
| protected function enable(option:IDisableable):void | |
| { | |
| option.enable(); | |
| } | |
| protected function disable(option:IDisableable):void | |
| { | |
| option.disable(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IBudgetGameOption extends IDisableable | |
| { | |
| function select():void; | |
| function deselect():void; | |
| function get selectedSignal():Signal; | |
| function get deselectedSignal():Signal; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NullDisableableOption implements IDisableable | |
| { | |
| public function NullDisableableOption() | |
| { | |
| super(); | |
| } | |
| public function enable():void { } | |
| public function disable():void { } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment