LiteGame.cs

Options
archmaegus
edited July 2012 in DotNet
In the HandleJoinOperation method in LiteGame.cs, there is the following code:
foreach (Actor t in this.Actors)
            {
                if (t.ActorNr != actor.ActorNr && t.Properties.Count > 0)
                {
                    if (joinResponse.CurrentActorProperties == null)
                    {
                        joinResponse.CurrentActorProperties = new Hashtable();
                    }

                    Hashtable actorProperties = t.Properties.GetProperties();
                    joinResponse.CurrentActorProperties.Add(t.ActorNr, actorProperties);
                }
            }
peer.SendOperationResponse(new OperationResponse(joinRequest.OperationRequest.OperationCode, joinResponse), sendParameters);

This code looks like it's looping through the actors and preparing to send a join notification to the actors of the room, which I assume is what the peer.SendOperationResponse call is doing. But right after this call is a call to this.PublishJoinEvent, which looks like it does the exact same thing. What's the difference between SendOperation and PublishJoinEvent?

Comments

  • Philip
    Options
    SendOperationResponse sends a joinresponse only to the peer that initiated the joinrequest.

    Publish sends a JoinEvent to all other players in the room.