Example #1
0
    private void ProcessRequestRemoteCall(RequestRemoteCall packet)
    {
        lock (responseCallbacks)
        {
            var response = new RespondRemoteCall();
            response.PacketId  = packet.PacketId;
            response.RespondTo = packet.Player;

            if (functions.ContainsKey(packet.FunctionName) == false)
            {
                Debug.LogError("Got RPCCall but there's no function : " + packet.FunctionName);

                response.Exception = new NotImplementedException(packet.FunctionName);
                response.IsSuccess = false;
            }
            else
            {
                try
                {
                    var ret = functions[packet.FunctionName].Invoke(packet.Player, packet.Args);
                    response.Result    = ret;
                    response.IsSuccess = true;
                }
                catch (Exception e)
                {
                    response.Exception = e;
                    response.IsSuccess = false;
                }

                Send(response);
            }
        }
    }
Example #2
0
    private void ProcessRespondRemoteCall(RespondRemoteCall packet)
    {
        lock (responseCallbacks)
        {
            if (responseCallbacks.ContainsKey(packet.PacketId) == false)
            {
                Debug.LogWarning("UnknownPacket : " + packet.PacketId);
                return;
            }

            responseCallbacks[packet.PacketId].Invoke(packet);
            responseCallbacks.Remove(packet.PacketId);
        }
    }
Example #3
0
        public void OnResponseRemoteCall(RespondRemoteCall packet)
        {
            EzService target;

            lock (Sessions)
            {
                target = Sessions.FirstOrDefault(x => x.Player.PlayerId == packet.RespondTo.PlayerId);
                if (target == null)
                {
                    return;
                }
            }

            target.SendPacket(packet);
        }