ClubUserSel.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_InputID:cc.EditBox,
  5. m_LabUserLv:cc.Label,
  6. m_UserNode:cc.Node,
  7. },
  8. onLoad:function(){
  9. this.m_UserCtrl = this.m_UserNode.getComponent("UserCtrl");
  10. },
  11. CheckInput:function(){
  12. if(this.m_InputID.string == ''){
  13. this.ShowTips("ID輸入為空!");
  14. return false;
  15. }
  16. var id = parseInt(this.m_InputID.string);
  17. if(id>=1000000 || id < 100000){
  18. this.ShowTips("ID輸入錯誤!");
  19. return false;
  20. }
  21. return true;
  22. },
  23. CheckCurUserInfo:function(){
  24. var id = parseInt(this.m_InputID.string);
  25. if(this.m_UserCtrl.GetUserID() == 0){
  26. this.ShowTips("請先査詢用戶資訊!");
  27. return false;
  28. }
  29. return true;
  30. },
  31. OnBtSel:function(){
  32. if(!this.CheckInput()) return;
  33. var id = parseInt(this.m_InputID.string);
  34. this.m_Hook.OnSelUser(id);
  35. this.m_UserCtrl.SetUserByGameID(id);
  36. },
  37. OnBtAdd:function(){
  38. if(!this.CheckInput()) return;
  39. if(!this.CheckCurUserInfo()) return;
  40. this.m_Hook.OnOpClubUserLv(this.m_UserCtrl.GetUserID(),3);
  41. },
  42. OnBtDel:function(){
  43. if(!this.CheckInput()) return;
  44. if(!this.CheckCurUserInfo()) return;
  45. this.m_Hook.OnOpClubUserLv(this.m_UserCtrl.GetUserID(),0);
  46. },
  47. OnShowView:function(){
  48. this.m_UserCtrl.SetUserByID(0);
  49. },
  50. // update (dt) {},
  51. });