signIn.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const ADSdk = require("ADSdk");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. signBtn: cc.Node,
  6. videoBtn: cc.Node,
  7. },
  8. onLoad() {
  9. this.signBtn.on("click", this._sign, this);
  10. this.videoBtn.on("click", this._video, this);
  11. },
  12. init(c) {
  13. this.awardNum = 2;
  14. if (c) this.controller = c;
  15. this.node.active = true;
  16. let ui = this.node.children[1];
  17. ui.scaleX = 0.1;
  18. ui.scaleY = 0.1;
  19. ui.runAction(
  20. cc.sequence(
  21. cc.scaleTo(0.3, 1.1),
  22. cc.scaleTo(0.2, 1)
  23. ));
  24. },
  25. _sign() {
  26. this.close();
  27. this.controller.scoreMgr.onStep(this.awardNum);
  28. },
  29. _video() {
  30. this.close();
  31. // TODO 广告 视频双倍奖励
  32. if (AppConst.SHOWADUI) {
  33. if (AppConst.CHANNEL == AppConst.channel.ANDROID) {
  34. ADSdk.pay(4, this);
  35. } else {
  36. ADSdk.showVideo(null, (result) => {
  37. if (result == 1) {
  38. this.controller.scoreMgr.onStep(this.awardNum * 2);
  39. }
  40. });
  41. }
  42. } else {
  43. this.controller.scoreMgr.onStep(this.awardNum * 2);
  44. }
  45. // this.controller.scoreMgr.onStep(this.awardNum * 2);
  46. },
  47. close() {
  48. Utils.setSignIn();
  49. this.controller.game.signInBtn.active = false;
  50. this.node.active = false;
  51. }
  52. // update (dt) {},
  53. });