game.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. const setters = {
  2. // 游戏状态: 0未开始 1游戏中 3游戏结束
  3. setGameStatus(status) {
  4. wx.setStorageSync('game_status', status)
  5. },
  6. setToyItem(toy_item) {
  7. wx.setStorageSync('toy_item', toy_item)
  8. },
  9. setToySn(toy_sn) {
  10. wx.setStorageSync('toy_sn', toy_sn)
  11. },
  12. removeToyHex() {
  13. wx.removeStorageSync('toy_hex')
  14. },
  15. // 游戏模式: 1次数 2时间
  16. setMode(mode) {
  17. wx.setStorageSync('mode', mode)
  18. },
  19. setGameRecordId(param) {
  20. wx.setStorageSync('game_record_id', param)
  21. },
  22. // 游玩类型的时间30分钟或10分钟
  23. setOverPlayTime(param) {
  24. wx.setStorageSync('over_play_time', param)
  25. },
  26. setPlayTime(param) {
  27. wx.setStorageSync('play_time', param)
  28. },
  29. setPlayedTime(param) {
  30. wx.setStorageSync('played_time', param)
  31. },
  32. // 记录推到后台得时间
  33. setHideStatus($param) {
  34. wx.setStorageSync('hide_status', $param)
  35. },
  36. // 记录推到后台得时间
  37. setHideTime($param) {
  38. wx.setStorageSync('hide_time', $param)
  39. },
  40. //记录游戏数据
  41. setGameAttMedDatas($param) {
  42. wx.setStorageSync('game_data', $param)
  43. },
  44. // setIsNew($param) {
  45. // wx.setStorageSync('is_new', $param)
  46. // },
  47. // 脑机LED灯
  48. setLED(bool) {
  49. wx.setStorageSync('led_status', bool)
  50. },
  51. setGameCloseStatus(status) {
  52. wx.setStorageSync('game_close_status', status)
  53. },
  54. }
  55. const getters = {
  56. getGameStatus() {
  57. return wx.getStorageSync('game_status')
  58. },
  59. getToyItem() {
  60. return wx.getStorageSync('toy_item')
  61. },
  62. getToySn() {
  63. return wx.getStorageSync('toy_sn')
  64. },
  65. getMode() {
  66. return wx.getStorageSync('mode')
  67. },
  68. getGameRecordId() {
  69. return wx.getStorageSync('game_record_id')
  70. },
  71. // 游玩类型的时间30分钟或10分钟
  72. getOverPlayTime() {
  73. return wx.getStorageSync('over_play_time')
  74. },
  75. //该局游戏剩余可以游玩的时间
  76. getPlayTime() {
  77. return wx.getStorageSync('play_time')
  78. },
  79. //完了多长时间
  80. getPlayedTime() {
  81. return wx.getStorageSync('played_time')
  82. },
  83. // 获取一开始隐藏的时间
  84. getHideStatus() {
  85. return wx.getStorageSync('hide_status')
  86. },
  87. // 获取一开始隐藏的时间
  88. getHideTime() {
  89. return wx.getStorageSync('hide_time')
  90. },
  91. //记录游戏数据
  92. getGameAttMedDatas() {
  93. return wx.getStorageSync('game_data')
  94. },
  95. // //记录游戏数据
  96. // getIsNew() {
  97. // return wx.getStorageSync('is_new')
  98. // },
  99. // 脑机LED灯
  100. getLED() {
  101. return wx.getStorageSync('led_status')
  102. },
  103. getGameCloseStatus() {
  104. return wx.getStorageSync('game_close_status')
  105. },
  106. }
  107. const remover = {
  108. rmGameAttMedDatas() {
  109. wx.removeStorageSync('game_data')
  110. },
  111. rmHideTime() {
  112. wx.removeStorageSync('hide_time')
  113. },
  114. rmHideStatus() {
  115. wx.removeStorageSync('hide_status')
  116. }
  117. }
  118. export default {
  119. setters, getters, remover
  120. }