void OnDestroy() { Completed -= OnComplete; Received -= OnReceiveMsg; // 退出的时候, 最后尝试一下看消息能否发出 LeaveRoom output = new LeaveRoom() { RoomId = RoomId, ReleaseIfNoUser = true, }; SendMsg(ROOM.LeaveRoom, output.ToByteArray()); RoomLogic.Fini(); }
public void OnClickExit() { LeaveRoom output = new LeaveRoom() { RoomId = GameRoomManager.Instance.RoomId, ReleaseIfNoUser = true, }; if (GameRoomManager.Instance) { GameRoomManager.Instance.SendMsg(ROOM.LeaveRoom, output.ToByteArray()); } if (ClientManager.Instance != null) { ClientManager.Instance.StateMachine.TriggerTransition(ConnectionFSMStateEnum.StateEnum.RESULT); } }