• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PhotonTargets类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PhotonTargets的典型用法代码示例。如果您正苦于以下问题:C# PhotonTargets类的具体用法?C# PhotonTargets怎么用?C# PhotonTargets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PhotonTargets类属于命名空间,在下文中一共展示了PhotonTargets类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SendChat

 void SendChat(PhotonTargets target)
 {
     if (chatInput != "")
     {
         photonView.RPC("SendChatMessage", target, chatInput);
         chatInput = "";
     }
 }
开发者ID:loursbrun,项目名称:sniperspiritV3,代码行数:8,代码来源:ChatVik.cs


示例2: PhotonRpcSendFsmEventWithString

    /// <summary>
    /// Function typically called from the action "PhotonViewRpcBroadcastFsmEvent" that use RPC to send information about the event to Send to self over the network
    /// </summary>
    /// <param name='target'>
    /// Photon Target.
    /// </param>
    /// <param name='globalEventName'>
    /// Global Fsm event name to broadcast using the photon target rule.
    /// </param>	
    /// <param name='stringData'>
    /// String data to pass with this event. WARNING: this is not supposed to be (nor efficient) a way to synchronize data. This is simply to comply with
    /// the ability for FsmEvent to include data.
    /// </param>
    public void PhotonRpcSendFsmEventWithString(PhotonTargets target,string globalEventName,string stringData)
    {
        if (LogMessageInfo)
        {
            Debug.Log("RPC to send string:"+stringData+"  with global Fsm Event:"+globalEventName+" to self, with network target:"+target.ToString());
        }

        photonView.RPC("rpc_s", target, globalEventName, stringData);// method name used to be too long :  "RPC_FsmPhotonRpcBroadcastFsmEventWithString"
    }
开发者ID:jiangkuo888,项目名称:ORP_beta,代码行数:22,代码来源:PlayMakerPhotonGameObjectProxy.cs


示例3: PhotonRpcSendFsmEvent

    /// <summary>
    /// Function typically called from the action "PhotonViewRpcBroadcastFsmEvent" that use RPC to send information about the event to Send to self over the network
    /// </summary>
    /// <param name='target'>
    /// Photon Target.
    /// </param>
    /// <param name='globalEventName'>
    /// Global Fsm event name to send using the photon target rule.
    /// </param>
    public void PhotonRpcSendFsmEvent(PhotonTargets target,string globalEventName)
    {
        if (LogMessageInfo)
        {
            Debug.Log("RPC to send global Fsm Event:"+globalEventName+" to self, with network target:"+target.ToString());
        }

        photonView.RPC("rpc", target, globalEventName);// method name used to be too long : "RPC_PhotonRpcBroadcastFsmEvent"
    }
开发者ID:jiangkuo888,项目名称:ORP_beta,代码行数:18,代码来源:PlayMakerPhotonGameObjectProxy.cs


示例4: Reset

		public override void Reset()
		{
			// JFF: how can I set this silently without a plubic variable? if I set it to private, it doesn't work anymore. maybe I forgot a setting?
			eventTarget = new FsmEventTarget();
			eventTarget.target = FsmEventTarget.EventTarget.BroadcastAll;
			
			remoteEvent = null;
			photonTargets = PhotonTargets.All;
			photonTargetsFromString = null;
			stringData = null;
		}
开发者ID:nermakov777,项目名称:Unity_Tests,代码行数:11,代码来源:PhotonViewRpcBroadcastFsmEvent.cs


示例5: resetDoorTime

 void resetDoorTime(PhotonTargets ptarget)
 {
     photonView.RPC("resetDoors",ptarget, false);
 }
开发者ID:nguyensitien,项目名称:SGICollab,代码行数:4,代码来源:DoorTriggerScript.cs


