ContractConfirmBTN.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. CompanyNameEditbox:{
  5. default :null,
  6. type :cc.EditBox
  7. },
  8. CEONameEditbox:{
  9. default :null,
  10. type :cc.EditBox
  11. },
  12. Hint:{
  13. default :null,
  14. type :cc.Node
  15. },
  16. Stamp:{
  17. default :null,
  18. type :cc.Node
  19. },
  20. },
  21. Confirm:function()
  22. {
  23. var CompanyName = this.CompanyNameEditbox.string;
  24. var CEOName = this.CEONameEditbox.string;
  25. // if blank
  26. if(CompanyName=='' || CEOName == '')
  27. {
  28. this.Hint.active=true;
  29. this.schedule(function(){
  30. this.Hint.active=false;
  31. },1, 0, 0);
  32. return;
  33. }
  34. //confirm condition ok
  35. cc.sys.localStorage.setItem('PreviousStoryCompanyName', CompanyName);
  36. cc.sys.localStorage.setItem('PreviousStoryCEOName', CEOName);
  37. //init value
  38. this.Stamp.active=true;
  39. this.Stamp.opacity=0;
  40. this.Stamp.scale=3;
  41. //stamp animation
  42. var Duaration = 1;
  43. var ShowStampfadeInAnim = cc.fadeIn(Duaration);
  44. var ShowStampScaleAnim = cc.scaleTo(0.2,Duaration);
  45. this.Stamp.runAction(ShowStampfadeInAnim);
  46. this.Stamp.runAction(ShowStampScaleAnim);
  47. this.scheduleOnce(function(){
  48. cc.log('1111111')
  49. cc.director.loadScene("Game");
  50. },Duaration)
  51. }
  52. });