Where is the "GetOperationResponse" method?

Options
storm33229
edited March 2013 in Photon Server
I was looking here: http://doc.exitgames.com/photon-server/ ... perations/ when I found:
if (operation.Message == "Hello World")
{
    // received hello world, send an answer!
    operation.Message = "Hello yourself!";
    OperationResponse response = operation.GetOperationResponse(0, "OK");
    this.PhotonPeer.SendOperationResponse(response);
}

More specifically:
OperationResponse response = operation.GetOperationResponse(0, "OK");

I am curious as to where this "GetOperationResponse" method is located. It isn't defined in the custom operation type "MyCustomOperation", and I could not find it in "Photon.SocketServer.Rpc.Operation", Lite or LiteLobby.

While we are on the subject... what is the recommended way this method be formed and used? For example, it looks to me like you are passing the parameter number and value for that parameter into the method.

Comments

  • Its not inside "Photon.SocketServer.Rpc.Operation" its a custom method you have to create yourself. For ex
    [code2=csharp]public class CustomOperation : Operation
    {
    public CustomOperation(IRpcProtocol protocol, OperationRequest request)
    : base(protocol, request)
    {
    }

    // stuff

    public OperationResponse GetOperationResponse(string message, short errorCode)
    {
    return new OperationResponse((byte)request.Code) { ReturnCode = errorCode, DebugMessage = message };
    }
    }[/code2]
  • Ah, OK. Thanks, I was sorta figuring as much... this should be added to that page.