public void JoinMatch(string matchName) { // verify that a game with the specified name actually exists if (matches.ContainsKey(matchName)) { ExampleServerMatch match = matches[matchName]; // hand the peer over to the specified match HandoverPeer(SenderPeer, match); } // if game couldn't be found, tell the peer else { SendToPeer(SenderPeer).OnMatchNotFound(matchName); } }
public void CreateMatch(string matchName) { // verify that a game with that name doesn't already exist if (!matches.ContainsKey(matchName)) { // create a new Match by registering it with the Master Server instance ExampleServerMatch newMatch = Master.RegisterScope <ExampleServerMatch>(2, false); // add it to the dictionary under the given match name matches[matchName] = newMatch; // hand the peer over to the newly created match HandoverPeer(SenderPeer, newMatch); } // if it already exists, tell the peer else { ReplyToPeer().OnMatchAlreadyExists(matchName); } }