Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Gameplay.MessageTextureClient


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
class MessageTextureClient extends Info
	placeable;

var() ScriptedTexture	MessageTexture;

var() localized string ScrollingMessage;
var localized string HisMessage, HerMessage;
var() Font Font;
var() color FontColor;
var() bool bCaps;

var string OldText;

/* parameters for ScrollingMessage:

   %p - local player name
   %h - his/her for local player
   %lp - leading player's name
   %lf - leading player's frags
*/

simulated function PostNetBeginPlay()
{
	if(MessageTexture != None)
		MessageTexture.Client = Self;

	SetTimer(1,true);
}

simulated function Timer()
{
	local string Text;
	local PlayerReplicationInfo Leading, PRI;

	Text = ScrollingMessage;

	if(InStr(Text, "%lf") != -1 || InStr(Text, "%lp") != -1)
	{
		// find the leading player
		Leading = None;

		ForEach AllActors(class'PlayerReplicationInfo',PRI)
			if ( !PRI.bIsSpectator && (Leading==None || PRI.Score>Leading.Score) )
				Leading = PRI;

		if(Leading != None)
		{
			Text = Replace(Text, "%lp", Leading.PlayerName);
			Text = Replace(Text, "%lf", string(int(Leading.Score)));
		}
		else
			Text = "";
	}

	if(bCaps)
		Text = Caps(Text);

	if(Text != OldText)
	{
		OldText = Text;
		MessageTexture.Revision++;
	}
}

simulated event RenderTexture(ScriptedTexture Tex)
{
	local int	SizeX,
				SizeY;

	Tex.TextSize(OldText,Font,SizeX,SizeY);

	Tex.DrawText( (Tex.USize - SizeX) * 0.5, (Tex.VSize - SizeY) * 0.5, OldText, Font, FontColor );
}

simulated function string Replace(string Text, string Match, string Replacement)
{
	local int i;
	
	i = InStr(Text, Match);	

	if(i != -1)
		return Left(Text, i) $ Replacement $ Replace(Mid(Text, i+Len(Match)), Match, Replacement);
	else
		return Text;
}

defaultproperties
{
	HisMessage="his"
	HerMessage="her"
	RemoteRole=ROLE_SimulatedProxy
	bStatic=False
	bNoDelete=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:28:50.000 - Creation time: Do 14.8.2014 09:58:44.502 - Created with UnCodeX