giải thích bất cứ điều gì khác trong phát hiện va chạm Chương 1 và Nettrix. GDI + trò chơi nếu chúng ta sử dụng thủ thuật này hình ảnh 7-9: Một con thỏ nhảy mà không có dự đoán trò chơi thú vị đa phương tiện bằng cách sử dụng Managed DirectX và Tiếp theo chúng ta sẽ thảo luận về một khái niệm phim hoạt hình | Catch 0 End Try Else 0 End f End Sub In the next section we ll write the code for creating game sessions and joining them. Coding the Session Methods Although we are coding a single class for the sessions there ll be specific methods executed by the host and others used by the client. We ll discuss these methods in separated sections so that we won t confuse the two. Creating and Destroying Sessions To create a session in DirectPlay we simply call the Host method of the Peer object passing the appropriate parameters which enables us to receive connections from other computers. TheHost method will receive two parameters an ApplicationDescription 0 bject which will give the game GUID and the session name and the Addressobject which points to the service provider to be used Public Function CreateSession strSessionName As String As Boolean Try Create the application description object Dim AppDesc As New ApplicationDescription GameGuid strSessionName No special flags 0 Host a game on DPAddress as described by AppDesc AppDesc DPAddress CreateSession True Catch e As DirectPlayException Error when creating a session __ - CreateSession False End Try End Function We must follow here a rule of thumb for any program Close what you opened. So we ll add code for the CloseConnection method which can be called if the program wants to explicitly close the connection to other computers. Public Sub CloseConnection End Sub These two methods will be used only by the Host and they are all we need to create and destroy game sessions. Since many games will need a configuration screen to receive the session name from the player we can add an extra Create-Session method that receives no .