FSjpPanel.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import ViewObject from "../../../../../main/ViewObject";
  2. import { HttpStateType, ReveData } from "../../../../../util/CHttp";
  3. /**
  4. * 获得水晶瓶界面提示
  5. */
  6. const {ccclass, property} = cc._decorator;
  7. @ccclass
  8. export default class FSjpPanel extends ViewObject {
  9. public callback:()=>void;
  10. public setCallback(callback:()=>void){
  11. this.callback = callback
  12. }
  13. public onclick(){
  14. this.openSkill()
  15. }
  16. public openSkill(){
  17. this.main.startLoad()
  18. this.main.gameHttp.sendJson('stage/v1/openSkill',{},(state,reve:ReveData)=>{
  19. this.main.stopLoad();
  20. if(state == HttpStateType.SUCCESS){
  21. if(reve.retCode == 0){
  22. let role = this.main.player.role
  23. role.openSkill = 1
  24. this.callback()
  25. this.exitDistroy()
  26. }else{
  27. this.main.showTips(reve.message);
  28. }
  29. }else{
  30. this.main.showTips('网络异常');
  31. }
  32. });
  33. }
  34. }