Ejemplo n.º 1
0
        public void RecvRPCData(string data, string action)
        {
            string typeName = this.GetType().Namespace + "." + action;
            var    obj      = MessageSenderUtil.Decode(data, Type.GetType(typeName));

            SalinCallbacks.OnPhotonCallbackEvent(new PhotonEvent(PhotonAction.Message, obj));
        }
Ejemplo n.º 2
0
        private void SendRPC <T>(T data, SendTarget sendTargets = SendTarget.ToTarget) where T : MessageData
        {
            data.senderId = UserManager.Instance.userID;
            string requestJsonString = MessageSenderUtil.Encode <T>(data);

            RpcTarget target = RpcTarget.Others;

            switch (sendTargets)
            {
            case SendTarget.ToAll:
                target = RpcTarget.All;
                break;

            case SendTarget.ToOthers:
                target = RpcTarget.Others;
                break;

            default:
                target = RpcTarget.Others;
                break;
            }

            pv?.RPC("RecvRPCData", target, requestJsonString, data.action);
        }