So today I am preparing for the ability to create a character and I had to go back and fix part of my message handler. If you notice, I create 2 delegates for before receiving and processing the message and after, but you never see those delegates get called. To do this we need to make a few minor modifications. First, we need to change the name of HandleMessage to OnHandleMessage. Make this same change in the CharacterSelectHandler. Next we will add a new function to IMessageHandler called HandleMessage and it will look like this:
public void HandleMessage(ISFSObject data)
{
if (beforeMessageRecieved != null)
{
beforeMessageRecieved();
}
OnHandleMessage(data);
if (afterMessageRecieved != null)
{
afterMessageRecieved();
}
}
This will check if any functions have been added to beforeMessageReceived and afterMessageReceived and call them when necessary.
In the next post you will see why this is important as we set up to display the characters, a new character button and a back button that will log us off the server and put us back to the lobby.
Tuesday, May 10, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment