OpRaiseEvent() public method

public OpRaiseEvent ( byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions, raiseEventOptions ) : bool
eventCode byte
customEventContent object
sendReliable bool
raiseEventOptions RaiseEventOptions,
return bool
Beispiel #1
0
    public static bool CloseConnection(PhotonPlayer kickPlayer)
    {
        if (!VerifyCanUseNetwork())
        {
            return(false);
        }
        if (!player.IsMasterClient)
        {
            Debug.LogError("CloseConnection: Only the masterclient can kick another player.");
            return(false);
        }
        if (kickPlayer == null)
        {
            Debug.LogError("CloseConnection: No such player connected!");
            return(false);
        }
        RaiseEventOptions raiseEventOptions = new RaiseEventOptions
        {
            TargetActors = new int[]
            {
                kickPlayer.ID
            }
        };

        return(networkingPeer.OpRaiseEvent(203, null, true, raiseEventOptions));
    }
Beispiel #2
0
 public static bool RaiseEvent(byte eventCode, object eventContent, bool sendReliable, RaiseEventOptions options)
 {
     if (!inRoom || eventCode >= byte.MaxValue)
     {
         Debug.LogWarning("RaiseEvent() failed. Your event is not being sent! Check if your are in a Room and the eventCode must be less than 200 (0..199).");
         return(false);
     }
     return(networkingPeer.OpRaiseEvent(eventCode, eventContent, sendReliable, options));
 }
Beispiel #3
0
    /// <summary>
    /// Request a client to disconnect (KICK). Only the master client can do this.
    /// </summary>
    /// <param name="kickPlayer">The PhotonPlayer to kick.</param>
    public static void CloseConnection(PhotonPlayer kickPlayer)
    {
        if (!VerifyCanUseNetwork())
        {
            return;
        }

        if (!player.isMasterClient)
        {
            Debug.LogError("CloseConnection: Only the masterclient can kick another player.");
        }

        if (kickPlayer == null)
        {
            Debug.LogError("CloseConnection: No such player connected!");
        }
        else
        {
            int[] rec = new int[1];
            rec[0] = kickPlayer.ID;
            networkingPeer.OpRaiseEvent(PhotonNetworkMessages.CloseConnection, null, true, 0, rec);
        }
    }