RoomList.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. // onLoad () {},
  6. start () {
  7. },
  8. InitView:function(){
  9. if (!this.m_ListCtrl) {
  10. this.m_ListCtrl = this.$('@CustomListCtrl');
  11. this.m_ListCtrl.InitList(0, 'LobbyRoom', this);
  12. }
  13. this.m_Hook.OnLoadOwnRoomList();
  14. },
  15. OnShowView: function () {
  16. this.InitView();
  17. ShowO2I(this.node);
  18. },
  19. OnHideView: function () {
  20. HideI2O(this.node);
  21. },
  22. onOwnRoomList: function (OwnRoom) { //CMD_GP_S_OwnRoomInfo
  23. this.m_ListCtrl.InitList(0, 'LobbyRoom', this);
  24. this.$('NoRoom').active = OwnRoom.wCnt == 0;
  25. for (var i = 0; i < OwnRoom.wCnt; i++) {
  26. this.m_ListCtrl.InsertListInfo(0, OwnRoom.RoomInfo[i]);
  27. }
  28. },
  29. DeleteRoom: function(dwRoomID) {
  30. if(!this.node.active || !this.m_ListCtrl) return;
  31. this.m_ListCtrl.ForEachCtrl(0, function(item){
  32. if(dwRoomID ==item.m_dwRoomID) item.node.active = false;
  33. }.bind(this));
  34. },
  35. });