Лабораторная работа: Greating game on visual basic with multiplayer system
Set dpmsg = dxplay. CreateMessage
dpmsg. WriteLong (MSG_STARTGAME) 'case selector
dpmsg. WriteByte (numplayers) 'number of players
Dim PlayerID As Long
For x = 0 To numplayers - 1
PlayerID = tnumplayers. GetDPID (x + 1)
dpmsg. WriteLong (PlayerID)
' Keep local copy of player IDs
PlayerIDs (x) = PlayerID
' Assign place in order to the host
If PlayerID = MyPlayer Then dxMyTurn = x
Next x
Call dxplay. Send (MyPlayer, DPID_ALLPLAYERS, DPSEND_GUARANTEED, dpmsg)
Hide
MainBoard. Enabled = True
MainBoard. Show
MainBoard. playerdisplaylabel. Caption = opponentsname & " Has Joined The Game"
MainBoard. StatusBar1. SimpleText = opponentsname & "Is Ready To Play, Start Game"
MainBoard. mnudisconnect. Enabled = True
connectionmade = True
multiplayermode = True
MainBoard. mnuchat. Enabled = True
onconnect = True
Exit Sub
CouldNotStart:
MsgBox "Could not start game. ", vbOKOnly, "System"
End Sub
Private Function updatedisplay ()
label7. Visible = True