mine_view.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { _decorator, Component, Node, Label, Sprite } from 'cc';
  2. import UIDialog from '../Game/UIDialog';
  3. import { GameMng } from '../GameMng';
  4. import { UIButton } from '../gcommon/UIButton';
  5. import { UIManager } from '../gcommon/UIManager';
  6. import { native_manager } from '../native_manager';
  7. import { Tools } from '../Tools';
  8. const { ccclass, property } = _decorator;
  9. @ccclass('mine_view')
  10. export class mine_view extends Component {
  11. @property(Node)
  12. btn_setting: Node = null;
  13. @property(Node)
  14. btn_self_info: Node = null;
  15. @property(Node)
  16. btn_quit: Node = null;
  17. @property(Node)
  18. btn_share: Node = null;
  19. @property(Node)
  20. lab_name: Node = null;
  21. @property(Node)
  22. lab_id: Node = null;
  23. @property(Node)
  24. lab_login_name: Node = null;
  25. @property(Node)
  26. head_spr: Node = null;
  27. //@property(Node)
  28. // btn_zhuangban: Node = null;
  29. start() {
  30. UIButton.BindClick(this.btn_quit,()=>{
  31. UIDialog.Show(()=>{},()=>{},"您确定要退出登陆吗?",null,true)
  32. },this)
  33. UIButton.BindClick(this.btn_setting,()=>{
  34. UIManager.AddPrefab(GameMng.Instance.uiSettingView)
  35. },this)
  36. UIButton.BindClick(this.btn_self_info,()=>{
  37. UIManager.AddPrefab(GameMng.Instance.self_info_view)
  38. },this)
  39. UIButton.BindClick(this.btn_share,()=>{
  40. native_manager.share()
  41. },this)
  42. // UIButton.BindClick(this.btn_zhuangban,()=>{
  43. // UIManager.AddPrefab(GameMng.Instance.shop_view)
  44. // },this)
  45. }
  46. onEnable(){
  47. if(GameMng._userData!=null){
  48. this.lab_name.getComponent(Label).string = GameMng._userData.user_name
  49. this.lab_id.getComponent(Label).string = "ID:"+GameMng._userData.userid +""
  50. this.lab_login_name.getComponent(Label).string = GameMng._userData.user_name
  51. Tools.loadWeiXinHead(GameMng._userData.user_avatar,this.head_spr.getComponent(Sprite))
  52. }
  53. }
  54. update(deltaTime: number) {
  55. }
  56. }