Engine
Class DemoRecSpectator

source: e:\games\UnrealTournament\Engine\Classes\DemoRecSpectator.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Engine.PlayerPawn
            |
            +--Engine.Spectator
               |
               +--Engine.MessagingSpectator
                  |
                  +--Engine.DemoRecSpectator
Direct Known Subclasses:None

class DemoRecSpectator
extends Engine.MessagingSpectator

//============================================================================= // DemoRecSpectator - spectator for demo recordings to replicate ClientMessages //=============================================================================
Variables
 PlayerPawn PlaybackActor
 GameReplicationInfo PlaybackGRI


Function Summary
 void ClientMessage(string S, optional name, optional bool)
 void ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
 
simulated
RepClientMessage(string S, optional name, optional bool)
 
simulated
RepClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
 
simulated
RepTeamMessage(PlayerReplicationInfo PRI, string S, name Type)
 void TeamMessage(PlayerReplicationInfo PRI, string S, name Type, optional bool)
 
simulated
Tick(float Delta)
     
//==== Called during demo playback ============================================



Source Code


00001	//=============================================================================
00002	// DemoRecSpectator - spectator for demo recordings to replicate ClientMessages
00003	//=============================================================================
00004	
00005	class DemoRecSpectator extends MessagingSpectator;
00006	
00007	var PlayerPawn PlaybackActor;
00008	var GameReplicationInfo PlaybackGRI;
00009	
00010	function ClientMessage( coerce string S, optional name Type, optional bool bBeep )
00011	{
00012		RepClientMessage( S, Type, bBeep );
00013	}
00014	
00015	function TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep )
00016	{
00017		RepTeamMessage( PRI, S, Type );
00018	}
00019	
00020	function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
00021	{
00022		RepClientVoiceMessage(Sender, Recipient, messagetype, messageID);
00023	}
00024	
00025	function ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
00026	{
00027		RepReceiveLocalizedMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
00028	}
00029	
00030	//==== Called during demo playback ============================================
00031	
00032	simulated function Tick(float Delta)
00033	{
00034		local PlayerPawn p;
00035		local GameReplicationInfo g;
00036	
00037		// find local playerpawn and attach.
00038		if(Level.NetMode == NM_Client)
00039		{
00040			if(PlaybackActor == None)
00041			{
00042				foreach AllActors(class'PlayerPawn', p)
00043				{
00044					if( p.Player.IsA('Viewport') )
00045					{
00046						PlaybackActor = p;
00047						if(PlaybackGRI != None)
00048							PlaybackActor.GameReplicationInfo = PlaybackGRI;
00049	
00050						Log("Attached to player "$p);
00051						
00052						break;
00053					}
00054				}
00055			}
00056	
00057			if(PlaybackGRI == None)
00058			{
00059				foreach AllActors(class'GameReplicationInfo', g)
00060				{
00061					PlaybackGRI = g;
00062					if(PlaybackActor != None)
00063						PlaybackActor.GameReplicationInfo = PlaybackGRI;
00064					break;
00065				}
00066			}
00067	
00068			if(PlaybackActor != None && PlaybackGRI != None)
00069				Disable('Tick');
00070	
00071		}
00072		else
00073		{
00074			Disable('Tick');
00075		}
00076	}
00077	
00078	simulated function RepClientMessage( coerce string S, optional name Type, optional bool bBeep )
00079	{	
00080		if(PlaybackActor != None && PlaybackActor.Role == ROLE_Authority)
00081			PlaybackActor.ClientMessage( S, Type, bBeep );
00082	}
00083	
00084	simulated function RepTeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type )
00085	{
00086		if(PlaybackActor != None && PlaybackActor.Role == ROLE_Authority)
00087			PlaybackActor.TeamMessage( PRI, S, Type );
00088	}
00089	
00090	simulated function RepClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
00091	{
00092		if(PlaybackActor != None && PlaybackActor.Role == ROLE_Authority)
00093			PlaybackActor.ClientVoiceMessage(Sender, Recipient, messagetype, messageID);
00094	}
00095	
00096	simulated function RepReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
00097	{
00098		if(PlaybackActor != None && PlaybackActor.Role == ROLE_Authority)
00099			PlaybackActor.ReceiveLocalizedMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
00100	}
00101	
00102	replication
00103	{
00104		reliable if ( bDemoRecording )
00105			RepClientMessage, RepTeamMessage, RepClientVoiceMessage, RepReceiveLocalizedMessage;
00106	}
00107	
00108	defaultproperties
00109	{
00110	}

End Source Code