示例6: RpcSecure

 /// <summary>
 /// Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
 /// </summary>
 /// <remarks>
 /// [Remote Procedure Calls](@ref rpcManual) are an essential tool in making multiplayer games with PUN.
 /// It enables you to make every client in a room call a specific method.
 ///
 /// RPC calls can target "All" or the "Others".
 /// Usually, the target "All" gets executed locally immediately after sending the RPC.
 /// The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back.
 /// Of course, calls are affected by this client's lag and that of remote clients.
 ///
 /// Each call automatically is routed to the same PhotonView (and GameObject) that was used on the
 /// originating client.
 ///
 /// See: [Remote Procedure Calls](@ref rpcManual).
 /// </remarks>
 ///<param name="methodName">The name of a fitting method that was has the RPC attribute.</param>
 ///<param name="target">The group of targets and the way the RPC gets sent.</param>
 ///<param name="encrypt"> </param>
 ///<param name="parameters">The parameters that the RPC method has (must fit this call!).</param>
 public void RpcSecure(string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
 {
     PhotonNetwork.RPC(this, methodName, target, encrypt, parameters);
 }
开发者ID:matsmulder,项目名称:MinorProject,代码行数:25,代码来源:PhotonView.cs


示例7: RPC

 /// <summary>
 /// Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
 /// </summary>
 /// <remarks>
 /// [Remote Procedure Calls](@ref rpcManual) are an essential tool in making multiplayer games with PUN.
 /// It enables you to make every client in a room call a specific method.
 ///
 /// RPC calls can target "All" or the "Others".
 /// Usually, the target "All" gets executed locally immediately after sending the RPC.
 /// The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back.
 /// Of course, calls are affected by this client's lag and that of remote clients.
 ///
 /// Each call automatically is routed to the same PhotonView (and GameObject) that was used on the
 /// originating client.
 ///
 /// See: [Remote Procedure Calls](@ref rpcManual).
 /// </remarks>
 /// <param name="methodName">The name of a fitting method that was has the RPC attribute.</param>
 /// <param name="target">The group of targets and the way the RPC gets sent.</param>
 /// <param name="parameters">The parameters that the RPC method has (must fit this call!).</param>
 public void RPC(string methodName, PhotonTargets target, params object[] parameters)
 {
     RpcSecure(methodName, target, false, parameters);
 }
开发者ID:matsmulder,项目名称:MinorProject,代码行数:24,代码来源:PhotonView.cs


示例8: RPC

    /// RPC Hashtable Structure
    /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
    /// (byte)1 -> (short) prefix (level)
    /// (byte)2 -> (int) server timestamp
    /// (byte)3 -> (string) methodname
    /// (byte)4 -> (object[]) parameters
    /// (byte)5 -> (string) method shortcut (alternative to name)
    /// 
    /// This is sent as event (code: 200) which will contain a sender (origin of this RPC).
    internal void RPC(PhotonView view, string methodName, PhotonTargets target, params object[] parameters)
    {
        if (this.blockSendingGroups.Contains(view.group))
        {
            return; // Block sending on this group
        }

        if (view.viewID < 1)
        {
            Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
        }

        if (this.DebugOut >= DebugLevel.INFO)
        {
            this.DebugReturn(DebugLevel.INFO, "Sending RPC \"" + methodName + "\" to " + target);
        }

        //ts: changed RPCs to a one-level hashtable as described in internal.txt
        Hashtable rpcEvent = new Hashtable();
        rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
        if (view.prefix > 0)
        {
            rpcEvent[(byte)1] = (short)view.prefix;
        }
        rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;

        // send name or shortcut (if available)
        int shortcut = 0;
        if (rpcShortcuts.TryGetValue(methodName, out shortcut))
        {
            rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
        }
        else
        {
            rpcEvent[(byte)3] = methodName;
        }

        if (parameters != null || parameters.Length == 0)
        {
            rpcEvent[(byte)4] = (object[])parameters;
        }

        // Check scoping
        if (target == PhotonTargets.All)
        {
            this.OpRaiseEvent(PhotonNetworkMessages.RPC, (byte)view.group, rpcEvent, true, 0);
            // Execute local
            this.ExecuteRPC(rpcEvent, this.mLocalActor);
        }
        else if (target == PhotonTargets.Others)
        {
            this.OpRaiseEvent(PhotonNetworkMessages.RPC, (byte)view.group, rpcEvent, true, 0);
        }
        else if (target == PhotonTargets.AllBuffered)
        {
            this.OpRaiseEvent(PhotonNetworkMessages.RPC, rpcEvent, true, 0, EventCaching.AddToRoomCache, ReceiverGroup.Others);

            // Execute local
            this.ExecuteRPC(rpcEvent, this.mLocalActor);
        }
        else if (target == PhotonTargets.OthersBuffered)
        {
            this.OpRaiseEvent(PhotonNetworkMessages.RPC, rpcEvent, true, 0, EventCaching.AddToRoomCache, ReceiverGroup.Others);
        }
        else if (target == PhotonTargets.MasterClient)
        {
            if (this.mMasterClient == this.mLocalActor)
            {
                this.ExecuteRPC(rpcEvent, this.mLocalActor);
            }
            else
            {
                this.OpRaiseEvent(PhotonNetworkMessages.RPC, rpcEvent, true, 0, EventCaching.DoNotCache, ReceiverGroup.MasterClient);//TS: changed from caching to non-cached. this goes to master only
            }
        }
        else
        {
            Debug.LogError("Unsupported target enum: " + target);
        }
    }
开发者ID:rmkeezer,项目名称:fpsgame,代码行数:89,代码来源:NetworkingPeer.cs


示例9: RPC

 /// <summary>
 /// Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
 /// </summary>
 /// <remarks>
 /// [Remote Procedure Calls](@ref rpcManual) are an essential tool in making multiplayer games with PUN.
 /// It enables you to make every client in a room call a specific method.
 ///
 /// RPC calls can target "All" or the "Others".
 /// Usually, the target "All" gets executed locally immediately after sending the RPC.
 /// The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back.
 /// Of course, calls are affected by this client's lag and that of remote clients.
 ///
 /// Each call automatically is routed to the same PhotonView (and GameObject) that was used on the
 /// originating client.
 ///
 /// See: [Remote Procedure Calls](@ref rpcManual).
 /// </remarks>
 /// <param name="methodName">The name of a fitting method that was has the RPC attribute.</param>
 /// <param name="target">The group of targets and the way the RPC gets sent.</param>
 /// <param name="parameters">The parameters that the RPC method has (must fit this call!).</param>
 public void RPC(string methodName, PhotonTargets target, params object[] parameters)
 {
     PhotonNetwork.RPC(this, methodName, target, false, parameters);
 }
开发者ID:daniel-cheng,项目名称:stellar,代码行数:24,代码来源:PhotonView.cs


示例10: RPC

    /// RPC Hashtable Structure
    /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
    /// (byte)1 -> (short) prefix (level)
    /// (byte)2 -> (int) server timestamp
    /// (byte)3 -> (string) methodname
    /// (byte)4 -> (object[]) parameters
    /// (byte)5 -> (byte) method shortcut (alternative to name)
    ///
    /// This is sent as event (code: 200) which will contain a sender (origin of this RPC).

    internal void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
    {
        // Check scoping
        if (target == PhotonTargets.All)
        {
            RPC(view, methodName, PhotonNetwork.playerList, encrypt, parameters);
        }
        else if (target == PhotonTargets.Others)
        {
            RPC(view, methodName, PhotonNetwork.otherPlayers, encrypt, parameters);
        }
        else if(target == PhotonTargets.MasterClient)
        {
            RPC(view, methodName, PhotonNetwork.masterClient, encrypt, parameters);
        }
    }
开发者ID:Awesome-MQP,项目名称:Storybook,代码行数:26,代码来源:NetworkingPeer.cs


示例11: RPC

    /// <summary>
    /// Internal to send an RPC on given PhotonView. Do not call this directly but use: PhotonView.RPC!
    /// </summary>
    internal static void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        if (room == null)
        {
            Debug.LogWarning("Cannot send RPCs in Lobby! RPC dropped.");
            return;
        }

        if (networkingPeer != null)
        {
            if (PhotonNetwork.networkingPeer.hasSwitchedMC && target == PhotonTargets.MasterClient)
            {
                networkingPeer.RPC(view, methodName, PhotonNetwork.masterClient, encrypt, parameters);
            }
            else
            {
                networkingPeer.RPC(view, methodName, target, encrypt, parameters);
            }
        }
        else
        {
            Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
        }
    }
开发者ID:Kaljo123,项目名称:Teleport,代码行数:32,代码来源:PhotonNetwork.cs


示例12: sendLiftTime

 void sendLiftTime(PhotonTargets ptarget)
 {
     photonView.RPC("updateLiftTime", ptarget, localLiftTime);
 }
开发者ID:nguyensitien,项目名称:SGICollab,代码行数:4,代码来源:triggerCsScript.cs


示例13: RPC

    /// <summary>
    /// Internal to send an RPC on given PhotonView. Do not call this directly but use: PhotonView.RPC!
    /// </summary>
    internal static void RPC(PhotonView view, string methodName, PhotonTargets target, params object[] parameters)
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        if (room == null)
        {
            UnityEngine.Debug.LogWarning("Cannot send RPCs in Lobby! RPC dropped.");
            return;
        }

        if (networkingPeer != null)
        {
            networkingPeer.RPC(view, methodName, target, parameters);
        }
        else
        {
            UnityEngine.Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
        }
    }
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:25,代码来源:PhotonNetwork.cs


示例14: RpcSecureAsMaster

 public static void RpcSecureAsMaster(this PhotonView photonView, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
 {
     RpcManager.SendRpcSecureToMaster(photonView, methodName, target, encrypt, parameters);
 }
开发者ID:oatssss,项目名称:McGill-Once-McGill-Twice,代码行数:4,代码来源:ExtensionMethods.cs


示例15: SendChat

 private void SendChat(PhotonTargets target)
 {
     Debug.Log(target);
     photonView.RPC("SendChatMessage", target, chatInput);
     chatInput = "";
 }
开发者ID:pbes0707,项目名称:DifBird,代码行数:6,代码来源:Network_Chat.cs


示例16: SendChat

    void SendChat(PhotonTargets target)
    {
        if (chatInput != "")
        {
            //Send to other players
            if (photonView)
            photonView.RPC("SendChatMessage", target, "<"+chatterClass+">: " +chatInput, chatterClass);

            //Send to online database
            StartCoroutine(saveChatToOnlineDatabase());

            //Empty input
            chatInput = "";
        }
    }
开发者ID:nguyensitien,项目名称:SGICollab,代码行数:15,代码来源:ChatVik.cs


示例17: RPC

    /// <summary>
    /// Internal to send an RPC on given PhotonView. Do not call this directly but use: PhotonView.RPC!
    /// </summary>
    internal static void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        if (room == null)
        {
            Debug.LogWarning("RPCs can only be sent in rooms. Call of \"" + methodName + "\" gets executed locally only, if at all.");
            return;
        }

        if (networkingPeer != null)
        {
            if (PhotonNetwork.room.serverSideMasterClient)
            {
                networkingPeer.RPC(view, methodName, target, null, encrypt, parameters);
            }
            else
            {
                if (PhotonNetwork.networkingPeer.hasSwitchedMC && target == PhotonTargets.MasterClient)
                {
                    networkingPeer.RPC(view, methodName, PhotonTargets.Others, PhotonNetwork.masterClient, encrypt, parameters);
                }
                else
                {
                    networkingPeer.RPC(view, methodName, target, null, encrypt, parameters);
                }
            }
        }
        else
        {
            Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
        }
    }
开发者ID:yuvadius,项目名称:need4bit,代码行数:39,代码来源:PhotonNetwork.cs


示例18: RPC

    /// <summary>
    /// Call a RPC method of this GameObject on remote clients of this room (or on all, inclunding this client).
    /// </summary>
    /// <remarks>
    /// [Remote Procedure Calls](@ref rpcManual) are an essential tool in making multiplayer games with PUN.
    /// It enables you to make every client in a room call a specific method.
    ///
    /// RPC calls can target "All" or the "Others".
    /// Usually, the target "All" gets executed locally immediately after sending the RPC.
    /// The "*ViaServer" options send the RPC to the server and execute it on this client when it's sent back.
    /// Of course, calls are affected by this client's lag and that of remote clients.
    ///
    /// Each call automatically is routed to the same PhotonView (and GameObject) that was used on the
    /// originating client.
    ///
    /// See: [Remote Procedure Calls](@ref rpcManual).
    /// </remarks>
    /// <param name="methodName">The name of a fitting method that was has the RPC attribute.</param>
    /// <param name="target">The group of targets and the way the RPC gets sent.</param>
    /// <param name="parameters">The parameters that the RPC method has (must fit this call!).</param>
    public void RPC(string methodName, PhotonTargets target, params object[] parameters)
    {
		if(PhotonNetwork.networkingPeer.hasSwitchedMC && target == PhotonTargets.MasterClient)
        {
			PhotonNetwork.RPC(this, methodName, PhotonNetwork.masterClient, parameters);
		}
        else
        {
        	PhotonNetwork.RPC(this, methodName, target, parameters);
		}
    }
开发者ID:jeffreychien,项目名称:zombietoilet,代码行数:31,代码来源:PhotonView.cs


