SelectGameMatch.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var SelGame = window.clientName + '_C_G'
  2. cc.Class({
  3. extends: cc.BaseClass,
  4. properties: {
  5. m_ldiamond: cc.Label,
  6. m_personT: [cc.Toggle],
  7. },
  8. ctor: function () {
  9. this.m_RoomType = 0;// 0普通 1俱乐部
  10. this.m_personIndex = 1;
  11. this.m_playMethod = 0;
  12. },
  13. onLoad: function () {
  14. this._Sub = [];
  15. this._Sub.push(this.$('NewNode/Sub1'));
  16. // this._Sub.push(this.$('NewNode/Sub2'));
  17. // this._Sub.push(this.$('NewNode/Sub3'));
  18. this.updateDiamond()
  19. this.m_personIndex = cc.sys.localStorage.getItem("personIndex",1);
  20. if(this.m_personIndex==null||this.m_personIndex == undefined){
  21. this.m_personIndex = 1;
  22. }
  23. console.log("人数m_personIndex",this.m_personIndex)
  24. this.m_personT[this.m_personIndex].isChecked = true;
  25. },
  26. OnShowView: function () {
  27. if (this.m_FirstCtrl == null) {
  28. this.m_FirstCtrl = this.$('LeftBG/Layout/T0@Toggle');
  29. this.m_FirstCtrl.isChecked = false;
  30. this.m_FirstCtrl.check();
  31. }
  32. return
  33. },
  34. OnSetRoomType: function (type) {
  35. this.m_RoomType = type;
  36. this.FilterGame(type);
  37. },
  38. FilterGame: function (type) {
  39. // this.$('NewNode/Sub2/view/content/63500').active = type>0;
  40. },
  41. OnTogClick: function (tag, data) {
  42. // console.log('data:'+data);
  43. // for(let i =0;i<3;i++){
  44. // this._Sub[i].active = false;
  45. // }
  46. // this._Sub[data].active = true;
  47. },
  48. onClickPlayMethod: function (data, tag) {
  49. console.log("点击玩法", tag)
  50. this.m_playMethod = tag;
  51. },
  52. OnClickButtonPerson: function (data, tag) {
  53. console.log("点击Person", tag)
  54. this.m_personIndex = tag;
  55. cc.sys.localStorage.setItem("personIndex", this.m_personIndex)
  56. },
  57. OnClickButtonMatch: function (data, tag) {
  58. console.log("点击data", tag)
  59. this.m_Hook.matchRoom(this.m_personIndex, tag,this.m_playMethod)
  60. // this.ShowPrefabDLG('CreateRoom2',null,(Js)=>{
  61. // Js.OnSetGameID(tag.currentTarget.name);
  62. // Js.OnClubAutoView(this.m_RoomType);
  63. // });
  64. },
  65. OnCreateRoom: function (KindID, dwRules, dwServerRules, Name) {
  66. this.m_Hook.OnCreateRoom(KindID, dwRules, dwServerRules, Name, 0, 0);
  67. this.HideView();
  68. },
  69. updateDiamond: function () {
  70. let diamond = g_GlobalUserInfo.GetGlobalUserData().llUserIngot;
  71. this.m_ldiamond.string = diamond;
  72. },
  73. });