Class KFGUI_TextScroll extends KFGUI_TextField; `include(Build.uci) `include(Logger.uci) var float ScrollSpeed; var transient float CharStartTime; var transient bool bScrollCompleted, bTextDirty; var transient array RowsCompleted; var transient int MaxIndex, RowsDropped; function SetText( string S ) { Super.SetText(S); MaxIndex = 0; RowsCompleted.Length = 0; RowsDropped = 0; bScrollCompleted = false; bTextDirty = true; CharStartTime = GetPlayer().WorldInfo.TimeSeconds; } function DrawMenu() { local int i,j,k,SLen,CurrentIndex; local float Y, DTime, XL, YL, MainY, MainX, CharTime; local string MainString; local Color MainTextColor; local Texture CurrentCursor; local ETextFieldStyles TextStyle; if( bScrollCompleted ) { Super.DrawMenu(); return; } if( Text=="" ) return; // Need to figure out best fitting font. if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] ) InitSize(); Canvas.Font = InitFont; if( bShowScrollbar ) { Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]); i = ScrollBar.GetValue(); } else i = 0; if( ScrollBar != None ) { if( bTextDirty ) { ScrollBar.bDisabled = true; RowsCompleted.Length = Lines.Length; bTextDirty = false; } if( RowsCompleted[Lines.Length-1] ) { ScrollBar.AddValue(1); ScrollBar.bDisabled = false; bScrollCompleted = true; //Temp fix! The last line in the string seems to be skipped AddText(LineSplitter); return; } else if( MaxIndex != 0 && RowsCompleted[MaxIndex] ) { MaxIndex = 0; ScrollBar.AddValue(1); RowsDropped++; i = ScrollBar.GetValue(); } } if( RowsDropped > 0 ) { for( i=0; i<=RowsDropped; ++i ) { for( j=0; j=CompPos[3] ) { MaxIndex = i-1; break; } if( Lines[i].Text.Length!=0 ) { for( j=0; j DTime ) { if( CurrentIndex == k ) { Canvas.SetDrawColor(255,255,255,255); Canvas.SetPos(MainX+XL,MainY); Canvas.DrawTile(CurrentCursor, YL/2, YL, 0, 0, CurrentCursor.GetSurfaceWidth(), CurrentCursor.GetSurfaceHeight()); } continue; } Canvas.DrawColor = GetColorFromStyle(MainTextColor, TextStyle); Canvas.SetPos(MainX+XL,MainY); Canvas.DrawText(Mid(MainString, k, 1),,InitFontScale,InitFontScale,TextFontInfo); CurrentIndex = k+1; if( k >= SLen ) { RowsCompleted[i] = true; } } } } } } } function bool CaptureMouse() { return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse(); } function MouseClick( bool bRight ) { if( bScrollCompleted ) return; if( ScrollBar != None ) ScrollBar.bDisabled = false; bScrollCompleted = true; //Temp fix! The last line in the string seems to be skipped AddText(LineSplitter); } defaultproperties { ScrollSpeed=0.01 }