当前位置: 首页>>代码示例>>C#>>正文


C# PhotonTargets类代码示例

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


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


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