简体   繁体   中英

Restricting Users from Gaining Life when changing local device time & date cocos2dx Game

Am developing a cocos2dx game(IOS & android) in Which we provide the user Diamond for every 4 hours.

Since no Server is used,every data are saved locally in CCUserDefault.My problem is ,now the user

able to Gain Diamonds by setting future date & time in local device. I am fully dependent on the

device time , as i can't run my own timer when the game is not in memory .I am stuck here

eg : candy crush saga we can get life when changing date or time.

please guide me in the right direction . Suggestions are welcomed !!

Thanks

You are using an information on which you have no control whatsoever : 'time of day'. You dont control the clock, nor its accuracy, nor its precision. Instead of 'time of day', use 'play time' as your measuring stick. Store a minutesCounter in a secure place, and increment it every minute of active play. When minutesCounter reaches 240, you have a winner, award the goodies, and reset the counter to zero. In you game loop, setup a timer that does this whenever the app is running (not in background).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM