Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How to implement control of the state of ui buttons?

$
0
0
Hello everyone! Im using mvc framework for wrapper. So i have UIController, UIView for this problem. The object of type UIView is display object and works as container(like in ActionScript). So it holds some static buttons wich control sound,fullscreen and etc. and another dynamic controls wich control the state and current rules of the game. When the game is in different states the buttons can be active or inactive for pressing, can be with different texts over them, wich can cause different functionallity to be performed in the controller. So i have around 10-13 states of the game in wich the ui buttons are in different state so: Control state of the buttons in the controller. It is not ok cuz the controller is more than 300 rows and its ugly for reading and understanding. It shouldnt be. To create custom object in the controller and to pass to it the ui buttons and with some function called changeState to set the appropriate appearance to the buttons. How to structure and name that custom object to be enough descriptive. Or is there some well known pattern ? Or do u have better idea ?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>