game.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. const setters = {
  2. clearDeviceToy() {
  3. wx.removeStorageSync('deviceId')
  4. wx.removeStorageSync('deviceSn')
  5. wx.removeStorageSync('serviceId')
  6. wx.removeStorageSync('is_new')
  7. // wx.removeStorageSync('characteristicId')
  8. },
  9. //setter模块
  10. setDeviceId(deviceId) {
  11. wx.setStorageSync('deviceId', deviceId)
  12. },
  13. setDeviceSn(deviceSn) {
  14. wx.setStorageSync('deviceSn', deviceSn)
  15. },
  16. setServiceId(serviceId) {
  17. wx.setStorageSync('serviceId', serviceId)
  18. },
  19. setGameStatus(status) {
  20. wx.setStorageSync('game_status', status)
  21. },
  22. setGameCloseStatus(status) {
  23. wx.setStorageSync('game_close_status', status)
  24. },
  25. setToyList(toy_list) {
  26. wx.setStorageSync('toy_list', toy_list)
  27. },
  28. setToyHex(toy_hex) {
  29. wx.setStorageSync('toy_hex', toy_hex)
  30. },
  31. removeToyHex() {
  32. wx.removeStorageSync('toy_hex')
  33. },
  34. setMode(mode) {
  35. wx.setStorageSync('mode', mode)
  36. },
  37. setGameRecordId(param) {
  38. wx.setStorageSync('game_record_id', param)
  39. },
  40. // 游玩类型的时间30分钟或10分钟
  41. setOverPlayTime(param) {
  42. wx.setStorageSync('over_play_time', param)
  43. },
  44. setPlayTime(param) {
  45. wx.setStorageSync('play_time', param)
  46. },
  47. setPlayedTime(param) {
  48. wx.setStorageSync('played_time', param)
  49. },
  50. // 记录推到后台得时间
  51. setHideStatus($param) {
  52. wx.setStorageSync('hide_status', $param)
  53. },
  54. // 记录推到后台得时间
  55. setHideTime($param) {
  56. wx.setStorageSync('hide_time', $param)
  57. },
  58. //记录游戏数据
  59. setGameAttMedDatas($param) {
  60. wx.setStorageSync('game_data', $param)
  61. },
  62. setIsNew($param) {
  63. wx.setStorageSync('is_new', $param)
  64. },
  65. // 脑机LED灯
  66. setLED(bool) {
  67. wx.setStorageSync('led_status', bool)
  68. },
  69. }
  70. const getters = {
  71. getDeviceId() {
  72. return wx.getStorageSync('deviceId')
  73. },
  74. getDeviceSn() {
  75. return wx.getStorageSync('deviceSn')
  76. },
  77. getServiceId() {
  78. return wx.getStorageSync('serviceId')
  79. },
  80. getGameStatus() {
  81. return wx.getStorageSync('game_status')
  82. },
  83. getGameCloseStatus() {
  84. return wx.getStorageSync('game_close_status')
  85. },
  86. getToyList() {
  87. return wx.getStorageSync('toy_list')
  88. },
  89. getToyHex() {
  90. return wx.getStorageSync('toy_hex')
  91. },
  92. getMode() {
  93. return wx.getStorageSync('mode')
  94. },
  95. getGameRecordId() {
  96. return wx.getStorageSync('game_record_id')
  97. },
  98. // 游玩类型的时间30分钟或10分钟
  99. getOverPlayTime() {
  100. return wx.getStorageSync('over_play_time')
  101. },
  102. //该局游戏剩余可以游玩的时间
  103. getPlayTime() {
  104. return wx.getStorageSync('play_time')
  105. },
  106. //完了多长时间
  107. getPlayedTime() {
  108. return wx.getStorageSync('played_time')
  109. },
  110. // 获取一开始隐藏的时间
  111. getHideStatus() {
  112. return wx.getStorageSync('hide_status')
  113. },
  114. // 获取一开始隐藏的时间
  115. getHideTime() {
  116. return wx.getStorageSync('hide_time')
  117. },
  118. //记录游戏数据
  119. getGameAttMedDatas() {
  120. return wx.getStorageSync('game_data')
  121. },
  122. //记录游戏数据
  123. getIsNew() {
  124. return wx.getStorageSync('is_new')
  125. },
  126. // 脑机LED灯
  127. getLED() {
  128. return wx.getStorageSync('led_status')
  129. },
  130. }
  131. const remover = {
  132. rmGameAttMedDatas() {
  133. wx.removeStorageSync('game_data')
  134. },
  135. rmHideTime() {
  136. wx.removeStorageSync('hide_time')
  137. },
  138. rmHideStatus() {
  139. wx.removeStorageSync('hide_status')
  140. }
  141. }
  142. export default {
  143. setters, getters, remover
  144. }