MateUnlockPanel.ts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { HTTP_TYPE } from "../datas/CommonData";
  2. import Main from "../Main";
  3. import GameM, { AUDIO_TYPE } from "../manager/GameM";
  4. import GuideMng from "../manager/GuideMng";
  5. import UiM from "../manager/UiM";
  6. import MyExtends from "../tools/MyExtends";
  7. import BasePanel from "../uiFrames/BasePanel";
  8. const { ccclass, property } = cc._decorator;
  9. @ccclass
  10. export default class MateUnlockPanel extends BasePanel {
  11. @property(cc.Node)
  12. panelNode: cc.Node = null;
  13. @property(cc.Label)
  14. txtName: cc.Label = null;
  15. @property(cc.Sprite)
  16. img: cc.Sprite = null;
  17. private mateBtnPos: cc.Vec2 = null;
  18. private mateLv: number = -1;
  19. onLoad() {
  20. this.mateBtnPos = MyExtends.convetOtherNodeSpaceAR(cc.find("Canvas/HallNode/downPart/btnMate"), cc.find("Canvas"));
  21. console.log("MateBtnPos:", this.mateBtnPos);
  22. }
  23. OnEnter(param?) {
  24. this.mateLv = param.lv;
  25. this.txtName.string = GameM.commonData.fightRoleCfg[param.lv.toString()].name;
  26. cc.loader.loadRes('carPic/side/side_' + param.lv, cc.SpriteFrame, (err, asset) => {
  27. this.img.spriteFrame = asset;
  28. });
  29. this.img.node.setPosition(0, 112);
  30. this.img.node.scale = 1;
  31. this.node.setPosition(0, 0);
  32. this.node.scale = 1;
  33. this.panelNode.scale = 0;
  34. this.node.active = true;
  35. cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }).start();
  36. this.node.setSiblingIndex(this.node.parent.childrenCount - 1);
  37. }
  38. OnExit() {
  39. cc.tween(this.img.node)
  40. .to(0.3, { position: this.mateBtnPos, scale: 0 })
  41. .call(() => {
  42. this.node.active = false;
  43. this.img.spriteFrame = null;
  44. //伙伴引导 孙悟空
  45. if (this.mateLv == 10) {
  46. // GuideMng.Ins.CheckMateGuide3();
  47. } else if (this.mateLv == 17) {
  48. //解锁伙伴猪八戒 解锁探索
  49. //UiM.Instance.hallNode.getComponent(Main).checkMateLockBtn(3,0);
  50. //GuideMng.Ins.CheckInvestGuide5();
  51. }
  52. else if (this.mateLv == 23) {
  53. //开通富翁银行请求
  54. //GameM.httpM.sendDatas(HTTP_TYPE.backIsOpenRichBank, {});
  55. //GameM.commonData.isopenrichbank = 1;
  56. //UiM.Instance.hallNode.getComponent(Main).checkMateLockBtn(4,0);
  57. //解锁伙伴猪沙僧 解锁钱庄 富翁银行
  58. // GuideMng.Ins.CheckBankGuide7();
  59. }
  60. })
  61. .start();
  62. //cc.tween(this.node)
  63. // .to(0.3, { position: this.mateBtnPos, scale: 0 })
  64. // .call(() => {
  65. // this.node.active = false;
  66. // this.img.spriteFrame = null;
  67. // })
  68. // .start();
  69. //this.node.active = false;
  70. }
  71. Click_GetBtn() {
  72. this.OnExit();
  73. GameM.audioM.playEffect(AUDIO_TYPE.button);
  74. }
  75. Click_CloseBtn() {
  76. this.OnExit();
  77. GameM.audioM.playEffect(AUDIO_TYPE.button);
  78. }
  79. }