mine_view.ts 2.4 KB

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