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 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 |
/*============================================================================= In Game GUI Editor System V1.0 2003 - Irrational Games, LLC. * Dan Kaplan =============================================================================*/ #if !IG_GUI_LAYOUT #error This code requires IG_GUI_LAYOUT to be defined due to extensive revisions of the origional code. [DKaplan] #endif /*===========================================================================*/ class GUIScrollTextBox extends GUIListBoxBase HideCategories(Menu,Object) native; var(GUIScrollTextBox) Editinline Editconst GUIScrollText MyScrollText; var(GUIScrollTextBox) config bool bRepeat "Should the sequence be repeated ?"; var(GUIScrollTextBox) config bool bNoTeletype "Dont do the teletyping effect at all"; var(GUIScrollTextBox) config bool bStripColors "Strip out IRC-style colour characters (^C)"; var(GUIScrollTextBox) config float InitialDelay "Initial delay after new content was set"; var(GUIScrollTextBox) config float CharDelay "This is the delay between each char"; var(GUIScrollTextBox) config float EOLDelay "This is the delay to use when reaching end of line"; var(GUIScrollTextBox) config float RepeatDelay "This is used after all the text has been displayed and bRepeat is true"; var(GUIScrollTextBox) config eTextAlign TextAlign "How is text Aligned in the control"; function OnConstruct(GUIController MyController) { Super.OnConstruct(MyController); MyScrollText=GUIScrollText(AddComponent( "GUI.GUIScrollText" , self.Name$"_ScrollText")); } function InitComponent(GUIComponent MyOwner) { Super.InitComponent(MyOwner); InitBaseList(MyScrollText); MyScrollText.InitialDelay = InitialDelay; MyScrollText.CharDelay = CharDelay; MyScrollText.EOLDelay = EOLDelay; MyScrollText.RepeatDelay = RepeatDelay; MyScrollText.TextAlign = TextAlign; MyScrollText.bRepeat = bRepeat; MyScrollText.bNoTeletype = bNoTeletype; MyScrollText.OnADjustTop = InternalOnAdjustTop; } function SetContent(string NewContent, optional string sep) { MyScrollText.SetContent(NewContent, sep); } function Restart() { MyScrollText.Restart(); } function Stop() { MyScrollText.Stop(); } function InternalOnAdjustTop(GUIComponent Sender) { MyScrollText.EndScrolling(); } function bool IsNumber(string Num) { if( Num == Chr(48) ) return true; // character '0' etc.. if( Num == Chr(49) ) return true; if( Num == Chr(50) ) return true; if( Num == Chr(51) ) return true; if( Num == Chr(52) ) return true; if( Num == Chr(53) ) return true; if( Num == Chr(54) ) return true; if( Num == Chr(55) ) return true; if( Num == Chr(56) ) return true; if( Num == Chr(57) ) return true; return false; } function string StripColors(string MyString) { local int EscapePos, RemCount, LenFromEscape; EscapePos = InStr(MyString, Chr(3)); // Chr(3) == ^C while(EscapePos != -1) { LenFromEscape = Len(MyString) - (EscapePos + 1); // how far after the escape character the string goes on for // Now we have to work out how many characters follow the ^C and should be removed. This is rather unpleasant..! RemCount = 1; // strip the ctrl-C regardless if( LenFromEscape >= 1 && IsNumber(Mid(MyString, EscapePos+1, 1)) ) // If a digit follows the ctrl-C, strip that { RemCount = 2; // # if( LenFromEscape >= 3 && Mid(MyString, EscapePos+2, 1) == Chr(44) && IsNumber(Mid(MyString, EscapePos+3, 1)) ) // If we have a comma and another digit, strip those { RemCount = 4; // #,# if( LenFromEscape >= 4 && IsNumber(Mid(MyString, EscapePos+4, 1)) ) // if there is another digit after that, strip it RemCount = 5; // #,## } else if( LenFromEscape >= 2 && IsNumber(Mid(MyString, EscapePos+2, 1)) )// if there is a second digit, strip that { RemCount = 3; // ## if( LenFromEscape >= 4 && Mid(MyString, EscapePos+3, 1) == Chr(44) && IsNumber(Mid(MyString, EscapePos+4, 1)) ) // If we have a comma and another digit, strip those { RemCount = 5; // ##,# if( LenFromEscape >= 5 && IsNumber(Mid(MyString, EscapePos+5, 1)) ) // if there is another digit after that, strip it RemCount = 6; // ##,## } } } MyString = Left(MyString, EscapePos)$Mid(MyString, EscapePos+RemCount); EscapePos = InStr(MyString, Chr(3)); } return MyString; } function AddText(string NewText) { local string StrippedText; if(NewText == "") return; if(bStripColors) StrippedText = StripColors(NewText); else StrippedText = NewText; if(MyScrollText.NewText == "") MyScrollText.NewText = StrippedText; else MyScrollText.NewText = MyScrollText.NewText$MyScrollText.Separator$StrippedText; #if IG_TRIBES3 // michaelj: Quick temporary fix for text boxes not properly updating MyScrollText.EndScrolling(); #endif } defaultproperties { TextAlign=TXTA_Left InitialDelay=0.0 CharDelay=0.025 EOLDelay=0.15 RepeatDelay=3.0 bNoTeletype=true } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |