I'm getting every few seconds an Object
from my Server with some data, lets say it's a level game data, that includes : title , second_title , score, playerRank etc.
At first time I draw and update all that information in the right places but when update come I sometimes have change in only one parameter, for example in title
and sometimes it's coming without any changes.
What I do is in every updadte I run on all the object fields and check:
if (title != object.title) {
updateTitle (object.title);
}
if (score != object.score) {
updateScore(object.score);
}
if (second_title != object.second_title) {
updateSecondTitle (object.second_title);
}
and so on...
I think its not very useful in every update run on all the fields for that update again and again, any ideas or some kind of design pattern to do it more flexible.
Aucun commentaire:
Enregistrer un commentaire