internal void RPC(PhotonView view, string methodName, PhotonPlayer player, bool encrypt, params object[] parameters)
{
if (this.blockSendingGroups.Contains(view.group))
{
return; // Block sending on this group
}
if (view.viewID < 1) //TODO: check why 0 should be illegal
{
Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
}
if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
{
Debug.Log("Sending RPC \"" + methodName + "\" to 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 PHOTONVIEWS&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;
}
if (this.mLocalActor == player)
{
this.ExecuteRpc(rpcEvent, player);
}
else
{
RaiseEventOptions options = new RaiseEventOptions() { TargetActors = new int[] { player.ID }, Encrypt = encrypt };
this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
}
}