55 Commits 58dbe7f24d ... e8de3cc8e7

Author SHA1 Message Date
  tang biao e8de3cc8e7 修改global为GameGlobal 5 years ago
  tang biao 4e6ad4c71f 解决qq合并的冲突 5 years ago
  tang biao aed6912c85 发版1.2.2 5 years ago
  smallqiang dacb8bf026 修改引擎文件 5 years ago
  smallqiang 37f42e84bf Merge branch 'master' into qq 5 years ago
  smallqiang 8b33a76ddf Merge branch 'master' into qq 5 years ago
  smallqiang c33aafe9a0 修改环境 6 years ago
  smallqiang 77d4b2b06c 修改QQ API域名 6 years ago
  smallqiang b7c1134258 Merge branch 'master' into qq 6 years ago
  smallqiang ac0d47ee27 修改抽奖和分享游戏 6 years ago
  smallqiang 7127b1de86 修改登录界面 6 years ago
  smallqiang 65dcb20940 添加QQ昵称头像上报 6 years ago
  smallqiang 0413a6dbfb Merge branch 'master' into qq 6 years ago
  tang biao 6b7bc7a20d 合并master 6 years ago
  tang biao eddecc1ed7 修改login 6 years ago
  tang biao 03d381982c 修复冲突 6 years ago
  tang biao d958ccaffa 添加商城购买弹窗 6 years ago
  smallqiang e0378cda32 添加离线收益 6 years ago
  smallqiang a4c8390d2e 添加游戏分享 6 years ago
  smallqiang e6cceb644d 修改分享链接地址 6 years ago
  smallqiang 64f3caa6b1 Merge branch 'master' into qq 6 years ago
  smallqiang 0a80d53966 Merge branch 'master' into qq 6 years ago
  smallqiang 811505a659 添加QQ提示框 6 years ago
  tang biao 2a915d6e62 添加promise 6 years ago
  smallqiang cb023aa957 修改引用promise方法 6 years ago
  smallqiang 83a0e3be12 Merge branch 'master' into qq 6 years ago
  smallqiang c022543764 修改排行榜显示 6 years ago
  smallqiang 64b58a9205 添加QQ好友排行榜 6 years ago
  tang biao 86640621c3 修改冲突 6 years ago
  tang biao bd77057349 修改global 6 years ago
  smallqiang b8248a750a Merge branch 'master' into qq 6 years ago
  smallqiang a96c4aedc9 修改core 6 years ago
  tang biao a983821940 修改post和socket 6 years ago
  tang biao da455f936c Merge branch 'qq' of http://svn.ouj.com:3000/DWG/taptapstar into qq 6 years ago
  tang biao b85909feee 修改socket 6 years ago
  smallqiang 4b2dd66032 修改广告播放 6 years ago
  smallqiang 4ae1503b96 修改QQ广告播放 6 years ago
  smallqiang 6d579d20fc QQ运行成功 6 years ago
  tang biao fd080face4 Merge branch 'qq' of http://svn.ouj.com:3000/DWG/taptapstar into qq 6 years ago
  tang biao c76cdeb6ea 修改网络请求 6 years ago
  smallqiang cad4e91dd0 添加分数上报,修改分享功能 6 years ago
  smallqiang 4aa68632af 修改提交分数方法 6 years ago
  smallqiang edeb1dda1d Merge branch 'master' into qq 6 years ago
  tang biao 6fbeeabaed Merge branch 'qq' of http://svn.ouj.com:3000/DWG/taptapstar into qq 6 years ago
  tang biao 8594438c4a 修改qq网络请求code报错 6 years ago
  smallqiang 9bed45c190 Merge branch 'master' into qq 6 years ago
  smallqiang 542b635963 Merge branch 'master' into qq 6 years ago
  tang biao 361b85d31d Merge branch 'qq' of http://svn.ouj.com:3000/DWG/taptapstar into qq 6 years ago
  tang biao 2245a07166 修改qq游戏编译报错 6 years ago
  smallqiang 6b849a70a2 修改Api请求 6 years ago
  smallqiang 074c902ad1 修改文件引用 6 years ago
  tang biao b1f997324c 修改网络请求 6 years ago
  tang biao a4e7af9198 修复qq崩溃问题 6 years ago
  Duowan 5495276409 修改qq玩一玩配置 6 years ago
  tang biao bb6e79611f 添加登录和网络请求 6 years ago
86 changed files with 5815 additions and 1037 deletions
  1. 1622 240
      assets/resources/prefabs/precedence/game_rank.prefab
  2. 789 0
      assets/resources/prefabs/store/storeQQAlert.prefab
  3. 7 0
      assets/resources/prefabs/store/storeQQAlert.prefab.meta
  4. BIN
      assets/resources/textures/store/store_add_qqGroup.png
  5. 31 0
      assets/resources/textures/store/store_add_qqGroup.png.meta
  6. 3 0
      assets/scene/game.fire
  7. 3 3
      assets/scene/login.fire
  8. 1 1
      assets/scene/login.fire.meta
  9. 4 4
      assets/scripts/applet/MyApplet.js
  10. 294 0
      assets/scripts/common/Platform.js
  11. 9 0
      assets/scripts/common/Platform.js.meta
  12. 21 40
      assets/scripts/common/UserInfo.js
  13. 10 9
      assets/scripts/draw/DrawContent.js
  14. 1 1
      assets/scripts/draw/DrawRedRecord.js
  15. 2 2
      assets/scripts/draw/DrawScroll.js
  16. 2 1
      assets/scripts/draw/DrawStarSuccss.js
  17. 67 59
      assets/scripts/game/Game.js
  18. 8 7
      assets/scripts/game/GameShop.js
  19. 16 16
      assets/scripts/game/GameSkill.js
  20. 5 5
      assets/scripts/game/GameTabbar.js
  21. 11 12
      assets/scripts/game/HomeGuide.js
  22. 6 6
      assets/scripts/game/HomeSideCtrl.js
  23. 4 4
      assets/scripts/game/MoneyCat.js
  24. 5 5
      assets/scripts/game/OfflineGrossIncome.js
  25. 1 1
      assets/scripts/invite/FriendHelpClick.js
  26. 7 7
      assets/scripts/invite/FriendHelpItem.js
  27. 2 2
      assets/scripts/invite/InviteMission.js
  28. 1 1
      assets/scripts/invite/InviteMissionItem.js
  29. 15 29
      assets/scripts/levelHome/LevelHome.js
  30. 3 3
      assets/scripts/levelHome/LevelHomeAward.js
  31. 9 9
      assets/scripts/levelHome/LevelHomeItem.js
  32. 3 3
      assets/scripts/levelHome/LevelHomeListAdapter.js
  33. 1183 0
      assets/scripts/lib/es6-promise.js
  34. 9 0
      assets/scripts/lib/es6-promise.js.meta
  35. 77 52
      assets/scripts/login/LoginCtrl.js
  36. 1 1
      assets/scripts/login/LoginCtrl.js.meta
  37. 7 7
      assets/scripts/loginReward/LoginRewardCtrl.js
  38. 1 1
      assets/scripts/loginReward/LoginRewardItem.js
  39. 1 1
      assets/scripts/messageList/MessageItem.js
  40. 19 19
      assets/scripts/messageList/MessageList.js
  41. 222 26
      assets/scripts/net/Api.js
  42. 0 1
      assets/scripts/net/HomeApi.js
  43. 55 7
      assets/scripts/net/LoginApi.js
  44. 58 0
      assets/scripts/net/QQPlayer.js
  45. 9 0
      assets/scripts/net/QQPlayer.js.meta
  46. 0 1
      assets/scripts/net/QuestApi.js
  47. 34 12
      assets/scripts/net/WeChat.js
  48. 75 11
      assets/scripts/net/Ws.js
  49. 1 1
      assets/scripts/quest/QuestDaily.js
  50. 1 1
      assets/scripts/quest/QuestDailyItem.js
  51. 1 1
      assets/scripts/quest/QuestMainItem.js
  52. 1 1
      assets/scripts/quest/QuestPopup.js
  53. 2 2
      assets/scripts/quest/QuestTab.js
  54. 1 1
      assets/scripts/rank/GameCountryRank.js
  55. 3 3
      assets/scripts/rank/GameCrowdRank.js
  56. 100 3
      assets/scripts/rank/GameFriendRank.js
  57. 7 2
      assets/scripts/rank/GameRank.js
  58. 33 0
      assets/scripts/rank/GameRankItem.js
  59. 6 13
      assets/scripts/signIn/SignIn.js
  60. 1 1
      assets/scripts/skill/SkillBuildingAlert.js
  61. 4 3
      assets/scripts/skill/SkillBuyAlert.js
  62. 21 19
      assets/scripts/skill/SkillItem.js
  63. 42 32
      assets/scripts/skill/SkillTopItem.js
  64. 5 4
      assets/scripts/skill/skillContent.js
  65. 5 4
      assets/scripts/star/StarContent.js
  66. 3 2
      assets/scripts/star/StarHandbook.js
  67. 5 5
      assets/scripts/star/StarHandbookDesc.js
  68. 12 12
      assets/scripts/star/StarItem.js
  69. 6 5
      assets/scripts/store/StoreContent.js
  70. 28 0
      assets/scripts/store/StoreQQAddGroup.js
  71. 9 0
      assets/scripts/store/StoreQQAddGroup.js.meta
  72. 4 4
      assets/scripts/store/StoreSmallItem.js
  73. 56 6
      assets/scripts/utils/ADVideo.js
  74. 25 6
      assets/scripts/utils/AlertManager.js
  75. 7 6
      assets/scripts/utils/ArtistManager.js
  76. 1 1
      assets/scripts/utils/BuildingModel.js
  77. 84 59
      assets/scripts/utils/DWTool.js
  78. 210 212
      assets/scripts/utils/Global.js
  79. 4 3
      assets/scripts/utils/PrefabManager.js
  80. 2 2
      assets/scripts/utils/TapTapTool.js
  81. 12 12
      assets/scripts/utils/ThemeManger.js
  82. 4 0
      build-templates/qqplay/gameConfig.json
  83. BIN
      build-templates/qqplay/inviteIcon.png
  84. 0 0
      build-templates/qqplay/libs/qqPlayCore.js
  85. 394 0
      build-templates/qqplay/libs/qqplay-adapter.js
  86. 2 2
      settings/builder.json

File diff suppressed because it is too large
+ 1622 - 240
assets/resources/prefabs/precedence/game_rank.prefab


+ 789 - 0
assets/resources/prefabs/store/storeQQAlert.prefab

@@ -0,0 +1,789 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "asyncLoadAssets": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "qqGoup",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 6
+      }
+    ],
+    "_active": true,
+    "_level": 1,
+    "_components": [
+      {
+        "__id__": 22
+      }
+    ],
+    "_prefab": {
+      "__id__": 23
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 730,
+      "height": 1020
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "star_mask",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 2,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": {
+      "__id__": 5
+    },
+    "_opacity": 153,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 1000,
+      "height": 2500
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
+    },
+    "_type": 0,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "61dMRHPE9Jor9NBHFxyrdB"
+  },
+  {
+    "__type__": "cc.BlockInputEvents",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_id": "a8jGU9ehlCaYnH58+JAyjW"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "36qCu8oL9PBL7kHQOpYr5U",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "content",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 7
+      },
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 13
+      }
+    ],
+    "_active": true,
+    "_level": 2,
+    "_components": [],
+    "_prefab": {
+      "__id__": 21
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 730,
+      "height": 1020
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "big_bg",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 6
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 3,
+    "_components": [
+      {
+        "__id__": 8
+      }
+    ],
+    "_prefab": {
+      "__id__": 9
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 730,
+      "height": 1020
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 7
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "46fff2fd-a06a-4b3d-a835-547c67766224"
+    },
+    "_type": 1,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "62CISfQ9NEXqozDB1qIOoo"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "59SKAZ/4tPp4V3KF1gL4MS",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "store_add_qqGroup",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 6
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 3,
+    "_components": [
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": {
+      "__id__": 12
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 700,
+      "height": 990
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 10
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "34fb708d-ff76-498e-bb0d-9270ed1c9870"
+    },
+    "_type": 0,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "4bYYm9/ZlMIp+AsNRPNKTE"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "2e4jMOwuFL6obB7u0OpYo6",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "strore_close_btn",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 6
+    },
+    "_children": [
+      {
+        "__id__": 14
+      }
+    ],
+    "_active": true,
+    "_level": 3,
+    "_components": [
+      {
+        "__id__": 17
+      },
+      {
+        "__id__": 19
+      }
+    ],
+    "_prefab": {
+      "__id__": 20
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 99,
+      "height": 114
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 326,
+      "y": 492,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "store_close",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 13
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 4,
+    "_components": [
+      {
+        "__id__": 15
+      }
+    ],
+    "_prefab": {
+      "__id__": 16
+    },
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 66,
+      "height": 71
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_position": {
+      "__type__": "cc.Vec3",
+      "x": 16,
+      "y": -1,
+      "z": 0
+    },
+    "_scale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_rotationX": 0,
+    "_rotationY": 0,
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "3b53aea6-e62a-4433-9e69-df03a3a718a7"
+    },
+    "_type": 0,
+    "_sizeMode": 1,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "9cprXbjQpFH65CkHhyDSND"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "b3yucnS+dImYaoKBh+/PSm",
+    "sync": false
+  },
+  {
+    "__type__": "cc.Button",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 13
+    },
+    "_enabled": true,
+    "transition": 1,
+    "pressedColor": {
+      "__type__": "cc.Color",
+      "r": 120,
+      "g": 120,
+      "b": 120,
+      "a": 255
+    },
+    "hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "duration": 0.1,
+    "zoomScale": 1.2,
+    "clickEvents": [
+      {
+        "__id__": 18
+      }
+    ],
+    "_N$interactable": true,
+    "_N$enableAutoGrayEffect": false,
+    "_N$normalColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$disabledColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$normalSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "_N$hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$disabledSprite": {
+      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
+    },
+    "_N$target": {
+      "__id__": 14
+    },
+    "_id": "0b2k25ZTlNbYZrF5t5paoR"
+  },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "StoreQQAddGroup",
+    "handler": "hiddenAction",
+    "customEventData": ""
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 13
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 33,
+    "_left": 0,
+    "_right": -10.5,
+    "_top": -39,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": "a2cQQmT/BD2p1zz+eqcUxG"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "65Q2GnuA9F95+NL/WDlFlK",
+    "sync": false
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "e1TIJTEetOpYOd5JhirOEL",
+    "sync": false
+  },
+  {
+    "__type__": "3ebadjShcZJVrY3OwysVcIR",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "_id": "69yfwiNhNHnbxScLTGRoiu"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__uuid__": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f"
+    },
+    "fileId": "ac2De8XCJM34D9Bus1wI8x",
+    "sync": false
+  }
+]

+ 7 - 0
assets/resources/prefabs/store/storeQQAlert.prefab.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.0.0",
+  "uuid": "1ae9bd85-0f20-4e94-a465-9ccc17599b1f",
+  "optimizationPolicy": "AUTO",
+  "asyncLoadAssets": false,
+  "subMetas": {}
+}

BIN
assets/resources/textures/store/store_add_qqGroup.png


+ 31 - 0
assets/resources/textures/store/store_add_qqGroup.png.meta

@@ -0,0 +1,31 @@
+{
+  "ver": "2.2.0",
+  "uuid": "c682da95-25e8-4d6b-b60c-ede99ac91d13",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "subMetas": {
+    "store_add_qqGroup": {
+      "ver": "1.0.3",
+      "uuid": "34fb708d-ff76-498e-bb0d-9270ed1c9870",
+      "rawTextureUuid": "c682da95-25e8-4d6b-b60c-ede99ac91d13",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 700,
+      "height": 990,
+      "rawWidth": 700,
+      "rawHeight": 990,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 3 - 0
assets/scene/game.fire

@@ -352,6 +352,9 @@
     "drawNode": {
       "__id__": 106
     },
+    "inviteNode": {
+      "__id__": 79
+    },
     "messageListNode": {
       "__id__": 252
     },

+ 3 - 3
assets/scene/login.fire

@@ -55,7 +55,7 @@
     "_zIndex": 0,
     "groupIndex": 0,
     "autoReleaseAssets": false,
-    "_id": "40f8b7e6-9666-4b26-87e8-6f986f1c078d"
+    "_id": "6d3c479f-cf4e-43d2-8b48-74bd4f57b5df"
   },
   {
     "__type__": "cc.Node",
@@ -1054,7 +1054,7 @@
     "_id": "46zyxZHutP6ZBDOdCK8srX"
   },
   {
-    "__type__": "92fe3yYmypJhroGUfWBAS8i",
+    "__type__": "03ce8IFGmtMGpnczXFaYMor",
     "_name": "",
     "_objFlags": 0,
     "node": {
@@ -1078,6 +1078,6 @@
     },
     "_updating": false,
     "_canRetry": false,
-    "_id": "5crQZtSm1Ay74X6Z9xw3n4"
+    "_id": "feKVAP/hBN3Iv0ZdacQP0v"
   }
 ]

+ 1 - 1
assets/scene/login.fire.meta

@@ -1,6 +1,6 @@
 {
   "ver": "1.0.0",
-  "uuid": "40f8b7e6-9666-4b26-87e8-6f986f1c078d",
+  "uuid": "6d3c479f-cf4e-43d2-8b48-74bd4f57b5df",
   "asyncLoadAssets": false,
   "autoReleaseAssets": false,
   "subMetas": {}

+ 4 - 4
assets/scripts/applet/MyApplet.js

@@ -13,7 +13,7 @@ cc.Class({
     // LIFE-CYCLE CALLBACKS:
 
     onLoad () {
-        if (Global.isMineEnter) {
+        if (GameGlobal.isMineEnter) {
             this.gainButton.interactable = true;
             this.gainButton.getComponent(cc.Sprite).spriteFrame = this.btnSpriteFrame[1];
         } else {
@@ -38,14 +38,14 @@ cc.Class({
                     diamond: parseInt(respondData.diamond)
                 });
             } else {
-                Global.commonAlert.showCommonErrorAlert("领取奖励成功");
+                GameGlobal.commonAlert.showCommonErrorAlert("领取奖励成功");
             }
-            Global.appletAward = true;
+            GameGlobal.appletAward = true;
             this.node.destroy();
             GameEvent.fire('Gain_My_Applet');
         }, (code, msg) => {
             this.gainButton.interactable = true;
-            Global.commonAlert.showCommonErrorAlert("领取失败");
+            GameGlobal.commonAlert.showCommonErrorAlert("领取失败");
         });
     },
 

+ 294 - 0
assets/scripts/common/Platform.js

@@ -0,0 +1,294 @@
+const BuildingManager = require("../utils/BuildingManager");
+const ShareAction = require('../utils/ShareAction');
+const HomeApi = require("../net/HomeApi");
+const SkillApi = require("../net/SkillApi");
+const WeChat = require("../net/WeChat");
+const AlertManager = require('../utils/AlertManager');
+const {GameNotificationKey, WechatShareType } = require('../utils/GameEnum');
+const GameModule = require("../utils/GameModule");
+/// 处理
+class Platform {
+    static initPlatform() {
+        if (cc.sys.platform === cc.sys.WECHAT_GAME) {
+            this.handelWxLifeCyle();
+        } else if (CC_QQPLAY) {
+            this.handelQQLifeCycle();
+        }
+    }
+
+    static handelQQLifeCycle() {
+        
+        BK.onMaximize( () => {
+            BK.Script.log('游戏最小化');
+            Platform.handelOnHide();
+        })
+
+        BK.onGameClose(() => {
+            BK.Script.log('关闭游戏');
+            Platform.handelOnHide();
+        } )
+
+        BK.onEnterBackground( () => {
+            BK.Script.log('游戏退出到后台');
+            Platform.handelOnHide();
+        })
+        BK.onEnterForeground( () => {
+            BK.Script.log('游戏回到前台');
+            this.handelOnShow();
+        })
+
+        // BK.onGameShare( () => {
+        //     BK.Script.log('分享事件,点击分享按钮触发');
+        //     let shareInfo = {
+        //         summary: '猜猜他是谁?',
+        //         picUrl: 'https://pub.dwstatic.com/wxgame/taptapstar_qq/share/qq_share.png',
+        //         extendInfo: ''
+        //     };
+        //     return shareInfo;
+        // })
+
+        new BK.Game({
+            onShare() {
+                BK.Script.log('分享事件,点击分享按钮触发');
+                let shareInfo = {
+                    summary: '猜猜他是谁?',
+                    picUrl: 'https://pub.dwstatic.com/wxgame/taptapstar_qq/share/qq_share.png',
+                    extendInfo: ''
+                };
+                return shareInfo;
+            }
+        });
+
+        // BK.onGameShareComplete( () => {
+        //     BK.Script.log('分享结果,分享事件完成');
+        // })
+        // BK.Game.onNetworkChange( () => {
+        //     console.log('网络情况改变');
+        // })
+        // BK.game.onException( (app) => {
+        //     console.log('游戏报错');
+        //     BK.Script.log(1, 0, "msg = " + app.errorMessage() + ", stack = " + app.errorStacktrace());
+        // })
+    }
+
+    static handelWxLifeCyle() {
+        wx.onShow(({scene, query, shareTicket }) => {
+            if (typeof wx.getUpdateManager === 'function') {
+                const updateManager = wx.getUpdateManager();
+    
+                updateManager.onCheckForUpdate(function (res) {
+                    // 请求完新版本信息的回调
+                    console.log('hasUpdate: ' + JSON.stringify(res.hasUpdate));
+                })
+    
+                updateManager.onUpdateReady(function () {
+                    // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+                    updateManager.applyUpdate();
+                })
+    
+                updateManager.onUpdateFailed(function () {
+                    // 新的版本下载失败
+                })
+            }
+    
+                    //进入游戏的场景值
+            console.log('scene ' + scene + '==============================game ===============================');
+            if (scene == 1104) {
+                GameGlobal.isMineEnter = true;    //从我的小程序进入游戏
+            } else {
+                GameGlobal.isMineEnter = false;    //从我的小程序进入游戏
+            }
+            console.log('Global onShow' + JSON.stringify(query) + '======================================');
+            if (query != undefined && query != null) {
+                if (typeof query == "string") {
+                    query = JSON.parse(query);
+                }
+
+                GameGlobal.shareType = query.shareType;
+
+                if (GameGlobal.shareType == ShareAction.SHOW_GROUP_RANK) {
+                    if (shareTicket != undefined && shareTicket != null) {
+                        GameGlobal.shareTicket = shareTicket;
+                        GameEvent.fire(GameNotificationKey.GameShowGroupRank);//处理通过点击分享链接进入游戏的查看群排行榜
+                    } else {
+                        GameGlobal.shareTicket = '';
+                    }
+                }
+
+                if (query.uid != undefined && GameGlobal.shareType == ShareAction.INVITE_FRIEND) {
+                    GameGlobal.shareUid = query.uid;
+                    GameEvent.fire(GameNotificationKey.ProcessShareAction);//处理通过点击分享链接进入游戏的各种操作,加好友.....
+                }
+            }
+            //// 如果是从后台到前台
+            Platform.handelOnShow();
+        });
+    
+        wx.onHide(() => {
+            console.log('Global onHide ===================================');
+            GameGlobal.isOnHide = true;
+            if (GameModule.userInfo) {
+                GameModule.userInfo.doReport();
+            }
+    
+            // /// 关闭socket 如果socket是打开的状态 其它的状态就不管 打开之后直接重连 && Global._wxSocket.readyState == 'open'
+            // if (Global._wxSocket != undefined && Global._wxSocket != null ) {
+            //     Global._wxSocket.close();
+            // }
+            cc.sys.localStorage.setItem("onHideTimestamp", Date.parse(new Date()));
+            HomeApi.exitGame();
+            if (GameModule.audioMng) {
+                GameModule.audioMng.stopAll();
+            }
+        });
+    
+        wx.showShareMenu({
+            withShareTicket: true,
+            success: function (res) {
+    
+            },
+            fail: function (res) {
+    
+            },
+            complete: function (res) {
+    
+            }
+        });
+    
+        wx.onShareAppMessage(function (res) {
+            // 用户点击了“转发”按钮
+            if (res.from === 'button') {
+                // 来自页面内转发按钮
+            } else if (res.from === 'menu') {
+    
+            }
+    
+            if (GameGlobal.isCheck) {
+    
+                var uid = -1;
+                if (GameGlobal.user != undefined && GameGlobal.user.uid != undefined) {
+                    uid = GameGlobal.user.uid;
+                }
+    
+                return {
+                    title: '猜猜他是谁?',
+                    imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/share_3.png',
+                    query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
+                    success: function (res) {
+                        console.log('分享成功');
+                        // 分享成功上报
+                        SkillApi.report(2, (responseData) => {
+                            console.log('上报分享成功');
+                        },(error) => {
+    
+                        });
+                    },
+                    fail: function (res) {
+                        // 转发失败
+                        console.log('取消或分享失败');
+                    },
+                    complete: function () {
+    
+                    }
+                }
+            } else {
+                let randomIndex = parseInt(Math.random()*(WeChat.shareArray.length),10);
+                let shareObjct = WeChat.shareArray[randomIndex];
+                var uid = -1;
+                if (GameGlobal.user != undefined && GameGlobal.user.uid != undefined) {
+                    uid = GameGlobal.user.uid;
+                }
+    
+                return {
+                    title: shareObjct.title,
+                    imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/' + shareObjct.icon,
+                    query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
+                    success: function (res) {
+                        console.log('分享成功');
+                        // 分享成功上报
+                        SkillApi.report(2, (responseData) => {
+                            console.log('上报分享成功');
+                        },(error) => {
+    
+                        });
+                    },
+                    fail: function (res) {
+                        // 转发失败
+                        console.log('取消或分享失败');
+                    },
+                    complete: function () {
+                    },
+                };
+            }
+        });
+    }
+
+    static handelOnShow() {
+        if (GameGlobal.isOnHide) {
+            GameGlobal.isOnHide = false;
+
+            //客户端优先刷新技能使用情况
+            GameEvent.fire(GameNotificationKey.GameSkillOnHide);
+
+            /// 发通知更新跟定时器相关的数据
+            GameEvent.fire(GameNotificationKey.GameShowNotificationKey);
+
+            if (GameGlobal.clickShare) {
+
+                let onHideTime = cc.sys.localStorage.getItem('onHideTimestamp');
+
+                let curTime = new Date().getTime();
+                let difference = curTime - onHideTime;
+
+                var isShareOk = false;
+                //判断是否忽略分享的状态
+                if (GameGlobal.isIgnoreShareStatus) {
+                    isShareOk = true;
+                } else {
+                    //在分享界面停留了3秒当作分享成功,如果少于3秒即有10%概率当作成功
+                    if (difference > 3000) {
+                        isShareOk = true;
+                    } else {
+                        let randomOk = Math.random() <= 0.1 ? true : false;
+                        if (randomOk) {
+                            isShareOk = true;
+                        }
+                    }
+                }
+
+                GameEvent.fire(GameNotificationKey.ShowShareAction, GameGlobal.gameShareType, isShareOk);
+                GameGlobal.clickShare = false;
+                GameGlobal.gameShareType = WechatShareType.None;
+                GameGlobal.isIgnoreShareStatus = false;
+                if (isShareOk) {
+                    SkillApi.report(2, (responseData) => {
+
+                    },(error) => {
+
+                    });
+                } else {
+                    AlertManager.showShareFailAlert();
+                }
+            }
+        }
+    }
+
+    static handelOnHide() {
+        GameGlobal.isOnHide = true;
+        if (GameModule.userInfo) {
+            GameModule.userInfo.doReport();
+        }
+        /// 关闭socket
+        if (GameGlobal._wxSocket != undefined && GameGlobal._wxSocket != null) {
+            GameGlobal._wxSocket.close();
+        }
+        cc.sys.localStorage.setItem("onHideTimestamp", Date.parse(new Date()));
+        HomeApi.exitGame();
+        if (GameModule.audioMng) {
+            GameModule.audioMng.stopAll();
+        }
+    }
+    
+}
+
+module.exports = Platform;

+ 9 - 0
assets/scripts/common/Platform.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.5",
+  "uuid": "373e2910-8dd1-4dc4-9ec1-46e24b35ff4e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 21 - 40
assets/scripts/common/UserInfo.js

@@ -56,7 +56,7 @@ cc.Class({
                 return this._gold;
             },
             set: function (value) {
-                cc.sys.localStorage.setItem(`localGold_${Global.user.uid}`, JSON.stringify(this._gold));
+                cc.sys.localStorage.setItem(`localGold_${GameGlobal.user.uid}`, JSON.stringify(this._gold));
 
                 this._gold = value;
                 this.grossIncomeRichText.string = `<outline color=#ffffff width=3><color=#009100>${TapTapTool.parseToString(this._gold)}</c></outline>`;
@@ -138,34 +138,16 @@ cc.Class({
             },
             set: function (value) {
                 this._buildingLevel = value;
-                // 把用户的总部等级上报给微信
-                DWTool.submitWechatScore(this._buildingLevel);
+                if (CC_WECHATGAME) {
+                    // 把用户的总部等级上报给微信
+                    DWTool.submitWechatScore(this._buildingLevel);
+                } else if (CC_QQPLAY) {
+                    // 把用户的总部等级上报给QQ玩一玩
+                    DWTool.submitQQScore(this._buildingLevel);
+                }
             }
         },
 
-        // //获得奖励的永久产出倍数
-        // perpetualMt: {
-        //     default: 1,
-        //     visible: false,
-        //     type: cc.Float
-        // },
-
-        // //获得奖励的永久点击倍数
-        // perpetualClickMt: {
-        //     default: 1,
-        //     visible: false,
-        //     type: cc.Float
-        // },
-
-        //入驻在建筑的明星加成倍数
-        // starMt: {
-        //     default: 1,
-        //     visible: false,
-        //     type: cc.Float
-        // },
-
-
-
         levelHomeItemFullCount: 0
     },
 
@@ -177,7 +159,7 @@ cc.Class({
         this._rateGold = {'n': 0, 'e': 0};
         this._gold = {'n': 0, 'e': 0};
         this.coinTap = {'n': 0, 'e': 0};
-        this.buildingLevel = Global.userData.buildingLevel;
+        this.buildingLevel = GameGlobal.userData.buildingLevel;
         // let objc = TapTapTool.goldStrToClass('3.265;29');
         // let str = TapTapTool.parseToString(objc);
         
@@ -264,13 +246,12 @@ cc.Class({
     doReport() {
         // return;
         let goldStr = this._gold.n + ";" + this._gold.e;
-        DWTool.reportInfo(this.seq, goldStr, this.stars, this.clickCount, this.recordModify, this.recordUnlockModify)
-            .then(() => {
+        DWTool.reportInfo(this.seq, goldStr, this.stars, this.clickCount, this.recordModify, this.recordUnlockModify, () => {
                 this._reportFailDuration = 0;
                 this.recordModify = [];
                 this.recordUnlockModify = [];
                 this.seq += 1;
-            }).catch(err => {
+            }, (err) => {
                 if (err.code === -4) {
                     this._reportFailDuration = 60;
                 }
@@ -282,9 +263,9 @@ cc.Class({
     reportFirst() {
 
         //如果为true则以网络数据为主不用覆盖
-        if (Global.localData) {
-            cc.sys.localStorage.removeItem(`localGold_${Global.user.uid}`);
-            cc.sys.localStorage.removeItem(`localRooms_${Global.user.uid}`);
+        if (GameGlobal.localData) {
+            cc.sys.localStorage.removeItem(`localGold_${GameGlobal.user.uid}`);
+            cc.sys.localStorage.removeItem(`localRooms_${GameGlobal.user.uid}`);
             return;
         }
 
@@ -297,7 +278,7 @@ cc.Class({
      * 初始化用户数据
      */
     initUserInfo() {
-        let userInfo = this.userInfo = Global.userData;
+        let userInfo = this.userInfo = GameGlobal.userData;
 
         if (userInfo != undefined) {
             let goldObj = this.compareGoldLocalData();
@@ -315,8 +296,8 @@ cc.Class({
     },
 
     compareGoldLocalData() {
-        let localGold = cc.sys.localStorage.getItem(`localGold_${Global.user.uid}`);
-        if (this.userInfo != undefined && localGold!= undefined && localGold && !Global.localData) {
+        let localGold = cc.sys.localStorage.getItem(`localGold_${GameGlobal.user.uid}`);
+        if (this.userInfo != undefined && localGold!= undefined && localGold && !GameGlobal.localData) {
             let goldObj = JSON.parse(localGold);
             if (goldObj != undefined) {
                 return goldObj;
@@ -329,11 +310,11 @@ cc.Class({
     },
 
     compareRoomsLocalData() {
-        let localData = cc.sys.localStorage.getItem(`localRooms_${Global.user.uid}`);
-        this.buildingData = Global.BuildingManager.networkRooms;
-        if (this.userInfo != undefined && localData!= undefined && localData && !Global.localData) {
+        let localData = cc.sys.localStorage.getItem(`localRooms_${GameGlobal.user.uid}`);
+        this.buildingData = GameGlobal.BuildingManager.networkRooms;
+        if (this.userInfo != undefined && localData!= undefined && localData && !GameGlobal.localData) {
             let userRooms = JSON.parse(localData);
-            if (Global.BuildingManager.networkRooms && Global.BuildingManager.networkRooms.length > 0 && userRooms.length > 0) {
+            if (GameGlobal.BuildingManager.networkRooms && GameGlobal.BuildingManager.networkRooms.length > 0 && userRooms.length > 0) {
                 userRooms.forEach(room => {
                     this.buildingData.forEach(n => {
                         if (room.roomId == n.roomId) {

+ 10 - 9
assets/scripts/draw/DrawContent.js

@@ -5,7 +5,7 @@ const GameModule = require("../utils/GameModule");
 const WeChat = require('../net/WeChat');
 const {GameNotificationKey, WechatShareType, GameRedDot } = require('../utils/GameEnum');
 const TapTapTool = require("../utils/TapTapTool");
-// const ADVideo = require('../utils/ADVideo');
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -34,7 +34,7 @@ cc.Class({
 
     onLoad () {
         this.setUpUIIsShow(false);
-        if (Global.isCheck) {
+        if (GameGlobal.isCheck) {
             this.shareActionNode.active = false;
         }
         this.setupNotification();
@@ -46,7 +46,7 @@ cc.Class({
         }).catch(({code, msg}) => {
             console.log(code, msg);
         });
-        this.drawMoneyLabel.string = `<b><color=#fec808>¥${(Global.userData.hb / 100).toFixed(2)}</c></b>`;
+        this.drawMoneyLabel.string = `<b><color=#fec808>¥${(GameGlobal.userData.hb / 100).toFixed(2)}</c></b>`;
     },
 
     onDestroy() {
@@ -134,7 +134,8 @@ cc.Class({
         }
     },
     /// 网络请求
-    getDrawState() {
+    getDrawState(success, fail) {
+        
         return new Promise((resolve, reject) => {
             DrawApi.getLotteryInfo((respondData) => {
                 resolve(respondData);
@@ -168,7 +169,7 @@ cc.Class({
         }).catch(({code, msg}) => {
             console.log(code, msg);
             completion(false);
-            Global.commonAlert.showCommonErrorAlert(msg);
+            GameGlobal.commonAlert.showCommonErrorAlert(msg);
         });
     },
 
@@ -187,7 +188,7 @@ cc.Class({
     /// 看广告抽奖
     adNodeAction() {
         GameModule.audioMng.playClickButton();
-        if (CC_WECHATGAME) {
+        if (CC_WECHATGAME || CC_QQPLAY) {
             if (this._adState === 0) {
                 GameEvent.on(GameNotificationKey.ShowShareAction, this, (type, isOk) => {
                     if (type != WechatShareType.DrawLottery) { return; }
@@ -206,7 +207,7 @@ cc.Class({
                     console.log('分享失败或取消');
                 });
             } else {
-                Global._adVideo.showVideo('draw');
+                GameGlobal._adVideo.showVideo('draw');
             }
         }
     },
@@ -289,9 +290,9 @@ cc.Class({
             return;
         }
          //// 说明有广告
-         if (Global._adVideoState == 0) {
+         if (GameGlobal._adVideoState == 0) {
             this._adState = 1;
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 0;
         }
         /// 如果时间到了 那么更新显示的UI

+ 1 - 1
assets/scripts/draw/DrawRedRecord.js

@@ -17,7 +17,7 @@ cc.Class({
 
     onLoad () {
         /// 获取红包记录数据
-        this.moneyTileRichText.string = `<b><color=#613f16>余额:¥${(Global.userData.hb / 100).toFixed(2)}</c></b>`;
+        this.moneyTileRichText.string = `<b><color=#613f16>余额:¥${(GameGlobal.userData.hb / 100).toFixed(2)}</c></b>`;
         
         DrawApi.getDrawHbs((respondData) => {
             let reds = respondData.list;

+ 2 - 2
assets/scripts/draw/DrawScroll.js

@@ -63,8 +63,8 @@ cc.Class({
                 this.scrollBg.node.width = 408;
             }
 
-            this.node.height = Global.winSize.height;
-            if (Global.winSize.height <= 1000) {
+            this.node.height = GameGlobal.winSize.height;
+            if (GameGlobal.winSize.height <= 1000) {
                 this.scrollNode.height = 800;
                 this.scrollBg.node.height = 967;
             } else {

+ 2 - 1
assets/scripts/draw/DrawStarSuccss.js

@@ -2,6 +2,7 @@ const DrawApi  = require("../net/DrawApi");
 const {GameNotificationKey, WechatShareType} = require('../utils/GameEnum');
 const GameModule = require("../utils/GameModule");
 const DWTool = require("../utils/DWTool");
+var Promise = require('../lib/es6-promise').Promise;
 const lottery = require('../data/lottery');
 const TapTapTool = require("../utils/TapTapTool");
 const WeChat = require('../net/WeChat');
@@ -65,7 +66,7 @@ cc.Class({
             nameString += `钻石 ${drawSuccessData.opt}`;
             /// 如果是红包
         } else if (drawSuccessData.type == 4) {
-            Global.userData.hb += drawSuccessData.hb;
+            GameGlobal.userData.hb += drawSuccessData.hb;
             nameString += ` ${(drawSuccessData.hb / 100).toFixed(2)}元`;
             desc += '红包满十元可提现噢~';
             /// 如果抽中的是明星

+ 67 - 59
assets/scripts/game/Game.js

@@ -9,11 +9,11 @@ const GameRedDot = require('../utils/GameEnum').GameRedDot;
 const TapTapTool = require("../utils/TapTapTool");
 const ADVideo = require('../utils/ADVideo');
 
-import DwSdk from "../duowansdk/DwSdk";
-let debug = false;
-var objSdk = new DwSdk("点点大明星", debug);
-// 注册sdk的update事件
-cc.director.on(cc.Director.EVENT_AFTER_DRAW, objSdk.update);
+// import DwSdk from "../duowansdk/DwSdk";
+// let debug = false;
+// var objSdk = new DwSdk("点点大明星", debug);
+// // 注册sdk的update事件
+// cc.director.on(cc.Director.EVENT_AFTER_DRAW, objSdk.update);
 
 cc.Class({
     extends: cc.Component,
@@ -39,6 +39,8 @@ cc.Class({
 
         // drawNode: cc.Node,
 
+        inviteNode: cc.Node,
+
         messageListNode: cc.Node,
 
         bottomTabbar: cc.Node,
@@ -53,31 +55,34 @@ cc.Class({
         this.isShowBar = false;
         this._isTimer = false;
         this.winSize = cc.view.getVisibleSize();
-        Global.winSize = this.winSize;
+        GameGlobal.winSize = this.winSize;
 
         // 创建一个事件监听实例, 用来实现跨节点监听事件
         GameEvent.init();
         this._setEventListener();
         /// 初始化广告W6Lcux7ArPGCBpnWuAyEVK48PrrYX7xWBA
         if (CC_WECHATGAME) {
-            Global._adVideo = new ADVideo();
-            Global._adVideo.wxCreateADVideo();
+            GameGlobal._adVideo = new ADVideo();
+            GameGlobal._adVideo.wxCreateADVideo();
         }
 
         this._initSocketMng();
         this._getInformation();
 
-        if (window.wx != undefined) {
-            Global.wechatScoreKey = Global.debug ? 'buildingLevel_test' : 'buildingLevel';
+        if (CC_WECHATGAME) {
+            GameGlobal.wechatScoreKey = GameGlobal.debug ? 'buildingLevel_test' : 'buildingLevel';
             window.wx.postMessage({
                 messageType: 5,
-                key1: Global.debug
+                key1: GameGlobal.debug
             });
-
             window.wx.postMessage({
                 messageType: 6,
-                winSize: Global.winSize
+                winSize: GameGlobal.winSize
             });
+        } else if (CC_QQPLAY) {
+            if (window.GameStatusInfo) {
+                GameStatusInfo.startMs = ((new Date()).getTime()).toString();
+            }
         }
 
         // 引导界面
@@ -92,7 +97,7 @@ cc.Class({
         //建筑展示
         let levelHome = cc.instantiate(this.levelHomePrefab);
         levelHome = levelHome.getComponent('LevelHome');
-        levelHome.init(Global.user.uid);
+        levelHome.init(GameGlobal.user.uid);
         this.levelHome = levelHome;
         this.levelHome.node.active = true;
 
@@ -105,22 +110,26 @@ cc.Class({
         }
 
         this.additionTipsNode = this.additionTipsNode.getComponent('AdditionTips');
-
-        if (Global.shareType == ShareAction.SHOW_GROUP_RANK && Global.shareTicket.length > 0) {
+        if (GameGlobal.shareType == ShareAction.SHOW_GROUP_RANK && GameGlobal.shareTicket.length > 0) {
             if (this.homeGuide.guideState.state1.pass) {
                 GameEvent.fire(GameNotificationKey.GameShowGroupRank);
             }
         }
 
-        if (Global.messageNotice !== undefined && Global.messageNotice.length > 0) {
-            if (Global.noticeDiamond !== undefined && Global.noticeDiamond > 0) {
+        // if (GameGlobal.isCheck) {
+        //     this.storeNode.active = false;
+        //     this.drawNode.active = false;
+        // }
+
+        if (GameGlobal.messageNotice !== undefined && GameGlobal.messageNotice.length > 0) {
+            AlertManager.showNoticeAlert(GameGlobal.messageNotice);
+            if (GameGlobal.noticeDiamond !== undefined && GameGlobal.noticeDiamond > 0) {
                 let showText = `钻石 x ${Global.noticeDiamond}`;
                 AlertManager.showActGiftAlert('diamond', showText);
             }
-            AlertManager.showNoticeAlert(Global.messageNotice);
         }
 
-        if (Global.shareUid != -1) {
+        if (GameGlobal.shareUid != -1) {
             this.processShareAction();
         }
     },
@@ -166,8 +175,8 @@ cc.Class({
         //// 重连socket
         GameEvent.on(GameNotificationKey.GameShowNotificationKey, this, () => {
             // debugger;
-            Global._wxSocket._reconnectTimes = 0;
-            Global._wxSocket.connect();
+            GameGlobal._wxSocket._reconnectTimes = 0;
+            GameGlobal._wxSocket.connect();
             // if (Global._wxSocket.readyState != 'open') {
             // }
             // if (Global._wxSocket.readyState == 'open') {
@@ -186,9 +195,14 @@ cc.Class({
     _initSocketMng() {
         let testUrl = 'wss://test-message-taptap.duowan.com/connect';
         let pUrl = 'wss://message-taptap.duowan.com/connect';
-        // let testUrl = 'wss://new-message-taptap.duowan.com/connect';
-        let socketUrl = Global.debug ? testUrl : pUrl;
+
+        let qqUrl = 'wss://qq-message-taptap.duowan.com';
+        var socketUrl = GameGlobal.debug ? testUrl : pUrl;
+
         // let socketUrl = 'ws://172.16.15.196:9099/connect';
+        if (CC_QQPLAY) {
+            socketUrl = GameGlobal.debug ? testUrl : qqUrl;
+        }
 
         let ws = new WsManager(socketUrl, {
             binaryType: 'arraybuffer',
@@ -198,7 +212,7 @@ cc.Class({
             // reconnectionAttempts: 5     // 最大重连尝试次数,默认为Infinity
         });
 
-        Global._wxSocket = ws;
+        GameGlobal._wxSocket = ws;
 
         ws.on('open', (res) => {
             console.log('socket 打开');
@@ -214,7 +228,7 @@ cc.Class({
             if (data.type != undefined) {   
                 // Global._redTypes = data.type;
                 /// 商品购买的通知 第一次的socket不管的啦因为接口已经处理了
-                if (data.type.indexOf(1) != -1 && data.userShops.length > 0 && Global._socketCount > 1) {
+                if (data.type.indexOf(1) != -1 && data.userShops.length > 0 && GameGlobal._socketCount > 1) {
                     let userShops = data.userShops;
                     for (let i = 0; i < data.userShops.length; ++ i) {
                         let shopData = userShops[i];
@@ -246,10 +260,10 @@ cc.Class({
                 for (let i = 0; i < data.type.length; ++ i) {
                     /// 如果包含它就什么都不管
                     let type = data.type[i];
-                    if (Global._redTypes.indexOf(type) != -1) {
+                    if (GameGlobal._redTypes.indexOf(type) != -1) {
                         isContain = true;
                     } else {
-                        Global._redTypes.push(type);
+                        GameGlobal._redTypes.push(type);
                         isContain = false;
                     }
                 }
@@ -277,10 +291,10 @@ cc.Class({
     /// 需要更新的时间包括
     handelSocketShop(shopData) {
         /// 更新信息流时间
-        let informationsLength = Global._timeInformations.length;
+        let informationsLength = GameGlobal._timeInformations.length;
         if (informationsLength > 0) {
             for(let i = 0; i < informationsLength; ++i) {
-                let information = Global._timeInformations[i];
+                let information = GameGlobal._timeInformations[i];
                 /// 如果是商品 并且已经拥有过的话
                 if (information.type == 1 && information.sId == shopData.shopId) {
                     information.cdTime = shopData.cdTime;
@@ -294,48 +308,42 @@ cc.Class({
 
     /// 获取信息流
     _getInformation() {
-        Global._redTypes = [];
-        Global._timeInformations = [];
-        Global._fixInformations = [];
-        Global._gold10 = {'n': 0, 'e': 0};
-        Global._buyStarGold = {'n': 0, 'e': 0};
-        this.getInformation().then((respondData) => {
+        GameGlobal._redTypes = [];
+        GameGlobal._timeInformations = [];
+        GameGlobal._fixInformations = [];
+        GameGlobal._gold10 = {'n': 0, 'e': 0};
+        GameGlobal._buyStarGold = {'n': 0, 'e': 0};
+        this.getInformation((respondData) => {
             console.log(respondData);
-            Global._gold10 = respondData.gold10;
-            Global._buyStarGold = respondData.buyStarGold;
-            Global._isSkillReset = respondData.isSkillReset;
-            Global._upBuildingInfo = respondData.upBuildingInfo;
-            Global._upRoomInfo = respondData.upRoomInfo;
-            Global._buyStarInfo = respondData.buyStarInfo;
+            GameGlobal._gold10 = respondData.gold10;
+            GameGlobal._buyStarGold = respondData.buyStarGold;
+            GameGlobal._isSkillReset = respondData.isSkillReset;
+            GameGlobal._upBuildingInfo = respondData.upBuildingInfo;
+            GameGlobal._upRoomInfo = respondData.upRoomInfo;
+            GameGlobal._buyStarInfo = respondData.buyStarInfo;
             if (respondData.types !== undefined) {
-                Global._redTypes = respondData.types;
+                GameGlobal._redTypes = respondData.types;
                 /// 这个是直接返回的 没有推送 七天登录的红点
             }
-            if (TapTapTool.compare(Global.userData.goldObj, respondData.buyStarGold)) {
-                Global._redTypes.push(GameRedDot.star);
+            if (TapTapTool.compare(GameGlobal.userData.goldObj, respondData.buyStarGold)) {
+                GameGlobal._redTypes.push(GameRedDot.star);
             }
             GameEvent.fire(GameNotificationKey.GameRedDotUpdate);
             // this.handelShowRedDot();
             //// 更新信息流数据
             if (respondData.informations !== undefined) {
-                Global._timeInformations = respondData.informations;
-                GameEvent.fire(GameNotificationKey.GameUpdateMessageList, Global._timeInformations.length);
+                GameGlobal._timeInformations = respondData.informations;
+                GameEvent.fire(GameNotificationKey.GameUpdateMessageList, GameGlobal._timeInformations.length);
             }
-        }).catch(({code, msg}) => {
+        }, ({code, msg}) => {
             console.log(code, msg);
         });
     },
 
     /// 网络请求
-    getInformation() {
-        return new Promise((resolve, reject) => {
+    getInformation(success, fail) {
             // 获取目标用户的建筑
-            HomeApi.getInformation((respondData) => {
-                resolve(respondData);
-            }, (code, msg) => {
-                reject({code, msg});
-            });
-        })
+        HomeApi.getInformation(success, fail);
     },
 
     onDestroy() {
@@ -369,7 +377,7 @@ cc.Class({
         this.sliderNode.getComponent('HomeSideCtrl').handelShowRedDot();
 
         //是否已经领取过神秘礼物
-        if (!Global.appletAward && CC_WECHATGAME) {
+        if (!GameGlobal.appletAward && CC_WECHATGAME) {
             this.luckyBagButton.node.active = true;
             var offset = 0;
             if (this.winSize.height >= this.XHeight) {
@@ -399,8 +407,8 @@ cc.Class({
     //处理邀请好友
     processShareAction() {
         //邀请好友和好友助力的分享链接进入
-        if (Global.shareType == ShareAction.INVITE_FRIEND) {
-            let shareUid = Global.shareUid;
+        if (GameGlobal.shareType == ShareAction.INVITE_FRIEND) {
+            let shareUid = GameGlobal.shareUid;
             InviteApi.postInviteFriend(shareUid, () => {
 
             });

+ 8 - 7
assets/scripts/game/GameShop.js

@@ -5,6 +5,7 @@ const StoreApi = require('../net/StoreApi');
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
 const TapTapTool = require("../utils/TapTapTool");
 const GameModule = require("../utils/GameModule");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -24,7 +25,7 @@ cc.Class({
     },
 
     handelUserShops() {
-        let shops = Global.shops;
+        let shops = GameGlobal.shops;
         this._mtArr = [];
         this._useTimeArr = [];
         this._diamondShopCoinTime = 0;
@@ -48,11 +49,11 @@ cc.Class({
                     GameModule.userInfo.refreshSecondText();
                 }
                 let objct = {'cdTime': 15 * 60 * 1000, 'infoDesc': infoDesc, 'icon': 900004, 'sId': 12, 'type': 1};
-                Global._timeInformations.push(objct);
+                GameGlobal._timeInformations.push(objct);
                 GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
             } else {
-                for(let i = 0; i < Global._timeInformations.length; ++i) {
-                    let information = Global._timeInformations[i];
+                for(let i = 0; i < GameGlobal._timeInformations.length; ++i) {
+                    let information = GameGlobal._timeInformations[i];
                     if (information.type == 1 && information.sId == 12) {
                         information.cdTime += 15 * 60 * 1000;
                         break;
@@ -147,7 +148,7 @@ cc.Class({
 
         //// 如果是长按点击的商品
         if (shop.shopId == 4) {
-            Global.isLongPressClick = true;
+            GameGlobal.isLongPressClick = true;
         }
     },
 
@@ -157,12 +158,12 @@ cc.Class({
         let desc = shopData.infoDesc + '';
         if (shopData.minuteTime > 0 && shopData.cdTime > 0) {
             let shopObjc = {'cdTime': shopData.cdTime, 'infoDesc': desc, 'icon': shopData.icon, 'sId': shopData.shopId, 'type': 1};
-            Global._timeInformations.push(shopObjc);
+            GameGlobal._timeInformations.push(shopObjc);
             GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
             /// 说明不是需要时间cd的 
         } else {
             let shopObjc = {'cdTime': -6 * 1000, 'infoDesc': desc, 'icon': shopData.icon, 'sId': shopData.shopId, 'type': 1};
-            Global._fixInformations.push(shopObjc);
+            GameGlobal._fixInformations.push(shopObjc);
             GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1);
         }
     },

+ 16 - 16
assets/scripts/game/GameSkill.js

@@ -12,7 +12,7 @@ cc.Class({
     onLoad () {
         GameModule.skill = this;
         this.multiple = {'n': 1, 'e': 0};
-        this.skills = Global.skills;
+        this.skills = GameGlobal.skills;
 
         //判断是否正在使用技能3
         this.isUsingSkill3 = false;
@@ -173,18 +173,18 @@ cc.Class({
             // console.log('skill 1 ' + this.skill1Info.tdStarTime);
         }
 
-        if (Global.friendRewardCdTime > 0) {
+        if (GameGlobal.friendRewardCdTime > 0) {
             if (onHideTime) {
                 if (difference > 0) {
-                    let isPast = difference > Global.friendRewardCdTime;  //大于的话就是已超过使用技能的时间戳
+                    let isPast = difference > GameGlobal.friendRewardCdTime;  //大于的话就是已超过使用技能的时间戳
                     if (isPast) {
-                        Global.friendRewardCdTime = 0;
+                        GameGlobal.friendRewardCdTime = 0;
                         this.updateAutoGetGold();
                     } else {
-                        Global.friendRewardCdTime = Global.friendRewardCdTime - difference;
+                        GameGlobal.friendRewardCdTime = GameGlobal.friendRewardCdTime - difference;
                     }
                 } else {
-                    Global.friendRewardCdTime = 0;
+                    GameGlobal.friendRewardCdTime = 0;
                     this.updateAutoGetGold();
                 }
             }
@@ -284,10 +284,10 @@ cc.Class({
         }
 
         //好友助力技能使用中
-        if (Global.friendRewardCdTime > 0) {
-            Global.friendRewardCdTime -= (1 * 1000 );
-            if (Global.friendRewardCdTime <= 0) {
-                Global.friendRewardCdTime = 0;
+        if (GameGlobal.friendRewardCdTime > 0) {
+            GameGlobal.friendRewardCdTime -= (1 * 1000 );
+            if (GameGlobal.friendRewardCdTime <= 0) {
+                GameGlobal.friendRewardCdTime = 0;
                 this.updateAutoGetGold();
             }
         }
@@ -313,7 +313,7 @@ cc.Class({
             click += skill4.cc / skill4.iv;
         }
 
-        if (Global.friendRewardCdTime > 0) {
+        if (GameGlobal.friendRewardCdTime > 0) {
             click += 10;
         }
 
@@ -351,7 +351,7 @@ cc.Class({
             return null;
         }
 
-        let skillInfo = Global.BuildingManager.getSkillLevelInfo(this.skill1Info.skillId, this.skill1Info.skillLevel);
+        let skillInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skill1Info.skillId, this.skill1Info.skillLevel);
         return skillInfo;
     },
 
@@ -365,7 +365,7 @@ cc.Class({
             return null;
         }
         
-        let skillInfo = Global.BuildingManager.getSkillLevelInfo(this.skill3Info.skillId, this.skill3Info.skillLevel);
+        let skillInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skill3Info.skillId, this.skill3Info.skillLevel);
         this.multiple = {'n': skillInfo.mt, 'e': 0};
         GameModule.userInfo.multiple = this.multiple;
 
@@ -379,7 +379,7 @@ cc.Class({
             return null;
         }
 
-        let skillInfo = Global.BuildingManager.getSkillLevelInfo(this.skill4Info.skillId, this.skill4Info.skillLevel);
+        let skillInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skill4Info.skillId, this.skill4Info.skillLevel);
         return skillInfo;
     },
 
@@ -389,7 +389,7 @@ cc.Class({
             return 1;
         }
 
-        let skillInfo = Global.BuildingManager.getSkillLevelInfo(this.skill5Info.skillId, this.skill5Info.skillLevel);
+        let skillInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skill5Info.skillId, this.skill5Info.skillLevel);
         let mt = skillInfo.mt;
         return mt;
     },
@@ -399,7 +399,7 @@ cc.Class({
         let skillInfo = this.skills.find(n => {
             return n.skillId == 6;
         });
-        skillInfo = Global.BuildingManager.getSkillLevelInfo(skillInfo.skillId, skillInfo.skillLevel);
+        skillInfo = GameGlobal.BuildingManager.getSkillLevelInfo(skillInfo.skillId, skillInfo.skillLevel);
         let rcd = (1 - skillInfo.rcd);
         return rcd;
     },

+ 5 - 5
assets/scripts/game/GameTabbar.js

@@ -64,17 +64,17 @@ cc.Class({
     },
 
     updateRedDot () {
-        if (Global._gold10 === undefined) {
+        if (GameGlobal._gold10 === undefined) {
             return;
         }
-        if (TapTapTool.compare(GameModule.userInfo.gold, Global._gold10)) {
+        if (TapTapTool.compare(GameModule.userInfo.gold, GameGlobal._gold10)) {
             this.skillRedNode.active = true;
             /// 如果是小于 说明金币不满足
         } else if (this.skillRedNode.active == true) {
             this.skillRedNode.active = false;
         }
 
-        if (TapTapTool.compare(GameModule.userInfo.gold, Global._buyStarGold)) {
+        if (TapTapTool.compare(GameModule.userInfo.gold, GameGlobal._buyStarGold)) {
             this.starRedNode.active = true;
         } else {
             this.starRedNode.active = false;
@@ -86,12 +86,12 @@ cc.Class({
     },
 
     handelHomeTabbarShowRedDot() {
-        if (Global._redTypes == null || Global._redTypes == undefined || Global._redTypes.length == 0) {
+        if (GameGlobal._redTypes == null || GameGlobal._redTypes == undefined || GameGlobal._redTypes.length == 0) {
             this.skillRedNode.active = false;
             this.starRedNode.active = false;
             return;
         }
-        let redTypes = Global._redTypes;
+        let redTypes = GameGlobal._redTypes;
         
         // this.skillRedNode.active = redTypes.indexOf(GameRedDot.skill) != -1;
         let starActive = redTypes.indexOf(GameRedDot.star) != -1

+ 11 - 12
assets/scripts/game/HomeGuide.js

@@ -342,7 +342,7 @@ cc.Class({
 
         this.setupAllFinished();
 
-        if (Global.debug) {
+        if (GameGlobal.debug) {
             for(let i = 0; i < 35; i++) {
                 let state = `state${i}`;
                 if (this.guideState[state] != undefined) {
@@ -439,11 +439,10 @@ cc.Class({
         // 判断满足以下条件时为已完成购买明星前的教程:
         // 1. 总部大楼大于25级
         // 2. 已拥有1个明星
+        let unLockStatus1 = GameGlobal.userData.buildingLevel >= 25;
+        let unLockStatus2 = GameGlobal.userData.buyStarCount > 0;
         // 3. 是否已签到过
-        let unLockStatus1 = Global.userData.buildingLevel >= 25;
-        let unLockStatus2 = Global.userData.buyStarCount > 0;
-        let unLockStatus3 = Global.signCount > 0;
-
+        let unLockStatus3 = GameGlobal.signCount > 0;
         if (unLockStatus1 && unLockStatus2) {
             if (unLockStatus3) {
                 for(let i = 1; i < 35; i++) {
@@ -810,7 +809,7 @@ cc.Class({
         if (this.curState == 'state7') {
             this.taskCoditionLabel.string = `${TapTapTool.parseToString(GameModule.userInfo.gold)}/${target.taskCodition}`;
         } else if (this.curState == 'state21') {
-            let level = Global.BuildingManager.getRoomLevel(1);
+            let level = GameGlobal.BuildingManager.getRoomLevel(1);
             this.taskCoditionLabel.string = `(${level}/${target.taskCodition})`;
         } else if (this.curState == 'state13' || this.curState == 'state15') {
             let currentLevel = GameModule.userInfo.buildingLevel;
@@ -1334,7 +1333,7 @@ cc.Class({
         if (this.curState == 'state33') {
             this.node.emit(`Fire_${this.curState}`);
             this.handlePass(this.curState);
-            if (Global.isSignAward == false) {
+            if (GameGlobal.isSignAward == false) {
                 this.handleState('state34');
             }
         }
@@ -1440,10 +1439,10 @@ cc.Class({
     guideTask21() {
         if (this.curState == 'state21') {
             let target = this.guideState[this.curState];
-            let level = Global.BuildingManager.getRoomLevel(1);
+            let level = GameGlobal.BuildingManager.getRoomLevel(1);
             this.taskCoditionLabel.string = `(${level}/${target.taskCodition})`;
 
-            let data = Global.BuildingManager.getBuildingInfo(1, level);
+            let data = GameGlobal.BuildingManager.getBuildingInfo(1, level);
 
             // 判断是否已经解锁
             if (data.isUnlocked || level > 0) {
@@ -1497,7 +1496,7 @@ cc.Class({
         let maxLevel = (25 - level) > 5 ? (level + 5) : 25;
         let buildingGold = {'n': 0, 'e': 0};
         for (let i = level; i <= maxLevel; ++ i) {
-            let data = Global.BuildingManager.getBuildingInfo(1, level);
+            let data = GameGlobal.BuildingManager.getBuildingInfo(1, level);
             buildingGold = TapTapTool.add(buildingGold, data.nextUpGold);
         }
         return buildingGold;
@@ -1506,10 +1505,10 @@ cc.Class({
     guideTask24() {
         if (this.curState == 'state24') {
             let target = this.guideState[this.curState];
-            let level = Global.BuildingManager.getRoomLevel(1);
+            let level = GameGlobal.BuildingManager.getRoomLevel(1);
             this.taskCoditionLabel.string = `(${level}/${target.taskCodition})`;
 
-            let data = Global.BuildingManager.getBuildingInfo(1, level);
+            let data = GameGlobal.BuildingManager.getBuildingInfo(1, level);
 
             // 判断是否已经解锁
             if (data.isUnlocked || level > 0) {

+ 6 - 6
assets/scripts/game/HomeSideCtrl.js

@@ -46,13 +46,13 @@ cc.Class({
         }, 500, true);
 
         //判断正在审核中的版本隐藏商城、抽奖按钮
-        if (Global.isCheck) {
+        if (GameGlobal.isCheck) {
             this.storeNode.active = false;
             this.drawNode.active = false;
         }
 
         //判断正在审核中的版本隐藏7天登录按钮或已完成7天登录任务
-        if (Global.isCheck || (Global.userLoginReward.isLoginReward && Global.userLoginReward.rewardCount == 7)) {
+        if (GameGlobal.isCheck || (GameGlobal.userLoginReward.isLoginReward && GameGlobal.userLoginReward.rewardCount == 7)) {
             this.loginRewardNode.active = false;
             this.moreContentWidth = 225;
         } else {
@@ -78,8 +78,8 @@ cc.Class({
     },
 
     _loadStoreDiscountSprite() {
-        if (Global._shopZk > 0) {
-            let url = Global.debug ? `https://pub.dwstatic.com/wxgame/taptapstar_test/assets/shop_${Global._shopZk}.png` : `https://pub.dwstatic.com/wxgame/taptapstar/assets/shop_${Global._shopZk}.png`;
+        if (GameGlobal._shopZk > 0) {
+            let url = GameGlobal.debug ? `https://pub.dwstatic.com/wxgame/taptapstar_test/assets/shop_${GameGlobal._shopZk}.png` : `https://pub.dwstatic.com/wxgame/taptapstar/assets/shop_${GameGlobal._shopZk}.png`;
             DWTool.loadSpriteFrame(url).then( (spriteFrame) => {
                 this.storeNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
             }).catch((err) => {
@@ -123,7 +123,7 @@ cc.Class({
     },
 
     handelShowRedDot() {
-        if (Global._redTypes == null || Global._redTypes == undefined || Global._redTypes.length == 0) {
+        if (GameGlobal._redTypes == null || GameGlobal._redTypes == undefined || GameGlobal._redTypes.length == 0) {
             this.taskRedNode.active = false;
             this.drawRedNode.active = false;
             this.storeRedNode.active = false;
@@ -134,7 +134,7 @@ cc.Class({
             return;
         }
 
-        let redTypes = Global._redTypes;
+        let redTypes = GameGlobal._redTypes;
         this.taskRedNode.active = (redTypes.indexOf(GameRedDot.mainTask) != -1 || redTypes.indexOf(GameRedDot.dayTask) != -1);
         this.drawRedNode.active = redTypes.indexOf(GameRedDot.draw) != -1;
         this.inviteFriendRedNode.active = redTypes.indexOf(GameRedDot.inviteFriend) != -1;

+ 4 - 4
assets/scripts/game/MoneyCat.js

@@ -54,7 +54,7 @@ cc.Class({
 
         GameEvent.on('just_cat_hit', this, this.catHit);
 
-        if (Global.isLongPressClick) {
+        if (GameGlobal.isLongPressClick) {
             this.addLongTap();
         }
 
@@ -70,7 +70,7 @@ cc.Class({
              //// 如果有购买商品 一秒钟点击十次
             // console.log('开始点击');
             if (!this._isTouch) {
-                if (Global.isLongPressClick === true) {
+                if (GameGlobal.isLongPressClick === true) {
                     /// 最起码要按住1秒
                     this._addClick = false;
                     this._timeCount = 0;
@@ -84,7 +84,7 @@ cc.Class({
         this.node.on(cc.Node.EventType.TOUCH_END, (event) => {
             // console.log("点击结束");
             if (this._isTouch) {
-                if (Global.isLongPressClick === true && this._addClick) {
+                if (GameGlobal.isLongPressClick === true && this._addClick) {
                     
                     let clickCount = 1 / GameModule.userInfo.secondClick;
                     clickCount -= 10;
@@ -106,7 +106,7 @@ cc.Class({
             // console.log('移动');
            
             if (this._isTouch && ( Math.abs(x - startLocation.x) > 10 || Math.abs(y - startLocation.y) > 10)) {
-                if (Global.isLongPressClick === true && this._addClick) {
+                if (GameGlobal.isLongPressClick === true && this._addClick) {
                     let clickCount = 1 / GameModule.userInfo.secondClick;
                     clickCount -= 10;
                     GameModule.userInfo.secondClick = 1 / clickCount;

+ 5 - 5
assets/scripts/game/OfflineGrossIncome.js

@@ -78,7 +78,7 @@ cc.Class({
         this._resetBtn();
         if (CC_WECHATGAME) {
             //判断是否是正在审核的版本,是的话将隐藏分享到群的按钮
-            if (Global.isCheck) {
+            if (GameGlobal.isCheck) {
                 this.videoBtn.active = false;
                 this.shareBtn.active = false;
                 this.normalBtn.active = true;
@@ -124,10 +124,10 @@ cc.Class({
         }
 
         //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this.videoBtn.active = true;
             this.shareBtn.active = false;
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this.videoBtn.active = false;
             this.shareBtn.active = true;
         }
@@ -183,7 +183,7 @@ cc.Class({
     watchVideo() {
         GameModule.audioMng.playClickButton();
         this.videoBtn.getComponent(cc.Button).interactable = false;
-        Global._adVideo.showVideo('offlineIncome');
+        GameGlobal._adVideo.showVideo('offlineIncome');
     },
 
     /**
@@ -191,7 +191,7 @@ cc.Class({
      */
     share() {
         GameModule.audioMng.playClickButton();
-        if (CC_WECHATGAME) {
+        if (CC_WECHATGAME || CC_QQPLAY) {
             this.shareBtn.getComponent(cc.Button).interactable = false;
             GameEvent.on(GameNotificationKey.ShowShareAction, this, (type, isOk) => {
                 if (type == WechatShareType.OfflineIncome) {

+ 1 - 1
assets/scripts/invite/FriendHelpClick.js

@@ -61,7 +61,7 @@ cc.Class({
         }, () => {
             console.log('分享失败或取消');
         });
-        Global.isIgnoreShareStatus = true;
+        GameGlobal.isIgnoreShareStatus = true;
     },
 
     // update (dt) {},

+ 7 - 7
assets/scripts/invite/FriendHelpItem.js

@@ -64,22 +64,22 @@ cc.Class({
             }
             this.refreshButtonState();
             let isNew = true;
-            for (let i = 0; i < Global._timeInformations.length; ++ i) {
-                let information = Global._timeInformations[i];
+            for (let i = 0; i < GameGlobal._timeInformations.length; ++ i) {
+                let information = GameGlobal._timeInformations[i];
                 if (information.type == 3) {
                     /// 如果是已经使用过的直接刷新时间就可以啦
-                    information.cdTime = Global.friendRewardCdTime;
+                    information.cdTime = GameGlobal.friendRewardCdTime;
                     isNew = false;
                     break;
                 }
             }
             if (isNew) {
-                let messageItem = {'cdTime': Global.friendRewardCdTime, 'type': 3};
-                Global._timeInformations.push(messageItem);
+                let messageItem = {'cdTime': GameGlobal.friendRewardCdTime, 'type': 3};
+                GameGlobal._timeInformations.push(messageItem);
                 GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
             }
         }, (error) => {
-            Global.commonAlert.showCommonErrorAlert("领取失败");
+            GameGlobal.commonAlert.showCommonErrorAlert("领取失败");
         });
     },
 
@@ -88,7 +88,7 @@ cc.Class({
         this.model.status = QuestMainMissionType.AlreadyGet;
         this.hideAllButton();
         this.finishButton.node.active = true;
-        Global.friendRewardCdTime += this.model.time * 1000;
+        GameGlobal.friendRewardCdTime += this.model.time * 1000;
         GameEvent.fire(GameNotificationKey.GainFriendHelpClick);
     }
 

+ 2 - 2
assets/scripts/invite/InviteMission.js

@@ -28,7 +28,7 @@ cc.Class({
 
     onLoad() {
 
-        if (Global.winSize.height <= 1000) {
+        if (GameGlobal.winSize.height <= 1000) {
             this.contentNode.height = 820;
         }
 
@@ -126,6 +126,6 @@ cc.Class({
         }, () => {
             console.log('分享失败或取消');
         });
-        Global.isIgnoreShareStatus = true;
+        GameGlobal.isIgnoreShareStatus = true;
     },
 });

+ 1 - 1
assets/scripts/invite/InviteMissionItem.js

@@ -83,7 +83,7 @@ cc.Class({
             }
             this.refreshButtonState();
         }, (error) => {
-            Global.commonAlert.showCommonErrorAlert("领取失败");
+            GameGlobal.commonAlert.showCommonErrorAlert("领取失败");
         });
     },
 

+ 15 - 29
assets/scripts/levelHome/LevelHome.js

@@ -2,6 +2,7 @@ const GameModule = require("../utils/GameModule");
 const {GameNotificationKey} = require('../utils/GameEnum');
 const AlertManager = require('../utils/AlertManager');
 const TapTapTool = require("../utils/TapTapTool");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -113,7 +114,6 @@ cc.Class({
 
         this.getUserBuildings()
             .then((userRooms) => {
-
             // 清空数据
             this.buildingInfos = [];
 
@@ -122,7 +122,7 @@ cc.Class({
             // 离线收益金币数量
             // let offlineGrossIncome = 0;
             sortArray.map((value, index, array) => {
-                let model = Global.BuildingManager.getBuildingInfo(value.roomId, value.roomLevel);
+                let model = GameGlobal.BuildingManager.getBuildingInfo(value.roomId, value.roomLevel);
                 this._unlockBuilding[index] = model.isUnlocked ? 1 : 0;
 
                 if (value.roomStars == undefined) {
@@ -158,47 +158,33 @@ cc.Class({
             }
 
             //第一层楼是否已经解锁
-            if (!Global.BuildingManager.getRoomIsUnlocked(1) || Global.BuildingManager.getRoomLevel(1) < 5) {
+            if (!GameGlobal.BuildingManager.getRoomIsUnlocked(1) || GameGlobal.BuildingManager.getRoomLevel(1) < 5) {
                 let guide = GameModule.homeGuide.getComponent('HomeGuide');
                 if (guide.isPassGuideState('state15') || guide.isPassGuideState('state16') || guide.isPassGuideState('state17') || guide.isPassGuideState('state20')) {
                     GameModule.homeGuide.getComponent('HomeGuide').handleState('state21');
                 }
                 this.scrollViewMng.configGuide();
-            } else if (Global.BuildingManager.getRoomLevel(1) < 25) {
+            } else if (GameGlobal.BuildingManager.getRoomLevel(1) < 25) {
                 GameModule.homeGuide.getComponent('HomeGuide').handleGuideStateNext('state21', 'state24');
                 this.scrollViewMng.configGuide();
             }
-        })
-        .then((buildingItems) => {
-
-            for (const roomId in buildingItems) {
-
-                let itemScript;
-                let filterList = this.buildings.filter( item => item.buildingInfo.roomId === parseInt(roomId) ) || [];
-                if (filterList.length > 0) { itemScript = filterList[0]; }
-
-                if (buildingItems.hasOwnProperty(roomId)) {
-                    let prop = buildingItems[roomId];
-                    itemScript.configProp(prop);
-                }
-            }
-        })
-        .catch((err) => {
+        }).catch((err) => {
             console.log(err);
         });
-    },
+        },
 
     getUserBuildings() {
         return new Promise((resolve, reject) => {
             // 返回用户的建筑等级
-            if (Global.BuildingManager.networkRooms && Global.BuildingManager.networkRooms.length > 0) {
-                resolve(Global.BuildingManager.networkRooms);
+            if (GameGlobal.BuildingManager.networkRooms && GameGlobal.BuildingManager.networkRooms.length > 0) {
+                resolve(GameGlobal.BuildingManager.networkRooms);
             } else {
                 reject('error');
             }
         })
     },
 
+
     configBuildings() {
         this.refreshAllbuildingGoldRate();
 
@@ -247,7 +233,7 @@ cc.Class({
      * @param {Number} offlineGrossIncome 离线收益金币数量
      */
     configOffIncome() {
-        let offlineGold = Global.offlineGold;
+        let offlineGold = GameGlobal.offlineGold;
         // AlertManager.showOfflineGrossIncome(offlineGold);
         // return;
         let lastTime = cc.sys.localStorage.getItem('offlineLastTime');
@@ -266,7 +252,7 @@ cc.Class({
             // 4. 已签到过一次
             let unLockStatus2 = GameModule.userInfo.buildingLevel >= 25;
             let unLockStatus3 = GameModule.userInfo.buyStarCount > 0;
-            let unLockStatus4 = Global.signCount > 0;
+            let unLockStatus4 = GameGlobal.signCount > 0;
             // showOffLineUI: 用户每次进入游戏离线收益只会显示1次
             if (this.showOffLineUI && unLockStatus2 && unLockStatus3 && unLockStatus4) {
                 this.showOffLineUI = false;
@@ -290,7 +276,7 @@ cc.Class({
             // let unLockStatus1 = curTime - lastTime > 1 * 1000;
             let unLockStatus2 = GameModule.userInfo.buildingLevel >= 25;
             let unLockStatus3 = GameModule.userInfo.buyStarCount > 0;
-            let unLockStatus4 = Global.signCount > 0;
+            let unLockStatus4 = GameGlobal.signCount > 0;
             // showOffLineUI: 用户每次进入游戏离线收益只会显示1次
             if (this.showOffLineUI && unLockStatus1 && unLockStatus2 && unLockStatus3 && unLockStatus4) {
                 this.showOffLineUI = false;
@@ -304,8 +290,8 @@ cc.Class({
         // 2. 已拥有1个明星
         let unLockStatus1 = GameModule.userInfo.buildingLevel >= 25;
         let unLockStatus2 = GameModule.userInfo.buyStarCount > 0;
-        if (!Global.isSignAward && unLockStatus1 && unLockStatus2) {
-            if (Global.signCount == 0) {
+        if (!GameGlobal.isSignAward && unLockStatus1 && unLockStatus2) {
+            if (GameGlobal.signCount == 0) {
                 GameModule.homeGuide.getComponent('HomeGuide').handleGuideStateNext('state31', 'state34');
             }
             AlertManager.showSignInAlert();
@@ -340,7 +326,7 @@ cc.Class({
         GameModule.userInfo.rateGold = totalRate;
         GameEvent.fire(GameNotificationKey.UpBuildingLevel);
 
-        cc.sys.localStorage.setItem(`localRooms_${Global.user.uid}`, JSON.stringify(this.buildingInfos));
+        cc.sys.localStorage.setItem(`localRooms_${GameGlobal.user.uid}`, JSON.stringify(this.buildingInfos));
     },
 
     //获取房间里程碑

+ 3 - 3
assets/scripts/levelHome/LevelHomeAward.js

@@ -42,15 +42,15 @@ cc.Class({
             this.pickupCallback(responseData.awardCount);
             GameEvent.fire(GameNotificationKey.GetRoomAward,responseData);
 
-            let roomName = Global.BuildingManager.getRoomName(this.roomId);
+            let roomName = GameGlobal.BuildingManager.getRoomName(this.roomId);
             GameEvent.fire(GameNotificationKey.GameShowAdditionTips,roomName,1);
             let objct = {'cdTime': -6 * 1000, 'infoDesc': roomName + ' 提升2倍的金币产出', 'icon': 900001};
-            Global._fixInformations.push(objct);
+            GameGlobal._fixInformations.push(objct);
             GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, false);
 
         },(errCode, errMsg) => {
             this.isGetting = false;
-            Global.commonAlert.showCommonErrorAlert("领取奖励失败");
+            GameGlobal.commonAlert.showCommonErrorAlert("领取奖励失败");
         });
 
         if (!GameModule.homeGuide.getComponent('HomeGuide').isPassGuideState('state27')) {

+ 9 - 9
assets/scripts/levelHome/LevelHomeItem.js

@@ -203,9 +203,9 @@ cc.Class({
         }
 
         //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this._adState = 2;
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 1;
         }
         this.refreshWatchVideoUI();
@@ -237,7 +237,7 @@ cc.Class({
                 let adObject = new Object();
                 adObject.type = 'updateRoom';
                 adObject.roomId = this.data.roomId;
-                Global._adVideo.showVideo(adObject);
+                GameGlobal._adVideo.showVideo(adObject);
             }
         }
     },
@@ -245,9 +245,9 @@ cc.Class({
     finishVideoOrShare(roomId) {
         if (this.data.roomId == roomId) {
             HomeApi.reportInformation(2, () => {
-                Global._upRoomInfo.count += 1;
+                GameGlobal._upRoomInfo.count += 1;
                 /// 时间重置为5分钟
-                Global._upRoomInfo.cdTime = 5 * 60 * 1000;
+                GameGlobal._upRoomInfo.cdTime = 5 * 60 * 1000;
 
                 this.updateBuildingEvent(true);
                 this.refreshWatchVideoUI();
@@ -314,7 +314,7 @@ cc.Class({
         // console.log(GameModule.skill.isUsingSkill3);
 
         // 判断是否有下一级, 没有的话就是满级
-        if (data.hasNext === 1 && data.level < Global.BuildingManager.getLevelCount(data.roomId)) {
+        if (data.hasNext === 1 && data.level < GameGlobal.BuildingManager.getLevelCount(data.roomId)) {
 
             // 判断是否已经解锁
             if (data.isUnlocked) {
@@ -352,7 +352,7 @@ cc.Class({
                 if (TapTapTool.compare(GameModule.userInfo.gold, data.nextUpGold)) {
                     this.setState(RoomState.Update);
                 } else {
-                    let isAd = DWTool.checkIsOldUser() && Global._upRoomInfo != undefined && Global._upRoomInfo.count < Global._upRoomInfo.maxCount && Global._upRoomInfo.cdTime <= 0;
+                    let isAd = DWTool.checkIsOldUser() && GameGlobal._upRoomInfo != undefined && GameGlobal._upRoomInfo.count < GameGlobal._upRoomInfo.maxCount && GameGlobal._upRoomInfo.cdTime <= 0;
                     if (isAd) {
                         this.setState(RoomState.WatchVideo);
                     } else {
@@ -594,10 +594,10 @@ cc.Class({
         GameModule.audioMng.playUpdateBuilding();
 
         // 从配置文件里获取
-        let maxLevel = Global.BuildingManager.getLevelCount(this.data.roomId);
+        let maxLevel = GameGlobal.BuildingManager.getLevelCount(this.data.roomId);
         let nextLevel = this.data.level + 1;
         let level = nextLevel > maxLevel ? maxLevel : nextLevel;
-        let buildModel = Global.BuildingManager.getBuildingInfo(this.data.roomId, level);
+        let buildModel = GameGlobal.BuildingManager.getBuildingInfo(this.data.roomId, level);
 
         buildModel.roomStars = this.data.roomStars;
         buildModel.roomMt = this.data.roomMt;

+ 3 - 3
assets/scripts/levelHome/LevelHomeListAdapter.js

@@ -34,7 +34,7 @@ cc.Class({
         this.scrollView.node.on(cc.Node.EventType.TOUCH_START, (event) => {
             //// 如果有购买商品 一秒钟点击十次
             if (!this._isTouch) {
-                if (Global.isLongPressClick === true) {
+                if (GameGlobal.isLongPressClick === true) {
                     /// 最起码要按住1秒
                     this._isTouch = true;
                     this._addClick = false;
@@ -50,7 +50,7 @@ cc.Class({
         this.scrollView.node.on(cc.Node.EventType.TOUCH_CANCEL, () => {
             /// 防止多点点击
             if (this._isTouch) {
-                if (Global.isLongPressClick === true && this._addClick) {
+                if (GameGlobal.isLongPressClick === true && this._addClick) {
                     let clickCount = 1 / GameModule.userInfo.secondClick;
                     clickCount -= 10;
                     GameModule.userInfo.secondClick = 1 / clickCount;
@@ -72,7 +72,7 @@ cc.Class({
         this.scrollView.node.on(cc.Node.EventType.TOUCH_END, (event) => {
             /// 防止多点点击
             if (this._isTouch) {
-                if (Global.isLongPressClick === true && this._addClick) {
+                if (GameGlobal.isLongPressClick === true && this._addClick) {
                     let clickCount = 1 / GameModule.userInfo.secondClick;
                     clickCount -= 10;
                     GameModule.userInfo.secondClick = 1 / clickCount;

+ 1183 - 0
assets/scripts/lib/es6-promise.js

@@ -0,0 +1,1183 @@
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license   Licensed under MIT license
+ *            See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
+ * @version   v4.2.5+7f2b526d
+ */
+
+(function (global, factory) {
+	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+	typeof define === 'function' && define.amd ? define(factory) :
+	(global.ES6Promise = factory());
+}(this, (function () { 'use strict';
+
+function objectOrFunction(x) {
+  var type = typeof x;
+  return x !== null && (type === 'object' || type === 'function');
+}
+
+function isFunction(x) {
+  return typeof x === 'function';
+}
+
+
+
+var _isArray = void 0;
+if (Array.isArray) {
+  _isArray = Array.isArray;
+} else {
+  _isArray = function (x) {
+    return Object.prototype.toString.call(x) === '[object Array]';
+  };
+}
+
+var isArray = _isArray;
+
+var len = 0;
+var vertxNext = void 0;
+var customSchedulerFn = void 0;
+
+var asap = function asap(callback, arg) {
+  queue[len] = callback;
+  queue[len + 1] = arg;
+  len += 2;
+  if (len === 2) {
+    // If len is 2, that means that we need to schedule an async flush.
+    // If additional callbacks are queued before the queue is flushed, they
+    // will be processed by this flush that we are scheduling.
+    if (customSchedulerFn) {
+      customSchedulerFn(flush);
+    } else {
+      scheduleFlush();
+    }
+  }
+};
+
+function setScheduler(scheduleFn) {
+  customSchedulerFn = scheduleFn;
+}
+
+function setAsap(asapFn) {
+  asap = asapFn;
+}
+
+var browserWindow = typeof window !== 'undefined' ? window : undefined;
+var browserGlobal = browserWindow || {};
+var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
+var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+// test for web worker but not in IE10
+var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
+
+// node
+function useNextTick() {
+  // node version 0.10.x displays a deprecation warning when nextTick is used recursively
+  // see https://github.com/cujojs/when/issues/410 for details
+  return function () {
+    return process.nextTick(flush);
+  };
+}
+
+// vertx
+function useVertxTimer() {
+  if (typeof vertxNext !== 'undefined') {
+    return function () {
+      vertxNext(flush);
+    };
+  }
+
+  return useSetTimeout();
+}
+
+function useMutationObserver() {
+  var iterations = 0;
+  var observer = new BrowserMutationObserver(flush);
+  var node = document.createTextNode('');
+  observer.observe(node, { characterData: true });
+
+  return function () {
+    node.data = iterations = ++iterations % 2;
+  };
+}
+
+// web worker
+function useMessageChannel() {
+  var channel = new MessageChannel();
+  channel.port1.onmessage = flush;
+  return function () {
+    return channel.port2.postMessage(0);
+  };
+}
+
+function useSetTimeout() {
+  // Store setTimeout reference so es6-promise will be unaffected by
+  // other code modifying setTimeout (like sinon.useFakeTimers())
+  var globalSetTimeout = setTimeout;
+  return function () {
+    return globalSetTimeout(flush, 1);
+  };
+}
+
+var queue = new Array(1000);
+function flush() {
+  for (var i = 0; i < len; i += 2) {
+    var callback = queue[i];
+    var arg = queue[i + 1];
+
+    callback(arg);
+
+    queue[i] = undefined;
+    queue[i + 1] = undefined;
+  }
+
+  len = 0;
+}
+
+function attemptVertx() {
+  try {
+    var vertx = Function('return this')().require('vertx');
+    vertxNext = vertx.runOnLoop || vertx.runOnContext;
+    return useVertxTimer();
+  } catch (e) {
+    return useSetTimeout();
+  }
+}
+
+var scheduleFlush = void 0;
+// Decide what async method to use to triggering processing of queued callbacks:
+if (isNode) {
+  scheduleFlush = useNextTick();
+} else if (BrowserMutationObserver) {
+  scheduleFlush = useMutationObserver();
+} else if (isWorker) {
+  scheduleFlush = useMessageChannel();
+} else if (browserWindow === undefined && typeof require === 'function') {
+  scheduleFlush = attemptVertx();
+} else {
+  scheduleFlush = useSetTimeout();
+}
+
+function then(onFulfillment, onRejection) {
+  var parent = this;
+
+  var child = new this.constructor(noop);
+
+  if (child[PROMISE_ID] === undefined) {
+    makePromise(child);
+  }
+
+  var _state = parent._state;
+
+
+  if (_state) {
+    var callback = arguments[_state - 1];
+    asap(function () {
+      return invokeCallback(_state, child, callback, parent._result);
+    });
+  } else {
+    subscribe(parent, child, onFulfillment, onRejection);
+  }
+
+  return child;
+}
+
+/**
+  `Promise.resolve` returns a promise that will become resolved with the
+  passed `value`. It is shorthand for the following:
+
+  ```javascript
+  let promise = new Promise(function(resolve, reject){
+    resolve(1);
+  });
+
+  promise.then(function(value){
+    // value === 1
+  });
+  ```
+
+  Instead of writing the above, your code now simply becomes the following:
+
+  ```javascript
+  let promise = Promise.resolve(1);
+
+  promise.then(function(value){
+    // value === 1
+  });
+  ```
+
+  @method resolve
+  @static
+  @param {Any} value value that the returned promise will be resolved with
+  Useful for tooling.
+  @return {Promise} a promise that will become fulfilled with the given
+  `value`
+*/
+function resolve$1(object) {
+  /*jshint validthis:true */
+  var Constructor = this;
+
+  if (object && typeof object === 'object' && object.constructor === Constructor) {
+    return object;
+  }
+
+  var promise = new Constructor(noop);
+  resolve(promise, object);
+  return promise;
+}
+
+var PROMISE_ID = Math.random().toString(36).substring(2);
+
+function noop() {}
+
+var PENDING = void 0;
+var FULFILLED = 1;
+var REJECTED = 2;
+
+var TRY_CATCH_ERROR = { error: null };
+
+function selfFulfillment() {
+  return new TypeError("You cannot resolve a promise with itself");
+}
+
+function cannotReturnOwn() {
+  return new TypeError('A promises callback cannot return that same promise.');
+}
+
+function getThen(promise) {
+  try {
+    return promise.then;
+  } catch (error) {
+    TRY_CATCH_ERROR.error = error;
+    return TRY_CATCH_ERROR;
+  }
+}
+
+function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
+  try {
+    then$$1.call(value, fulfillmentHandler, rejectionHandler);
+  } catch (e) {
+    return e;
+  }
+}
+
+function handleForeignThenable(promise, thenable, then$$1) {
+  asap(function (promise) {
+    var sealed = false;
+    var error = tryThen(then$$1, thenable, function (value) {
+      if (sealed) {
+        return;
+      }
+      sealed = true;
+      if (thenable !== value) {
+        resolve(promise, value);
+      } else {
+        fulfill(promise, value);
+      }
+    }, function (reason) {
+      if (sealed) {
+        return;
+      }
+      sealed = true;
+
+      reject(promise, reason);
+    }, 'Settle: ' + (promise._label || ' unknown promise'));
+
+    if (!sealed && error) {
+      sealed = true;
+      reject(promise, error);
+    }
+  }, promise);
+}
+
+function handleOwnThenable(promise, thenable) {
+  if (thenable._state === FULFILLED) {
+    fulfill(promise, thenable._result);
+  } else if (thenable._state === REJECTED) {
+    reject(promise, thenable._result);
+  } else {
+    subscribe(thenable, undefined, function (value) {
+      return resolve(promise, value);
+    }, function (reason) {
+      return reject(promise, reason);
+    });
+  }
+}
+
+function handleMaybeThenable(promise, maybeThenable, then$$1) {
+  if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
+    handleOwnThenable(promise, maybeThenable);
+  } else {
+    if (then$$1 === TRY_CATCH_ERROR) {
+      reject(promise, TRY_CATCH_ERROR.error);
+      TRY_CATCH_ERROR.error = null;
+    } else if (then$$1 === undefined) {
+      fulfill(promise, maybeThenable);
+    } else if (isFunction(then$$1)) {
+      handleForeignThenable(promise, maybeThenable, then$$1);
+    } else {
+      fulfill(promise, maybeThenable);
+    }
+  }
+}
+
+function resolve(promise, value) {
+  if (promise === value) {
+    reject(promise, selfFulfillment());
+  } else if (objectOrFunction(value)) {
+    handleMaybeThenable(promise, value, getThen(value));
+  } else {
+    fulfill(promise, value);
+  }
+}
+
+function publishRejection(promise) {
+  if (promise._onerror) {
+    promise._onerror(promise._result);
+  }
+
+  publish(promise);
+}
+
+function fulfill(promise, value) {
+  if (promise._state !== PENDING) {
+    return;
+  }
+
+  promise._result = value;
+  promise._state = FULFILLED;
+
+  if (promise._subscribers.length !== 0) {
+    asap(publish, promise);
+  }
+}
+
+function reject(promise, reason) {
+  if (promise._state !== PENDING) {
+    return;
+  }
+  promise._state = REJECTED;
+  promise._result = reason;
+
+  asap(publishRejection, promise);
+}
+
+function subscribe(parent, child, onFulfillment, onRejection) {
+  var _subscribers = parent._subscribers;
+  var length = _subscribers.length;
+
+
+  parent._onerror = null;
+
+  _subscribers[length] = child;
+  _subscribers[length + FULFILLED] = onFulfillment;
+  _subscribers[length + REJECTED] = onRejection;
+
+  if (length === 0 && parent._state) {
+    asap(publish, parent);
+  }
+}
+
+function publish(promise) {
+  var subscribers = promise._subscribers;
+  var settled = promise._state;
+
+  if (subscribers.length === 0) {
+    return;
+  }
+
+  var child = void 0,
+      callback = void 0,
+      detail = promise._result;
+
+  for (var i = 0; i < subscribers.length; i += 3) {
+    child = subscribers[i];
+    callback = subscribers[i + settled];
+
+    if (child) {
+      invokeCallback(settled, child, callback, detail);
+    } else {
+      callback(detail);
+    }
+  }
+
+  promise._subscribers.length = 0;
+}
+
+function tryCatch(callback, detail) {
+  try {
+    return callback(detail);
+  } catch (e) {
+    TRY_CATCH_ERROR.error = e;
+    return TRY_CATCH_ERROR;
+  }
+}
+
+function invokeCallback(settled, promise, callback, detail) {
+  var hasCallback = isFunction(callback),
+      value = void 0,
+      error = void 0,
+      succeeded = void 0,
+      failed = void 0;
+
+  if (hasCallback) {
+    value = tryCatch(callback, detail);
+
+    if (value === TRY_CATCH_ERROR) {
+      failed = true;
+      error = value.error;
+      value.error = null;
+    } else {
+      succeeded = true;
+    }
+
+    if (promise === value) {
+      reject(promise, cannotReturnOwn());
+      return;
+    }
+  } else {
+    value = detail;
+    succeeded = true;
+  }
+
+  if (promise._state !== PENDING) {
+    // noop
+  } else if (hasCallback && succeeded) {
+    resolve(promise, value);
+  } else if (failed) {
+    reject(promise, error);
+  } else if (settled === FULFILLED) {
+    fulfill(promise, value);
+  } else if (settled === REJECTED) {
+    reject(promise, value);
+  }
+}
+
+function initializePromise(promise, resolver) {
+  try {
+    resolver(function resolvePromise(value) {
+      resolve(promise, value);
+    }, function rejectPromise(reason) {
+      reject(promise, reason);
+    });
+  } catch (e) {
+    reject(promise, e);
+  }
+}
+
+var id = 0;
+function nextId() {
+  return id++;
+}
+
+function makePromise(promise) {
+  promise[PROMISE_ID] = id++;
+  promise._state = undefined;
+  promise._result = undefined;
+  promise._subscribers = [];
+}
+
+function validationError() {
+  return new Error('Array Methods must be provided an Array');
+}
+
+var Enumerator = function () {
+  function Enumerator(Constructor, input) {
+    this._instanceConstructor = Constructor;
+    this.promise = new Constructor(noop);
+
+    if (!this.promise[PROMISE_ID]) {
+      makePromise(this.promise);
+    }
+
+    if (isArray(input)) {
+      this.length = input.length;
+      this._remaining = input.length;
+
+      this._result = new Array(this.length);
+
+      if (this.length === 0) {
+        fulfill(this.promise, this._result);
+      } else {
+        this.length = this.length || 0;
+        this._enumerate(input);
+        if (this._remaining === 0) {
+          fulfill(this.promise, this._result);
+        }
+      }
+    } else {
+      reject(this.promise, validationError());
+    }
+  }
+
+  Enumerator.prototype._enumerate = function _enumerate(input) {
+    for (var i = 0; this._state === PENDING && i < input.length; i++) {
+      this._eachEntry(input[i], i);
+    }
+  };
+
+  Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
+    var c = this._instanceConstructor;
+    var resolve$$1 = c.resolve;
+
+
+    if (resolve$$1 === resolve$1) {
+      var _then = getThen(entry);
+
+      if (_then === then && entry._state !== PENDING) {
+        this._settledAt(entry._state, i, entry._result);
+      } else if (typeof _then !== 'function') {
+        this._remaining--;
+        this._result[i] = entry;
+      } else if (c === Promise$1) {
+        var promise = new c(noop);
+        handleMaybeThenable(promise, entry, _then);
+        this._willSettleAt(promise, i);
+      } else {
+        this._willSettleAt(new c(function (resolve$$1) {
+          return resolve$$1(entry);
+        }), i);
+      }
+    } else {
+      this._willSettleAt(resolve$$1(entry), i);
+    }
+  };
+
+  Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
+    var promise = this.promise;
+
+
+    if (promise._state === PENDING) {
+      this._remaining--;
+
+      if (state === REJECTED) {
+        reject(promise, value);
+      } else {
+        this._result[i] = value;
+      }
+    }
+
+    if (this._remaining === 0) {
+      fulfill(promise, this._result);
+    }
+  };
+
+  Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
+    var enumerator = this;
+
+    subscribe(promise, undefined, function (value) {
+      return enumerator._settledAt(FULFILLED, i, value);
+    }, function (reason) {
+      return enumerator._settledAt(REJECTED, i, reason);
+    });
+  };
+
+  return Enumerator;
+}();
+
+/**
+  `Promise.all` accepts an array of promises, and returns a new promise which
+  is fulfilled with an array of fulfillment values for the passed promises, or
+  rejected with the reason of the first passed promise to be rejected. It casts all
+  elements of the passed iterable to promises as it runs this algorithm.
+
+  Example:
+
+  ```javascript
+  let promise1 = resolve(1);
+  let promise2 = resolve(2);
+  let promise3 = resolve(3);
+  let promises = [ promise1, promise2, promise3 ];
+
+  Promise.all(promises).then(function(array){
+    // The array here would be [ 1, 2, 3 ];
+  });
+  ```
+
+  If any of the `promises` given to `all` are rejected, the first promise
+  that is rejected will be given as an argument to the returned promises's
+  rejection handler. For example:
+
+  Example:
+
+  ```javascript
+  let promise1 = resolve(1);
+  let promise2 = reject(new Error("2"));
+  let promise3 = reject(new Error("3"));
+  let promises = [ promise1, promise2, promise3 ];
+
+  Promise.all(promises).then(function(array){
+    // Code here never runs because there are rejected promises!
+  }, function(error) {
+    // error.message === "2"
+  });
+  ```
+
+  @method all
+  @static
+  @param {Array} entries array of promises
+  @param {String} label optional string for labeling the promise.
+  Useful for tooling.
+  @return {Promise} promise that is fulfilled when all `promises` have been
+  fulfilled, or rejected if any of them become rejected.
+  @static
+*/
+function all(entries) {
+  return new Enumerator(this, entries).promise;
+}
+
+/**
+  `Promise.race` returns a new promise which is settled in the same way as the
+  first passed promise to settle.
+
+  Example:
+
+  ```javascript
+  let promise1 = new Promise(function(resolve, reject){
+    setTimeout(function(){
+      resolve('promise 1');
+    }, 200);
+  });
+
+  let promise2 = new Promise(function(resolve, reject){
+    setTimeout(function(){
+      resolve('promise 2');
+    }, 100);
+  });
+
+  Promise.race([promise1, promise2]).then(function(result){
+    // result === 'promise 2' because it was resolved before promise1
+    // was resolved.
+  });
+  ```
+
+  `Promise.race` is deterministic in that only the state of the first
+  settled promise matters. For example, even if other promises given to the
+  `promises` array argument are resolved, but the first settled promise has
+  become rejected before the other promises became fulfilled, the returned
+  promise will become rejected:
+
+  ```javascript
+  let promise1 = new Promise(function(resolve, reject){
+    setTimeout(function(){
+      resolve('promise 1');
+    }, 200);
+  });
+
+  let promise2 = new Promise(function(resolve, reject){
+    setTimeout(function(){
+      reject(new Error('promise 2'));
+    }, 100);
+  });
+
+  Promise.race([promise1, promise2]).then(function(result){
+    // Code here never runs
+  }, function(reason){
+    // reason.message === 'promise 2' because promise 2 became rejected before
+    // promise 1 became fulfilled
+  });
+  ```
+
+  An example real-world use case is implementing timeouts:
+
+  ```javascript
+  Promise.race([ajax('foo.json'), timeout(5000)])
+  ```
+
+  @method race
+  @static
+  @param {Array} promises array of promises to observe
+  Useful for tooling.
+  @return {Promise} a promise which settles in the same way as the first passed
+  promise to settle.
+*/
+function race(entries) {
+  /*jshint validthis:true */
+  var Constructor = this;
+
+  if (!isArray(entries)) {
+    return new Constructor(function (_, reject) {
+      return reject(new TypeError('You must pass an array to race.'));
+    });
+  } else {
+    return new Constructor(function (resolve, reject) {
+      var length = entries.length;
+      for (var i = 0; i < length; i++) {
+        Constructor.resolve(entries[i]).then(resolve, reject);
+      }
+    });
+  }
+}
+
+/**
+  `Promise.reject` returns a promise rejected with the passed `reason`.
+  It is shorthand for the following:
+
+  ```javascript
+  let promise = new Promise(function(resolve, reject){
+    reject(new Error('WHOOPS'));
+  });
+
+  promise.then(function(value){
+    // Code here doesn't run because the promise is rejected!
+  }, function(reason){
+    // reason.message === 'WHOOPS'
+  });
+  ```
+
+  Instead of writing the above, your code now simply becomes the following:
+
+  ```javascript
+  let promise = Promise.reject(new Error('WHOOPS'));
+
+  promise.then(function(value){
+    // Code here doesn't run because the promise is rejected!
+  }, function(reason){
+    // reason.message === 'WHOOPS'
+  });
+  ```
+
+  @method reject
+  @static
+  @param {Any} reason value that the returned promise will be rejected with.
+  Useful for tooling.
+  @return {Promise} a promise rejected with the given `reason`.
+*/
+function reject$1(reason) {
+  /*jshint validthis:true */
+  var Constructor = this;
+  var promise = new Constructor(noop);
+  reject(promise, reason);
+  return promise;
+}
+
+function needsResolver() {
+  throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
+}
+
+function needsNew() {
+  throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
+}
+
+/**
+  Promise objects represent the eventual result of an asynchronous operation. The
+  primary way of interacting with a promise is through its `then` method, which
+  registers callbacks to receive either a promise's eventual value or the reason
+  why the promise cannot be fulfilled.
+
+  Terminology
+  -----------
+
+  - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
+  - `thenable` is an object or function that defines a `then` method.
+  - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
+  - `exception` is a value that is thrown using the throw statement.
+  - `reason` is a value that indicates why a promise was rejected.
+  - `settled` the final resting state of a promise, fulfilled or rejected.
+
+  A promise can be in one of three states: pending, fulfilled, or rejected.
+
+  Promises that are fulfilled have a fulfillment value and are in the fulfilled
+  state.  Promises that are rejected have a rejection reason and are in the
+  rejected state.  A fulfillment value is never a thenable.
+
+  Promises can also be said to *resolve* a value.  If this value is also a
+  promise, then the original promise's settled state will match the value's
+  settled state.  So a promise that *resolves* a promise that rejects will
+  itself reject, and a promise that *resolves* a promise that fulfills will
+  itself fulfill.
+
+
+  Basic Usage:
+  ------------
+
+  ```js
+  let promise = new Promise(function(resolve, reject) {
+    // on success
+    resolve(value);
+
+    // on failure
+    reject(reason);
+  });
+
+  promise.then(function(value) {
+    // on fulfillment
+  }, function(reason) {
+    // on rejection
+  });
+  ```
+
+  Advanced Usage:
+  ---------------
+
+  Promises shine when abstracting away asynchronous interactions such as
+  `XMLHttpRequest`s.
+
+  ```js
+  function getJSON(url) {
+    return new Promise(function(resolve, reject){
+      let xhr = new XMLHttpRequest();
+
+      xhr.open('GET', url);
+      xhr.onreadystatechange = handler;
+      xhr.responseType = 'json';
+      xhr.setRequestHeader('Accept', 'application/json');
+      xhr.send();
+
+      function handler() {
+        if (this.readyState === this.DONE) {
+          if (this.status === 200) {
+            resolve(this.response);
+          } else {
+            reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
+          }
+        }
+      };
+    });
+  }
+
+  getJSON('/posts.json').then(function(json) {
+    // on fulfillment
+  }, function(reason) {
+    // on rejection
+  });
+  ```
+
+  Unlike callbacks, promises are great composable primitives.
+
+  ```js
+  Promise.all([
+    getJSON('/posts'),
+    getJSON('/comments')
+  ]).then(function(values){
+    values[0] // => postsJSON
+    values[1] // => commentsJSON
+
+    return values;
+  });
+  ```
+
+  @class Promise
+  @param {Function} resolver
+  Useful for tooling.
+  @constructor
+*/
+
+var Promise$1 = function () {
+  function Promise(resolver) {
+    this[PROMISE_ID] = nextId();
+    this._result = this._state = undefined;
+    this._subscribers = [];
+
+    if (noop !== resolver) {
+      typeof resolver !== 'function' && needsResolver();
+      this instanceof Promise ? initializePromise(this, resolver) : needsNew();
+    }
+  }
+
+  /**
+  The primary way of interacting with a promise is through its `then` method,
+  which registers callbacks to receive either a promise's eventual value or the
+  reason why the promise cannot be fulfilled.
+   ```js
+  findUser().then(function(user){
+    // user is available
+  }, function(reason){
+    // user is unavailable, and you are given the reason why
+  });
+  ```
+   Chaining
+  --------
+   The return value of `then` is itself a promise.  This second, 'downstream'
+  promise is resolved with the return value of the first promise's fulfillment
+  or rejection handler, or rejected if the handler throws an exception.
+   ```js
+  findUser().then(function (user) {
+    return user.name;
+  }, function (reason) {
+    return 'default name';
+  }).then(function (userName) {
+    // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
+    // will be `'default name'`
+  });
+   findUser().then(function (user) {
+    throw new Error('Found user, but still unhappy');
+  }, function (reason) {
+    throw new Error('`findUser` rejected and we're unhappy');
+  }).then(function (value) {
+    // never reached
+  }, function (reason) {
+    // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
+    // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
+  });
+  ```
+  If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
+   ```js
+  findUser().then(function (user) {
+    throw new PedagogicalException('Upstream error');
+  }).then(function (value) {
+    // never reached
+  }).then(function (value) {
+    // never reached
+  }, function (reason) {
+    // The `PedgagocialException` is propagated all the way down to here
+  });
+  ```
+   Assimilation
+  ------------
+   Sometimes the value you want to propagate to a downstream promise can only be
+  retrieved asynchronously. This can be achieved by returning a promise in the
+  fulfillment or rejection handler. The downstream promise will then be pending
+  until the returned promise is settled. This is called *assimilation*.
+   ```js
+  findUser().then(function (user) {
+    return findCommentsByAuthor(user);
+  }).then(function (comments) {
+    // The user's comments are now available
+  });
+  ```
+   If the assimliated promise rejects, then the downstream promise will also reject.
+   ```js
+  findUser().then(function (user) {
+    return findCommentsByAuthor(user);
+  }).then(function (comments) {
+    // If `findCommentsByAuthor` fulfills, we'll have the value here
+  }, function (reason) {
+    // If `findCommentsByAuthor` rejects, we'll have the reason here
+  });
+  ```
+   Simple Example
+  --------------
+   Synchronous Example
+   ```javascript
+  let result;
+   try {
+    result = findResult();
+    // success
+  } catch(reason) {
+    // failure
+  }
+  ```
+   Errback Example
+   ```js
+  findResult(function(result, err){
+    if (err) {
+      // failure
+    } else {
+      // success
+    }
+  });
+  ```
+   Promise Example;
+   ```javascript
+  findResult().then(function(result){
+    // success
+  }, function(reason){
+    // failure
+  });
+  ```
+   Advanced Example
+  --------------
+   Synchronous Example
+   ```javascript
+  let author, books;
+   try {
+    author = findAuthor();
+    books  = findBooksByAuthor(author);
+    // success
+  } catch(reason) {
+    // failure
+  }
+  ```
+   Errback Example
+   ```js
+   function foundBooks(books) {
+   }
+   function failure(reason) {
+   }
+   findAuthor(function(author, err){
+    if (err) {
+      failure(err);
+      // failure
+    } else {
+      try {
+        findBoooksByAuthor(author, function(books, err) {
+          if (err) {
+            failure(err);
+          } else {
+            try {
+              foundBooks(books);
+            } catch(reason) {
+              failure(reason);
+            }
+          }
+        });
+      } catch(error) {
+        failure(err);
+      }
+      // success
+    }
+  });
+  ```
+   Promise Example;
+   ```javascript
+  findAuthor().
+    then(findBooksByAuthor).
+    then(function(books){
+      // found books
+  }).catch(function(reason){
+    // something went wrong
+  });
+  ```
+   @method then
+  @param {Function} onFulfilled
+  @param {Function} onRejected
+  Useful for tooling.
+  @return {Promise}
+  */
+
+  /**
+  `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
+  as the catch block of a try/catch statement.
+  ```js
+  function findAuthor(){
+  throw new Error('couldn't find that author');
+  }
+  // synchronous
+  try {
+  findAuthor();
+  } catch(reason) {
+  // something went wrong
+  }
+  // async with promises
+  findAuthor().catch(function(reason){
+  // something went wrong
+  });
+  ```
+  @method catch
+  @param {Function} onRejection
+  Useful for tooling.
+  @return {Promise}
+  */
+
+
+  Promise.prototype.catch = function _catch(onRejection) {
+    return this.then(null, onRejection);
+  };
+
+  /**
+    `finally` will be invoked regardless of the promise's fate just as native
+    try/catch/finally behaves
+  
+    Synchronous example:
+  
+    ```js
+    findAuthor() {
+      if (Math.random() > 0.5) {
+        throw new Error();
+      }
+      return new Author();
+    }
+  
+    try {
+      return findAuthor(); // succeed or fail
+    } catch(error) {
+      return findOtherAuther();
+    } finally {
+      // always runs
+      // doesn't affect the return value
+    }
+    ```
+  
+    Asynchronous example:
+  
+    ```js
+    findAuthor().catch(function(reason){
+      return findOtherAuther();
+    }).finally(function(){
+      // author was either found, or not
+    });
+    ```
+  
+    @method finally
+    @param {Function} callback
+    @return {Promise}
+  */
+
+
+  Promise.prototype.finally = function _finally(callback) {
+    var promise = this;
+    var constructor = promise.constructor;
+
+    if (isFunction(callback)) {
+      return promise.then(function (value) {
+        return constructor.resolve(callback()).then(function () {
+          return value;
+        });
+      }, function (reason) {
+        return constructor.resolve(callback()).then(function () {
+          throw reason;
+        });
+      });
+    }
+
+    return promise.then(callback, callback);
+  };
+
+  return Promise;
+}();
+
+Promise$1.prototype.then = then;
+Promise$1.all = all;
+Promise$1.race = race;
+Promise$1.resolve = resolve$1;
+Promise$1.reject = reject$1;
+Promise$1._setScheduler = setScheduler;
+Promise$1._setAsap = setAsap;
+Promise$1._asap = asap;
+
+/*global self*/
+function polyfill() {
+  var local = void 0;
+
+  if (typeof global !== 'undefined') {
+    local = global;
+  } else if (typeof self !== 'undefined') {
+    local = self;
+  } else {
+    try {
+      local = Function('return this')();
+    } catch (e) {
+      throw new Error('polyfill failed because global object is unavailable in this environment');
+    }
+  }
+
+  var P = local.Promise;
+
+  if (P) {
+    var promiseToString = null;
+    try {
+      promiseToString = Object.prototype.toString.call(P.resolve());
+    } catch (e) {
+      // silently ignored
+    }
+
+    if (promiseToString === '[object Promise]' && !P.cast) {
+      return;
+    }
+  }
+
+  local.Promise = Promise$1;
+}
+
+// Strange compat..
+Promise$1.polyfill = polyfill;
+Promise$1.Promise = Promise$1;
+
+return Promise$1;
+
+})));
+
+
+
+//# sourceMappingURL=es6-promise.map

+ 9 - 0
assets/scripts/lib/es6-promise.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.5",
+  "uuid": "a9d83c67-98bb-4184-a8b9-e9502c7d3a66",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 77 - 52
assets/scripts/login/LoginCtrl.js

@@ -1,11 +1,12 @@
 const weChat = require('../net/WeChat');
+const QQPlayer = require('../net/QQPlayer');
 const LoginApi = require('../net/LoginApi');
 const HomeApi = require("../net/HomeApi");
 const Api = require('../net/Api');
 const DWTool = require('../utils/DWTool');
 const GameModule = require('../utils/GameModule');
 const TapTapTool = require("../utils/TapTapTool");
-
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -29,7 +30,9 @@ cc.Class({
                 messageType: 8,
             });
         }
-        Global._socketCount = 0;
+
+        this._updateChannel();
+        GameGlobal._socketCount = 0;
         this.loadAllGameRes();
     },
 
@@ -82,8 +85,8 @@ cc.Class({
                     if (err) {
                         // reject(err);
                     } else {
-                        if (Global) {
-                            Global.buildRes = res;
+                        if (GameGlobal) {
+                            GameGlobal.buildRes = res;
                         }
                     }
                     resolve(true);
@@ -111,8 +114,8 @@ cc.Class({
                 if (err) {
                     // reject(err);
                 } else {
-                    if (Global) {
-                        Global.prefabsRes = res;
+                    if (GameGlobal) {
+                        GameGlobal.prefabsRes = res;
                     }
                     // resolve(true);
                 }
@@ -141,8 +144,8 @@ cc.Class({
                 if (err) {
                     // reject(err);
                 } else {
-                    if (Global) {
-                        Global.starAvatarRes = res;
+                    if (GameGlobal) {
+                        GameGlobal.starAvatarRes = res;
                     }
                     // resolve(true);
                 }
@@ -171,8 +174,8 @@ cc.Class({
                 if (err) {
                     // reject(err);
                 } else {
-                    if (Global) {
-                        Global.starSpineRes = res;
+                    if (GameGlobal) {
+                        GameGlobal.starSpineRes = res;
                     }
                     // resolve(true);
                 }
@@ -184,13 +187,25 @@ cc.Class({
     // 加载完成, 开始进入游戏
     _downloadFinished() {
         this.endPreload();
+        this.startLogin();
+    },
 
+    //// 开始登录
+    startLogin() {
         if(CC_WECHATGAME) {
             this._startWxLogin();
+        } else if (CC_QQPLAY) {
+            QQPlayer.qqLogin((isError) => {
+                if (isError) {
+                    this._getDataFail();
+                } else {
+                    this._getUserInfoAndStartGame();
+                }
+            });
         } else {
-            Global.user = {
-                uid: DWTool.getUrlParam('uid'),
-                token: DWTool.getUrlParam('token'),
+            GameGlobal.user = {
+                uid: 6000278,
+                token: '174c09f9-0f74-4ae6-905a-9efa828cec44',
                 nick: '游客',
                 avatar: "",
                 gender: 1
@@ -231,7 +246,7 @@ cc.Class({
         this.loginLabel.node.active = false;
         this.updateUINode.active = false;
 
-        if (Global.needLogin) {
+        if (GameGlobal.needLogin) {
             //服务端通知登录态失效,重新调起微信登录获取新的token
             weChat.login((isError) => {
                 if (isError) {
@@ -263,59 +278,60 @@ cc.Class({
     },
 
     _getUserInfoAndStartGame() {
-        if (Global.user == undefined || Global.user.uid == undefined) {
-            weChat.login((isError) => {
-                if (isError) {
-                    this._getDataFail();
-                } else {
-                    this._getUserInfoAndStartGame();
-                }
-            });
+        if (GameGlobal.user == undefined || GameGlobal.user.uid == undefined) {
+            if (CC_QQPLAY) {
+                this.startLogin();
+            } else if (CC_WECHATGAME) {
+                weChat.login((isError) => {
+                    if (isError) {
+                        this._getDataFail();
+                    } else {
+                        this._getUserInfoAndStartGame();
+                    }
+                });
+            }
             return;
         }
 
         LoginApi.getUserInfoPromise().then(({ data, msg }) => {
-            Global.needLogin = false;
-            Global.userData = data.userExtra;
-            Global.diamond = data.userExtra.diamond;
-            Global.skills = data.userSkills;    //拥有技能
-            Global.userLoginReward = data.userLoginReward;   //7天登录奖励数据
-            // Global.userLoginReward.rewardCount = 6;
-            // Global.userLoginReward.isLoginReward = 0;
-
+            GameGlobal.needLogin = false;
+            GameGlobal.userData = data.userExtra;
+            GameGlobal.diamond = data.userExtra.diamond;
+            GameGlobal.skills = data.userSkills;    //拥有技能
+            GameGlobal.userLoginReward = data.userLoginReward;   //7天登录奖励数据
             /// 通知信息
-            Global.messageNotice = data.messageNotice;
+            GameGlobal.messageNotice = data.messageNotice;
 
             //是否已经领取过我的小程序奖励
-            Global.appletAward = data.appletAward == 0 ? false : true;
+            GameGlobal.appletAward = data.appletAward == 0 ? false : true;
 
-            //是否使用远程数据
-            Global.localData = data.localData == 0 ? false : true;
+            //当天是否已经签到
+            GameGlobal.isSignAward = data.isSignAward == 0 ? false : true;
 
-            Global.isSignAward = data.isSignAward == 0 ? false : true;
+            GameGlobal.localData = data.localData == 0 ? false : true;
 
             //好友助力剩余使用时间
-            Global.friendRewardCdTime = data.friendRewardCdTime;
+            GameGlobal.friendRewardCdTime = data.friendRewardCdTime;
             // Global.friendRewardCdTime = 10000;
 
             //签到的次数
-            Global.signCount = data.signCount;
-            Global.rsDiamond = data.rsDiamond;
+            GameGlobal.signCount = data.signCount;
+            GameGlobal.rsDiamond = data.rsDiamond;
             /// 通知获得的钻石数量
-            Global.noticeDiamond = data.noticeDiamond;
+            GameGlobal.noticeDiamond = data.noticeDiamond;
 
             //// 用户拥有的商品
-            Global.shops = data.shops;
+            GameGlobal.shops = data.shops;
             
-            Global.offlineGold = data.offlineGold;  //离线收益
+            GameGlobal.offlineGold = data.offlineGold;  //离线收益
 
-            Global._shopZk = data.shopZk; /// 商品折扣
+            GameGlobal._shopZk = data.shopZk; /// 商品折扣
 
             // Global.offlineGold = {n: 461, e:2};  //测试使用假的离线收益
             /// 收到socket消息的数量
             //判断当前版本是否正在审核中
-            if (data.ver === Global.ver) {
-                Global.isCheck = true;
+            if (data.ver === GameGlobal.ver) {
+                GameGlobal.isCheck = true;
             }
 
             // 获取存在服务端的用户guideState
@@ -327,13 +343,11 @@ cc.Class({
                     }
                     this.getUserBuildings()
                         .then((responseData) => {
-                            this.restartButton.node.active = false;
-                            Global.BuildingManager.networkRooms = responseData.userRooms;
-                            cc.director.loadScene("game");
-
-                            this._getUserInfo();
-                        }).catch((err) => {
-                            this._getDataFail();
+                        this.restartButton.node.active = false;
+                        GameGlobal.BuildingManager.networkRooms = responseData.userRooms;
+                        cc.director.loadScene("game");
+                    }).catch((err) => {
+                        this._getDataFail();
                     });
                 },
                 fail: (res) => {
@@ -350,7 +364,7 @@ cc.Class({
     _getDataFail() {
         this.loginLabel.node.active = false;
         this.updateUINode.active = false;
-        Global.commonAlert.showCommonErrorAlert('登录失败请重试');
+        GameGlobal.commonAlert.showCommonErrorAlert('登录失败请重试');
         if (CC_WECHATGAME) {
             //检查登录态
             weChat.checkLogin(flag => {
@@ -396,6 +410,17 @@ cc.Class({
         })
     },
 
+    /// 更新全局channel
+    _updateChannel() {
+        if (CC_WECHATGAME) {
+            GameGlobal.channel = 'weixin';
+        } else if (CC_QQPLAY) {
+            GameGlobal.channel = 'qq';
+        } else {
+            GameGlobal.channel = 'LuciferChannel';
+        }
+    },
+
     _getUserInfo() {
         if (CC_WECHATGAME) {
             this._getWXCode().then( (code) => {

+ 1 - 1
assets/scripts/login/LoginCtrl.js.meta

@@ -1,6 +1,6 @@
 {
   "ver": "1.0.5",
-  "uuid": "92fe3c98-9b2a-4986-ba06-51f581012f22",
+  "uuid": "03ce8205-1a6b-4c1a-99dc-cd715a60ca2b",
   "isPlugin": false,
   "loadPluginInWeb": true,
   "loadPluginInNative": true,

+ 7 - 7
assets/scripts/loginReward/LoginRewardCtrl.js

@@ -46,7 +46,7 @@ cc.Class({
             item.getComponent('LoginRewardItem').init(itemModel);
 
             if (this.reward == undefined) {
-                if (itemModel.rewardId > Global.userLoginReward.rewardCount) {
+                if (itemModel.rewardId > GameGlobal.userLoginReward.rewardCount) {
                     this.reward = itemModel;
                 }
             }
@@ -58,10 +58,10 @@ cc.Class({
             let imageId = 50000 + itemModel.starId;
             ArtistManager.loadStarAvatarSpriteFrame(imageId, this.starSprite);
 
-            this.star = Global.BuildingManager.getStarInfo(itemModel.starId);
+            this.star = GameGlobal.BuildingManager.getStarInfo(itemModel.starId);
             this.starRichText.string = `<b><outline color=#ff6e19 width=2>累计登录7天\n即可获得${this.star.name}签约资格~</outline></b>`;
 
-            if (Global.userLoginReward.rewardCount >= 6 && !Global.userLoginReward.isLoginReward) {
+            if (GameGlobal.userLoginReward.rewardCount >= 6 && !GameGlobal.userLoginReward.isLoginReward) {
                 this.shareLabel.string = '分享到群炫耀';
                 this.reward = itemModel;
             }
@@ -113,7 +113,7 @@ cc.Class({
     },
 
     refreshButton() {
-        if (Global.userLoginReward.isLoginReward) {
+        if (GameGlobal.userLoginReward.isLoginReward) {
             this.signButton.interactable = false;
             this.signButton.getComponent(cc.Sprite).spriteFrame = this.signButtonSpriteFrame[1];
         } else {
@@ -124,8 +124,8 @@ cc.Class({
 
     gainReward(isShare) {
         InviteApi.postLoginReward(this.reward.rewardId, isShare, (responseData) => {
-            Global.userLoginReward.isLoginReward = true;
-            Global.userLoginReward.rewardCount = this.reward.rewardId;
+            GameGlobal.userLoginReward.isLoginReward = true;
+            GameGlobal.userLoginReward.rewardCount = this.reward.rewardId;
             TapTapTool.removeRedDot(GameRedDot.sign);
             this.refreshButton();
 
@@ -158,7 +158,7 @@ cc.Class({
             }
         }, (error) => {
             this.signButton.interactable = true;
-            Global.commonAlert.showCommonErrorAlert("签到失败");
+            GameGlobal.commonAlert.showCommonErrorAlert("签到失败");
         });
     },
 

+ 1 - 1
assets/scripts/loginReward/LoginRewardItem.js

@@ -77,7 +77,7 @@ cc.Class({
             this.itemCountRichText.string = `<b><outline color=#000000 width=2>金币 X${TapTapTool.parseToString(gold)}</outline></b>`;
         }
 
-        if (Global.userLoginReward.rewardCount >= this.model.rewardId) {
+        if (GameGlobal.userLoginReward.rewardCount >= this.model.rewardId) {
             this.isSigned = true;
         } else {
             this.isSigned = false;

+ 1 - 1
assets/scripts/messageList/MessageItem.js

@@ -48,7 +48,7 @@ cc.Class({
             if (this._messageData.type === 2 && this._messageData.sId != 2 && infoDesc.indexOf('{num}') != -1) {
                 let skillLevel = this._messageData.level;
                 let skillId = this._messageData.sId;
-                let skillLevelInfo = Global.BuildingManager.getSkillLevelInfo(skillId, skillLevel);
+                let skillLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(skillId, skillLevel);
                 /// 第一个技能
                 if (skillId === 1) {
                     let num = skillLevel > 11 ? (10 + skillLevel - 11) : 10;

+ 19 - 19
assets/scripts/messageList/MessageList.js

@@ -27,8 +27,8 @@ cc.Class({
     },
 
     updateInitData(updateCount, isTime) {
-        let timeInformations = Global._timeInformations;
-        let itemDatas = timeInformations.concat(Global._fixInformations);
+        let timeInformations = GameGlobal._timeInformations;
+        let itemDatas = timeInformations.concat(GameGlobal._fixInformations);
         let originLength = this._itemsData.length;
         let upLength = updateCount == -1 ? itemDatas.length : updateCount;
         let max = upLength + originLength;
@@ -49,7 +49,7 @@ cc.Class({
                 item = null;
                 this._itemsData.splice(index, 1);
                 itemDatas.splice(arrIndex + i, 1);
-                Global._fixInformations.splice(i, 1);
+                GameGlobal._fixInformations.splice(i, 1);
             }
             max -= sub;
             originLength -= sub;
@@ -102,28 +102,28 @@ cc.Class({
         // maxCount	免费设计总部大头的最大次数	
         // cdTime
         /// 看视频分享免费获取的cd时间    
-        if (Global._upBuildingInfo == undefined) {
+        if (GameGlobal._upBuildingInfo == undefined) {
             return;
         }
-        let buildingCount = Global._upBuildingInfo.maxCount - Global._upBuildingInfo.count;
-        if (Global._upBuildingInfo.cdTime > 0 && buildingCount > 0) {
-            Global._upBuildingInfo.cdTime -= 1000;
-            if (Global._upBuildingInfo.cdTime <= 0) {
+        let buildingCount = GameGlobal._upBuildingInfo.maxCount - GameGlobal._upBuildingInfo.count;
+        if (GameGlobal._upBuildingInfo.cdTime > 0 && buildingCount > 0) {
+            GameGlobal._upBuildingInfo.cdTime -= 1000;
+            if (GameGlobal._upBuildingInfo.cdTime <= 0) {
                 // GameEvent.fire(GameNotificationKey.AdBuildingStateUpdate);
             }
         }
-        let upRoomCount = Global._upRoomInfo.maxCount - Global._upRoomInfo.count;
-        if (Global._upRoomInfo.cdTime > 0 && upRoomCount > 0) {
-            Global._upRoomInfo.cdTime -= 1000;
-            if (Global._upRoomInfo.cdTime <= 0) {
+        let upRoomCount = GameGlobal._upRoomInfo.maxCount - GameGlobal._upRoomInfo.count;
+        if (GameGlobal._upRoomInfo.cdTime > 0 && upRoomCount > 0) {
+            GameGlobal._upRoomInfo.cdTime -= 1000;
+            if (GameGlobal._upRoomInfo.cdTime <= 0) {
                 GameEvent.fire(GameNotificationKey.AdRoomStateUpdate);
             }
         }
 
-        let starCount = Global._buyStarInfo.maxCount - Global._buyStarInfo.count;
-        if (Global._buyStarInfo.cdTime > 0 && starCount > 0) {
-            Global._buyStarInfo.cdTime -= 1000;
-            if (Global._buyStarInfo.cdTime <= 0) {
+        let starCount = GameGlobal._buyStarInfo.maxCount - GameGlobal._buyStarInfo.count;
+        if (GameGlobal._buyStarInfo.cdTime > 0 && starCount > 0) {
+            GameGlobal._buyStarInfo.cdTime -= 1000;
+            if (GameGlobal._buyStarInfo.cdTime <= 0) {
                 GameEvent.fire(GameNotificationKey.AdStarStateUpdate);
             }
         }
@@ -150,10 +150,10 @@ cc.Class({
             item.destroy();
             item = null;
             this._itemsData.splice(index, 1);
-            if (index < Global._timeInformations.length) {
-                Global._timeInformations.splice(index, 1);
+            if (index < GameGlobal._timeInformations.length) {
+                GameGlobal._timeInformations.splice(index, 1);
             } else {
-                Global._fixInformations.splice(index - Global._timeInformations.length - 1, 1);
+                GameGlobal._fixInformations.splice(index - GameGlobal._timeInformations.length - 1, 1);
             }
         }
 

+ 222 - 26
assets/scripts/net/Api.js

@@ -1,5 +1,6 @@
 
 const ResponseStateCode = require('../utils/GameEnum').ResponseStateCode;
+var Promise = require('../lib/es6-promise').Promise;
 
 class Api {
 
@@ -65,10 +66,21 @@ class Api {
      * @param {function} requestBody.fail 请求失败的回调
      */
     static httpGet(requestBody) {
+        /// 如果是qq游戏那么做特殊处理
         requestBody.data = Api.baseParam(requestBody.data);
         requestBody.url = Api.requestUrl(requestBody.url);
-        if (window.wx != undefined) {
+        if (CC_QQPLAY) {
+            /// 如果是get方式那么转变url
+            if (requestBody.method == undefined || requestBody.method == 'GET') {
+                // 将data对象直接拼接到url后面做参数
+                requestBody.url = Api.urlEncode(requestBody.url, requestBody.data);
+            }
+        }
+
+        if (CC_WECHATGAME) {
             Api.wxGet(requestBody);
+        } else if (CC_QQPLAY) {
+            Api.qqGet(requestBody);
         } else {
             Api.jsGet(requestBody);
         }
@@ -79,20 +91,46 @@ class Api {
      * @param {*} requestBody 
      */
     static httpPost(requestBody) {
-        requestBody.data = Api.baseParam(requestBody.data);
-        requestBody.url = Api.requestUrl(requestBody.url);
-        if (window.wx != undefined) {
-            Api.wxPost(requestBody);
+        if (CC_WECHATGAME) {
+            requestBody.url = Api.requestUrl(requestBody.url);
+            requestBody.data = Api.baseParam(requestBody.data);
+            return Api.wxPost(requestBody);
+        } else if (CC_QQPLAY) {
+            requestBody.url = Api.qqUrlHandle(requestBody.url);
+            requestBody.url = Api.requestUrl(requestBody.url);
+            return Api.qqPost(requestBody);
         } else {
-            Api.jsPost(requestBody);
+            requestBody.url = Api.requestUrl(requestBody.url);
+            requestBody.data = Api.baseParam(requestBody.data);
+            return Api.jsPost(requestBody);
         }
     }
 
+    /// 在最后一个/前面加上/qq
+    static qqUrlHandle(url) {
+        let urlArr = url.split('/');
+        let newUrl = '';
+        let arrLen = urlArr.length;
+        for (let i = 0; i < arrLen; ++i) {
+            /// 如果是到了最后一个
+            if (i == arrLen - 1) {
+                newUrl += '/qq';
+            }
+
+            if (i == 0) {
+                continue;
+            }
+
+            newUrl += '/';
+            newUrl += urlArr[i];
+        }
+        return newUrl;
+    }
+
     static wxGet(requestBody) {
         let onSuccess = requestBody.success;
         let onFail = requestBody.fail;
         let onComplete = requestBody.complete;
-
         wx.request({
             url: requestBody.url,
             data: requestBody.data,
@@ -101,14 +139,14 @@ class Api {
             success: (res) => {
                 //直接处理登录失效的逻辑
                 if (res.data.code === ResponseStateCode.LOGIN_INVALIDATE) {
-                    Global.needLogin = true;
+                    GameGlobal.needLogin = true;
                     cc.director.loadScene('login');
                     return;
                 }
 
                 if (res.data.code === ResponseStateCode.OK) {
                     if (onSuccess != undefined) {
-                        onSuccess(res.data.data, res.data.msg);
+                        onSuccess(res.data.data);
                     }
                 } else {
                     if (onFail != undefined) {
@@ -135,6 +173,86 @@ class Api {
         Api.wxGet(requestBody);
     }
 
+   static qqGet(requestBody) {
+        requestBody.header = {
+            'Referer': 'https://hudong.qq.com',
+            'User-Agent': 'brick-client',
+            'Content-Type': 'application/json'
+        };
+
+        let onSuccess = requestBody.success;
+        let onFail = requestBody.fail;
+        let data = requestBody.data;
+        /// 如果是post方式
+        if (data != undefined && requestBody.method == 'POST') {
+            data = JSON.stringify(data);
+        } else {
+            data = '';
+        }
+        let method = requestBody.method === undefined ? 'GET' : 'POST';
+        let url = requestBody.url;
+        // let url = "https://test-api-taptap.duowan.com/room/reportGold1";
+        BK.Http.request({
+            url: url,
+            body: data,
+            method: method,
+            headers: requestBody.header,
+            success: (res) => {
+                //直接处理登录失效的逻辑
+                /// 如果请求成功
+                if (res.statusCode === 200) {
+                    let bodyStr = res.text();
+                    let bodyObjct = JSON.parse(bodyStr);
+
+                    if (bodyObjct == undefined) {
+                        if (onFail != undefined) {
+                            onFail(res.statusCode, '请求失败');
+                        }
+                        return;
+                    }
+
+                    console.log('url :' + url, 'res: ' + res);
+                    if (bodyObjct.code === ResponseStateCode.LOGIN_INVALIDATE) {
+                        GameGlobal.needLogin = true;
+                        cc.director.loadScene('login');
+                        return;
+                    }
+    
+                    if (bodyObjct.code === ResponseStateCode.OK) {
+                        if (onSuccess != undefined) {
+                            onSuccess(bodyObjct.data);
+                        }
+                    } else {
+                        if (onFail != undefined) {
+                            onFail(bodyObjct.code, bodyObjct.msg);
+                            // GameGlobal.commonAlert.showCommonErrorAlert('url' + url + ' login error code: ' + errCode + 'login error msg: ' + errMsg);
+                        }
+                    }
+                } else {
+                    console.log('response error statusCode' + res.statusCode);
+                    if (onFail != undefined) {
+                        onFail(res.statusCode, '请求失败');
+                    }
+                }
+            },
+            fail: (res) => {
+                console.log('qqGet fail: ' + res, 'url : ' + url, 'res : ' + res);
+                if (onFail != undefined) {
+                    onFail(-1, res.msg);
+                }
+            },
+        });
+          
+    }
+
+    static qqPost(requestBody) {
+        
+        requestBody.method = 'POST';
+        /// 添加post公共参数
+        requestBody.url = Api.urlEncode(requestBody.url, Api.baseParam({}));
+        Api.qqGet(requestBody);
+    }
+
     static jsGet(requestBody) {
         let url = requestBody.url;
         let data = requestBody.data;
@@ -192,8 +310,10 @@ class Api {
     static httpGetPromise(url, data) {
         url = Api.requestUrl(url);
         data = Api.baseParam(data);
-        if (window.wx != undefined) {
+        if (CC_WECHATGAME) {
             return Api.wxGetP(url, data);
+        } else if (CC_QQPLAY) {
+            return Api.qqGetP(url, data);
         } else {
             return Api.jsGetP(url, data);
         }
@@ -206,8 +326,10 @@ class Api {
     static httpPostPromise(url, data) {
         url = Api.requestUrl(url);
         data = Api.baseParam(data);
-        if (window.wx != undefined) {
+        if (CC_WECHATGAME) {
             return Api.wxPostP(url, data);
+        } else if (CC_QQPLAY) {
+            return Api.qqPostP(url, data);
         } else {
             return Api.jsPostP(url, data);
         }
@@ -230,15 +352,14 @@ class Api {
                 url: url,
                 data: data,
                 method: method,
-                header: header === undefined ? {} : header,
+                headers: header === undefined ? {} : header,
                 success: (res) => {
                     //直接处理登录失效的逻辑
                     if (res.data.code === ResponseStateCode.LOGIN_INVALIDATE) {
-                        Global.needLogin = true;
+                        GameGlobal.needLogin = true;
                         cc.director.loadScene('login');
                         reject(res.data);
                     }
-
                     if (res.data.code === ResponseStateCode.OK) {
                         resolve(res.data);
                     } else {
@@ -248,7 +369,7 @@ class Api {
                 fail: (res) => {
                     reject({
                         code: -1,
-                        msg: '微信接口调用失败'
+                        msg: '微信登录接口调用失败'
                     });
                 },
                 complete: {},
@@ -256,6 +377,68 @@ class Api {
         });
     }
 
+
+    static qqGetP(url, data) {
+        url = Api.urlEncode(url, data);
+        return Api.qqRequestPromise(url, '', 'GET');
+    }
+
+    static qqPostP(url, data) {
+        if (data != null || data != undefined) {
+            data = JSON.stringify(data);
+        }
+        return Api.qqRequestPromise(url, data, 'POST');
+    }
+
+    static qqRequestPromise(url, data, method) {
+        return new Promise((resolve, reject) => {
+            BK.Http.request({
+                url: url,
+                body: data,
+                method: method,
+                headers: {
+                    'Content-Type': 'application/json'
+                },
+                success: (res) => {
+                    /// 如果请求成功
+                    console.log('url :' + url, 'res: ' + res);
+                    if (res.statusCode === 200) {
+                        let bodyStr = res.text();
+                        let bodyObjct = JSON.parse(bodyStr);
+
+                        if (bodyObjct.code === ResponseStateCode.LOGIN_INVALIDATE) {
+                            GameGlobal.needLogin = true;
+                            cc.director.loadScene('login');
+                            return;
+                        }
+                        if (bodyObjct.code === ResponseStateCode.OK) {
+                            resolve(bodyObjct);
+                        } else {
+                            reject({
+                                code: bodyObjct.code,
+                                msg: bodyObjct.msg
+                            });
+                        }
+                    } else {
+                        console.log('response error statusCode' + res.statusCode);
+                        reject({
+                            code: res.statusCode,
+                            msg: 'qq登录接口调用失败'
+                        });
+                    }
+                },
+                fail: (res) => {
+                    console.log('url :' + url, 'res: ' + res);
+                    reject({
+                        code: -1,
+                        msg: 'qq登录接口调用失败'
+                    });
+                },
+                // complete: {},
+            });
+        });
+    }
+
     static jsGetP(url, data) {
         return new Promise((resolve, reject) => {
             url = url + "?";
@@ -283,8 +466,6 @@ class Api {
         });
     }
 
-
-
     static jsBaseRequestP(resolve, reject) {
         var xhr = new XMLHttpRequest();
         xhr.onreadystatechange = () => {
@@ -310,11 +491,11 @@ class Api {
             target = {};
         }
         target.thirdType = 1;
-        target.channel = Global.channel;
-        target.ver = Global.ver;
-        target.os = Global.os;
-        target.uid = Global.user ? Global.user.uid : '';
-        target.token = Global.user ? Global.user.token : '';
+        target.channel = GameGlobal.channel;
+        target.ver = GameGlobal.ver;
+        target.os = GameGlobal.os;
+        target.uid = GameGlobal.user ? GameGlobal.user.uid : '';
+        target.token = GameGlobal.user ? GameGlobal.user.token : '';
         return target;
     }
 
@@ -323,10 +504,11 @@ class Api {
      * @param targetUrl [string] 请求接口
      */
     static requestUrl(targetUrl) {
-        let host = Global.debug ? 'https://test-api-taptap.duowan.com' : 'https://api-taptap.duowan.com';
-        //  let host = 'https://new-api-taptap.duowan.com';
-         
-        // let host = Global.debug ? 'http://172.16.15.196:8888' : 'https://api-allstar.duowan.com';
+        var host = GameGlobal.debug ? 'https://test-api-taptap.duowan.com' : 'https://api-taptap.duowan.com';
+        if (CC_QQPLAY) {
+            host = GameGlobal.debug ? 'https://test-api-taptap.duowan.com' : 'https://qq-api-taptap.duowan.com';
+        }
+        // let host = GameGlobal.debug ? 'http://172.16.15.196:8888' : 'https://api-allstar.duowan.com';
         // let host = 'https://new-api-taptap.duowan.com';
         return host + targetUrl;
     }
@@ -344,6 +526,20 @@ class Api {
         return requestBody;
     }
 
+    /// 将data对象拼接到url上做参数
+    static urlEncode(url, data) {
+        if(typeof(url) == 'undefined' || url == null || url == '') {
+            return '';
+        }
+        if(typeof(data) == 'undefined' || data == null || typeof(data) != 'object') {
+            return '';
+        }
+        url += (url.indexOf("?") != -1) ? "" : "?";
+        for(var k in data) {
+            url += ((url.indexOf("=") != -1) ? "&" : "") + k + "=" + encodeURI(data[k]);
+        }
+        return url;
+    }
 }
 
 module.exports = Api;

+ 0 - 1
assets/scripts/net/HomeApi.js

@@ -57,7 +57,6 @@ class HomeApi {
     //领取房间里程碑奖励
     static getRoomAward(roomId, level, success, fail) {
         let url = "/room/award.do";
-
         let data = {
             roomId: roomId,
             level: level

+ 55 - 7
assets/scripts/net/LoginApi.js

@@ -3,8 +3,8 @@ const Api = require('./Api');
 class LoginApi {
 
     static login(js_code, wxRes, cb, fail) {
-
-        let url = "/auth/loginByGame.do";
+     
+        let url = "/auth/loginByGame.do" ;
 
         let data = {
             nick: wxRes.userInfo.nickName,
@@ -21,7 +21,7 @@ class LoginApi {
             success: (response) => {
                 console.log('login response: ' + JSON.stringify(response));
                 var user = response.user;
-                Global.user = {
+                GameGlobal.user = {
                     token: response.token,
                     uid: user.id,
                     openId: user.openId,
@@ -29,7 +29,7 @@ class LoginApi {
                     avatarUrl: wxRes.userInfo.avatarUrl,
                     gender: wxRes.userInfo.gender,
                 };
-                cc.sys.localStorage.setItem('GlobalUser', Global.user);
+                cc.sys.localStorage.setItem('GlobalUser', GameGlobal.user);
                 cb();
             },
             fail: (errCode, errMsg) => {
@@ -39,13 +39,44 @@ class LoginApi {
         });
     }
 
+    //// 登录qq
+    static qqLogin(openId, openKey, gender, cb) {
+        let url = "/auth/loginByGame" ;
+        let data = {
+            openId: openId,
+            openKey: openKey,
+            gender: gender,
+        };
+        Api.httpPost({
+            url: url,
+            data: data,
+            success: (response) => {
+                console.log('login response: ' + JSON.stringify(response));
+                var user = response.user;
+                GameGlobal.user = {
+                    token: response.token,
+                    uid: user.id,
+                    openId: user.openId,
+                    nick: user.nick == undefined ? '' : user.nick,
+                    avatarUrl: user.head == undefined ? '' : user.head,
+                    gender: user.gender,
+                };
+                // cc.sys.localStorage.setItem('GlobalUser', GameGlobal.user);
+                cb(false);
+            },
+            fail: (errCode, errMsg) => {
+                console.log('login error code: ' + errCode, 'login error msg: ' + errMsg);
+                cb(true);
+            }
+        });
+    }
 
     static getUserInfoPromise() {
         let data = {
-            targetUid: Global.user.uid
+            targetUid: GameGlobal.user.uid
         };
 
-       return Api.httpGetPromise('/user/getInfo.do',data);
+        return Api.httpGetPromise('/user/getInfo.do',data);
     }
 
     static getUserInfo(success, fail) {
@@ -59,6 +90,24 @@ class LoginApi {
         Api.httpGet(requestBody);
     }
 
+
+    //QQ上报昵称和头像
+    static getUpdateNickOrHead(nick, head, success, fail) {
+        let url = '/auth/updateNickOrHead.do';
+        let data = {
+            nick: nick,
+            head: head
+        };
+
+        let requestBody = {
+            url: url,
+            data: data,
+            success: success,
+            fail: fail,
+        };
+        Api.httpPost(requestBody);
+    }
+
     static updateUnionId(js_code, encryptedData, iv, success, fail) {
         let url = "/auth/updateUnionId.do";
         let data = {
@@ -66,7 +115,6 @@ class LoginApi {
             encryptedData: encryptedData,
             iv: iv
         };
-
         let requestBody = {
             url: url,
             data: data,

+ 58 - 0
assets/scripts/net/QQPlayer.js

@@ -0,0 +1,58 @@
+const LoginApi = require('./LoginApi');
+// const ShareAction = require('../utils/ShareAction');
+// const AlertManager = require('../utils/AlertManager');
+// const SkillApi = require("../net/SkillApi");
+
+class QQPlayer {
+
+    static qqLogin(cb) {
+        
+        if (typeof GameStatusInfo != undefined && GameStatusInfo != undefined) {
+            let openId = GameStatusInfo.openId; //获取当前用户的唯一标识
+            let accessToken = GameStatusInfo.accessToken;
+            console.log('gamestatusInfo' + GameStatusInfo);
+            BK.QQ.fetchOpenKey(function (errCode, cmd, data) {
+                if (errCode == 0) {
+                    let openKey = data.openKey;
+                    console.log('qq openKey' + openKey);
+                    console.log('qq openId' + openId);
+                    let gender = data.sex;
+                    // 1 男 2 女
+                    if (gender == 2) {
+                        gender = 0;
+                    } 
+
+                    if (gender == undefined) {
+                        gender = -1;
+                    }
+
+                    LoginApi.qqLogin(openId, openKey, gender, cb);
+                } else {
+                    console.log('login fail');
+                }
+            });
+        } else {
+            // LoginApi.qqLogin('oadDi5C3mWabn5c5cUjWEa1HAecwqq', 'oadDi5C3mWabn5c5cUjWEa1HAecwqq', 1);
+            console.log('GameStatusInfo is undefined');
+        }
+
+        // //Test
+        // PLATFORM.authQQ(0, 0, 0);
+    }
+
+
+
+    static shareObjcts = [
+        {'title': '猜猜他是谁?', 'icon': 'share_3.png'},
+        {'title': '猜猜他是谁?', 'icon': 'share_4.png'},
+        {'title': '看到这位明星了吗,签下这份合同,她就是你的人了~', 'icon': 'share_5.png'},
+        {'title': '就、就算你是大明星,签约了你也是我的人!', 'icon': 'share_6.png'},
+        {'title': '老板跟着小姨子跑路啦!本公司签约女团低价转让!', 'icon': 'share_7.png'},
+        {'title': '你,还有你,我钦定你们两个。。。组CP!', 'icon': 'share_8.png'},
+        {'title': '猜猜他是谁?', 'icon': 'share_9.png'},
+        {'title': '猜猜他是谁?', 'icon': 'share_10.png'},
+        {'title': '猜猜她是谁?', 'icon': 'share_11.png'}
+    ]
+}
+
+module.exports = QQPlayer;

+ 9 - 0
assets/scripts/net/QQPlayer.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.5",
+  "uuid": "f436ab01-689f-4886-bda3-d3f90d5e55c5",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 0 - 1
assets/scripts/net/QuestApi.js

@@ -36,7 +36,6 @@ class QuestApi {
     static postDailyDegreeReward(degree, success, fail) {
 
         let url = "/daily/getDailyDegreeReward";
-
         let data = {
             degree: degree
         };

+ 34 - 12
assets/scripts/net/WeChat.js

@@ -1,7 +1,7 @@
 const LoginApi = require('./LoginApi');
 const ShareAction = require('../utils/ShareAction');
 const AlertManager = require('../utils/AlertManager');
-const SkillApi = require("../net/SkillApi");
+// const SkillApi = require("../net/SkillApi");
 
 class WeChat {
 
@@ -38,7 +38,7 @@ class WeChat {
     loginStatic(cb) {
         let userStorage = cc.sys.localStorage.getItem('GlobalUser')
         if (userStorage) {
-            Global.user = userStorage;
+            GameGlobal.user = userStorage;
             cb && cb()
         } else {
             this.login(cb)
@@ -53,16 +53,14 @@ class WeChat {
     login(cb) {
 
         this.cb = cb || function () { }
-
         if (!CC_WECHATGAME) {
-            Global.user = {
+            GameGlobal.user = {
                 uid: 1,
                 token: 'lucifer_test_token',
                 nick: 'lucifer',
                 avatarUrl: 'http://mpic.tiankong.com/f94/72b/f9472be4691ab43e3f6132bb8b63d00a/640.jpg',
                 gender: 1
             }
-
             this.cb();
             return;
         }
@@ -93,7 +91,7 @@ class WeChat {
 
         wx.getSystemInfo({
             success: (res) => {
-                Global.os = res.platform == "android" ? 2 : 1;
+                GameGlobal.os = res.platform == "android" ? 2 : 1;
                 this.wxWidth = res.windowWidth;
                 this.wxHeight = res.windowHeight;
             }
@@ -154,13 +152,14 @@ class WeChat {
 
     shareAction(type, success, fail) {
         if (CC_WECHATGAME) {
-            Global.isIgnoreShareStatus = false;
-            Global.clickShare = true;
-            Global.gameShareType = type;
+            GameGlobal.isIgnoreShareStatus = false;
+            GameGlobal.clickShare = true;
+            GameGlobal.gameShareType = type;
+        }
+        let randomIndex = parseInt(Math.random()*(WeChat.shareObjcts.length),10);
+        let shareObjct = WeChat.shareObjcts[randomIndex];
 
-            let randomIndex = parseInt(Math.random()*(WeChat.shareObjcts.length),10);
-            let shareObjct = WeChat.shareObjcts[randomIndex];
-            
+        if (CC_WECHATGAME) {
             wx.shareAppMessage({
                 title: shareObjct.title,
                 imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/' + shareObjct.icon,
@@ -187,6 +186,27 @@ class WeChat {
                     console.log('分享失败或取消');
                 }
             });
+        } else if (CC_QQPLAY) {
+            BK.Share.share({
+                qqImgUrl: 'https://pub.dwstatic.com/wxgame/taptapstar_qq/share/' + shareObjct.icon,
+                summary: shareObjct.title,
+                isToFriend: true,
+                extendInfo: '',
+                success: function(res) {
+                    BK.Console.log('分享成功', res.code, JSON.stringify(res.data));
+
+                    if(res.data.ret == 0) {
+                        success && success()
+                    }
+                },
+                fail: function(res) {
+                    BK.Console.log('分享失败', res.code, JSON.stringify(res.msg));
+                    fail && fail()
+                },
+                complete: function(res) {
+                    BK.Console.log('分享完成,不论成功失败');
+                }
+            });
         }
     }
 
@@ -206,6 +226,8 @@ class WeChat {
                     sendMessageImg: 'https://pub.dwstatic.com/wxgame/taptapstar/share/share_shop.png'
                 });
            }
+       } else if (CC_QQPLAY) {
+         AlertManager.showStoreQQaddGroup();
        }
     }
 

+ 75 - 11
assets/scripts/net/Ws.js

@@ -186,7 +186,7 @@ function WsManager(url, opts) {
     opts.path = opts.path || '/'
 
     this.opts = opts
-    this.url = `${url}?uid=${Global.user.uid}&token=${Global.user.token}&channel=${Global.channel}&ver=${Global.os}&os=${Global.ver}`
+    this.url = `${url}?uid=${GameGlobal.user.uid}&token=${GameGlobal.user.token}&channel=${GameGlobal.channel}&ver=${GameGlobal.os}&os=${GameGlobal.ver}`
     this.lastPing = null
     // this.socketCache = [] //缓存socket队列
     this.socketMaxCache = 5 //最大缓存socket实例数量
@@ -215,9 +215,14 @@ WsManager.prototype.connect = function(fn) {
     }
 
     this.readyState = 'opening';
-    let _socket = CC_WECHATGAME ? this.openWxConnect() : this.openH5Connect()
+    if (CC_WECHATGAME) {
+        this.socket = this.openWxConnect();
+    } else if (CC_QQPLAY) {
+        this.socket = this.openQQConnect();
+    } else {
+        this.socket = this.openH5Connect()
+    }
     // this.socketCache.push(_socket)
-    this.socket = _socket;
 }
 
 WsManager.prototype.reconnect = function() {
@@ -232,8 +237,13 @@ WsManager.prototype.reconnect = function() {
         console.log(`%c [Socket正在尝试第${this._reconnectTimes}次重连]`, this.logStyle);
         this.readyState = 'reconnecting'
         setTimeout(() => {
-            this.socket = CC_WECHATGAME ? this.openWxConnect() : this.openH5Connect();
-            
+            if (CC_WECHATGAME) {
+                this.socket = this.openWxConnect();
+            } else if (CC_QQPLAY) {
+                this.socket = this.openQQConnect();
+            } else {
+                this.socket = this.openH5Connect()
+            }
         }, this._reconnectionDelay);
     } else {
         if(this.socket) {
@@ -263,6 +273,8 @@ WsManager.prototype.keepAlive = function() {
             this.socket.send({
                 data: alivemsg
             })
+        } else if (CC_QQPLAY) {
+            this.socket.send(alivemsg)
         } else {
             // this.socket.binaryType = 'blob'
             this.socket.send(alivemsg)
@@ -290,7 +302,7 @@ WsManager.prototype.openWxConnect = function() {
         this.readyState = 'closed';
         clearInterval(this.keepAliveTimeout);
         //只要关闭就重连(暂时性处理)并且不是在后台 不进行重连
-        if(this._reconnection && !Global.isOnHide ) {
+        if(this._reconnection && !GameGlobal.isOnHide ) {
             this.reconnect();
         }
 
@@ -304,9 +316,9 @@ WsManager.prototype.openWxConnect = function() {
             this.emit('message', res.data)
         }
                 
-        Global._socketCount += 1;
-        if (Global._socketCount > 10000) {
-            Global._socketCount = 2;
+        GameGlobal._socketCount += 1;
+        if (GameGlobal._socketCount > 10000) {
+            GameGlobal._socketCount = 2;
         }
         console.log(`%c [接收到Socket消息: ${JSON.stringify(res.data)}]`, this.logStyle);
     })
@@ -314,7 +326,7 @@ WsManager.prototype.openWxConnect = function() {
     _socket.onError((res) => {
         this.readyState = 'closed';
         clearInterval(this.keepAliveTimeout);
-        if(this._reconnection && !Global.isOnHide) {
+        if(this._reconnection && !GameGlobal.isOnHide) {
             this.reconnect();
         } else {
             _socket.close();
@@ -327,6 +339,58 @@ WsManager.prototype.openWxConnect = function() {
     return _socket;
 }
 
+WsManager.prototype.openQQConnect = function() {
+
+    let ws = new BK.WebSocket(this.url);
+
+    let self = this;
+    ws.onOpen = function(ws) {
+        self.readyState = 'open';
+        self.emit('open', '打开qqwebSocket');
+        console.log(`%c [Socket连接成功: ${self.url.split("&token")[0]}]`, self.logStyle);
+        // 每隔一段时间发一个心跳包保持连接状态
+        self.keepAlive();
+    }
+
+    ws.onClose = function(ws) {
+        self.readyState = 'closed';
+        
+        //只要关闭就重连(暂时性处理)
+        if(self._reconnection) {
+            self.reconnect();
+        }
+
+        self.emit('close', 'qq websocket关闭');
+        console.log(`%c [Socket连接关闭]`, self.logStyle);
+    }
+
+    
+    ws.onError = function(ws) {
+        if(self._reconnection) {
+            self.reconnect()
+        } else {
+            _socket.close()
+        }
+
+        self.emit('error', 'error')
+        console.log(`%c [Socket错误]`, self.logStyle);
+    }
+
+
+    ws.onMessage = function(ws, res) {
+        if(res.data != 1) {
+            let str = res.data.readAsString();
+            self.emit('message', str);
+        }
+
+        console.log(`%c [接收到Socket消息: ${JSON.stringify(res.data)}]`, self.logStyle);
+    }
+
+    ws.connect();
+
+    return ws;
+}
+
 WsManager.prototype.openH5Connect = function() {
     let _socket = new WebSocket(this.url);
     _socket.binaryType = "arraybuffer";
@@ -395,7 +459,7 @@ WsManager.prototype.send = function(data) {
         })
     } else {
         this.socket.binaryType = this.binaryType
-        this.socket.send(data)
+        this.socket.send(data);
     }
 }
 

+ 1 - 1
assets/scripts/quest/QuestDaily.js

@@ -206,7 +206,7 @@ cc.Class({
             }, (errCode, errMsg) => {
                 this.questBtns[1].interactable = true;
                 // 领取失败
-                Global.commonAlert.showCommonErrorAlert("领取奖励失败");
+                GameGlobal.commonAlert.showCommonErrorAlert("领取奖励失败");
             });
         }
     },

+ 1 - 1
assets/scripts/quest/QuestDailyItem.js

@@ -191,7 +191,7 @@ cc.Class({
             }, (errCode, errMsg) => {
                 this.questBtns[0].interactable = true;
                 // 领取失败
-                Global.commonAlert.showCommonErrorAlert("领取奖励失败");
+                GameGlobal.commonAlert.showCommonErrorAlert("领取奖励失败");
         });
     }
 });

+ 1 - 1
assets/scripts/quest/QuestMainItem.js

@@ -216,7 +216,7 @@ cc.Class({
                 this.questBtns[1].interactable = true;
 
                 // 领取失败
-                Global.commonAlert.showCommonErrorAlert("领取奖励失败");
+                GameGlobal.commonAlert.showCommonErrorAlert("领取奖励失败");
             }
         })
     },

+ 1 - 1
assets/scripts/quest/QuestPopup.js

@@ -29,7 +29,7 @@ cc.Class({
 
     onLoad () {
 
-        if (Global.winSize.height <= 1000) {
+        if (GameGlobal.winSize.height <= 1000) {
             this.popupBgNode.height = 820;
         }
 

+ 2 - 2
assets/scripts/quest/QuestTab.js

@@ -44,11 +44,11 @@ cc.Class({
     },
 
     handelQuestShowRedDot() {
-        if (Global._redTypes == null || Global._redTypes == undefined || Global._redTypes.length == 0) {
+        if (GameGlobal._redTypes == null || GameGlobal._redTypes == undefined || GameGlobal._redTypes.length == 0) {
             this.noticeNode.active = false;
             return;
         }
-        let redTypes = Global._redTypes;
+        let redTypes = GameGlobal._redTypes;
         if (this.isMain) {
             this.noticeNode.active = redTypes.indexOf(GameRedDot.mainTask) != -1;
         } else {

+ 1 - 1
assets/scripts/rank/GameCountryRank.js

@@ -25,7 +25,7 @@ cc.Class({
             this.listItem.push(item);
         }
 
-        if (Global.winSize.height <= 1000) {
+        if (GameGlobal.winSize.height <= 1000) {
             this.scrollView.vertical = true;
         }
     },

+ 3 - 3
assets/scripts/rank/GameCrowdRank.js

@@ -76,12 +76,12 @@ cc.Class({
     },
 
     postGroupMessage(isRefresh = false) {
-        if (Global.shareTicket.length > 0) {
+        if (GameGlobal.shareTicket.length > 0) {
             this.isShowRank = true;
             if (window.wx != undefined) {
                 window.wx.postMessage({
                     messageType: 3,
-                    key1: Global.shareTicket,
+                    key1: GameGlobal.shareTicket,
                     key2: isRefresh
                 });
             }
@@ -107,7 +107,7 @@ cc.Class({
                     //判断是否分享到群
                     if (res.hasOwnProperty('shareTickets')) {
                         let shareTicket = res.shareTickets[0];
-                        Global.shareTicket = shareTicket;
+                        GameGlobal.shareTicket = shareTicket;
                         this.postGroupMessage(true);
                         // wx.getShareInfo({
                         //     shareTicket: shareTicket,

+ 100 - 3
assets/scripts/rank/GameFriendRank.js

@@ -1,15 +1,37 @@
+const LoginApi = require('../net/LoginApi');
 
 cc.Class({
     extends: cc.Component,
 
     properties: {
+        scrollView: cc.ScrollView,
+        layout: cc.Layout,
 
+        rankItem: cc.Prefab,
+
+        meNode: cc.Node
     },
 
     // LIFE-CYCLE CALLBACKS:
 
     onLoad () {
+        if (CC_QQPLAY) {
+            this.scrollView.node.active = true;
+
+            this.pageIndex = 0;
+
+            this.listItem = [];
+            for(let i = 0; i < 5; i++) {
+                let item = cc.instantiate(this.rankItem);
+                this.layout.node.addChild(item);
+                item.active = false;
+                this.listItem.push(item);
+            }
 
+            if (GameGlobal.winSize.height <= 1000) {
+                this.scrollView.vertical = true;
+            }
+        }
     },
 
     start () {
@@ -17,30 +39,105 @@ cc.Class({
     },
 
     onEnable() {
-        if (window.wx != undefined) {
+        if (CC_WECHATGAME) {
             window.wx.postMessage({
                 messageType: 0
             });
+        } else if (CC_QQPLAY) {
+
         }
     },
 
     init() {
+        if (CC_QQPLAY) {
+            var attr = "score";//使用哪一种上报数据做排行,可传入score,a1,a2等
+            var order = 1;     //排序的方法:[ 1: 从大到小(单局),2: 从小到大(单局),3: 由大到小(累积)]
+            var rankType = 0; //要查询的排行榜类型,0: 好友排行榜
+            let self = this;
+            BK.QQ.getRankListWithoutRoom(attr, order, rankType, function (errCode, cmd, data) {
+                // 返回错误码信息
+                if (errCode !== 0) {
+                    BK.Script.log(1, 1, '获取排行榜数据失败!错误码:' + errCode);
+                    return;
+                }
+                // 解析数据
+                if (data) {
+                    self.ranks = data.data.ranking_list;
+                    self._sortMeData();
+                    self._setupList();
+                }
+            });
+        }
+    },
+
+    _setupList() {
+        let start = this.pageIndex * 5;
+        let end = start + 5;
+        let sortArray = this.ranks.slice(start,end);
+
+        this.listItem.forEach(n => {
+            n.active = false;
+        });
+
+        for(let i = 0; i < sortArray.length; i++) {
+            let item = this.listItem[i];
+            item.active = true;
+            let model = sortArray[i];
+            model.rank = this.pageIndex * 5 + (i + 1);
+            item.getComponent('GameRankItem').initQQData(model);
+        }
+    },
+
+    _sortMeData() {
+        for(let i = 0; i < this.ranks.length; i++) {
+            let model = this.ranks[i];
+            model.rank = i + 1;
+            if (model.selfFlag) {
+                this.myData = model;
+                this._setupMeData();
+                break;
+            }
+        }
+    },
+
+    _setupMeData() {
+        LoginApi.getUpdateNickOrHead(this.myData.nick,this.myData.url, (res) => {
+
+        }, (error) => {
+
+        });
 
+        this.meNode.active = true;
+        this.meNode.getComponent('GameRankItem').initQQData(this.myData, true);
     },
 
     previousPage() {
-        if (window.wx != undefined) {
+        if (CC_WECHATGAME) {
             window.wx.postMessage({
                 messageType: 1
             });
+        } else if (CC_QQPLAY) {
+            if (this.pageIndex <= 0 || this.ranks == undefined || this.ranks.length == 0) {
+                return;
+            }
+            this.pageIndex -= 1;
+            this._setupList();
+            this.scrollView.scrollToTop();
         }
     },
 
     nextPage() {
-        if (window.wx != undefined) {
+        if (CC_WECHATGAME) {
             window.wx.postMessage({
                 messageType: 2
             });
+        } else if (CC_QQPLAY) {
+            if (this.pageIndex >= (Math.ceil(this.ranks.length / 5) - 1)  || this.ranks == undefined || this.ranks.length == 0) {
+                return;
+            }
+            this.pageIndex += 1;
+            this._setupList();
+            this.scrollView.scrollToTop();
         }
     }
 

+ 7 - 2
assets/scripts/rank/GameRank.js

@@ -48,7 +48,7 @@ cc.Class({
         this.isFirst = true;
         this.node.zIndex = this.zIndex;
 
-        if (Global.winSize.height <= 1000) {
+        if (GameGlobal.winSize.height <= 1000) {
             this.content.height = 800;
         }
 
@@ -79,6 +79,11 @@ cc.Class({
         }, 500, true);
 
         GameEvent.on(GameNotificationKey.GameShowGroupRank, this, this.hideGameRank);
+
+        if (CC_QQPLAY) {
+            this.rankTab[2].active = false;
+            this.crowdNode.active = false;
+        }
     },
 
     init(index = 0) {
@@ -96,7 +101,7 @@ cc.Class({
                 messageType: 4
             });
         }
-        Global.shareTicket = '';
+        GameGlobal.shareTicket = '';
         GameEvent.off(GameNotificationKey.GameShowGroupRank, this);
     },
 

+ 33 - 0
assets/scripts/rank/GameRankItem.js

@@ -69,6 +69,39 @@ cc.Class({
 
         this.nameLabel.string = model.nick;
         this.lvRichText.string = `<b><outline color=white width=2><color=#934C31>LV.${model.buildingLevel}</color></outline></b>`;
+    },
+
+    initQQData(model, isMe = false) {
+        this.model = model;
+        this.isMe = isMe;
+        // model 的字段如下:
+        //var rd = {
+        //    url: '',            // 头像的 url
+        //    nick: '',           // 昵称
+        //    score: 1,           // 分数
+        //    selfFlag: false,    // 是否是自己
+        //};
+
+        this.headSprite.spriteFrame = this.headDefaultSpriteFrame;
+        if (model.url) {
+            Api.createImageFromUrl(model.url, (spriteFrame) => {
+                this.headSprite.spriteFrame = spriteFrame;
+        });
+        }
+
+        if (model.rank < 4) {
+            this.rankSprite.node.active = true;
+            this.rankRichText.node.active = false;
+            this.rankSprite.spriteFrame = this.rankSpriteFrame[(model.rank - 1)];
+        } else {
+            this.rankSprite.node.active = false;
+            this.rankRichText.node.active = true;
+            let rank = (model.rank > 100) ? "100+" : model.rank;
+            this.rankRichText.string = `<b><outline color=#692e0e width=2><color=white>${rank}</color></outline></b>`;
+        }
+
+        this.nameLabel.string = model.nick;
+        this.lvRichText.string = `<b><outline color=white width=2><color=#934C31>LV.${model.score}</color></outline></b>`;
     }
 
     // update (dt) {},

+ 6 - 13
assets/scripts/signIn/SignIn.js

@@ -45,38 +45,31 @@ cc.Class({
                 this.isSigned = false;
                 // 更新全局userInfo
                 GameModule.userInfo.diamond += this.award.diamond;
-                Global.isSignAward = true;
+                GameGlobal.isSignAward = true;
                 this.node.destroy();
             }, (errCode, errMsg) => {
                 this.isSigned = false;
                 if (errCode == -3) {
                     this.node.destroy();
                 } else {
-                    Global.commonAlert.showCommonErrorAlert(`签到失败 \n${errMsg}`);
+                    GameGlobal.commonAlert.showCommonErrorAlert(`签到失败 \n${errMsg}`);
                 }
             });
         }
     },
 
     start () {
-        this.getAllSign().then((respondData) => {
+        this.getAllSign((respondData) => {
             this.configData(respondData);
-        }).catch((code) => {
+        }, (code) => {
             console.log(code);
             this.node.destroy();
         });
     },
 
     /// 网络请求
-    getAllSign() {
-        return new Promise((resolve, reject) => {
-            // 获取签到数据
-            SignInApi.getUserAllSign((respondData) => {
-                resolve(respondData);
-            }, (code) => {
-                reject(code);
-            });
-        })
+    getAllSign(success, fail) {
+        SignInApi.getUserAllSign(success, fail);
     },
 
     configData(respondData) {

+ 1 - 1
assets/scripts/skill/SkillBuildingAlert.js

@@ -4,6 +4,7 @@ const GameModule = require("../utils/GameModule");
 const buildingLevel = require('../data/buildingLevel');
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
 const TapTapTool = require("../utils/TapTapTool");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -83,7 +84,6 @@ cc.Class({
             GameModule.userInfo.buildingLevel = respondData.level;
             GameModule.userInfo.gold = TapTapTool.sub(GameModule.userInfo.gold, upGold);
             this._item.hiddenSkillBuidingAlert(respondData.gold10, respondData.gold100);
-            
             GameEvent.fire(GameNotificationKey.UpBuildingLevel);
           }).catch(({code, msg}) => {
               console.log(code, msg);

+ 4 - 3
assets/scripts/skill/SkillBuyAlert.js

@@ -2,6 +2,7 @@
 const SkillApi = require('../net/SkillApi');
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
 const GameModule = require("../utils/GameModule");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -52,7 +53,7 @@ cc.Class({
             this._starItem.skillData.skillLevel += 1;
             this._starItem.updateGloabData();
             GameEvent.fire('skill_update');
-            let skillLevelInfo = Global.BuildingManager.getSkillLevelInfo(this._skillId, this._starItem.skillData.skillLevel);
+            let skillLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this._skillId, this._starItem.skillData.skillLevel);
             if (this._skillId <= 3) {
                 GameEvent.fire(GameNotificationKey.UpdateTimeSkill, skillLevelInfo);
             } else {
@@ -62,7 +63,7 @@ cc.Class({
                     GameEvent.fire("skill_five_use");
                     /// 使用最后一个减cd的
                 } else if (this._skillId == 6) {
-                    Global.rcdSkillLevel += 1;
+                    GameGlobal.rcdSkillLevel += 1;
                     GameEvent.fire("skill_six_use");
                 }
             }
@@ -71,7 +72,7 @@ cc.Class({
             console.log("升级技能成功");
           }).catch(({code, msg}) => {
               console.log(code, msg);
-              Global.commonAlert.showCommonErrorAlert(msg);
+              GameGlobal.commonAlert.showCommonErrorAlert(msg);
               this.buyButton.interactable = true;
         });
     },

+ 21 - 19
assets/scripts/skill/SkillItem.js

@@ -7,8 +7,10 @@ const WeChat = require('../net/WeChat');
 
 const TapTapTool = require("../utils/TapTapTool");
 const AlertManager = require('../utils/AlertManager');
-const ADVideo = require('../utils/ADVideo');
+// const ADVideo = require('../utils/ADVideo');
 const HomeApi = require('../net/HomeApi');
+// const GameRedDot = require('../utils/GameEnum').GameRedDot;
+var Promise = require('../lib/es6-promise').Promise;
 
 // const GameRedDot = require('../utils/GameEnum').GameRedDot;
 // WeChat
@@ -93,7 +95,7 @@ cc.Class({
         if (this.fillBuldingNode.active && this._isAction === false)  {
             let isCanUse = this.judgeIsCanUse();
             if (CC_WECHATGAME) {
-                let isAd = DWTool.checkIsOldUser() && Global._upBuildingInfo.maxCount > Global._upBuildingInfo.count && Global._upBuildingInfo.cdTime <= 0;
+                let isAd = DWTool.checkIsOldUser() && GameGlobal._upBuildingInfo.maxCount > GameGlobal._upBuildingInfo.count && GameGlobal._upBuildingInfo.cdTime <= 0;
                 /// 如果有广告或者分享
                 if (!this._isInitAd && isAd) {
                     this._isInitAd = true;
@@ -157,10 +159,10 @@ cc.Class({
             return;
         }
         //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this._adState = 2;
             this.freeSkillTitleRichText.string = '<color=#ffffff> 看视频\n免费升级' + '</c>';
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 1;
             this.freeSkillTitleRichText.string = '<color=#ffffff> 分享\n免费升级' + '</c>';
         }
@@ -168,9 +170,9 @@ cc.Class({
 
     finishAction() {
         HomeApi.reportInformation(1, () => {
-            Global._upBuildingInfo.count += 1;
+            GameGlobal._upBuildingInfo.count += 1;
             /// 时间重置为5分钟
-            Global._upBuildingInfo.cdTime = 5 * 60 * 1000;
+            GameGlobal._upBuildingInfo.cdTime = 5 * 60 * 1000;
             this.requestUpBuildingLevel(true);
         }, (code, msg) => {
             console.log(msg);
@@ -233,8 +235,8 @@ cc.Class({
     },
     /// 更新技能相关数据
     updateData() {
-        let levelInfo = Global.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel); 
-        let skillInfo = Global.BuildingManager.getSkillInfo(this.skillData.skillId);
+        let levelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel); 
+        let skillInfo = GameGlobal.BuildingManager.getSkillInfo(this.skillData.skillId);
         this._skillInfo = skillInfo;
          //// 如果是没有拥有的
         if (this.skillData.isHave == 0) {
@@ -397,7 +399,7 @@ cc.Class({
             });
             /// 如果是看视频
         } else {
-            Global._adVideo.showVideo('skill');
+            GameGlobal._adVideo.showVideo('skill');
         }
     },
 
@@ -420,10 +422,10 @@ cc.Class({
             }
             this.initAward(this._awardCount);
             GameEvent.fire(GameNotificationKey.UpBuildingLevel);
-            Global._gold10 = respondData.gold10;
+            GameGlobal._gold10 = respondData.gold10;
             this.updateBuildingData();
           }).catch(({code, msg}) => {
-              Global.commonAlert.showCommonErrorAlert(msg);
+            GameGlobal.commonAlert.showCommonErrorAlert(msg);
               console.log(code, msg);
               this._isAction = false;
               this.userSkillButton.interactable = true;
@@ -445,14 +447,14 @@ cc.Class({
                console.log("技能购买成功");
              }).catch(({code, msg}) => {
                  console.log(code, msg);
-                 Global.commonAlert.showCommonErrorAlert(msg);
+                 GameGlobal.commonAlert.showCommonErrorAlert(msg);
                  this.userSkillButton.interactable = true;
            });
         /// 升级技能
        } else {
-           let levelInfo = Global.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel);
+           let levelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel);
            levelInfo.name = this._skillInfo.name; 
-           let nextInfo = Global.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel + 1);
+           let nextInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skillData.skillId, this.skillData.skillLevel + 1);
            nextInfo.name = this._skillInfo.name;
            AlertManager.showSkillBuyAlert(levelInfo, nextInfo, this);
            this.userSkillButton.interactable = true;
@@ -466,12 +468,12 @@ cc.Class({
         this.skillData.isHave = 1;
         let skillId = this.skillData.skillId;
         /// 如果升级永久技能
-        let skillLevelInfo = Global.BuildingManager.getSkillLevelInfo(skillId, this.skillData.skillLevel);
+        let skillLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(skillId, this.skillData.skillLevel);
         GameEvent.fire(GameNotificationKey.UpdateFixationSkill, skillLevelInfo);
         if (skillId == 5) {
             GameEvent.fire("skill_five_use");
         } else if (skillId == 6) {
-            Global.rcdSkillLevel = 1;
+            GameGlobal.rcdSkillLevel = 1;
             GameEvent.fire("skill_six_use");
         }
         let iconPath = './textures/skill/4000' + skillId;
@@ -480,7 +482,7 @@ cc.Class({
 
     /// 显示购买技能
     showBuySkill() {
-        // let levelInfo = Global.BuildingManager.getSkillLevelInfo(this.skillData.skillId, 1);
+        // let levelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skillData.skillId, 1);
         
         /// 使用金币升级
         let diamondCount = this._skillInfo.bonus[10002];
@@ -536,8 +538,8 @@ cc.Class({
             GameEvent.fire(GameNotificationKey.UpBuildingLevel);
             GameEvent.fire(GameNotificationKey.GameShowAdditionTips,"总部大楼",0);
             this.updateBuildingData();
-            let objct = {'cdTime': -6 * 1000, 'infoDesc': '点击提升2倍的金币产出', 'icon': 900001};
-            Global._fixInformations.push(objct);
+            let objct = {'cdTime': -6 * 1000, 'desc': '点击提升2倍的金币产出', 'icon': 900001};
+            GameGlobal._fixInformations.push(objct);
             GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, false);
             console.log("领取里程碑奖励成功");
           }).catch(({code, msg}) => {

+ 42 - 32
assets/scripts/skill/SkillTopItem.js

@@ -5,8 +5,7 @@ const {GameNotificationKey, WechatShareType } = require('../utils/GameEnum');
 const WeChat = require('../net/WeChat');
 const TapTapTool = require("../utils/TapTapTool");
 const AlertManager = require('../utils/AlertManager');
-// const GameRedDot = require('../utils/GameEnum').GameRedDot;
-// const ADVideo = require('../utils/ADVideo');
+var Promise = require('../lib/es6-promise').Promise;
 
 const SkillState = cc.Enum({
     /// 使用中
@@ -72,7 +71,7 @@ cc.Class({
                 AlertManager.showCommonAlert(iconPath, this._skillData.desc, this._skillData.name);
                 let iconId = 900005 + skillId
                 let objct = {'cdTime': 0, 'infoDesc': `${this._skillData.name}可使用`, 'name': this._skillData.name, 'icon': iconId, 'sId': skillId, 'type': 2, 'skillStatus': 0};
-                Global._timeInformations.push(objct);
+                GameGlobal._timeInformations.push(objct);
                 GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
                 /// 设置重置技能可用
             } else if (this.skillInfo == undefined && this._isAlllLocked) {
@@ -101,7 +100,7 @@ cc.Class({
             this.setupTopSkillNotification();            
         } 
         this.skillInfo = skillInfo;
-        let skillData = Global.BuildingManager.getSkillInfo(skillInfo.skillId);
+        let skillData = GameGlobal.BuildingManager.getSkillInfo(skillInfo.skillId);
         this._skillData = skillData;
         if (skillInfo.isHave == 0) {
             this.setUpSkillState(SkillState.lockedState);
@@ -110,8 +109,8 @@ cc.Class({
         }
         /// 如果不是第二个技能那么去更新信息流时间
         if (skillInfo.skillId != 2) {
-            for (let i = 0; i < Global._timeInformations.length; ++ i) {
-                let information = Global._timeInformations[i]
+            for (let i = 0; i < GameGlobal._timeInformations.length; ++ i) {
+                let information = GameGlobal._timeInformations[i]
                 /// 如果是第一个技能或者第三个技能则更新它的时间
                 if (information.type == 2 && information.sId == skillInfo.skillId) {
                     /// 技能使用cd中
@@ -135,8 +134,8 @@ cc.Class({
                 this.setUpSkillState(SkillState.canUseState);
             }
             let isNew = true;
-            for (let i = 0; i < Global._timeInformations.length; ++ i) {
-                let information = Global._timeInformations[i]
+            for (let i = 0; i < GameGlobal._timeInformations.length; ++ i) {
+                let information = GameGlobal._timeInformations[i]
                 /// 如果是第一个技能或者第三个技能则更新它的时间
                 if (information.type == 2 && information.sId == this.skillInfo.skillId) {
                     information.cdTime = 0;
@@ -150,7 +149,7 @@ cc.Class({
             if (isNew) {
                 let iconId = 900005 + this.skillInfo.skillId
                 let objct = {'cdTime': 0, 'infoDesc': `${this.skillInfo.name}可使用`, 'name': this.skillInfo.name, 'icon': iconId, 'sId': this.skillInfo.skillId, 'type': 2, 'skillStatus': 0};
-                Global._timeInformations.push(objct);
+                GameGlobal._timeInformations.push(objct);
                 GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
             }
         });
@@ -158,7 +157,7 @@ cc.Class({
         /// 第六个技能使用  需要更新cd时间
         GameEvent.on("skill_six_use", this, () => {
             
-            let lastLevelInfo = Global.BuildingManager.getSkillLevelInfo(6, Global.rcdSkillLevel);
+            let lastLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(6, GameGlobal.rcdSkillLevel);
             this.cd = this._levelInfo.cd * (1 - lastLevelInfo.rcd / 100);
         });
 
@@ -170,12 +169,12 @@ cc.Class({
     },
 
     updataData() {
-        let levelInfo = Global.BuildingManager.getSkillLevelInfo(this.skillInfo.skillId, this.skillInfo.skillLevel);
+        let levelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(this.skillInfo.skillId, this.skillInfo.skillLevel);
         this._levelInfo = levelInfo;
-        if (Global.rcdSkillLevel == 0) {
+        if (GameGlobal.rcdSkillLevel == 0) {
             this.cd = levelInfo.cd;
         } else {
-            let lastLevelInfo = Global.BuildingManager.getSkillLevelInfo(6, Global.rcdSkillLevel);
+            let lastLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(6, GameGlobal.rcdSkillLevel);
             this.cd = levelInfo.cd * (1 - lastLevelInfo.rcd / 100);
         }
         /// 技能cd
@@ -210,8 +209,8 @@ cc.Class({
             this.setUpSkillState(SkillState.lockedState);
             return;
         }
-        this.resetSkillAlertTextRich.string = `<b><color=#6d4a36>是否花费${Global.rsDiamond}钻石重置技能?</color></b>`;
-        let resetSkillTime = Global.userData.resetSkillTime;
+        this.resetSkillAlertTextRich.string = `<b><color=#6d4a36>是否花费${GameGlobal.rsDiamond}钻石重置技能?</color></b>`;
+        let resetSkillTime = GameGlobal.userData.resetSkillTime;
         let timestamp = new Date().getTime();
 
         let totalCd = (timestamp - resetSkillTime) / 1000;
@@ -241,9 +240,9 @@ cc.Class({
             return;
         }
         //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this._adState = 1;
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 0;
         }
         this.updateResetTitle();
@@ -252,7 +251,7 @@ cc.Class({
     updateResetTitle() {
         if (this.resetSkillTitleRichTitle != null) {
             if (this._adState === 0) {
-                this.resetSkillTitleRichTitle.string = `<outline color=#fd9f00 width=1><b><color=#6e3011>${Global.rsDiamond}钻石\n重置技能</c></b></outline>`;
+                this.resetSkillTitleRichTitle.string = `<outline color=#fd9f00 width=1><b><color=#6e3011>${GameGlobal.rsDiamond}钻石\n重置技能</c></b></outline>`;
             } else {
                 this.resetSkillTitleRichTitle.string = `<outline color=#fd9f00 width=1><b><color=#6e3011>观看视频\n重置技能</c></b></outline>`;
             }
@@ -303,7 +302,7 @@ cc.Class({
 
     sendNotification() {
         let skillId = this.skillInfo.skillId;
-        let skillLevelInfo = Global.BuildingManager.getSkillLevelInfo(skillId, this.skillInfo.skillLevel);
+        let skillLevelInfo = GameGlobal.BuildingManager.getSkillLevelInfo(skillId, this.skillInfo.skillLevel);
         GameEvent.fire(GameNotificationKey.UseTimeSkill, skillLevelInfo);
                 //         cdTime	剩余时间	是	[long]	查看
     // 5	 desc	描述	是	[string]	查看
@@ -314,8 +313,8 @@ cc.Class({
             let text = TapTapTool.parseToString(gold);
             AlertManager.showSkill2Efc(text);
             let isNew = true;
-            for (let i = 0; i < Global._timeInformations.length; ++ i) {
-                let information = Global._timeInformations[i];
+            for (let i = 0; i < GameGlobal._timeInformations.length; ++ i) {
+                let information = GameGlobal._timeInformations[i];
                 if (information.type == 2 && information.sId == 2) {
                     /// 如果是已经使用过的直接刷新时间就可以啦
                     information.cdTime = -6 * 1000;
@@ -327,7 +326,7 @@ cc.Class({
             }
             if (isNew) {
                 let objct = {'cdTime': -6 * 1000, 'infoDesc': `获得金币${text}`, 'name': this.skillInfo.name, 'icon': 900007, 'sId': 2, 'type': 2, 'skillStatus': 1};
-                Global._fixInformations.push(objct);
+                GameGlobal._fixInformations.push(objct);
                 GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, false);
             }
         } else {
@@ -347,8 +346,8 @@ cc.Class({
         } else {
             infoDesc = infoDesc.replace('${num}', skillLevelInfo.mt * 100);
         }
-        for (let i = 0; i < Global._timeInformations.length; ++ i) {
-            let information = Global._timeInformations[i];
+        for (let i = 0; i < GameGlobal._timeInformations.length; ++ i) {
+            let information = GameGlobal._timeInformations[i];
             if (information.type == 2 && information.sId == skillId) {
                 /// 如果是已经使用过的直接刷新时间就可以啦
                 information.cdTime = skillLevelInfo.td * 1000;
@@ -360,7 +359,7 @@ cc.Class({
         }
         if (isNew){
             let objct = {'cdTime': skillLevelInfo.td * 1000, 'infoDesc': infoDesc, 'name': this.skillInfo.name, 'icon': 900005 + skillId, 'sId': skillId, 'type': 2, 'skillStatus': 1};
-            Global._timeInformations.push(objct);
+            GameGlobal._timeInformations.push(objct);
             GameEvent.fire(GameNotificationKey.GameUpdateMessageList, 1, true);
         }
     },
@@ -421,16 +420,27 @@ cc.Class({
         if (CC_WECHATGAME) {
             this.button.interactable = false;
             if (this._adState === 0) {
-                if (Global.rsDiamond <= GameModule.userInfo.diamond) {
+                if (GameGlobal.rsDiamond <= GameModule.userInfo.diamond) {
                      /// 弹出弹窗让它花砖石购买
                     this.resetSkillAlertNode.active = true;
                 } else {
-                    Global.commonAlert.showCommonErrorAlert('钻石不够,无法重置技能!');
+                    GameGlobal.commonAlert.showCommonErrorAlert('钻石不够,无法重置技能!');
                 }
            } else {
-            Global._adVideo.showVideo('resetSkill');
+            GameGlobal._adVideo.showVideo('resetSkill');
             this.button.interactable = true;
            }
+        } else if (CC_QQPLAY) {
+            this.button.interactable = false;
+            ADVideo.qqPlayADVideo(() => {
+                this.button.interactable = true;
+            }, (isFinished) => {
+                if (isFinished) {
+                    this.shareActionCallback();
+                } else {
+                    this.button.interactable = true;
+                }
+            });
         }
     },
 
@@ -447,21 +457,21 @@ cc.Class({
 
     shareActionCallback() {
         this.resetSkill().then((respondData) => {
-            Global.userData.resetSkillTime = respondData.curSystemTime;
+            GameGlobal.userData.resetSkillTime = respondData.curSystemTime;
             this.setUpSkillState(SkillState.cdState);
             this.timeLabelCount = this.cd;
             this.titleRichText.string = DWTool.calculateTime(this.cd);
             this.skillBg.fillRange = -1;
             if (this._adState === 0) {
-                GameModule.userInfo.diamond -= Global.rsDiamond;
+                GameModule.userInfo.diamond -= GameGlobal.rsDiamond;
                 this.resetSkillAlertTextRich.string = `<b><color=#6d4a36>是否花费${respondData.rsDiamond}钻石重置技能?</color></b>`;
-                Global.rsDiamond = respondData.rsDiamond;
+                GameGlobal.rsDiamond = respondData.rsDiamond;
                 this.updateResetTitle();
             }
             GameEvent.fire(GameNotificationKey.ResetSkill);
         }).catch(({code, msg}) => {
             console.log(code, msg);
-            Global.commonAlert.showCommonErrorAlert(msg);
+            GameGlobal.commonAlert.showCommonErrorAlert(msg);
             this.button.interactable = true;
         });
     },

+ 5 - 4
assets/scripts/skill/skillContent.js

@@ -3,6 +3,7 @@ const SkillApi = require('../net/SkillApi');
 const GameModule = require("../utils/GameModule");
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
 // const TapTapTool = require("../utils/TapTapTool");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -25,15 +26,15 @@ cc.Class({
 
     // LIFE-CYCLE CALLBACKS:
     onLoad () {
-        this.node.height = Global.winSize.height;
-        if (Global.winSize.height <= 1000) {
+        this.node.height = GameGlobal.winSize.height;
+        if (GameGlobal.winSize.height <= 1000) {
             this.content.height = 800;
         }
         this.setUpNotification();
         this.skillScrollView.active = false; 
         this.handelGuide();
 
-        // if (Global.isCheck) {
+        // if (GameGlobal.isCheck) {
         //     this.topSkillItems[3].active = false;
         // }
     },
@@ -60,7 +61,7 @@ cc.Class({
             }
             this._respondData = respondData;
             /// 初始化这个scrollView
-            Global.rcdSkillLevel = respondData.skills2[2].skillLevel;
+            GameGlobal.rcdSkillLevel = respondData.skills2[2].skillLevel;
             this.skillScrollView.active = true;
             this.initTopSkillItem(respondData.skills1);
             this.schedule(this.timeAction, 1);

+ 5 - 4
assets/scripts/star/StarContent.js

@@ -4,6 +4,7 @@ const ArtistManager = require('../utils/ArtistManager');
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
 const DWTool = require('../utils/DWTool');
 const GameModule = require("../utils/GameModule");
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -25,8 +26,8 @@ cc.Class({
     // LIFE-CYCLE CALLBACKS:
 
     onLoad () {
-        this.node.height = Global.winSize.height;
-        if (Global.winSize.height <= 1000) {
+        this.node.height = GameGlobal.winSize.height;
+        if (GameGlobal.winSize.height <= 1000) {
             this.content.height = 800;
         }
 
@@ -35,7 +36,7 @@ cc.Class({
         this.setUpNotification();
         this.handelGuide();
         this._isTimeAction = false;
-        if (Global.isCheck) {
+        if (GameGlobal.isCheck) {
             this.albumNode.active = false;
         }
     },
@@ -88,7 +89,7 @@ cc.Class({
 
         GameEvent.on(GameNotificationKey.RefreshSignArtistList, this, () => {
             this.node.destroy();
-            Global.starContent = null;
+            GameGlobal.starContent = null;
         });
     },
 

+ 3 - 2
assets/scripts/star/StarHandbook.js

@@ -2,6 +2,7 @@ const StarApi = require('../net/StarApi');
 const GameModule = require('../utils/GameModule');
 const {GameNotificationKey, StarType} = require('../utils/GameEnum');
 const AlertManager = require('../utils/AlertManager');
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -40,7 +41,7 @@ cc.Class({
 
         this.isFirst = true;
 
-        if (Global.winSize.height <= 1000) {
+        if (GameGlobal.winSize.height <= 1000) {
             this.content.height = 800;
         }
 
@@ -310,7 +311,7 @@ cc.Class({
             this.recallAllNode.active = false;
         }, (code, msg) => {
             this.isRecalling = false;
-            Global.commonAlert.showCommonErrorAlert(`收回失败 \n${msg}`);
+            GameGlobal.commonAlert.showCommonErrorAlert(`收回失败 \n${msg}`);
         });
     },
 

+ 5 - 5
assets/scripts/star/StarHandbookDesc.js

@@ -43,13 +43,13 @@ cc.Class({
             console.log(err);
         });
 
-        let star = Global.BuildingManager.getStarInfo(starInfo.starId);
+        let star = GameGlobal.BuildingManager.getStarInfo(starInfo.starId);
         this.nameLabel.string = star.name;
 
         if (star.starDesc) {
             this.conditionLabel.string = star.starDesc;
         } else {
-            let roomName = Global.BuildingManager.getRoomName(star.roomId);
+            let roomName = GameGlobal.BuildingManager.getRoomName(star.roomId);
             if (roomName) {
                 var descString = `需要 开启${roomName}`;
             }
@@ -99,11 +99,11 @@ cc.Class({
                     this.refreshStarCount();
                     GameEvent.fire(GameNotificationKey.StarEnterRoom, respondData.starId, respondData.roomId);
                 } else {
-                    Global.commonAlert.showCommonErrorAlert("派出失败 \n没有空余的房间");
+                    GameGlobal.commonAlert.showCommonErrorAlert("派出失败 \n没有空余的房间");
                 }
             }, (code, msg) => {
                 this.isDoing = false;
-                Global.commonAlert.showCommonErrorAlert(`派出失败 \n${msg}`);
+                GameGlobal.commonAlert.showCommonErrorAlert(`派出失败 \n${msg}`);
         })
     },
 
@@ -119,7 +119,7 @@ cc.Class({
             GameEvent.fire(GameNotificationKey.StarLeaveRoom, respondData.starId, respondData.roomId);
         }, (code, msg) => {
             this.isDoing = false;
-            Global.commonAlert.showCommonErrorAlert(`召回失败 \n${msg}`);
+            GameGlobal.commonAlert.showCommonErrorAlert(`召回失败 \n${msg}`);
         })
     }
 

+ 12 - 12
assets/scripts/star/StarItem.js

@@ -7,7 +7,7 @@ const ArtistManager = require('../utils/ArtistManager');
 const HomeApi = require('../net/HomeApi');
 const {GameNotificationKey, WechatShareType} = require('../utils/GameEnum');
 const WeChat = require('../net/WeChat');
-// const ADVideo = require('../utils/ADVideo');
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -91,7 +91,7 @@ cc.Class({
             // }
             let isCanUse = TapTapTool.compare(GameModule.userInfo.gold, this._buyGold);
             if (CC_WECHATGAME) {
-                let isAd = DWTool.checkIsOldUser() && Global._buyStarInfo.maxCount > Global._buyStarInfo.count && Global._buyStarInfo.cdTime <= 0;
+                let isAd = DWTool.checkIsOldUser() && GameGlobal._buyStarInfo.maxCount > GameGlobal._buyStarInfo.count && GameGlobal._buyStarInfo.cdTime <= 0;
             
                 if (isAd && !this._isInitAd) {
                     this._isInitAd = true;
@@ -119,10 +119,10 @@ cc.Class({
             return;
         }
         //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this._adState = 2;
             this.freeBuyStarRichText.string = '<color=#ffffff> 看视频\n免费签约' + '</c>';
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 1;
             this.freeBuyStarRichText.string = '<color=#ffffff> 分享\n免费签约' + '</c>';
         }
@@ -130,9 +130,9 @@ cc.Class({
 
     finishAction() {
         HomeApi.reportInformation(3, () => {
-            Global._buyStarInfo.count += 1;
+            GameGlobal._buyStarInfo.count += 1;
             /// 时间重置为5分钟
-            Global._buyStarInfo.cdTime = 5 * 60 * 1000;
+            GameGlobal._buyStarInfo.cdTime = 5 * 60 * 1000;
             /// 恢复到正常的状态
             this._isAcion = false;
             this.buyStarRequest(true);
@@ -151,7 +151,7 @@ cc.Class({
         this._itemId = itemId;
         this._starData = userInfo;
         // console.log(this._starData.itemId);
-        this._starInfo = Global.BuildingManager.getStarInfo(this._starData.starId);
+        this._starInfo = GameGlobal.BuildingManager.getStarInfo(this._starData.starId);
         this.updateData();
         this.starNameLabel.string = this._starInfo.name;
 
@@ -192,8 +192,8 @@ cc.Class({
         } else {
             let buyStarCount = GameModule.userInfo.buyStarCount;
             let roomId = this._starData.signRoomId;
-            let isUnlocked = Global.BuildingManager.getRoomIsUnlocked(roomId);
-            let roomName = Global.BuildingManager.getRoomName(roomId);
+            let isUnlocked = GameGlobal.BuildingManager.getRoomIsUnlocked(roomId);
+            let roomName = GameGlobal.BuildingManager.getRoomName(roomId);
             
             this._isRoomLocked = false;
             this._isStarLocked = false;
@@ -285,7 +285,7 @@ cc.Class({
             });
             /// 如果是看视频
         } else {
-            Global._adVideo.showVideo('buyStar' + this._starData.starId);
+            GameGlobal._adVideo.showVideo('buyStar' + this._starData.starId);
         }
     },
 
@@ -316,7 +316,7 @@ cc.Class({
             this._starData.starCount += 1;
             GameModule.userInfo.perpetualClickMt = TapTapTool.multiple(GameModule.userInfo.perpetualClickMt, {'e': 0, 'n': 2});
             GameModule.userInfo.perpetualMt = TapTapTool.multiple(GameModule.userInfo.perpetualMt, {'e': 0, 'n': 2});
-            Global._buyStarGold = respondData.buyGold;
+            GameGlobal._buyStarGold = respondData.buyGold;
             this.undateStarCount();
             this._listViewAdapter.isBuying = false;
             GameEvent.fire(GameNotificationKey.StarEnterRoom, this._starData.starId, respondData.roomId);
@@ -325,7 +325,7 @@ cc.Class({
         }).catch(({code, msg}) => {
             this.starUseBtn.interactable = true;
             this._isAction = false;
-            Global.commonAlert.showCommonErrorAlert(msg);
+            GameGlobal.commonAlert.showCommonErrorAlert(msg);
             console.error(error);
         });
     },

+ 6 - 5
assets/scripts/store/StoreContent.js

@@ -3,6 +3,7 @@ const DWTool = require("../utils/DWTool");
 const GameModule = require("../utils/GameModule");
 const GameRedDot = require('../utils/GameEnum').GameRedDot;
 const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -40,8 +41,8 @@ cc.Class({
     // LIFE-CYCLE CALLBACKS:
 
     onLoad () {
-        this.node.height = Global.winSize.height;
-        if (Global.winSize.height <= 1000) {
+        this.node.height = GameGlobal.winSize.height;
+        if (GameGlobal.winSize.height <= 1000) {
             this.contentNode.height = 800;
         }
 
@@ -57,7 +58,7 @@ cc.Class({
         this.handelStoreShowRedDot();
 
         GameEvent.on(GameNotificationKey.GameRedDotUpdate, this, this.handelStoreShowRedDot);
-        this.userIdLabel.string = `ID ${Global.user.uid}`
+        this.userIdLabel.string = `ID ${GameGlobal.user.uid}`
     },
 
     start () {
@@ -74,12 +75,12 @@ cc.Class({
     },
 
     handelStoreShowRedDot() {
-        if (Global._redTypes == null || Global._redTypes == undefined || Global._redTypes.length == 0) {
+        if (GameGlobal._redTypes == null || GameGlobal._redTypes == undefined || GameGlobal._redTypes.length == 0) {
             this.coinRedNode.active = false;
             this.diamandRedNode.active = false;
             return;
         }
-        let redTypes = Global._redTypes;
+        let redTypes = GameGlobal._redTypes;
         
         this.coinRedNode.active = redTypes.indexOf(GameRedDot.storeCoin) != -1;
         let diamandActive = redTypes.indexOf(GameRedDot.storeDiamond) != -1

+ 28 - 0
assets/scripts/store/StoreQQAddGroup.js

@@ -0,0 +1,28 @@
+
+
+cc.Class({
+    extends: cc.Component,
+
+    properties: {
+        
+    },
+
+    // LIFE-CYCLE CALLBACKS:
+
+    onLoad () {
+        this.node.height = GameGlobal.winSize.height;
+        if (GameGlobal.winSize.height <= 1000) {
+            this.content.height = 800;
+        }
+    },
+
+    start () {
+
+    },
+
+    hiddenAction() {
+        this.node.destroy();
+    }
+
+    // update (dt) {},
+});

+ 9 - 0
assets/scripts/store/StoreQQAddGroup.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.5",
+  "uuid": "3ebad8d2-85c6-4956-b637-3b0cac55c211",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 4 - 4
assets/scripts/store/StoreSmallItem.js

@@ -5,7 +5,7 @@ const AlertManager = require('../utils/AlertManager');
 const WeChat = require('../net/WeChat');
 const StoreApi = require('../net/StoreApi');
 const {GameNotificationKey, WechatShareType, GameRedDot } = require('../utils/GameEnum');
-// const ADVideo = require('../utils/ADVideo');
+var Promise = require('../lib/es6-promise').Promise;
 
 cc.Class({
     extends: cc.Component,
@@ -135,9 +135,9 @@ cc.Class({
         }
         // this.adId = this._tabIndex === 2 ? ADVideo.storeAdDiamand : ADVideo.storeAdCoinId;
          //// 说明有广告
-        if (Global._adVideoState == 0) {
+        if (GameGlobal._adVideoState == 0) {
             this._adState = 1;
-        } else if (Global._adVideoState === 1) {
+        } else if (GameGlobal._adVideoState === 1) {
             this._adState = 0;
         }
         this.updateNormalTitle();
@@ -259,7 +259,7 @@ cc.Class({
                     this.buyBtn.interactable = true;
                 });
             } else {
-                Global._adVideo.showVideo('store' + this._tabIndex);
+                GameGlobal._adVideo.showVideo('store' + this._tabIndex);
             }
         } else if (this._tabIndex == 3 && this._index == 1) {
             this.buyBtn.interactable = false;

+ 56 - 6
assets/scripts/utils/ADVideo.js

@@ -13,12 +13,12 @@ class ADVideo {
             adUnitId: defualtADdId
         });
         /// 默认是加载成功的 啦
-        Global._adVideoState = ADVideoLoadState.success;
+        GameGlobal._adVideoState = ADVideoLoadState.success;
         this.videoAd = videoAd;
         videoAd.load()
             .then(() => {
                 this.isFirstLoad = false;
-                Global._adVideoState = ADVideoLoadState.success;
+                GameGlobal._adVideoState = ADVideoLoadState.success;
                 GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.success);
                 console.log('视频加载成功');
             })
@@ -53,14 +53,64 @@ class ADVideo {
                 console.log('视频未正常关闭');
                 GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.closeFail, this.callBackObjct);
             }
-
             if (GameModule.audioMng) {
                 GameModule.audioMng.playBgm();
             }
             SkillApi.report(1, (responseData) => {
             },(error) => {
             });
-        })
+        });
+    }
+
+    static qqPlayADVideo(error,close) {
+        var isFinished = false;
+
+        var videoAd = BK.Advertisement.createVideoAd();
+        videoAd.onLoad(() => {
+            //加载成功
+            BK.Script.log(1,1,"onLoad")
+        });
+
+        videoAd.onPlayStart(() => {
+            if (GameModule.audioMng) {
+                GameModule.audioMng.stopBgm();
+            }
+            //开始播放
+            BK.Script.log(1,1,"onPlayStart")
+        });
+
+        videoAd.onPlayFinish(() => {
+            //播放结束
+            BK.Script.log(1,1,"onPlayFinish")
+            isFinished = true;
+        });
+
+        videoAd.onError((err) => {
+            //加载失败
+            BK.Script.log(1,1,"onError code:"+err.code+" msg:"+err.msg);
+            GameGlobal.commonAlert.showCommonErrorAlert('获取视频失败');
+            error && error();
+        });
+
+        videoAd.onClose(() => {
+            if (isFinished) {
+                //看完完整广告,可下发奖励
+                close && close(true);
+                SkillApi.report(1, (responseData) => {
+
+                },(error) => {
+
+                });
+            } else {
+                // 未看完广告,不下发游戏奖励
+                close && close(false);
+            }
+            if (GameModule.audioMng) {
+                GameModule.audioMng.playBgm();
+            }
+        });
+
+        videoAd.show();
     }
     /// 需要在close中回调的对象
     showVideo(callBackObjct = null) {
@@ -79,7 +129,7 @@ class ADVideo {
                 //     Global.commonAlert.showCommonErrorAlert('获取视频失败');
                 // }
                 if (err.errMsg && err.errMsg.includes('video-ad is showed')) {
-                    Global.commonAlert.showCommonErrorAlert('视频正在播放请不要重复点击~~');
+                    GameGlobal.commonAlert.showCommonErrorAlert('视频正在播放请不要重复点击~~');
                     return;
                 } else {
                     this.handelVideoErr(err);
@@ -91,7 +141,7 @@ class ADVideo {
         // if (isShow) {
         //     Global.commonAlert.showCommonErrorAlert('获取视频失败');
         // } 
-        Global._adVideoState = ADVideoLoadState.fail;
+        GameGlobal._adVideoState = ADVideoLoadState.fail;
         console.log('获取视频失败 fa' + res.errMsg);
         GameEvent.fire(GameNotificationKey.AdUpdateStateNotification, ADVideoLoadState.fail);
     }

+ 25 - 6
assets/scripts/utils/AlertManager.js

@@ -78,16 +78,16 @@ class AlertManager {
     /// 显示技能弹窗界面
     static showSkillAlert() {
         GameModule.audioMng.playClickButton();
-        if (Global.skillContent === undefined) {
+        if (GameGlobal.skillContent === undefined) {
             PrefabManager.loadPrefab('skill_content')
                 .then((result) => {
                 let alert = result;
                 let canvas = cc.find("Canvas/commonNode");
                 canvas.addChild(alert);
-                Global.skillContent = alert;
+                GameGlobal.skillContent = alert;
             });
         } else {
-            Global.skillContent.getComponent('skillContent').show();
+            GameGlobal.skillContent.getComponent('skillContent').show();
         }
     }
 
@@ -116,16 +116,16 @@ class AlertManager {
     /// 显示明星界面
     static showStarAlert() {
         GameModule.audioMng.playClickButton();
-        if (Global.starContent === undefined || Global.starContent === null) {
+        if (GameGlobal.starContent === undefined || Global.GameGlobal === null) {
             PrefabManager.loadPrefab('star_content')
                 .then((result) => {
                     let alert = result;
                     let canvas = cc.find("Canvas/commonNode");
                     canvas.addChild(alert);
-                    Global.starContent = alert;
+                    GameGlobal.starContent = alert;
             });
         } else {
-            Global.starContent.getComponent('StarContent').show();
+            GameGlobal.starContent.getComponent('StarContent').show();
         }
     }
 
@@ -268,6 +268,14 @@ class AlertManager {
                 title: message,
                 icon: 'none'
             });
+            /// qq平台直接弹出错误
+        } else if (CC_QQPLAY) {
+            BK.UI.showToast({
+                title: message,
+                duration:1500, complete:function() {
+                    BK.Script.log(0,0,"complete show");
+                }
+            });
         } else {
             alert(message);
         }
@@ -284,6 +292,17 @@ class AlertManager {
         });
     }
 
+
+    // 显示所拥有礼包界面
+    static showStoreQQaddGroup() {
+        DWTool.loadResPrefab("./prefabs/store/storeQQAlert")
+            .then((result) => {
+            let alert = cc.instantiate(result);
+            let canvas = cc.find("Canvas");
+            canvas.addChild(alert);
+        });
+    }
+
     //显示我的小程序神秘礼包界面
     static showAppletAlert() {
         GameModule.audioMng.playClickButton();

+ 7 - 6
assets/scripts/utils/ArtistManager.js

@@ -1,5 +1,6 @@
 
 const DWTool = require("./DWTool");
+var Promise = require('../lib/es6-promise').Promise;
 
 class ThemeManager {
 
@@ -54,9 +55,9 @@ class ThemeManager {
     //骨骼预制资源
     static loadStarSpine(starId) {
         let name = 60000 + parseInt(starId);
-        if (Global.starSpineRes) {
+        if (GameGlobal.starSpineRes) {
             let p = new Promise((resolve, reject) => {
-                let spine = this.getSpineByPath(name,Global.starSpineRes);
+                let spine = this.getSpineByPath(name,GameGlobal.starSpineRes);
             if (spine) {
                 resolve(spine)
             } else {
@@ -94,8 +95,8 @@ class ThemeManager {
 
     //明星黑色头像
     static loadStarBlackAvatarSpriteFrame(starId, sprite) {
-        if (Global.starAvatarRes) {
-            let spriteFrame = this.getSpriteFrameByPath(`star_handbook/dark_${starId}`,Global.starAvatarRes);
+        if (GameGlobal.starAvatarRes) {
+            let spriteFrame = this.getSpriteFrameByPath(`star_handbook/dark_${starId}`,GameGlobal.starAvatarRes);
             if (spriteFrame) {
                 sprite.spriteFrame = spriteFrame;
             } else {
@@ -118,8 +119,8 @@ class ThemeManager {
 
     //明星普通头像
     static loadStarAvatarSpriteFrame(starId, sprite) {
-        if (Global.starAvatarRes) {
-            let spriteFrame = this.getSpriteFrameByPath(`star_handbook/${starId}`,Global.starAvatarRes);
+        if (GameGlobal.starAvatarRes) {
+            let spriteFrame = this.getSpriteFrameByPath(`star_handbook/${starId}`,GameGlobal.starAvatarRes);
             if (spriteFrame) {
                 sprite.spriteFrame = spriteFrame;
             } else {

+ 1 - 1
assets/scripts/utils/BuildingModel.js

@@ -95,7 +95,7 @@ export default class BuildingModel {
 
     isFull() {
 
-        if (this.roomLevel && this.roomLevel == Global.BuildingManager.getLevelCount(this.roomId)) {
+        if (this.roomLevel && this.roomLevel == GameGlobal.BuildingManager.getLevelCount(this.roomId)) {
             return true;
         } else {
             return false;

+ 84 - 59
assets/scripts/utils/DWTool.js

@@ -3,6 +3,7 @@ var ReportType = require("../utils/GameEnum").ReportType;
 var Base64 = require("../lib/Base64").Base64;
 var HomeApi = require("../net/HomeApi");
 var GameModule = require('./GameModule');
+var Promise = require('../lib/es6-promise').Promise;
 
 class DWTool {
 
@@ -75,38 +76,35 @@ class DWTool {
      * @param {*} recordModify 是否有修改的建筑
      * @param {*} recordUnlockModify 是否有解锁的建筑
      */
-    static reportInfo(seq = 1, totalMoney = 0, stars = 0, clickCount = 0, recordModify = [], recordUnlockModify = []) {
-        return new Promise((resolve, reject) => {
-
-            let reportFormInfo = {};
-            reportFormInfo[ReportType.Seq] = seq;
-            reportFormInfo[ReportType.Gold] = totalMoney;
-            reportFormInfo[ReportType.Stars] = stars;
-            reportFormInfo[ReportType.ClickCount] = clickCount;
-            reportFormInfo[ReportType.Timestamp] = Date.parse(new Date());
-
-            if (recordUnlockModify.length > 0 || recordModify.length > 0) {
-                reportFormInfo[ReportType.Event] = 1;
-                if (recordUnlockModify.length > 0) {
-                    reportFormInfo[ReportType.Build] = this.parseReportArray(recordUnlockModify);
-                }
-                if (recordModify.length > 0) {
-                    reportFormInfo[ReportType.Build] = this.parseReportArray(recordModify);
-                }
-            } else {
-                reportFormInfo[ReportType.Event] = 0;
+    static reportInfo(seq = 1, totalMoney = 0, stars = 0, clickCount = 0, recordModify = [], recordUnlockModify = [], success, fail) {
+        let reportFormInfo = {};
+        reportFormInfo[ReportType.Seq] = seq;
+        reportFormInfo[ReportType.Gold] = totalMoney;
+        reportFormInfo[ReportType.Stars] = stars;
+        reportFormInfo[ReportType.ClickCount] = clickCount;
+        reportFormInfo[ReportType.Timestamp] = Date.parse(new Date());
+
+        if (recordUnlockModify.length > 0 || recordModify.length > 0) {
+            reportFormInfo[ReportType.Event] = 1;
+            if (recordUnlockModify.length > 0) {
+                reportFormInfo[ReportType.Build] = this.parseReportArray(recordUnlockModify);
             }
+            if (recordModify.length > 0) {
+                reportFormInfo[ReportType.Build] = this.parseReportArray(recordModify);
+            }
+        } else {
+            reportFormInfo[ReportType.Event] = 0;
+        }
 
-            // 还是将上报信息log出来吧, 方便调试
-            // console.log("reportFormInfo: " + JSON.stringify(reportFormInfo));
+        // 还是将上报信息log出来吧, 方便调试
+        // console.log("reportFormInfo: " + JSON.stringify(reportFormInfo));
 
-            let ecData = Base64.encode(JSON.stringify(reportFormInfo));
-            HomeApi.userReportGross(ecData, (rep) => {
-                // console.log("上报成功!");
-                resolve();
-            }, (code, msg) => {
-                reject({ "code": code, "msg": msg });
-            });
+        let ecData = Base64.encode(JSON.stringify(reportFormInfo));
+        HomeApi.userReportGross(ecData, (rep) => {
+            // console.log("上报成功!");
+            success();
+        }, (code, msg) => {
+            fail({ "code": code, "msg": msg });
         });
     };
 
@@ -127,39 +125,66 @@ class DWTool {
 
     //score对应总部等级buildingLevel,提交得分到微信后台
     static submitWechatScore(score) { //提交得分
-        let key2 = Global.wechatScoreKey;
-        if (window.wx != undefined) {
-            // 对用户托管数据进行写数据操作
-            let myValue = {
-                wxgame: {
-                    score: score,
-                    update_time: Date.parse(new Date()) / 1000
-                },
-                gender: Global.user.gender,
+        let key2 = GameGlobal.wechatScoreKey;
+        // 对用户托管数据进行写数据操作
+        let myValue = {
+            wxgame: {
+                score: score,
+                update_time: Date.parse(new Date()) / 1000
+            },
+            gender: GameGlobal.user.gender,
+        }
+        var myValueString = JSON.stringify(myValue);
+        window.wx.setUserCloudStorage({
+            KVDataList: [{ key: key2, value: myValueString }],
+            success: function (res) {
+                console.log('setUserCloudStorage', 'success', res)
+            },
+            fail: function (res) {
+                console.log('setUserCloudStorage', 'fail')
+            },
+            complete: function (res) {
+
             }
-            var myValueString = JSON.stringify(myValue);
-            window.wx.setUserCloudStorage({
-                KVDataList: [{ key: key2, value: myValueString }],
-                success: function (res) {
-                    console.log('setUserCloudStorage', 'success', res)
-                },
-                fail: function (res) {
-                    console.log('setUserCloudStorage', 'fail')
-                },
-                complete: function (res) {
+        });
+    }
+
+    static submitQQScore(score) { //提交得分
+        let key2 = GameGlobal.wechatScoreKey;
+        let myValue = {
+            wxgame: {
+                score: score,
+                update_time: Date.parse(new Date()) / 1000
+            },
+            gender: GameGlobal.user.gender,
+        }
+        var myValueString = JSON.stringify(myValue);
+
+        var data = {
+            userData: [{
+                openId: GameStatusInfo.openId,
+                startMs: GameStatusInfo.startMs,
+                endMs: ((new Date()).getTime()).toString(),
+                scoreInfo: {
+                    score: parseInt(score) //分数,类型必须是整型数
                 }
-            });
-        } else {
-            let myValue = {
-                wxgame: {
-                    score: score,
-                    update_time: Date.parse(new Date()) / 1000
-                },
-                gender: Global.user.gender,
+            }],
+            attr: {
+                score: {
+                    type: 'rank',
+                    order: 4,
+                }
+            },
+        };
+
+        BK.QQ.uploadScoreWithoutRoom(1, data, function (errCode, cmd, data) {
+            // 返回错误码信息
+            if (errCode !== 0) {
+                BK.Script.log(1, 1, '上传分数失败!错误码:' + errCode);
+            } else {
+                BK.Script.log(1, 1, '上传分数成功' + JSON.stringify(data));
             }
-            var myValueString = JSON.stringify(myValue);
-            // console.log("提交得分:" + key2 + " : " + myValueString)
-        }
+        });
     }
 
     static parseReportArray(array) {

+ 210 - 212
assets/scripts/utils/Global.js

@@ -1,20 +1,17 @@
 const BuildingManager = require("../utils/BuildingManager");
 const ShareAction = require('./ShareAction');
-const HomeApi = require("../net/HomeApi");
-const SkillApi = require("../net/SkillApi");
-const WeChat = require("../net/WeChat");
 const AlertManager = require('../utils/AlertManager');
-const {GameNotificationKey, WechatShareType } = require('../utils/GameEnum');
-const GameModule = require("../utils/GameModule");
+const Platform = require('../common/Platform');
+const WechatShareType = require('../utils/GameEnum').WechatShareType;
 
-window.Global = {
+window.GameGlobal = {
 
     // 建筑管理
     BuildingManager: BuildingManager.instance,
 
     debug: true,
 
-    ver: 121, //游戏版本号发版时需要核对
+    ver: 122, //游戏版本号发版时需要核对
     
     isCheck: false,
 
@@ -32,7 +29,8 @@ window.Global = {
 
     //SystemInfo
     os: 1,//1 android,2 ios
-    channel: CC_WECHATGAME ? "weixin" : "LuciferChannel",
+    
+    channel: null,
 
     user: null,
     /// 游戏是否退出到后台
@@ -83,211 +81,211 @@ window.Global = {
 
     //当前设备屏幕尺寸
     winSize: {height: 0, width: 0},
-
     //好友助力剩余使用时间:当为0时是没有使用
     friendRewardCdTime: 0
 };
 
-if (cc.sys.platform === cc.sys.WECHAT_GAME) {
-    wx.onShow(({scene, query, shareTicket }) => {
-        if (typeof wx.getUpdateManager === 'function') {
-            const updateManager = wx.getUpdateManager();
-
-            updateManager.onCheckForUpdate(function (res) {
-                // 请求完新版本信息的回调
-                console.log('hasUpdate: ' + JSON.stringify(res.hasUpdate));
-            })
-
-            updateManager.onUpdateReady(function () {
-                // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
-                updateManager.applyUpdate();
-            })
-
-            updateManager.onUpdateFailed(function () {
-                // 新的版本下载失败
-            })
-        }
-
-        //进入游戏的场景值
-        console.log('scene ' + scene + '==============================game ===============================');
-        if (scene == 1104) {
-            Global.isMineEnter = true;    //从我的小程序进入游戏
-        } else {
-            Global.isMineEnter = false;    //从我的小程序进入游戏
-        }
-        console.log('Global onShow' + JSON.stringify(query) + '======================================');
-        if (query != undefined && query != null) {
-            if (typeof query == "string") {
-                query = JSON.parse(query);
-            }
-
-            Global.shareType = query.shareType;
-
-            if (Global.shareType == ShareAction.SHOW_GROUP_RANK) {
-                if (shareTicket != undefined && shareTicket != null) {
-                    Global.shareTicket = shareTicket;
-                    GameEvent.fire(GameNotificationKey.GameShowGroupRank);//处理通过点击分享链接进入游戏的查看群排行榜
-                } else {
-                    Global.shareTicket = '';
-                }
-            }
-
-            if (query.uid != undefined && Global.shareType == ShareAction.INVITE_FRIEND) {
-                Global.shareUid = query.uid;
-                GameEvent.fire(GameNotificationKey.ProcessShareAction);//处理通过点击分享链接进入游戏的各种操作,加好友.....
-            }
-        }
-
-        // console.log(query.from, shareTicket);
-        //// 如果是从后台到前台
-        if (Global.isOnHide) {
-            Global.isOnHide = false;
-
-            //客户端优先刷新技能使用情况
-            GameEvent.fire(GameNotificationKey.GameSkillOnHide);
-
-            /// 发通知更新跟定时器相关的数据
-            GameEvent.fire(GameNotificationKey.GameShowNotificationKey);
-
-            if (Global.clickShare) {
-
-                let onHideTime = cc.sys.localStorage.getItem('onHideTimestamp');
-
-                let curTime = new Date().getTime();
-                let difference = curTime - onHideTime;
-
-                var isShareOk = false;
-                //判断是否忽略分享的状态
-                if (Global.isIgnoreShareStatus) {
-                    isShareOk = true;
-                } else {
-                    //在分享界面停留了3秒当作分享成功,如果少于3秒即有10%概率当作成功
-                    if (difference > 3000) {
-                        isShareOk = true;
-                    } else {
-                        let randomOk = Math.random() <= 0.1 ? true : false;
-                        if (randomOk) {
-                            isShareOk = true;
-                        }
-                    }
-                }
-
-                GameEvent.fire(GameNotificationKey.ShowShareAction, Global.gameShareType, isShareOk);
-                Global.clickShare = false;
-                Global.gameShareType = WechatShareType.None;
-                Global.isIgnoreShareStatus = false;
-                if (isShareOk) {
-                    SkillApi.report(2, (responseData) => {
-
-                    },(error) => {
-
-                    });
-                } else {
-                    AlertManager.showShareFailAlert();
-                }
-            }
-        }
-        if (GameModule.audioMng) {
-            GameModule.audioMng.playBgm();
-        }
-    });
-
-    wx.onHide(() => {
-        console.log('Global onHide ===================================');
-        Global.isOnHide = true;
-        if (GameModule.userInfo) {
-            GameModule.userInfo.doReport();
-        }
-
-        // /// 关闭socket 如果socket是打开的状态 其它的状态就不管 打开之后直接重连 && Global._wxSocket.readyState == 'open'
-        // if (Global._wxSocket != undefined && Global._wxSocket != null ) {
-        //     Global._wxSocket.close();
-        // }
-        cc.sys.localStorage.setItem("onHideTimestamp", Date.parse(new Date()));
-        HomeApi.exitGame();
-        if (GameModule.audioMng) {
-            GameModule.audioMng.stopAll();
-        }
-    });
-
-    wx.showShareMenu({
-        withShareTicket: true,
-        success: function (res) {
-
-        },
-        fail: function (res) {
-
-        },
-        complete: function (res) {
-
-        }
-    });
-
-    wx.onShareAppMessage(function (res) {
-        // 用户点击了“转发”按钮
-        if (res.from === 'button') {
-            // 来自页面内转发按钮
-        } else if (res.from === 'menu') {
-
-        }
-
-        if (Global.isCheck) {
-
-            var uid = -1;
-            if (Global.user != undefined && Global.user.uid != undefined) {
-                uid = Global.user.uid;
-            }
-
-            return {
-                title: '猜猜他是谁?',
-                imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/share_3.png',
-                query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
-                success: function (res) {
-                    console.log('分享成功');
-                    // 分享成功上报
-                    SkillApi.report(2, (responseData) => {
-                        console.log('上报分享成功');
-                    },(error) => {
-
-                    });
-                },
-                fail: function (res) {
-                    // 转发失败
-                    console.log('取消或分享失败');
-                },
-                complete: function () {
-
-                }
-            }
-        } else {
-            let randomIndex = parseInt(Math.random()*(WeChat.shareArray.length),10);
-            let shareObjct = WeChat.shareArray[randomIndex];
-            var uid = -1;
-            if (Global.user != undefined && Global.user.uid != undefined) {
-                uid = Global.user.uid;
-            }
-
-            return {
-                title: shareObjct.title,
-                imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/' + shareObjct.icon,
-                query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
-                success: function (res) {
-                    console.log('分享成功');
-                    // 分享成功上报
-                    SkillApi.report(2, (responseData) => {
-                        console.log('上报分享成功');
-                    },(error) => {
-
-                    });
-                },
-                fail: function (res) {
-                    // 转发失败
-                    console.log('取消或分享失败');
-                },
-                complete: function () {
-
-                }
-            }
-        }
-    });
-}
+// if (cc.sys.platform === cc.sys.WECHAT_GAME) {
+//     wx.onShow(({scene, query, shareTicket }) => {
+//         if (typeof wx.getUpdateManager === 'function') {
+//             const updateManager = wx.getUpdateManager();
+
+//             updateManager.onCheckForUpdate(function (res) {
+//                 // 请求完新版本信息的回调
+//                 console.log('hasUpdate: ' + JSON.stringify(res.hasUpdate));
+//             })
+
+//             updateManager.onUpdateReady(function () {
+//                 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+//                 updateManager.applyUpdate();
+//             })
+
+//             updateManager.onUpdateFailed(function () {
+//                 // 新的版本下载失败
+//             })
+//         }
+
+//         //进入游戏的场景值
+//         console.log('scene ' + scene + '==============================game ===============================');
+//         if (scene == 1104) {
+//             Global.isMineEnter = true;    //从我的小程序进入游戏
+//         } else {
+//             Global.isMineEnter = false;    //从我的小程序进入游戏
+//         }
+//         console.log('Global onShow' + JSON.stringify(query) + '======================================');
+//         if (query != undefined && query != null) {
+//             if (typeof query == "string") {
+//                 query = JSON.parse(query);
+//             }
+
+//             Global.shareType = query.shareType;
+
+//             if (Global.shareType == ShareAction.SHOW_GROUP_RANK) {
+//                 if (shareTicket != undefined && shareTicket != null) {
+//                     Global.shareTicket = shareTicket;
+//                     GameEvent.fire(GameNotificationKey.GameShowGroupRank);//处理通过点击分享链接进入游戏的查看群排行榜
+//                 } else {
+//                     Global.shareTicket = '';
+//                 }
+//             }
+
+//             if (query.uid != undefined && Global.shareType == ShareAction.INVITE_FRIEND) {
+//                 Global.shareUid = query.uid;
+//                 GameEvent.fire(GameNotificationKey.ProcessShareAction);//处理通过点击分享链接进入游戏的各种操作,加好友.....
+//             }
+//         }
+
+//         // console.log(query.from, shareTicket);
+//         //// 如果是从后台到前台
+//         if (Global.isOnHide) {
+//             Global.isOnHide = false;
+
+//             //客户端优先刷新技能使用情况
+//             GameEvent.fire(GameNotificationKey.GameSkillOnHide);
+
+//             /// 发通知更新跟定时器相关的数据
+//             GameEvent.fire(GameNotificationKey.GameShowNotificationKey);
+
+//             if (Global.clickShare) {
+
+//                 let onHideTime = cc.sys.localStorage.getItem('onHideTimestamp');
+
+//                 let curTime = new Date().getTime();
+//                 let difference = curTime - onHideTime;
+
+//                 var isShareOk = false;
+//                 //判断是否忽略分享的状态
+//                 if (Global.isIgnoreShareStatus) {
+//                     isShareOk = true;
+//                 } else {
+//                     //在分享界面停留了3秒当作分享成功,如果少于3秒即有10%概率当作成功
+//                     if (difference > 3000) {
+//                         isShareOk = true;
+//                     } else {
+//                         let randomOk = Math.random() <= 0.1 ? true : false;
+//                         if (randomOk) {
+//                             isShareOk = true;
+//                         }
+//                     }
+//                 }
+
+//                 GameEvent.fire(GameNotificationKey.ShowShareAction, Global.gameShareType, isShareOk);
+//                 Global.clickShare = false;
+//                 Global.gameShareType = WechatShareType.None;
+//                 Global.isIgnoreShareStatus = false;
+//                 if (isShareOk) {
+//                     SkillApi.report(2, (responseData) => {
+
+//                     },(error) => {
+
+//                     });
+//                 } else {
+//                     AlertManager.showShareFailAlert();
+//                 }
+//             }
+//         }
+//         if (GameModule.audioMng) {
+//             GameModule.audioMng.playBgm();
+//         }
+//     });
+
+//     wx.onHide(() => {
+//         console.log('Global onHide ===================================');
+//         Global.isOnHide = true;
+//         if (GameModule.userInfo) {
+//             GameModule.userInfo.doReport();
+//         }
+
+//         // /// 关闭socket 如果socket是打开的状态 其它的状态就不管 打开之后直接重连 && Global._wxSocket.readyState == 'open'
+//         // if (Global._wxSocket != undefined && Global._wxSocket != null ) {
+//         //     Global._wxSocket.close();
+//         // }
+//         cc.sys.localStorage.setItem("onHideTimestamp", Date.parse(new Date()));
+//         HomeApi.exitGame();
+//         if (GameModule.audioMng) {
+//             GameModule.audioMng.stopAll();
+//         }
+//     });
+
+//     wx.showShareMenu({
+//         withShareTicket: true,
+//         success: function (res) {
+
+//         },
+//         fail: function (res) {
+
+//         },
+//         complete: function (res) {
+
+//         }
+//     });
+
+//     wx.onShareAppMessage(function (res) {
+//         // 用户点击了“转发”按钮
+//         if (res.from === 'button') {
+//             // 来自页面内转发按钮
+//         } else if (res.from === 'menu') {
+
+//         }
+
+//         if (Global.isCheck) {
+
+//             var uid = -1;
+//             if (Global.user != undefined && Global.user.uid != undefined) {
+//                 uid = Global.user.uid;
+//             }
+
+//             return {
+//                 title: '猜猜他是谁?',
+//                 imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/share_3.png',
+//                 query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
+//                 success: function (res) {
+//                     console.log('分享成功');
+//                     // 分享成功上报
+//                     SkillApi.report(2, (responseData) => {
+//                         console.log('上报分享成功');
+//                     },(error) => {
+
+//                     });
+//                 },
+//                 fail: function (res) {
+//                     // 转发失败
+//                     console.log('取消或分享失败');
+//                 },
+//                 complete: function () {
+
+//                 }
+//             }
+//         } else {
+//             let randomIndex = parseInt(Math.random()*(WeChat.shareArray.length),10);
+//             let shareObjct = WeChat.shareArray[randomIndex];
+//             var uid = -1;
+//             if (Global.user != undefined && Global.user.uid != undefined) {
+//                 uid = Global.user.uid;
+//             }
+
+//             return {
+//                 title: shareObjct.title,
+//                 imageUrl: 'https://pub.dwstatic.com/wxgame/taptapstar/share/' + shareObjct.icon,
+//                 query: 'uid=' + uid + '&shareType=' + ShareAction.INVITE_FRIEND,
+//                 success: function (res) {
+//                     console.log('分享成功');
+//                     // 分享成功上报
+//                     SkillApi.report(2, (responseData) => {
+//                         console.log('上报分享成功');
+//                     },(error) => {
+
+//                     });
+//                 },
+//                 fail: function (res) {
+//                     // 转发失败
+//                     console.log('取消或分享失败');
+//                 },
+//                 complete: function () {
+//                 },
+//             };
+//         }
+//     });
+// }
+
+Platform.initPlatform();

+ 4 - 3
assets/scripts/utils/PrefabManager.js

@@ -1,4 +1,5 @@
 const DWTool = require("./DWTool");
+var Promise = require('../lib/es6-promise').Promise;
 
 class PrefabManager {
     static getPrefabByPath(path, res) {
@@ -21,11 +22,11 @@ class PrefabManager {
 
     //prefab预制资源
     static loadPrefab(name) {
-        if (Global.prefabsRes) {
-            // let prefab = this.getPrefabByPath(name,Global.prefabsRes);
+        if (GameGlobal.prefabsRes) {
+            // let prefab = this.getPrefabByPath(name,GameGlobal.prefabsRes);
             // sprite.spriteFrame = prefab;
             let p = new Promise((resolve, reject) => {
-                let prefab = this.getPrefabByPath(name,Global.prefabsRes);
+                let prefab = this.getPrefabByPath(name,GameGlobal.prefabsRes);
                 if (prefab) {
                     resolve(prefab)
                 } else {

+ 2 - 2
assets/scripts/utils/TapTapTool.js

@@ -517,12 +517,12 @@ class TapTapTool {
     static removeRedDot(gameRedDotType) {
         let isContain = false;
         for (let i = 0; i < 10; ++i) {
-            let index = Global._redTypes.indexOf(gameRedDotType);
+            let index = GameGlobal._redTypes.indexOf(gameRedDotType);
             if (index == -1) {
                 break;
                 ///说明里面有包含这个红点
             } else {
-                Global._redTypes.splice(index, 1);
+                GameGlobal._redTypes.splice(index, 1);
                 isContain = true;
             }
         }

+ 12 - 12
assets/scripts/utils/ThemeManger.js

@@ -35,7 +35,7 @@ class ThemeManager {
         let filePath = `resources/textures/building/${path}`;
         let uuid = cc.loader._getResUuid(filePath.slice(10), cc.Texture2D, true);
     
-        let result = Global.buildRes.filter((item) => { return item._uuid === uuid });
+        let result = GameGlobal.buildRes.filter((item) => { return item._uuid === uuid });
         if (result != null && result.length != undefined) {
             let texture = result[0];
             return new cc.SpriteFrame(texture);
@@ -45,7 +45,7 @@ class ThemeManager {
 
     // LevelHomeItem 样式变化
     static setItemBuildSpriteFrame(roomId, buildSprite) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let picId = 30100 + parseInt(roomId);
             buildSprite.spriteFrame = this.getSpriteFrameByPath(`${picId}`);
         } else {
@@ -60,7 +60,7 @@ class ThemeManager {
 
     // 外墙顶部
     static setItemPillarTopSpriteFrame(cityId, pillar) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let spriteFrame = this.getSpriteFrameByPath(`30${cityId}33`);
             pillar.spriteFrame = spriteFrame;
         } else {
@@ -75,7 +75,7 @@ class ThemeManager {
 
     // 外墙底部
     static setItemPillarBottomSpriteFrame(cityId, pillar) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let spriteFrame = this.getSpriteFrameByPath(`30${cityId}34`);
             pillar.spriteFrame = spriteFrame;
         } else {
@@ -90,7 +90,7 @@ class ThemeManager {
 
     // 外墙右边
     static setItemPillarRightSpriteFrame(cityId, pillar) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let spriteFrame = this.getSpriteFrameByPath(`30${cityId}35`);
             pillar.spriteFrame = spriteFrame;
         } else {
@@ -105,7 +105,7 @@ class ThemeManager {
 
     // 外墙左边
     static setItemPillarLeftSpriteFrame(cityId, pillar) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let spriteFrame = this.getSpriteFrameByPath(`30${cityId}36`);
             pillar.spriteFrame = spriteFrame;
         } else {
@@ -119,7 +119,7 @@ class ThemeManager {
     }
 
     static setItemPillarSpriteFrame(cityId, pillars) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             let spriteFrame = this.getSpriteFrameByPath(`${cityId}_pillar`);
             for (let i = 0; i < pillars.length; i++) {
                 let sprite = pillars[i];
@@ -139,7 +139,7 @@ class ThemeManager {
     }
 
     static setItemDownSpriteFrame(cityId, lockBottomBg) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             lockBottomBg.spriteFrame = this.getSpriteFrameByPath(`30${cityId}16`);
         } else {
             DWTool.loadResSpriteFrame(`./textures/building/30${cityId}16`)
@@ -153,7 +153,7 @@ class ThemeManager {
 
 
     static setItemLockDownSpriteFrame(lockBottomBg) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             lockBottomBg.spriteFrame = this.getSpriteFrameByPath(`30137`);
         } else {
             DWTool.loadResSpriteFrame(`./textures/building/30137`)
@@ -168,7 +168,7 @@ class ThemeManager {
 
     // LevelHome最底层一楼样式变化
     static setBottomBuildSpriteFrame(cityId, buildSprite) {
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             buildSprite.spriteFrame = this.getSpriteFrameByPath(`30${cityId}38`);
         } else {
             DWTool.loadResSpriteFrame(`./textures/building/30${cityId}38`)
@@ -183,7 +183,7 @@ class ThemeManager {
     // LevelHome最顶层楼顶样式变化
     static setTopBgBuildSpriteFrame(cityId, buildSprite) {
         
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             buildSprite.spriteFrame = this.getSpriteFrameByPath(`30${cityId}31`);
         } else {
             DWTool.loadResSpriteFrame(`./textures/building/30${cityId}31`)
@@ -197,7 +197,7 @@ class ThemeManager {
 
     static setTopCoverSpriteFrame(cityId, coverSprite) {
         
-        if (Global.buildRes) {
+        if (GameGlobal.buildRes) {
             coverSprite.spriteFrame = this.getSpriteFrameByPath(`30${cityId}32`);
         } else {
             DWTool.loadResSpriteFrame(`./textures/building/30${cityId}32`)

+ 4 - 0
build-templates/qqplay/gameConfig.json

@@ -0,0 +1,4 @@
+{
+  "viewMode":1,
+  "enterUrl":""
+}

BIN
build-templates/qqplay/inviteIcon.png


File diff suppressed because it is too large
+ 0 - 0
build-templates/qqplay/libs/qqPlayCore.js


+ 394 - 0
build-templates/qqplay/libs/qqplay-adapter.js

@@ -0,0 +1,394 @@
+/****************************************************************************
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
+
+ http://www.cocos.com
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+// BK.Script.loadlib('GameRes://libs/qqPlayCore.js');
+
+var gl;
+var window = this;
+window.addEventListener = function () {};
+window.removeEventListener = function () {};
+
+var navigator = window.navigator = {
+    userAgent: 'qqplay ' + GameStatusInfo.platform + ' QQ/' + GameStatusInfo.QQVer,
+    appVersion: ''
+};
+
+BK.Script.loadlib('GameRes://libs/xmldom/dom-parser.js');
+BK.Script.loadlib('GameRes://src/assets/scripts/lib/Underscore.js');
+
+// import element node
+BK.Script.loadlib('GameRes://libs/element/Utils.js');
+BK.Script.loadlib('GameRes://libs/element/HTMLElemenet.js');
+BK.Script.loadlib('GameRes://libs/element/HTMLAudioElement.js');
+BK.Script.loadlib('GameRes://libs/element/HTMLImageElement.js');
+BK.Script.loadlib('GameRes://libs/element/HTMLScriptElement.js');
+BK.Script.loadlib('GameRes://libs/element/HTMLVideoElement.js');
+BK.Script.loadlib('GameRes://libs/element/Document.js');
+BK.Script.loadlib('GameRes://libs/element/Canvas.js');
+BK.Script.loadlib('GameRes://libs/element/XMLHttpRequest.js');
+
+window['XMLHttpRequest'] = XMLHttpRequest;
+
+HTMLElement = _HTMLBaseElemenet;
+Image = window.Image = HTMLImageElement;
+document = window.document = new HTMLDocumentElement();
+
+var canvas = new HTMLMainCanvasElement();
+canvas.id = 'GameCanvas';
+document.body.appendChild(canvas);
+
+var HTMLCanvasElement = BK.Canvas;
+
+var location = window.location = {
+    href: "",
+};
+var console = window.console = {
+    log: function (msg) {
+        BK.Script.log(1, 0, msg);
+    },
+    warn: function (msg) {
+        BK.Script.log(1, 0, msg);
+    },
+    error: function (msg) {
+        BK.Script.log(1, 0, msg);
+    },
+    info: function(msg) {
+        BK.Script.log(1, 0, msg);
+    },
+    debug: function(msg) {
+        BK.Script.log(1, 0, msg);
+    },
+};
+
+window["BK"] = BK;
+window["isQQPlay"] = true;
+alert = window.alert = console.warn;
+window["pageXOffset"] = 0;
+window["pageYOffset"] = 0;
+
+var WebGLRenderingContext = function () {};
+
+// 用于在加载引擎后对一些代码适配
+function initAdapter () {
+
+    var sps = BK.Director.screenPixelSize;
+    window.innerWidth = sps.width;
+    window.innerHeight = sps.height;
+
+    canvas.width = sps.width;
+    canvas.height = sps.height;
+
+    // adapt _runMainLoop
+    cc.game._setAnimFrame = function () {
+        this._lastTime = new Date();
+        var frameRate = this.config.frameRate;
+        this._frameTime = 1000 / frameRate;
+        window.requestAnimFrame = window.requestAnimationFrame;
+        window.cancelAnimFrame = window.cancelAnimationFrame;
+    };
+    cc.game._runMainLoop = function () {
+        var self = this, callback, config = self.config,
+            director = cc.director,
+            frameRate = config.frameRate;
+
+        cc.debug.setDisplayStats(config.showFPS);
+
+        callback = function () {
+            if (!self._paused) {
+                self._intervalId = window.requestAnimFrame(callback);
+                director.mainLoop();
+            }
+        };
+
+        self._intervalId = window.requestAnimFrame(callback);
+        self._paused = false;
+    };
+
+    // adapt engine component
+    BK.Script.loadlib('GameRes://libs/engine/index.js');
+}
+
+var rendererAdapterInited = false;
+function initRendererAdapter () {
+    if (rendererAdapterInited) {
+        return;
+    }
+    rendererAdapterInited = true;
+    cc.renderer.__render = cc.renderer.render;
+    cc.renderer.render = function (ecScene) {
+        this.__render(ecScene);
+        gl.glCommit();
+    };
+    gl.canvas = canvas;
+}
+
+Float32Array.prototype.subarray = function (begin, end) {
+    return new Float32Array(this.buffer, begin, end)
+};
+
+Uint16Array.prototype.subarray = function (begin, end) {
+    return new Uint16Array(this.buffer, begin, end)
+};
+
+//--BK.Canvas------------------------------------------------
+
+var prototype = BK.Canvas.prototype;
+prototype.addEventListener = function () {};
+prototype.createLinearGradient = function () {};
+prototype.setTransform = prototype.transforms;
+var _fillText = prototype.strokeText = prototype.fillText;
+prototype.fillText = function () {
+    this.lineWidth = 0;
+    _fillText.apply(this, arguments);
+};
+prototype.getImageData = function(){
+    return {data : [1, 0, 1, 0]};
+};
+prototype.focus = function(){};
+prototype.getContext = function () {
+    return this;
+};
+Object.defineProperty(prototype, "width", {
+    get: function () {
+        return this.contentSize.width;
+    },
+    set: function (val) {
+        var size = this.contentSize;
+        size.width = val;
+        this.contentSize = size;
+        this.font = "";
+        this.strokeColor = {r:0,g:0,b:0,a:0};
+        this.strokewidth = 0;
+    },
+    enumerable: true,
+    configurable: true
+});
+Object.defineProperty(prototype, "height", {
+    get: function () {
+        return this.contentSize.height;
+    },
+    set: function (val) {
+        var size = this.contentSize;
+        size.height = val;
+        this.contentSize = size;
+        this.font = "";
+        this.strokeColor = {r:0,g:0,b:0,a:0};
+        this.strokewidth = 0;
+    },
+    enumerable: true,
+    configurable: true
+});
+
+var BOLD_REGEX = /bold/g;
+Object.defineProperty(prototype, "font", {
+    get: function () {
+        return this._font || '';
+    },
+    set: function (val) {
+        this._font = val;
+        if (val) {
+            var matchRet = val.match(/(\d*)px/);
+            var size = (matchRet && !isNaN(matchRet[1])) ? parseInt(matchRet[1]) : 20;
+            //console.log("size" + size)
+            this.setTextSize(size);
+            var isBold = BOLD_REGEX.test(val);
+            this.setTextBold(isBold);
+        }
+    },
+    enumerable: true,
+    configurable: true
+});
+
+var tempColor = { r: 0, g: 0, b: 0, a: 1.0};
+function rgbToColor (rgbStr) {
+    if (/^\#/.test(rgbStr)) {
+        if (rgbStr.length === 4) {
+            return {
+                r: parseInt(rgbStr[1] + rgbStr[1], 16) / 255,
+                g: parseInt(rgbStr[2] + rgbStr[2], 16) / 255,
+                b: parseInt(rgbStr[3] + rgbStr[3], 16) / 255,
+                a: parseInt(rgbStr[4] + rgbStr[4], 16),
+            }
+        } else if (rgbStr.length === 7) {
+            return {
+                r: parseInt(rgbStr.substr(1, 2), 16) / 255,
+                g: parseInt(rgbStr.substr(3, 2), 16) / 255,
+                b: parseInt(rgbStr.substr(5, 2), 16) / 255,
+                a: parseInt(rgbStr.substr(7, 2), 16),
+            };
+        } else {
+            return {r: 0, g: 0, b: 0, a: 1};
+        }
+    }
+
+    var strArr = rgbStr.match(/(\d|\.)+/g);
+    if (!strArr || strArr.length > 4 || strArr.length < 3) {
+        return {r: 0, g: 0, b: 0, a: 1};
+    }
+    tempColor.r = strArr[0] / 255 || 0;
+    tempColor.g = strArr[1] / 255 || 0;
+    tempColor.b = strArr[2] / 255 || 0;
+    tempColor.a = strArr[3] || 1;
+    return tempColor;
+}
+
+Object.defineProperty(prototype, "fillStyle", {
+    get: function () {
+        return this._fillStyle || '';
+    },
+    set: function (val) {
+        this._fillStyle = val;
+        this.fillColor = rgbToColor(val);
+    },
+    enumerable: true,
+    configurable: true
+});
+
+Object.defineProperty(prototype, "strokeStyle", {
+    get: function () {
+        return this._strokeStyle || '';
+    },
+    set: function (val) {
+        this._strokeStyle = val;
+        this.strokeColor = rgbToColor(val);
+    },
+    enumerable: true,
+    configurable: true
+});
+
+// requestAnimationFrame requestAnimationFrame
+
+var _mainTicker;
+var requestAnimationFrame = window.requestAnimationFrame = function (callback) {
+    if (!_mainTicker) {
+        _mainTicker = new BK.Ticker();
+        var frameRate = cc.game.config.frameRate;
+        _mainTicker.interval = 60 / frameRate;
+        _mainTicker.setTickerCallBack(function (ts, duration) {
+            if (!cc.game._paused) {
+                BK.inputManager && BK.inputManager.detectGesture();
+                callback();
+            }
+        });
+    }
+    return 1;
+};
+
+var cancelAnimationFrame = window.cancelAnimationFrame = function () {
+    if (_mainTicker) {
+        _mainTicker.dispose();
+        _mainTicker = null;
+    }
+};
+
+// setTimeout, clearTimeout
+
+var _windowTimeIntervalId = 0;
+var _windowTimeFunHash = {};
+var WindowTimeFun = function (code) {
+    this._intervalId = _windowTimeIntervalId++;
+    this._ticker = new BK.Ticker();
+    this._ticker.interval = 1;
+    this._code = code;
+};
+
+WindowTimeFun.prototype.fun = function () {
+    if (!this._code) return;
+    var code = this._code;
+
+    if (typeof code === 'string') {
+        Function(code)();
+    }
+    else if (typeof code === 'function') {
+        code.apply(null, this._args);
+    }
+};
+
+var setTimeout = window.setTimeout = function (code, delay) {
+    var target = new WindowTimeFun(code);
+    if (arguments.length > 2)
+        target._args = Array.prototype.slice.call(arguments, 2);
+    var original = target.fun;
+    target.fun = function () {
+        clearTimeout(this.target._intervalId);
+        original.apply(this.target, arguments);
+    };
+    if (!delay) {
+        delay = 0.001;
+    }
+    target._ticker.setTimeout(function(){
+        try{
+            target.fun.apply(this, arguments);
+        }catch(e){
+            debugger;
+            console.error(e);
+        }
+    }, delay, target);
+    _windowTimeFunHash[target._intervalId] = target;
+    return target._intervalId;
+};
+
+var setInterval = window.setInterval = function(code, delay){
+    var target = new WindowTimeFun(code);
+    if (arguments.length > 2)
+        target._args = Array.prototype.slice.call(arguments, 2);
+    var original = target.fun;
+    target.fun = function () {
+        original.apply(this.target, arguments);
+    };
+    if (!delay) {
+        delay = 0.001;
+    }
+    target._ticker.setInterval(target.fun, delay, target);
+    _windowTimeFunHash[target._intervalId] = target;
+    return target._intervalId;
+};
+
+var clearTimeout = window.clearTimeout = function (intervalId) {
+    var target = _windowTimeFunHash[intervalId];
+    if (target) {
+        target._ticker.removeTimeout(target);
+        target._ticker.dispose();
+        delete _windowTimeFunHash[intervalId];
+    }
+};
+
+var clearInterval = window.clearInterval = function (intervalId) {
+    var target = _windowTimeFunHash[intervalId];
+    if (target) {
+        target._ticker.removeInterval(target);
+        target._ticker.dispose();
+        delete _windowTimeFunHash[intervalId];
+    }
+};
+
+// WebSocket.js
+BK.Script.loadlib('GameRes://libs/engine/CCWebSocket.js');
+// Local Storage
+BK.Script.loadlib('GameRes://libs/engine/CCLocalStorage.js');
+
+// other adapter
+var performance = { now: function() { return BK.Time.timestamp * 1000; } };
+

+ 2 - 2
settings/builder.json

@@ -30,10 +30,10 @@
   "packageName": "org.cocos2d.taptapstar",
   "privateKey": "",
   "qqplay": {
-    "REMOTE_SERVER_ROOT": "https://pub.dwstatic.com/wxgame/taptapstar_qq_test",
+    "REMOTE_SERVER_ROOT": "https://pub.dwstatic.com/wxgame/taptapstar_qq",
     "orientation": "portrait"
   },
-  "startScene": "40f8b7e6-9666-4b26-87e8-6f986f1c078d",
+  "startScene": "6d3c479f-cf4e-43d2-8b48-74bd4f57b5df",
   "title": "taptapstar",
   "webOrientation": "auto",
   "wechatgame": {

Some files were not shown because too many files changed in this diff