SelfinfoPre.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_BtGPS:cc.Node,
  5. m_LabRoomCard:cc.Label,
  6. m_LabIP:cc.Label,
  7. m_SexSprite:cc.Sprite,
  8. m_atlas:cc.SpriteAtlas
  9. },
  10. ctor:function(){
  11. this.m_CArr = new Array(new cc.color(255,255,255),new cc.color(180,180,180))
  12. },
  13. OnShowView:function(){
  14. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  15. this.m_LabRoomCard.string = pGlobalUserData.llUserIngot;
  16. this.m_LabIP.string = pGlobalUserData.szClientIP;
  17. this.node.getChildByName('UserCtrl').getComponent('UserCtrl').SetUserByID(pGlobalUserData.dwUserID);
  18. var bShow = cc.sys.localStorage.getItem(window.Key_ShowGPS);
  19. if(bShow == null) bShow = 0;
  20. this.m_BtGPS.color = this.m_CArr[bShow];
  21. this.m_SexSprite.spriteFrame = this.m_atlas.getSpriteFrame('sex'+pGlobalUserData.cbGender);
  22. },
  23. OnBtSendCard:function(){
  24. this.m_Hook.ShowPrefabDLG('SendRoomCard', this.m_Hook.m_DlgNode,function(Js){
  25. this.m_SendCardCtrl = Js;
  26. }.bind(this.m_Hook));
  27. this.HideView();
  28. },
  29. OnBtGPS:function(){
  30. var bShow = cc.sys.localStorage.getItem(window.Key_ShowGPS);
  31. if(bShow == null || bShow == 0) bShow = 1;
  32. else bShow = 0;
  33. cc.sys.localStorage.setItem(window.Key_ShowGPS,bShow);
  34. this.m_BtGPS.color = this.m_CArr[bShow];
  35. },
  36. OnBtGetCard:function(){
  37. this.m_Hook.onClick_Bt_stone();
  38. this.HideView();
  39. },
  40. OnBtChangeSex:function(){
  41. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  42. var ChangeSex = 1;
  43. if(pGlobalUserData.cbGender) ChangeSex=0;
  44. var webUrl = window.PHP_HOME+'/UserFunc.php?&GetMark=6&dwUserID='+pGlobalUserData.dwUserID;
  45. webUrl += "&Sex="+ChangeSex;
  46. this.m_Hook.ShowLoading();
  47. WebCenter.GetData(webUrl, null, function (data) {
  48. this.m_Hook.StopLoading();
  49. pGlobalUserData.cbGender = ChangeSex;
  50. this.m_SexSprite.spriteFrame = this.m_atlas.getSpriteFrame('sex'+pGlobalUserData.cbGender);
  51. }.bind(this));
  52. },
  53. });