rankctrl.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // 排行榜控制器
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. // panel: {
  6. // default: null,
  7. // type: cc.Sprite,
  8. // },
  9. },
  10. // LIFE-CYCLE CALLBACKS:
  11. // onLoad () {},
  12. start () {
  13. // this.initWx();
  14. // this.initValues();
  15. console.log("Start ... ")
  16. },
  17. // 初始化
  18. // 初始化数据
  19. initValues:function() {
  20. this.texture = new cc.Texture2D();
  21. },
  22. // 初始化微信数据
  23. initWx:function() {
  24. if (cc.sys.platform == cc.sys.WECHAT_GAME) {
  25. // 配置上传的数据
  26. var kvScore = {}
  27. kvScore.key = "score"
  28. kvScore.value = "100"
  29. var kvList = [kvScore]
  30. wx.setUserCloudStorage({
  31. KVDataList : kvList,
  32. success : function() {
  33. console.log ("设置成功")
  34. },
  35. fail : function() {
  36. console.log ("设置失败")
  37. },
  38. complete : function() {
  39. console.log ("设置结束")
  40. }
  41. })
  42. }
  43. },
  44. // 事件
  45. backClicked:function() {
  46. cc.director.loadScene("startscene")
  47. },
  48. });