Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 |
class ScrollingMessageTexture expands ClientScriptedTexture; var() localized string ScrollingMessage; var localized string HisMessage, HerMessage; var() Font Font; var() color FontColor; var() bool bCaps; var() int PixelsPerSecond; var() int ScrollWidth; var() float YPos; var() bool bResetPosOnTextChange; var string OldText; var int Position; var float LastDrawTime; var PlayerPawn Player; /* 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 FindPlayer() { local PlayerPawn P; foreach AllActors(class'PlayerPawn', P) if(Viewport(P.Player) != None) Player = P; } simulated event RenderTexture(ScriptedTexture Tex) { local string Text; local PlayerReplicationInfo Leading, PRI; local int i; if(Player == None) FindPlayer(); if(Player == None || Player.PlayerReplicationInfo == None || Player.GameReplicationInfo == None) return; if(LastDrawTime == 0) Position = Tex.USize; else Position -= (Level.TimeSeconds-LastDrawTime) * PixelsPerSecond; if(Position < -ScrollWidth) Position = Tex.USize; LastDrawTime = Level.TimeSeconds; Text = ScrollingMessage; if(Player.bIsFemale) Text = Replace(Text, "%h", HerMessage); else Text = Replace(Text, "%h", HisMessage); Text = Replace(Text, "%p", Player.PlayerReplicationInfo.PlayerName); if(InStr(Text, "%lf") != -1 || InStr(Text, "%lp") != -1) { // find the leading player Leading = None; for (i=0; i<32; i++) { if (Player.GameReplicationInfo.PRIArray[i] != None) { PRI = Player.GameReplicationInfo.PRIArray[i]; if ( !PRI.bIsSpectator && (Leading==None || PRI.Score>Leading.Score) ) Leading = PRI; } } if(Leading == None) Leading = Player.PlayerReplicationInfo; Text = Replace(Text, "%lp", Leading.PlayerName); Text = Replace(Text, "%lf", string(int(Leading.Score))); } if(bCaps) Text = Caps(Text); if(Text != OldText && bResetPosOnTextChange) { Position = Tex.USize; OldText = Text; } Tex.DrawColoredText( Position, YPos, Text, 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" bResetPosOnTextChange=True } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |