public void Leave() { NetModule.instance.RemoveACMDListener(Module.HALL, Command.ACMD_BRO_ROOM_CREATED, this.OnRoomCreated); NetModule.instance.RemoveACMDListener(Module.HALL, Command.ACMD_BRO_ROOM_DESTROIED, this.OnRoomDestroy); NetModule.instance.RemoveACMDListener(Module.HALL, Command.ACMD_ROOM_LIST, this.OnRoomList); NetModule.instance.RemoveACMDListener(Module.HALL, Command.ACMD_JOIN_ROOM, this.OnEnterRoom); NetModule.instance.RemoveQCMDListener(Module.HALL, Command.QCMD_CREATE_ROOM, this.OnCreateRoomResult); NetModule.instance.RemoveQCMDListener(Module.HALL, Command.QCMD_JOIN_ROOM, this.OnJoinRoomResult); GList list = this._root["list"].asList; list.RemoveChildrenToPool(); if (this._createWin != null) { this._createWin.Dispose(); this._createWin = null; } if (this._joinPopup != null) { this._joinPopup.Dispose(); this._joinPopup = null; } if (this._root != null) { this._root.Dispose(); this._root = null; } }
public void Enter(object param) { NetModule.instance.AddACMDListener(Module.HALL, Command.ACMD_BRO_ROOM_CREATED, this.OnRoomCreated); NetModule.instance.AddACMDListener(Module.HALL, Command.ACMD_BRO_ROOM_DESTROIED, this.OnRoomDestroy); NetModule.instance.AddACMDListener(Module.HALL, Command.ACMD_ROOM_LIST, this.OnRoomList); NetModule.instance.AddACMDListener(Module.HALL, Command.ACMD_JOIN_ROOM, this.OnEnterRoom); NetModule.instance.AddQCMDListener(Module.HALL, Command.QCMD_CREATE_ROOM, this.OnCreateRoomResult); NetModule.instance.AddQCMDListener(Module.HALL, Command.QCMD_JOIN_ROOM, this.OnJoinRoomResult); this._root = UIPackage.CreateObject("hall", "Main").asCom; GRoot.inst.AddChild(this._root); this._root.size = GRoot.inst.size; this._createWin = new CreateRoomWin(); this._joinPopup = UIPackage.CreateObject("hall", "弹出").asCom; this._joinPopup["n0"].asButton.onClick.Add(this.OnJoinRoomBtnClick); GButton createBtn = this._root["create"].asButton; createBtn.onClick.Add(this.OnCreateBtnClick); GList list = this._root["list"].asList; list.onClickItem.Add(this.OnClickItem); this._root.ShowModalWait(); NetModule.instance.Send(ProtocolManager.PACKET_HALL_QCMD_ROOM_LIST(255, 0)); }