示例19: RPC

    /// RPC Hashtable Structure
    /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
    /// (byte)1 -> (short) prefix (level)
    /// (byte)2 -> (int) server timestamp
    /// (byte)3 -> (string) methodname
    /// (byte)4 -> (object[]) parameters
    /// (byte)5 -> (byte) method shortcut (alternative to name)
    ///
    /// This is sent as event (code: 200) which will contain a sender (origin of this RPC).

    internal void RPC(PhotonView view, string methodName, PhotonTargets target, params object[] parameters)
    {
        if (this.blockSendingGroups.Contains(view.group))
        {
            return; // Block sending on this group
        }

        if (view.viewID < 1)
        {
            Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
        }

        if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
            Debug.Log("Sending RPC \"" + methodName + "\" to " + target);


        //ts: changed RPCs to a one-level hashtable as described in internal.txt
        Hashtable rpcEvent = new Hashtable();
        rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
        if (view.prefix > 0)
        {
            rpcEvent[(byte)1] = (short)view.prefix;
        }
        rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;


        // send name or shortcut (if available)
        int shortcut = 0;
        if (rpcShortcuts.TryGetValue(methodName, out shortcut))
        {
            rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
        }
        else
        {
            rpcEvent[(byte)3] = methodName;
        }

        if (parameters != null && parameters.Length > 0)
        {
            rpcEvent[(byte)4] = (object[])parameters;
        }

        // Check scoping
        if (target == PhotonTargets.All)
        {
            RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
            //this.OpRaiseEvent(PunEvent.RPC, (byte)view.group, rpcEvent, true, 0);

            // Execute local
            this.ExecuteRPC(rpcEvent, this.mLocalActor);
        }
        else if (target == PhotonTargets.Others)
        {
            RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
        }
        else if (target == PhotonTargets.AllBuffered)
        {
            RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache};
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);

            // Execute local
            this.ExecuteRPC(rpcEvent, this.mLocalActor);
        }
        else if (target == PhotonTargets.OthersBuffered)
        {
            RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
        }
        else if (target == PhotonTargets.MasterClient)
        {
            if (this.mMasterClient == this.mLocalActor)
            {
                this.ExecuteRPC(rpcEvent, this.mLocalActor);
            }
            else
            {
                RaiseEventOptions options = new RaiseEventOptions() { Receivers = ReceiverGroup.MasterClient };
                this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
            }
        }
        else if (target == PhotonTargets.AllViaServer)
        {
            RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
            if (PhotonNetwork.offlineMode)
            {
                this.ExecuteRPC(rpcEvent, this.mLocalActor);
            }
//.........这里部分代码省略.........
开发者ID:JonasSkaug,项目名称:afgangsprojekt-team-tj,代码行数:101,代码来源:NetworkingPeer.cs


示例20: RPC

    /// RPC Hashtable Structure
    /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
    /// (byte)1 -> (short) prefix (level)
    /// (byte)2 -> (int) server timestamp
    /// (byte)3 -> (string) methodname
    /// (byte)4 -> (object[]) parameters
    /// (byte)5 -> (byte) method shortcut (alternative to name)
    ///
    /// This is sent as event (code: 200) which will contain a sender (origin of this RPC).
    internal void RPC(PhotonView view, string methodName, PhotonTargets target, PhotonPlayer player, bool encrypt, params object[] parameters)
    {
        if (this.blockSendingGroups.Contains(view.group))
        {
            return; // Block sending on this group
        }

        if (view.viewID < 1)
        {
            Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
        }

        if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
        {
            Debug.Log("Sending RPC \"" + methodName + "\" to target: " + target + " or player:" + player + ".");
        }

        //ts: changed RPCs to a one-level hashtable as described in internal.txt
        Hashtable rpcEvent = new Hashtable();
        rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
        if (view.prefix > 0)
        {
            rpcEvent[(byte)1] = (short)view.prefix;
        }
        rpcEvent[(byte)2] = PhotonNetwork.ServerTimestamp;

        // send name or shortcut (if available)
        int shortcut = 0;
        if (rpcShortcuts.TryGetValue(methodName, out shortcut))
        {
            rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
        }
        else
        {
            rpcEvent[(byte)3] = methodName;
        }

        if (parameters != null && parameters.Length > 0)
        {
            rpcEvent[(byte)4] = (object[])parameters;
        }

        // if sent to target player, this overrides the target
        if (player != null)
        {
            if (this.LocalPlayer.ID == player.ID)
            {
                this.ExecuteRpc(rpcEvent, player);
            }
            else
            {
                RaiseEventOptions options = new RaiseEventOptions() { TargetActors = new int[] { player.ID }, Encrypt = encrypt };
                this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
            }

            return;
        }

        // send to a specific set of players
        if (target == PhotonTargets.All)
        {
            RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);

            // Execute local
            this.ExecuteRpc(rpcEvent, this.LocalPlayer);
        }
        else if (target == PhotonTargets.Others)
        {
            RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
        }
        else if (target == PhotonTargets.AllBuffered)
        {
            RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);

            // Execute local
            this.ExecuteRpc(rpcEvent, this.LocalPlayer);
        }
        else if (target == PhotonTargets.OthersBuffered)
        {
            RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
            this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
        }
        else if (target == PhotonTargets.MasterClient)
        {
            if (this.mMasterClientId == this.LocalPlayer.ID)
            {
                this.ExecuteRpc(rpcEvent, this.LocalPlayer);
            }
//.........这里部分代码省略.........
开发者ID:yuvadius,项目名称:need4bit,代码行数:101,代码来源:NetworkingPeer.cs



注:本文中的PhotonTargets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PhotonView类代码示例发布时间:2022-05-24
下一篇:
C# PhotonStream类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap