One implementation ARPG hand travel red dot system

The whole idea of ​​the red dot system are: the need to detect - into the monitoring - detection finished removed.

  1. Each icon corresponds to a main interface red dot id. If a page has tabs, each tab is also corresponds to a red dot id.

  2. Establish a red dot manager. Each state has a red dot id and a detection function. When there is a change in the data system is necessary to detect the state of a red dot, the red dot id added to a list of detection, each time after the detection of completion, the id is removed from the list of red spots.

  3. Detecting red point polling mechanism. I.e. the red dot enable a second timer manager which, traversing a list of the above-described second, red dots id calls each corresponding detection function, the return value of a function is detected bool value, indicating whether a red dot. Id popular spot detection function return values inconsistent with the red dot id original state when an event is sent out. Need to show the red dot of the interface will listen for the event in order to refresh the red dot red dot.
    This polling mechanism with respect to the mechanism of the reaction (when the data changes, the red dot is detected immediately), in response to the case where the player upgrade mad when efficiency by n times in one second because the player mad dozens, it will only be tested once.

Finish.

Guess you like

Origin blog.51cto.com/zhangzhao/2476304