GameMode.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. gStat: {
  5. default: null,
  6. type: cc.Node,
  7. serializable: true,
  8. },
  9. logIn: cc.Prefab,
  10. avatar:cc.Sprite,
  11. dcPoint:cc.Label,
  12. gcPoint:cc.Label,
  13. activity:cc.Label,
  14. logInAvatar:cc.SpriteFrame
  15. },
  16. onLoad () {
  17. this.gStatScp = this.gStat.getComponent('GameStates');
  18. },
  19. IsLogIn(component)
  20. {
  21. if(this.gStatScp.bLogin)
  22. {
  23. return true;
  24. }
  25. else
  26. {
  27. let tPrefab = cc.instantiate(this.logIn);
  28. tPrefab.parent = component.node;
  29. tPrefab.setPosition(0,0);
  30. let scp = tPrefab.getComponent('login');
  31. scp.gameStates = this.gStat;
  32. scp.init();
  33. scp.avatar = this.avatar;
  34. scp.dcPoint = this.dcPoint;
  35. scp.gcPoint = this.gcPoint;
  36. scp.activity = this.activity;
  37. scp.logInAvatar = this.logInAvatar;
  38. return false;
  39. }
  40. }
  41. });