fix code style

This commit is contained in:
GenZmeY 2021-06-13 05:53:33 +03:00
parent 09ea64e941
commit 68a5e16a9e
45 changed files with 1011 additions and 1011 deletions

View File

@ -3,7 +3,7 @@ Class ClassicStyle extends KF2Style;
`include(Build.uci)
`include(Logger.uci)
function RenderFramedWindow( KFGUI_FloatingWindow P )
function RenderFramedWindow( KFGUI_FloatingWindow P)
{
local int XS,YS,TitleHeight;
local float XL, YL, FontScale;
@ -12,7 +12,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
YS = Canvas.ClipY-Canvas.OrgY;
TitleHeight = DefaultHeight;
if( P.bWindowFocused )
if (P.bWindowFocused)
Canvas.SetDrawColor(105,105,105,255);
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
@ -25,7 +25,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS-TitleHeight,0,0,128,128);
// Title.
if( P.WindowTitle!="" )
if (P.WindowTitle != "")
{
Canvas.Font = PickFont(FontScale);
Canvas.TextSize(P.WindowTitle,XL,YL,FontScale,FontScale);
@ -35,7 +35,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
}
}
function RenderWindow( KFGUI_Page P )
function RenderWindow( KFGUI_Page P)
{
local int XS,YS;
@ -43,7 +43,7 @@ function RenderWindow( KFGUI_Page P )
YS = Canvas.ClipY-Canvas.OrgY;
// Frame itself.
if( P.bWindowFocused )
if (P.bWindowFocused)
Canvas.SetDrawColor(105,105,105,255);
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
@ -51,7 +51,7 @@ function RenderWindow( KFGUI_Page P )
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS,0,0,128,128);
}
function RenderToolTip( KFGUI_Tooltip TT )
function RenderToolTip( KFGUI_Tooltip TT)
{
local int i;
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
@ -60,9 +60,9 @@ function RenderToolTip( KFGUI_Tooltip TT )
// First compute textbox size.
TY = DefaultHeight*TT.Lines.Length;
for( i=0; i<TT.Lines.Length; ++i )
for (i=0; i < TT.Lines.Length; ++i)
{
if( TT.Lines[i]!="" )
if (TT.Lines[i] != "")
Canvas.TextSize(TT.Lines[i],XS,YS);
TX = FMax(XS,TX);
}
@ -76,12 +76,12 @@ function RenderToolTip( KFGUI_Tooltip TT )
Y = TT.CompPos[1]+24.f;
// Then check if too close to window edge, then move it to another pivot.
if( (X+TX)>TT.Owner.ScreenSize.X )
if ((X+TX) > TT.Owner.ScreenSize.X)
X = TT.Owner.ScreenSize.X-TX;
if( (Y+TY)>TT.Owner.ScreenSize.Y )
if ((Y+TY) > TT.Owner.ScreenSize.Y)
Y = TT.CompPos[1]-TY;
if( TT.CurrentAlpha<255 )
if (TT.CurrentAlpha < 255)
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
// Reset clipping.
@ -102,7 +102,7 @@ function RenderToolTip( KFGUI_Tooltip TT )
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
X+=TOOLTIP_BORDER;
Y+=TOOLTIP_BORDER;
for( i=0; i<TT.Lines.Length; ++i )
for (i=0; i < TT.Lines.Length; ++i)
{
Canvas.SetPos(X,Y);
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
@ -110,33 +110,33 @@ function RenderToolTip( KFGUI_Tooltip TT )
}
}
function RenderScrollBar( KFGUI_ScrollBarBase S )
function RenderScrollBar( KFGUI_ScrollBarBase S)
{
local float A;
local byte i;
if( S.bDisabled )
if (S.bDisabled)
Canvas.SetDrawColor(5, 5, 5, 0);
else if( S.bFocused || S.bGrabbedScroller )
else if (S.bFocused || S.bGrabbedScroller)
Canvas.SetDrawColor(15, 15, 15, 160);
else Canvas.SetDrawColor(15, 15, 15, 160);
Canvas.SetPos(0.f, 0.f);
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],S.CompPos[2],S.CompPos[3],0,0,128,128);
if( S.bDisabled )
if (S.bDisabled)
return;
if( S.bVertical )
if (S.bVertical)
i = 3;
else i = 2;
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
if( S.bGrabbedScroller )
if (S.bGrabbedScroller)
{
// Track mouse.
if( S.bVertical )
if (S.bVertical)
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
@ -147,13 +147,13 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
A = float(S.CurrentScroll) / float(S.MaxRange);
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
if( S.bGrabbedScroller )
if (S.bGrabbedScroller)
Canvas.SetDrawColor(125,125,125,200);
else if( S.bFocused )
else if (S.bFocused)
Canvas.SetDrawColor(200,200,200,200);
else Canvas.SetDrawColor(255,255,255,200);
if( S.bVertical )
if (S.bVertical)
{
Canvas.SetPos(0.f, S.ButtonOffset);
Canvas.DrawTileStretched(ScrollTexture,S.CompPos[2],S.SliderScale,0,0,32,32);
@ -165,17 +165,17 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
}
}
function RenderCheckbox( KFGUI_CheckBox C )
function RenderCheckbox( KFGUI_CheckBox C)
{
local Texture CheckMark;
DrawTileStretched(ItemBoxTextures[`ITEMBOX_DISABLED],0.f,0.f,C.CompPos[2],C.CompPos[3]);
if( C.bChecked )
if (C.bChecked)
{
if( C.bDisabled )
if (C.bDisabled)
CheckMark = CheckBoxTextures[`CHECKMARK_DISABLED];
else if( C.bFocused )
else if (C.bFocused)
CheckMark = CheckBoxTextures[`CHECKMARK_HIGHLIGHTED];
else CheckMark = CheckBoxTextures[`CHECKMARK_NORMAL];
@ -185,13 +185,13 @@ function RenderCheckbox( KFGUI_CheckBox C )
}
}
function RenderComboBox( KFGUI_ComboBox C )
function RenderComboBox( KFGUI_ComboBox C)
{
if( C.bDisabled )
if (C.bDisabled)
Canvas.SetDrawColor(64,64,64,255);
else if( C.bPressedDown )
else if (C.bPressedDown)
Canvas.SetDrawColor(220,220,220,255);
else if( C.bFocused )
else if (C.bFocused)
Canvas.SetDrawColor(190,190,190,255);
Canvas.SetPos(0.f,0.f);
@ -199,10 +199,10 @@ function RenderComboBox( KFGUI_ComboBox C )
DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32);
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" )
if (C.SelectedIndex < C.Values.Length && C.Values[C.SelectedIndex] != "")
{
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
if( C.bDisabled )
if (C.bDisabled)
Canvas.DrawColor = C.TextColor*0.5f;
else Canvas.DrawColor = C.TextColor;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
@ -211,7 +211,7 @@ function RenderComboBox( KFGUI_ComboBox C )
}
}
function RenderComboList( KFGUI_ComboSelector C )
function RenderComboList( KFGUI_ComboSelector C)
{
local float X,Y,YL,YP,Edge;
local int i;
@ -226,7 +226,7 @@ function RenderComboList( KFGUI_ComboSelector C )
X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = C.Combo.TextFont;
YL = C.Combo.TextHeight;
@ -235,9 +235,9 @@ function RenderComboList( KFGUI_ComboSelector C )
C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.Combo.Values.Length; ++i )
for (i=0; i < C.Combo.Values.Length; ++i)
{
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{
bCheckMouse = false;
C.CurrentRow = i;
@ -247,7 +247,7 @@ function RenderComboList( KFGUI_ComboSelector C )
}
Canvas.SetPos(Edge,YP);
if( i==C.Combo.SelectedIndex )
if (i == C.Combo.SelectedIndex)
Canvas.DrawColor = C.Combo.SelectedTextColor;
else Canvas.DrawColor = C.Combo.TextColor;
@ -256,14 +256,14 @@ function RenderComboList( KFGUI_ComboSelector C )
YP+=YL;
}
Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow )
if (C.OldRow != C.CurrentRow)
{
C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange);
}
}
function RenderRightClickMenu( KFGUI_RightClickMenu C )
function RenderRightClickMenu( KFGUI_RightClickMenu C)
{
local float X,Y,XL,YL,YP,Edge,TextScale;
local int i;
@ -278,7 +278,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
PickFont(TextScale);
@ -286,15 +286,15 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.ItemRows.Length; ++i )
for (i=0; i < C.ItemRows.Length; ++i)
{
if( C.ItemRows[i].bSplitter )
if (C.ItemRows[i].bSplitter)
S = "-------";
else S = C.ItemRows[i].Text;
Canvas.TextSize(S,XL,YL,TextScale,TextScale);
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{
bCheckMouse = false;
C.CurrentRow = i;
@ -304,11 +304,11 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
}
Canvas.SetPos(Edge*6,YP);
if( C.ItemRows[i].bSplitter )
if (C.ItemRows[i].bSplitter)
Canvas.SetDrawColor(255,255,255,255);
else
{
if( C.ItemRows[i].bDisabled )
if (C.ItemRows[i].bDisabled)
Canvas.SetDrawColor(148,148,148,255);
else Canvas.SetDrawColor(248,248,248,255);
}
@ -317,41 +317,41 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
YP+=YL;
}
Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow )
if (C.OldRow != C.CurrentRow)
{
C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_FocusHover);
}
}
function RenderButton( KFGUI_Button B )
function RenderButton( KFGUI_Button B)
{
local float XL,YL,TS,AX,AY,GamepadTexSize;
local Texture2D Mat, ButtonTex;
local bool bDrawOverride;
bDrawOverride = B.DrawOverride(Canvas, B);
if( !bDrawOverride )
if (!bDrawOverride)
{
if( B.bDisabled )
if (B.bDisabled)
Mat = ButtonTextures[`BUTTON_DISABLED];
else if( B.bPressedDown )
else if (B.bPressedDown)
Mat = ButtonTextures[`BUTTON_PRESSED];
else if( B.bFocused || B.bIsHighlighted )
else if (B.bFocused || B.bIsHighlighted)
Mat = ButtonTextures[`BUTTON_HIGHLIGHTED];
else Mat = ButtonTextures[`BUTTON_NORMAL];
Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(Mat,B.CompPos[2],B.CompPos[3],0,0,32,32);
if( B.OverlayTexture.Texture!=None )
if (B.OverlayTexture.Texture != None)
{
Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL);
}
}
if( B.ButtonText!="" )
if (B.ButtonText != "")
{
Canvas.Font = MainFont;
@ -360,28 +360,28 @@ function RenderButton( KFGUI_Button B )
TS = GetFontScaler();
TS *= B.FontScale;
while( true )
while( true)
{
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
if( XL<(B.CompPos[2]*0.9) && YL<(B.CompPos[3]*0.9) )
if (XL < (B.CompPos[2]*0.9) && YL < (B.CompPos[3]*0.9))
break;
TS -= 0.001;
}
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
if( B.bDisabled )
if (B.bDisabled)
Canvas.DrawColor = B.TextColor*0.5f;
else Canvas.DrawColor = B.TextColor;
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
if( B.GetUsingGamepad() )
if (B.GetUsingGamepad())
{
ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D'));
if( ButtonTex != None )
if (ButtonTex != None)
{
B.GetRealtivePos(AX, AY);
while( (Canvas.CurX-(GamepadTexSize*1.25))<AX )
while( (Canvas.CurX-(GamepadTexSize*1.25)) < AX)
{
GamepadTexSize *= 0.95;
}

View File

@ -5,4 +5,4 @@ class CustomRanks extends Object
`include(Build.uci)
`include(Logger.uci)
var config array<RankInfo> Rank;
var config array < RankInfo> Rank;

View File

@ -5,7 +5,7 @@ Class GUIStyleBase extends Object
`include(Logger.uci)
var Texture2D ItemTex;
var array<Texture2D> BorderTextures, ArrowTextures, ButtonTextures, TabTextures, ItemBoxTextures, PerkBox, CheckBoxTextures, ProgressBarTextures, SliderTextures;
var array < Texture2D> BorderTextures, ArrowTextures, ButtonTextures, TabTextures, ItemBoxTextures, PerkBox, CheckBoxTextures, ProgressBarTextures, SliderTextures;
var Texture2D ScrollTexture,FavoriteIcon,BankNoteIcon;
var SoundCue MenuDown, MenuDrag, MenuEdit, MenuFade, MenuClick, MenuHover, MenuUp;
@ -24,21 +24,21 @@ struct FColorInfo
var name Code;
var Color Color;
};
var array<FColorInfo> ColorCodes;
var array < FColorInfo> ColorCodes;
struct FTexturePreCache
{
var string Path;
var Texture2D Tex;
};
var array<FTexturePreCache> PrecachedTextures;
var array < FTexturePreCache> PrecachedTextures;
function InitStyle()
{
local FColorInfo ColorInfo;
ItemTex=Texture2D(DynamicLoadObject("UI_LevelChevrons_TEX.UI_LevelChevron_Icon_02",class'Texture2D'));
if( ItemTex==None )
if (ItemTex == None)
ItemTex=Texture2D'EngineMaterials.DefaultWhiteGrid';
NumberFont = Font(DynamicLoadObject("UI_Canvas_Fonts.Font_General", class'Font'));
@ -142,19 +142,19 @@ function RenderCheckbox( KFGUI_CheckBox C );
function RenderComboBox( KFGUI_ComboBox C );
function RenderComboList( KFGUI_ComboSelector C );
function Font PickFont( out float Scaler, optional bool bNumbersOnly, optional bool bInfinite )
function Font PickFont( out float Scaler, optional bool bNumbersOnly, optional bool bInfinite)
{
Scaler = GetFontScaler();
if( bNumbersOnly )
if (bNumbersOnly)
return NumberFont;
else if( bInfinite )
else if (bInfinite)
return InfiniteFont;
return MainFont;
}
function PickDefaultFontSize( float YRes )
function PickDefaultFontSize( float YRes)
{
local int XL,YL;
local string S;
@ -164,7 +164,7 @@ function PickDefaultFontSize( float YRes )
DefaultHeight=float(YL)*YRes;
}
final function float ScreenScale( float Size, optional float MaxRes=1080.f )
final function float ScreenScale( float Size, optional float MaxRes=1080.f)
{
return Size * ( HUDOwner.SizeY / MaxRes );
}
@ -172,32 +172,32 @@ final function float GetFontScaler(optional float Scaler=0.750f, optional float
{
return FClamp((HUDOwner.SizeY / 1080.f) * Scaler, Min, Max);
}
final function DrawText( coerce string S )
final function DrawText( coerce string S)
{
local float Scale;
Canvas.Font=PickFont(Scale);
Canvas.DrawText(S,,Scale,Scale);
}
final function DrawCenteredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bVertical, optional bool bUseOutline )
final function DrawCenteredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bVertical, optional bool bUseOutline)
{
local float XL,YL;
Canvas.TextSize(S,XL,YL);
if( bVertical )
if (bVertical)
Canvas.SetPos(X,Y-(YL*Scale*0.5));
else Canvas.SetPos(X-(XL*Scale*0.5),Y);
if( bUseOutline )
if (bUseOutline)
DrawTextShadow(S, Canvas.CurX, Canvas.CurY, 1, Scale);
else Canvas.DrawText(S,,Scale,Scale);
}
final function string StripColorTags( coerce string S )
final function string StripColorTags( coerce string S)
{
local int Pos;
Pos = InStr(S, "\\c");
while( Pos != INDEX_NONE )
while( Pos != INDEX_NONE)
{
S = Left(S,Pos) $ Mid(S,Pos+3);
Pos = InStr(S, "\\c");
@ -205,17 +205,17 @@ final function string StripColorTags( coerce string S )
return S;
}
final function DrawColoredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bUseOutline )
final function DrawColoredText( coerce string S, float X, float Y, optional float Scale=1.f, optional bool bUseOutline)
{
local float XL,YL;
local int i, Index;
local array<string> SArray;
local array < string> SArray;
local string T, PrevT;
local Color TextColor;
if( InStr(S, "\\c") == INDEX_NONE )
if (InStr(S, "\\c") == INDEX_NONE)
{
if( bUseOutline )
if (bUseOutline)
DrawTextShadow(S, X, Y, 1, Scale);
else
{
@ -228,11 +228,11 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
SArray = SplitString(S, "\\c");
PrevT = Left(S,InStr(S, "\\c"));
if( Len(PrevT) > 0 )
if (Len(PrevT) > 0)
{
Canvas.TextSize(PrevT,XL,YL,Scale,Scale);
if( bUseOutline )
if (bUseOutline)
DrawTextShadow(PrevT, X, Y, 1, Scale);
else
{
@ -241,13 +241,13 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
}
}
for( i=0; i<SArray.Length; i++ )
for (i=0; i < SArray.Length; i++)
{
T = SArray[i];
if( i>0 || Left(S, 2)~="\\c" )
if (i > 0 || Left(S, 2)~="\\c")
{
Index = ColorCodes.Find('Code', name(Left(T, 1)));
if( Index != INDEX_NONE )
if (Index != INDEX_NONE)
TextColor = ColorCodes[Index].Color;
else TextColor = class'HUD'.default.WhiteColor;
@ -259,7 +259,7 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
Canvas.DrawColor = TextColor;
Canvas.TextSize(T,XL,YL,Scale,Scale);
if( bUseOutline )
if (bUseOutline)
DrawTextShadow(T, X, Y, 1, Scale);
else
{
@ -271,7 +271,7 @@ final function DrawColoredText( coerce string S, float X, float Y, optional floa
}
}
}
final function DrawTextBlurry( coerce string S, float X, float Y, optional float Scale=1.f )
final function DrawTextBlurry( coerce string S, float X, float Y, optional float Scale=1.f)
{
local Color OldDrawColor;
@ -291,7 +291,7 @@ final function DrawTextBlurry( coerce string S, float X, float Y, optional float
Canvas.SetPos(X, Y);
Canvas.DrawText(S,,Scale,Scale);
}
final function DrawTextOutline( coerce string S, float X, float Y, int Size, Color OutlineColor, optional float Scale=1.f, optional FontRenderInfo FRI )
final function DrawTextOutline( coerce string S, float X, float Y, int Size, Color OutlineColor, optional float Scale=1.f, optional FontRenderInfo FRI)
{
local Color OldDrawColor;
local int XS, YS, Steps;
@ -301,7 +301,7 @@ final function DrawTextOutline( coerce string S, float X, float Y, int Size, Col
Size += 1;
Steps = (Size * 2) / 3;
if( Steps < 1 )
if (Steps < 1 )
{
Steps = 1;
}
@ -320,7 +320,7 @@ final function DrawTextOutline( coerce string S, float X, float Y, int Size, Col
Canvas.SetPos(X, Y);
Canvas.DrawText(S,, Scale, Scale, FRI);
}
final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSize, optional float Scale=1.f )
final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSize, optional float Scale=1.f)
{
local Color OldDrawColor;
@ -334,7 +334,7 @@ final function DrawTextShadow( coerce string S, float X, float Y, float ShadowSi
Canvas.DrawColor = OldDrawColor;
Canvas.DrawText(S,, Scale, Scale);
}
final function DrawTexturedString( coerce string S, float X, float Y, optional float TextScaler=1.f, optional FontRenderInfo FRI, optional bool bUseOutline, optional bool bOnlyTexture )
final function DrawTexturedString( coerce string S, float X, float Y, optional float TextScaler=1.f, optional FontRenderInfo FRI, optional bool bUseOutline, optional bool bOnlyTexture)
{
local Texture2D Mat;
local string D;
@ -345,15 +345,15 @@ final function DrawTexturedString( coerce string S, float X, float Y, optional f
OrgC = Canvas.DrawColor;
Mat = FindNextTexture(S);
while( Mat != None )
while( Mat != None)
{
i = InStr(S,"<TEXTURE");
j = InStr(S,">");
i = InStr(S," < TEXTURE");
j = InStr(S," > ");
D = Left(S,i);
S = Mid(S,j+2);
if( !bOnlyTexture )
if (!bOnlyTexture)
{
Canvas.TextSize(StripColorTags(D),XL,YL,TextScaler,TextScaler);
DrawColoredText(D,X,Y,TextScaler,bUseOutline);
@ -384,20 +384,20 @@ final function Texture2D FindNextTexture(out string S)
local FTexturePreCache Cache;
Path = S;
i = InStr(Path,"<Icon>");
if( i == INDEX_NONE )
i = InStr(Path," < Icon > ");
if (i == INDEX_NONE)
return None;
j = InStr(Path,"</Icon>");
S = Left(Path,i)$"<TEXTURE>"$Mid(Path, j+6);
j = InStr(Path," < /Icon > ");
S = Left(Path,i)$" < TEXTURE > "$Mid(Path, j+6);
Path = Mid(Path, i+6, j-(i+6));
i = PrecachedTextures.Find('Path', Path);
if( i != INDEX_NONE )
if (i != INDEX_NONE)
return PrecachedTextures[i].Tex;
Tex = Texture2D(FindObject(Path, class'Texture2D'));
if( Tex != None )
if (Tex != None)
{
Cache.Path = Path;
Cache.Tex = Tex;
@ -416,14 +416,14 @@ final function string StripTextureFromString(string S, optional bool bNoStringAd
{
local int i, j;
while( true )
while( true)
{
i = InStr(S,"<Icon>");
if( i == INDEX_NONE )
i = InStr(S," < Icon > ");
if (i == INDEX_NONE)
break;
j = InStr(S,"</Icon>");
S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len("</Icon>"));
j = InStr(S," < /Icon > ");
S = Left(S,i)$(bNoStringAdd ? "" : "W")$Mid(S, j+Len(" < /Icon > "));
}
return StripColorTags(S);
@ -433,7 +433,7 @@ final function string GetTimeString(int Seconds)
local int Minutes, Hours;
local string Time;
if( Seconds > 3600 )
if (Seconds > 3600)
{
Hours = Seconds / 3600;
Seconds -= Hours * 3600;
@ -443,11 +443,11 @@ final function string GetTimeString(int Seconds)
Minutes = Seconds / 60;
Seconds -= Minutes * 60;
if( Minutes >= 10 )
if (Minutes >= 10)
Time = Time $ Minutes $ ":";
else Time = Time $ "0" $ Minutes $ ":";
if( Seconds >= 10 )
if (Seconds >= 10)
Time = Time $ Seconds;
else Time = Time $ "0" $ Seconds;
@ -456,7 +456,7 @@ final function string GetTimeString(int Seconds)
final function DrawCornerTexNU( int SizeX, int SizeY, byte Dir ) // Draw non-uniform corner.
{
switch( Dir )
switch( Dir)
{
case 0: // Up-left
Canvas.DrawTile(ItemTex,SizeX,SizeY,77,15,-66,58);
@ -471,9 +471,9 @@ final function DrawCornerTexNU( int SizeX, int SizeY, byte Dir ) // Draw non-uni
Canvas.DrawTile(ItemTex,SizeX,SizeY,11,73,66,-58);
}
}
final function DrawCornerTex( int Size, byte Dir )
final function DrawCornerTex( int Size, byte Dir)
{
switch( Dir )
switch( Dir)
{
case 0: // Up-left
Canvas.DrawTile(ItemTex,Size,Size,77,15,-66,58);
@ -488,19 +488,19 @@ final function DrawCornerTex( int Size, byte Dir )
Canvas.DrawTile(ItemTex,Size,Size,11,73,66,-58);
}
}
final function DrawWhiteBox( float XS, float YS, optional bool bClip )
final function DrawWhiteBox( float XS, float YS, optional bool bClip)
{
Canvas.DrawTile(ItemTex,XS,YS,19,45,1,1,,bClip);
}
final function DrawRectBox( float X, float Y, float Width, float Height, int Edge, optional byte Extrav )
final function DrawRectBox( float X, float Y, float Width, float Height, int Edge, optional byte Extrav)
{
if( Extrav==2 )
if (Extrav == 2)
Edge=Min(FMin(Edge,(Width)*0.5),Height);// Verify size.
else
Edge=Min(FMin(Edge,(Width)*0.5),(Height)*0.5);// Verify size.
Canvas.PreOptimizeDrawTiles(Extrav==0 ? 7 : 6, ItemTex);
Canvas.PreOptimizeDrawTiles(Extrav == 0 ? 7 : 6, ItemTex);
switch (Extrav)
{
@ -663,7 +663,7 @@ final function DrawRectBox( float X, float Y, float Width, float Height, int Edg
}
}
final function DrawBoxHollow( float X, float Y, float Width, float Height, float Thickness )
final function DrawBoxHollow( float X, float Y, float Width, float Height, float Thickness)
{
Canvas.PreOptimizeDrawTiles(4, ItemTex);
@ -680,7 +680,7 @@ final function DrawBoxHollow( float X, float Y, float Width, float Height, float
DrawWhiteBox(Thickness, Height);
}
final function DrawOutlinedBox( float X, float Y, float Width, float Height, float Thickness, Color BoxColor, Color OutlineColor )
final function DrawOutlinedBox( float X, float Y, float Width, float Height, float Thickness, Color BoxColor, Color OutlineColor)
{
Canvas.DrawColor = BoxColor;
Canvas.SetPos(X + Thickness, Y + Thickness);
@ -694,39 +694,39 @@ final function DrawBoxCorners(float BorderSize, float X, float Y, float W, float
{
// Top left
Canvas.SetPos(X,Y);
if( TopLeft )
if (TopLeft)
DrawCornerTex(BorderSize,0);
else DrawWhiteBox(BorderSize, BorderSize);
// Top right
Canvas.SetPos(X+W-BorderSize,Y);
if( TopRight )
if (TopRight)
DrawCornerTex(BorderSize,1);
else DrawWhiteBox(BorderSize, BorderSize);
// Bottom left
Canvas.SetPos(X,Y+H-BorderSize);
if( BottomLeft )
if (BottomLeft)
DrawCornerTex(BorderSize,2);
else DrawWhiteBox(BorderSize, BorderSize);
// Bottom right
Canvas.SetPos(X+W-BorderSize,Y+H-BorderSize);
if( BottomRight )
if (BottomRight)
DrawCornerTex(BorderSize,3);
else DrawWhiteBox(BorderSize, BorderSize);
}
final function DrawRoundedBox( float BorderSize, float X, float Y, float W, float H, Color BoxColor )
final function DrawRoundedBox( float BorderSize, float X, float Y, float W, float H, Color BoxColor)
{
DrawRoundedBoxEx(BorderSize, X, Y, W, H, BoxColor, true, true, true, true);
}
final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight )
final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight)
{
Canvas.DrawColor = BoxColor;
if( BorderSize <= 0 )
if (BorderSize <= 0)
{
Canvas.SetPos(X, Y);
DrawWhiteBox(W, H);
@ -749,12 +749,12 @@ final function DrawRoundedBoxEx( float BorderSize, float X, float Y, float W, fl
DrawBoxCorners(BorderSize, X, Y, W, H, TopLeft, TopRight, BottomLeft, BottomRight);
}
final function DrawRoundedBoxHollow( float BorderSize, float X, float Y, float W, float H, Color BoxColor )
final function DrawRoundedBoxHollow( float BorderSize, float X, float Y, float W, float H, Color BoxColor)
{
DrawRoundedBoxHollowEx(BorderSize, X, Y, W, H, BoxColor, true, true, true, true);
}
final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight )
final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float W, float H, Color BoxColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight)
{
Canvas.PreOptimizeDrawTiles(8, ItemTex);
@ -777,7 +777,7 @@ final function DrawRoundedBoxHollowEx( float BorderSize, float X, float Y, float
DrawBoxCorners(BorderSize, X, Y, W, H, TopLeft, TopRight, BottomLeft, BottomRight);
}
final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor )
final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor)
{
Canvas.DrawColor = BoxColor;
Canvas.SetPos(X + BorderSize, Y + BorderSize);
@ -786,7 +786,7 @@ final function DrawRoundedBoxOutlined( float BorderSize, float X, float Y, float
DrawRoundedBoxHollow(BorderSize, X, Y, Width, Height, OutlineColor);
}
final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight )
final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, float Width, float Height, Color BoxColor, Color OutlineColor, optional bool TopLeft, optional bool TopRight, optional bool BottomLeft, optional bool BottomRight)
{
Canvas.DrawColor = BoxColor;
Canvas.SetPos(X + BorderSize, Y + BorderSize);
@ -795,11 +795,11 @@ final function DrawRoundedBoxOutlinedEx( float BorderSize, float X, float Y, flo
DrawRoundedBoxHollowEx(BorderSize, X, Y, Width, Height, OutlineColor, TopLeft, TopRight, BottomLeft, BottomRight);
}
final function DrawArrowBox( int Direction, float X, float Y, float Width, float Height )
final function DrawArrowBox( int Direction, float X, float Y, float Width, float Height)
{
local Texture2D DirectionMat;
switch( Direction )
switch( Direction)
{
case 0:
DirectionMat=ArrowTextures[`ARROW_UP];
@ -822,12 +822,12 @@ final function DrawArrowBox( int Direction, float X, float Y, float Width, float
DrawTileStretched(DirectionMat,X,Y,Width,Height);
}
final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float YS )
final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float YS)
{
local float mW,mH,MidX,MidY,SmallTileW,SmallTileH,fX,fY;
local int OptimizeTiles;
if( Tex==None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse';
if (Tex == None ) Tex = Texture2D'EngineMaterials.DefaultDiffuse';
// Get the size of the image
mW = Tex.GetSurfaceWidth();
@ -844,22 +844,22 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
// Optimized
OptimizeTiles = 4;
if( mW<XS )
if (mW < XS)
OptimizeTiles += 2;
if( mH<YS )
if (mH < YS)
OptimizeTiles += 2;
if( (mH<YS) && (mW<XS) )
if ((mH < YS) && (mW < XS))
OptimizeTiles += 1;
Canvas.PreOptimizeDrawTiles(OptimizeTiles, Tex);
// Draw the spans first
// Top and Bottom
if (mW<XS)
if (mW < XS)
{
fX = MidX;
if (mH>YS)
if (mH > YS)
fY = YS/2;
else
fY = MidY;
@ -873,7 +873,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
fX = XS / 2;
// Left and Right
if (mH<YS)
if (mH < YS)
{
fY = MidY;
@ -886,7 +886,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
fY = YS / 2;
// Center
if ( (mH<YS) && (mW<XS) )
if ((mH < YS) && (mW < XS))
{
Canvas.SetPos(X+fX,Y+fY);
Canvas.DrawTile(Tex,SmallTileW,SmallTileH,fX,fY,1,1);
@ -903,7 +903,7 @@ final function DrawTileStretched( Texture Tex, float X, float Y, float XS, float
Canvas.DrawTile(Tex,fX,fY,mW-fX,mH-fY,fX,fY);
}
final function DrawTextJustified( byte Justification, float X1, float Y1, float X2, float Y2, coerce string S, optional float XS, optional float YS )
final function DrawTextJustified( byte Justification, float X1, float Y1, float X2, float Y2, coerce string S, optional float XS, optional float YS)
{
local float XL, YL;
local float CurY, CurX;
@ -912,17 +912,17 @@ final function DrawTextJustified( byte Justification, float X1, float Y1, float
CurY = ((Y2-Y1) / 2) - (YL/2);
if( Justification == 0 )
if (Justification == 0)
{
CurX = 0;
}
else if( Justification == 1 )
else if (Justification == 1)
{
if( XL > X2-X1 )
if (XL > X2-X1)
CurX = 0;
else CurX = ((X2-X1) / 2) - (XL/2);
}
else if( Justification == 2 )
else if (Justification == 2)
{
CurX = (X2-X1) - XL;
}
@ -931,7 +931,7 @@ final function DrawTextJustified( byte Justification, float X1, float Y1, float
Canvas.DrawText(S,,XS, YS);
}
static final function float TimeFraction( float Start, float End, float Current )
static final function float TimeFraction( float Start, float End, float Current)
{
return FClamp((Current - Start) / (End - Start), 0.f, 1.f);
}

View File

@ -4,7 +4,7 @@ Class KF2GUIController extends Info
`include(Build.uci)
`include(Logger.uci)
var() class<GUIStyleBase> DefaultStyle;
var() class < GUIStyleBase> DefaultStyle;
var PlayerController PlayerOwner;
var ScoreboardExtHUD HUDOwner;
@ -12,13 +12,13 @@ var transient KF2GUIInput CustomInput;
var transient PlayerInput BackupInput;
var transient GameViewportClient ClientViewport;
var delegate<Interaction.OnReceivedNativeInputKey> OldOnReceivedNativeInputKey;
var delegate<Interaction.OnReceivedNativeInputAxis> OldOnReceivedNativeInputAxis;
var delegate<Interaction.OnReceivedNativeInputChar> OldOnReceivedNativeInputChar;
var delegate < Interaction.OnReceivedNativeInputKey> OldOnReceivedNativeInputKey;
var delegate < Interaction.OnReceivedNativeInputAxis> OldOnReceivedNativeInputAxis;
var delegate < Interaction.OnReceivedNativeInputChar> OldOnReceivedNativeInputChar;
var delegate<GameViewportClient.HandleInputAxis> OldHandleInputAxis;
var delegate < GameViewportClient.HandleInputAxis> OldHandleInputAxis;
var array<KFGUI_Page> ActiveMenus,PersistentMenus;
var array < KFGUI_Page> ActiveMenus,PersistentMenus;
var transient KFGUI_Base MouseFocus,InputFocus,KeyboardFocus;
var IntPoint MousePosition,ScreenSize,OldMousePos,LastMousePos,LastClickPos[2];
var transient float MousePauseTime,MenuTime,LastClickTimes[2];
@ -27,7 +27,7 @@ var transient GUIStyleBase CurrentStyle;
var transient Console OrgConsole;
var transient KFGUIConsoleHack HackConsole;
var array<Texture2D> CursorTextures;
var array < Texture2D> CursorTextures;
var Color CursorColor;
var int CurrentCursorIndex, CursorSize;
@ -38,24 +38,24 @@ var int FontBlurX,FontBlurX2,FontBlurY,FontBlurY2,FastFontBlurX,FastFontBlurX2,F
var bool bMouseWasIdle,bIsInMenuState,bAbsorbInput,bIsInvalid,bHideCursor,bUsingGamepad,bForceEngineCursor,bNoInputReset;
static function KF2GUIController GetGUIController( PlayerController PC )
static function KF2GUIController GetGUIController( PlayerController PC)
{
local KF2GUIController G;
if( PC.Player==None )
if (PC.Player == None)
{
return None;
}
foreach PC.ChildActors(class'ScoreboardExt.KF2GUIController',G)
{
if( !G.bIsInvalid )
if (!G.bIsInvalid)
{
break;
}
}
if( G==None )
if (G == None)
{
G = PC.Spawn(class'ScoreboardExt.KF2GUIController',PC);
}
@ -81,7 +81,7 @@ simulated function PostBeginPlay()
simulated function SetupCursorFlash()
{
if( CursorFlash == 255 )
if (CursorFlash == 255)
CursorFlash = 0;
else CursorFlash = 255;
}
@ -109,24 +109,24 @@ simulated function Tick(float DT)
DT /= WorldInfo.TimeDilation;
CursorFade += 255 * DT * CursorStep;
if( CursorFade<=0 )
if (CursorFade <= 0)
{
CursorFade = 0;
CursorStep = 1;
}
else if( CursorFade>=255 )
else if (CursorFade >= 255)
{
CursorFade = 255;
CursorStep = -1;
}
FastCursorFade += 8192 * DT * FastCursorStep;
if( FastCursorFade<=0 )
if (FastCursorFade <= 0)
{
FastCursorFade = 0;
FastCursorStep = 1;
}
else if( FastCursorFade>=255 )
else if (FastCursorFade >= 255)
{
FastCursorFade = 255;
FastCursorStep = -1;
@ -135,27 +135,27 @@ simulated function Tick(float DT)
simulated function Destroyed()
{
if( PlayerOwner!=None )
if (PlayerOwner != None)
SetMenuState(false);
}
simulated function HandleDrawMenu()
{
if( HackConsole==None )
if (HackConsole == None)
{
HackConsole = new(ClientViewport)class'ScoreboardExt.KFGUIConsoleHack';
HackConsole.OutputObject = Self;
}
if( HackConsole!=ClientViewport.ViewportConsole )
if (HackConsole != ClientViewport.ViewportConsole)
{
OrgConsole = ClientViewport.ViewportConsole;
ClientViewport.ViewportConsole = HackConsole;
// Make sure nothing overrides these settings while menu is being open.
if( bIsInMenuState ) PlayerOwner.PlayerInput = CustomInput;
if (bIsInMenuState ) PlayerOwner.PlayerInput = CustomInput;
}
}
simulated function RenderMenu( Canvas C )
simulated function RenderMenu( Canvas C)
{
local int i;
local float OrgX,OrgY,ClipX,ClipY;
@ -172,11 +172,11 @@ simulated function RenderMenu( Canvas C )
CurrentStyle.Canvas = C;
CurrentStyle.PickDefaultFontSize(C.SizeY);
if( !KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive )
if (!KFPlayerController(PlayerOwner).MyGFxManager.bMenusActive)
{
HUDOwner.Canvas = C;
for( i=(HUDOwner.HUDWidgets.Length-1); i>=0; --i )
for (i=(HUDOwner.HUDWidgets.Length-1); i >= 0; --i)
{
HUDOwner.HUDWidgets[i].InputPos[0] = 0.f;
HUDOwner.HUDWidgets[i].InputPos[1] = 0.f;
@ -190,11 +190,11 @@ simulated function RenderMenu( Canvas C )
C.SetClip(ClipX,ClipY);
}
if( bIsInMenuState )
if (bIsInMenuState)
{
for( i=(ActiveMenus.Length-1); i>=0; --i )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
{
ActiveMenus[i].bWindowFocused = (i==0);
ActiveMenus[i].bWindowFocused = (i == 0);
ActiveMenus[i].InputPos[0] = 0.f;
ActiveMenus[i].InputPos[1] = 0.f;
ActiveMenus[i].InputPos[2] = ScreenSize.X;
@ -202,7 +202,7 @@ simulated function RenderMenu( Canvas C )
ActiveMenus[i].Canvas = C;
ActiveMenus[i].PreDraw();
}
if( InputFocus!=None && InputFocus.bFocusedPostDrawItem )
if (InputFocus != None && InputFocus.bFocusedPostDrawItem)
{
InputFocus.InputPos[0] = 0.f;
InputFocus.InputPos[1] = 0.f;
@ -220,7 +220,7 @@ simulated function RenderMenu( Canvas C )
}
}
if( OrgConsole!=None )
if (OrgConsole != None)
OrgConsole.PostRender_Console(C);
OrgConsole = None;
}
@ -236,28 +236,28 @@ simulated final function InventoryChanged(optional KFWeapon Wep, optional bool b
{
local int i;
for( i=(ActiveMenus.Length-1); i>=0; --i )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
{
ActiveMenus[i].InventoryChanged(Wep,bRemove);
}
}
simulated final function SetMenuState( bool bActive )
simulated final function SetMenuState( bool bActive)
{
if( PlayerOwner.PlayerInput==None )
if (PlayerOwner.PlayerInput == None)
{
NotifyLevelChange();
bActive = false;
}
if( bIsInMenuState==bActive )
if (bIsInMenuState == bActive)
return;
bIsInMenuState = bActive;
bHideCursor = !bActive;
if( bActive )
if (bActive)
{
if( CustomInput==None )
if (CustomInput == None)
{
CustomInput = new (KFPlayerController(PlayerOwner)) class'ScoreboardExt.KF2GUIInput';
CustomInput.ControllerOwner = Self;
@ -280,7 +280,7 @@ simulated final function SetMenuState( bool bActive )
PlayerOwner.PlayerInput = CustomInput;
if( LastMousePos != default.LastMousePos )
if (LastMousePos != default.LastMousePos)
ClientViewport.SetMouse(LastMousePos.X,LastMousePos.Y);
}
else
@ -289,7 +289,7 @@ simulated final function SetMenuState( bool bActive )
ClientViewport.HandleInputAxis = None;
if( BackupInput!=None )
if (BackupInput != None)
{
PlayerOwner.PlayerInput = BackupInput;
BackupInput.OnReceivedNativeInputKey = OldOnReceivedNativeInputKey;
@ -302,7 +302,7 @@ simulated final function SetMenuState( bool bActive )
LastClickTimes[1] = 0;
}
if( !bNoInputReset )
if (!bNoInputReset)
{
PlayerOwner.PlayerInput.ResetInput();
}
@ -312,19 +312,19 @@ simulated function NotifyLevelChange()
{
local int i;
if( bIsInvalid )
if (bIsInvalid)
return;
bIsInvalid = true;
if( InputFocus!=None )
if (InputFocus != None)
{
InputFocus.LostInputFocus();
InputFocus = None;
}
for( i=(ActiveMenus.Length-1); i>=0; --i )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
ActiveMenus[i].NotifyLevelChange();
for( i=(PersistentMenus.Length-1); i>=0; --i )
for (i=(PersistentMenus.Length-1); i >= 0; --i)
PersistentMenus[i].NotifyLevelChange();
SetMenuState(false);
@ -335,36 +335,36 @@ simulated function MenuInput(float DeltaTime)
local int i;
local vector2D V;
if( PlayerOwner.PlayerInput==None )
if (PlayerOwner.PlayerInput == None)
{
NotifyLevelChange();
return;
}
if( InputFocus!=None )
if (InputFocus != None)
InputFocus.MenuTick(DeltaTime);
for( i=0; i<ActiveMenus.Length; ++i )
for (i=0; i < ActiveMenus.Length; ++i)
ActiveMenus[i].MenuTick(DeltaTime);
// Check idle.
if( Abs(MousePosition.X-OldMousePos.X)>5.f || Abs(MousePosition.Y-OldMousePos.Y)>5.f || (bMouseWasIdle && MousePauseTime<0.5f) )
if (Abs(MousePosition.X-OldMousePos.X) > 5.f || Abs(MousePosition.Y-OldMousePos.Y) > 5.f || (bMouseWasIdle && MousePauseTime < 0.5f))
{
if( bMouseWasIdle )
if (bMouseWasIdle)
{
bMouseWasIdle = false;
if( InputFocus!=None )
if (InputFocus != None)
InputFocus.InputMouseMoved();
}
OldMousePos = MousePosition;
MousePauseTime = 0.f;
}
else if( !bMouseWasIdle && (MousePauseTime+=DeltaTime)>0.5f )
else if (!bMouseWasIdle && (MousePauseTime+=DeltaTime) > 0.5f)
{
bMouseWasIdle = true;
if( MouseFocus!=None )
if (MouseFocus != None)
MouseFocus.NotifyMousePaused();
}
if( ActiveMenus.Length>0 )
if (ActiveMenus.Length > 0)
MenuTime+=DeltaTime;
V = ClientViewport.GetMousePosition();
@ -381,15 +381,15 @@ simulated function MouseMove()
local KFGUI_Base F;
// Capture mouse for GUI
if( InputFocus!=None && InputFocus.bCanFocus )
if (InputFocus != None && InputFocus.bCanFocus)
{
if( InputFocus.CaptureMouse() )
if (InputFocus.CaptureMouse())
{
F = InputFocus.GetMouseFocus();
if( F!=MouseFocus )
if (F != MouseFocus)
{
MousePauseTime = 0;
if( MouseFocus!=None )
if (MouseFocus != None)
MouseFocus.MouseLeave();
MouseFocus = F;
F.MouseEnter();
@ -399,32 +399,32 @@ simulated function MouseMove()
}
else
{
for( i=0; i<ActiveMenus.Length; ++i )
for (i=0; i < ActiveMenus.Length; ++i)
{
if( ActiveMenus[i].CaptureMouse() )
if (ActiveMenus[i].CaptureMouse())
{
F = ActiveMenus[i].GetMouseFocus();
if( F!=MouseFocus )
if (F != MouseFocus)
{
MousePauseTime = 0;
if( MouseFocus!=None )
if (MouseFocus != None)
MouseFocus.MouseLeave();
MouseFocus = F;
F.MouseEnter();
}
break;
}
else if( ActiveMenus[i].bOnlyThisFocus ) // Discard any other menus after this one.
else if (ActiveMenus[i].bOnlyThisFocus ) // Discard any other menus after this one.
{
i = ActiveMenus.Length;
break;
}
}
}
if( MouseFocus!=None && i==ActiveMenus.Length ) // Hovering over nothing.
if (MouseFocus != None && i == ActiveMenus.Length ) // Hovering over nothing.
{
MousePauseTime = 0;
if( MouseFocus!=None )
if (MouseFocus != None)
MouseFocus.MouseLeave();
MouseFocus = None;
}
@ -434,8 +434,8 @@ simulated final function int GetFreeIndex( bool bNewAlwaysTop ) // Find first al
{
local int i;
for( i=0; i<ActiveMenus.Length; ++i )
if( bNewAlwaysTop || !ActiveMenus[i].bAlwaysTop )
for (i=0; i < ActiveMenus.Length; ++i)
if (bNewAlwaysTop || !ActiveMenus[i].bAlwaysTop)
{
ActiveMenus.Insert(i,1);
return i;
@ -444,16 +444,16 @@ simulated final function int GetFreeIndex( bool bNewAlwaysTop ) // Find first al
ActiveMenus.Length = i+1;
return i;
}
simulated function KFGUI_Base InitializeHUDWidget( class<KFGUI_Base> GUIClass )
simulated function KFGUI_Base InitializeHUDWidget( class < KFGUI_Base> GUIClass)
{
local KFGUI_Base Widget;
if( GUIClass==None )
if (GUIClass == None)
return None;
Widget = New(None) GUIClass;
if( Widget==None )
if (Widget == None)
return None;
HUDOwner.HUDWidgets.AddItem(Widget);
@ -466,17 +466,17 @@ simulated function KFGUI_Base InitializeHUDWidget( class<KFGUI_Base> GUIClass )
return Widget;
}
simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
simulated function KFGUI_Page OpenMenu( class < KFGUI_Page> MenuClass)
{
local int i;
local KFGUI_Page M;
if( MenuClass==None )
if (MenuClass == None)
return None;
if( KeyboardFocus!=None )
if (KeyboardFocus != None)
GrabInputFocus(None);
if( InputFocus!=None )
if (InputFocus != None)
{
InputFocus.LostInputFocus();
InputFocus = None;
@ -486,12 +486,12 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
SetMenuState(true);
// Check if should use pre-excisting menu.
if( MenuClass.Default.bUnique )
if (MenuClass.Default.bUnique)
{
for( i=0; i<ActiveMenus.Length; ++i )
if( ActiveMenus[i].Class==MenuClass )
for (i=0; i < ActiveMenus.Length; ++i)
if (ActiveMenus[i].Class == MenuClass)
{
if( i>0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront.
if (i > 0 && ActiveMenus[i].BringPageToFront() ) // Sort it upfront.
{
M = ActiveMenus[i];
ActiveMenus.Remove(i,1);
@ -501,10 +501,10 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
return M;
}
if( MenuClass.Default.bPersistant )
if (MenuClass.Default.bPersistant)
{
for( i=0; i<PersistentMenus.Length; ++i )
if( PersistentMenus[i].Class==MenuClass )
for (i=0; i < PersistentMenus.Length; ++i)
if (PersistentMenus[i].Class == MenuClass)
{
M = PersistentMenus[i];
PersistentMenus.Remove(i,1);
@ -517,7 +517,7 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
}
M = New(None)MenuClass;
if( M==None ) // Probably abstract class.
if (M == None ) // Probably abstract class.
return None;
i = GetFreeIndex(M.bAlwaysTop);
@ -527,125 +527,125 @@ simulated function KFGUI_Page OpenMenu( class<KFGUI_Page> MenuClass )
M.ShowMenu();
return M;
}
simulated function CloseMenu( class<KFGUI_Page> MenuClass, optional bool bCloseAll )
simulated function CloseMenu( class < KFGUI_Page> MenuClass, optional bool bCloseAll)
{
local int i, j;
local KFGUI_Page M;
if( !bCloseAll && MenuClass==None )
if (!bCloseAll && MenuClass == None)
return;
if( KeyboardFocus!=None )
if (KeyboardFocus != None)
GrabInputFocus(None);
if( InputFocus!=None )
if (InputFocus != None)
{
InputFocus.LostInputFocus();
InputFocus = None;
}
for( i=(ActiveMenus.Length-1); i>=0; --i )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
{
if( bCloseAll || ActiveMenus[i].Class==MenuClass )
if (bCloseAll || ActiveMenus[i].Class == MenuClass)
{
M = ActiveMenus[i];
ActiveMenus.Remove(i,1);
M.CloseMenu();
for( j=0; j<M.TimerNames.Length; j++ )
for (j=0; j < M.TimerNames.Length; j++)
{
M.ClearTimer(M.TimerNames[j]);
}
// Cache menu.
if( M.bPersistant && M.bUnique )
if (M.bPersistant && M.bUnique)
PersistentMenus[PersistentMenus.Length] = M;
}
}
if( ActiveMenus.Length==0 )
if (ActiveMenus.Length == 0)
{
SetMenuState(false);
}
}
simulated function PopCloseMenu( KFGUI_Base Item )
simulated function PopCloseMenu( KFGUI_Base Item)
{
local int i;
local KFGUI_Page M;
if( Item==None )
if (Item == None)
return;
if( Item.bIsHUDWidget )
if (Item.bIsHUDWidget)
{
HUDOwner.HUDWidgets.RemoveItem(Item);
Item.CloseMenu();
return;
}
if( KeyboardFocus!=None )
if (KeyboardFocus != None)
GrabInputFocus(None);
if( InputFocus!=None )
if (InputFocus != None)
{
InputFocus.LostInputFocus();
InputFocus = None;
}
for( i=(ActiveMenus.Length-1); i>=0; --i )
if( ActiveMenus[i]==Item )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
if (ActiveMenus[i] == Item)
{
M = ActiveMenus[i];
ActiveMenus.Remove(i,1);
M.CloseMenu();
// Cache menu.
if( M.bPersistant && M.bUnique )
if (M.bPersistant && M.bUnique)
PersistentMenus[PersistentMenus.Length] = M;
break;
}
if( ActiveMenus.Length==0 )
if (ActiveMenus.Length == 0)
SetMenuState(false);
}
simulated function BringMenuToFront( KFGUI_Page Page )
simulated function BringMenuToFront( KFGUI_Page Page)
{
local int i;
if( ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop )
if (ActiveMenus[0].bAlwaysTop && !Page.bAlwaysTop)
return; // Can't override this menu.
// Try to remove from current position at stack.
for( i=(ActiveMenus.Length-1); i>=0; --i )
if( ActiveMenus[i]==Page )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
if (ActiveMenus[i] == Page)
{
ActiveMenus.Remove(i,1);
break;
}
if( i==-1 )
if (i == -1)
return; // Page isn't open.
// Put on front of stack.
ActiveMenus.Insert(0,1);
ActiveMenus[0] = Page;
}
simulated final function bool MenuIsOpen( optional class<KFGUI_Page> MenuClass )
simulated final function bool MenuIsOpen( optional class < KFGUI_Page> MenuClass)
{
local int i;
for( i=(ActiveMenus.Length-1); i>=0; --i )
if( MenuClass==None || ActiveMenus[i].Class==MenuClass )
for (i=(ActiveMenus.Length-1); i >= 0; --i)
if (MenuClass == None || ActiveMenus[i].Class == MenuClass)
return true;
return false;
}
simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce )
simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce)
{
if( Comp==KeyboardFocus && !bForce )
if (Comp == KeyboardFocus && !bForce)
return;
if( KeyboardFocus!=None )
if (KeyboardFocus != None)
KeyboardFocus.LostKeyFocus();
if( Comp==None )
if (Comp == None)
{
OnInputKey = InternalInputKey;
OnReceivedInputChar = InternalReceivedInputChar;
}
else if( KeyboardFocus==None )
else if (KeyboardFocus == None)
{
OnInputKey = Comp.NotifyInputKey;
OnReceivedInputChar = Comp.NotifyInputChar;
@ -654,23 +654,23 @@ simulated final function GrabInputFocus( KFGUI_Base Comp, optional bool bForce )
KeyboardFocus = Comp;
}
simulated final function GUI_InputMouse( bool bPressed, bool bRight )
simulated final function GUI_InputMouse( bool bPressed, bool bRight)
{
local byte i;
MousePauseTime = 0;
if( bPressed )
if (bPressed)
{
if( KeyboardFocus!=None && KeyboardFocus!=MouseFocus )
if (KeyboardFocus != None && KeyboardFocus != MouseFocus)
{
GrabInputFocus(None);
LastClickTimes[0] = 0;
LastClickTimes[1] = 0;
}
if( MouseFocus!=None )
if (MouseFocus != None)
{
if( MouseFocus!=InputFocus && !MouseFocus.bClickable && !MouseFocus.IsTopMenu() && MouseFocus.BringPageToFront() )
if (MouseFocus != InputFocus && !MouseFocus.bClickable && !MouseFocus.IsTopMenu() && MouseFocus.BringPageToFront())
{
BringMenuToFront(MouseFocus.GetPageTop());
LastClickTimes[0] = 0;
@ -679,7 +679,7 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight )
else
{
i = byte(bRight);
if( (MenuTime-LastClickTimes[i])<0.2 && Abs(LastClickPos[i].X-MousePosition.X)<5 && Abs(LastClickPos[i].Y-MousePosition.Y)<5 )
if ((MenuTime-LastClickTimes[i]) < 0.2 && Abs(LastClickPos[i].X-MousePosition.X) < 5 && Abs(LastClickPos[i].Y-MousePosition.Y) < 5)
{
LastClickTimes[i] = 0;
MouseFocus.DoubleMouseClick(bRight);
@ -692,7 +692,7 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight )
}
}
}
else if( InputFocus!=None )
else if (InputFocus != None)
{
InputFocus.LostInputFocus();
InputFocus = None;
@ -702,17 +702,17 @@ simulated final function GUI_InputMouse( bool bPressed, bool bRight )
}
else
{
if( InputFocus!=None )
if (InputFocus != None)
InputFocus.MouseRelease(bRight);
else if( MouseFocus!=None )
else if (MouseFocus != None)
MouseFocus.MouseRelease(bRight);
}
}
simulated final function bool CheckMouse( name Key, EInputEvent Event )
simulated final function bool CheckMouse( name Key, EInputEvent Event)
{
if ( Event == IE_Pressed )
if (Event == IE_Pressed)
{
switch( Key )
switch( Key)
{
case 'XboxTypeS_A':
case 'LeftMouseButton':
@ -724,9 +724,9 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event )
return true;
}
}
else if ( Event == IE_Released )
else if (Event == IE_Released)
{
switch( Key )
switch( Key)
{
case 'XboxTypeS_A':
case 'LeftMouseButton':
@ -740,34 +740,34 @@ simulated final function bool CheckMouse( name Key, EInputEvent Event )
}
return false;
}
simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad )
simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad)
{
local KFPlayerInput KFInput;
local KeyBind BoundKey;
if( !bIsInMenuState )
if (!bIsInMenuState)
return false;
bUsingGamepad = bGamepad;
KFInput = KFPlayerInput(BackupInput);
if( KFInput == None )
if (KFInput == None)
{
KFInput = KFPlayerInput(PlayerOwner.PlayerInput);
}
if( KeyboardFocus == None )
if (KeyboardFocus == None)
{
if( KFInput != None )
if (KFInput != None)
{
KFInput.GetKeyBindFromCommand(BoundKey, "GBA_VoiceChat", false);
if( string(Key) ~= KFInput.GetBindDisplayName(BoundKey) )
if (string(Key) ~= KFInput.GetBindDisplayName(BoundKey))
{
if( Event == IE_Pressed )
if (Event == IE_Pressed)
{
KFInput.StartVoiceChat(true);
}
else if( Event == IE_Released )
else if (Event == IE_Released)
{
KFInput.StopVoiceChat();
}
@ -777,19 +777,19 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven
}
}
if( !CheckMouse(Key,Event) && !OnInputKey(ControllerId,Key,Event,AmountDepressed,bGamepad) )
if (!CheckMouse(Key,Event) && !OnInputKey(ControllerId,Key,Event,AmountDepressed,bGamepad))
{
if( bGamepad )
if (bGamepad)
{
if( ActiveMenus[0].ReceievedControllerInput(ControllerId, Key, Event) )
if (ActiveMenus[0].ReceievedControllerInput(ControllerId, Key, Event))
return true;
}
switch( Key )
switch( Key)
{
case 'XboxTypeS_Start':
case 'Escape':
if( Event==IE_Pressed )
if (Event == IE_Pressed)
ActiveMenus[0].UserPressedEsc(); // Pop top menu if possible. // IE_Released
return true;
case 'XboxTypeS_DPad_Up':
@ -798,8 +798,8 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven
case 'XboxTypeS_DPad_Right':
case 'MouseScrollDown':
case 'MouseScrollUp':
if( Event==IE_Pressed && MouseFocus!=None )
MouseFocus.ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left');
if (Event == IE_Pressed && MouseFocus != None)
MouseFocus.ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left');
return true;
}
@ -808,18 +808,18 @@ simulated function bool ReceivedInputKey( int ControllerId, name Key, EInputEven
return true;
}
simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad )
simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad)
{
local Vector2D V;
local KFPlayerInput KFInput;
local float GamepadSensitivity,OldMouseX,OldMouseY,MoveDelta,MoveDeltaInvert;
if( !bIsInMenuState )
if (!bIsInMenuState)
return false;
if( bGamepad )
if (bGamepad )
{
if( Abs(Delta) > 0.2f )
if (Abs(Delta) > 0.2f)
{
bUsingGamepad = true;
@ -836,52 +836,52 @@ simulated function bool ReceivedInputAxis( int ControllerId, name Key, float Del
{
case 'XboxTypeS_LeftX':
case 'XboxTypeS_RightX':
if( Delta < 0 )
if (Delta < 0)
V.X = Clamp(V.X - MoveDeltaInvert, 0, ScreenSize.X);
else V.X = Clamp(V.X + MoveDelta, 0, ScreenSize.X);
break;
case 'XboxTypeS_LeftY':
if( Delta < 0 )
if (Delta < 0)
V.Y = Clamp(V.Y + MoveDeltaInvert, 0, ScreenSize.Y);
else V.Y = Clamp(V.Y - MoveDelta, 0, ScreenSize.Y);
break;
case 'XboxTypeS_RightY':
if( Delta < 0 )
if (Delta < 0)
V.Y = Clamp(V.Y - MoveDeltaInvert, 0, ScreenSize.Y);
else V.Y = Clamp(V.Y + MoveDelta, 0, ScreenSize.Y);
break;
}
if( OldMouseX != V.X || OldMouseY != V.Y )
if (OldMouseX != V.X || OldMouseY != V.Y)
ClientViewport.SetMouse(V.X, V.Y);
}
}
return OnReceivedInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad);
}
simulated function bool ReceivedInputChar( int ControllerId, string Unicode )
simulated function bool ReceivedInputChar( int ControllerId, string Unicode)
{
if( !bIsInMenuState )
if (!bIsInMenuState)
return false;
return OnReceivedInputChar(ControllerId,Unicode);
}
simulated Delegate bool OnInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad )
simulated Delegate bool OnInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad)
{
return false;
}
simulated Delegate bool OnReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad )
simulated Delegate bool OnReceivedInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad)
{
return false;
}
simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode )
simulated Delegate bool OnReceivedInputChar( int ControllerId, string Unicode)
{
return false;
}
simulated Delegate bool InternalInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad )
simulated Delegate bool InternalInputKey( int ControllerId, name Key, EInputEvent Event, optional float AmountDepressed=1.f, optional bool bGamepad)
{
return false;
}
simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode )
simulated Delegate bool InternalReceivedInputChar( int ControllerId, string Unicode)
{
return false;
}

View File

@ -8,24 +8,24 @@ class KF2GUIInput extends KFPlayerInput;
var KF2GUIController ControllerOwner;
var PlayerInput BaseInput;
function DrawHUD( HUD H )
function DrawHUD( HUD H)
{
//ControllerOwner.RenderMenu(H.Canvas);
}
function PostRender( Canvas Canvas )
function PostRender( Canvas Canvas)
{
if( ControllerOwner.bIsInMenuState )
if (ControllerOwner.bIsInMenuState)
ControllerOwner.HandleDrawMenu();
//ControllerOwner.RenderMenu(Canvas);
}
// Postprocess the player's input.
function PlayerInput( float DeltaTime )
function PlayerInput( float DeltaTime)
{
// Do not move.
ControllerOwner.MenuInput(DeltaTime);
if( !ControllerOwner.bAbsorbInput )
if (!ControllerOwner.bAbsorbInput)
{
aMouseX = 0;
aMouseY = 0;

View File

@ -14,13 +14,13 @@ function InitStyle()
LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D'));
LoadedTex[1] = Texture2D(DynamicLoadObject("EditorMaterials.Tick",class'Texture2D'));
for( i=0; i<ArrayCount(LoadedTex); ++i )
for (i=0; i < ArrayCount(LoadedTex); ++i)
{
if( LoadedTex[i]==None )
if (LoadedTex[i] == None)
LoadedTex[i] = Texture2D'EngineMaterials.DefaultWhiteGrid';
}
}
function RenderFramedWindow( KFGUI_FloatingWindow P )
function RenderFramedWindow( KFGUI_FloatingWindow P)
{
local int XS,YS,CornerSlope,TitleHeight;
@ -30,7 +30,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
TitleHeight = DefaultHeight;
// Frame Header
if( P.bWindowFocused )
if (P.bWindowFocused)
Canvas.SetDrawColor(220,2,2,255);
else Canvas.SetDrawColor(100,1,1,P.FrameOpacity);
Canvas.SetPos(0,0);
@ -49,7 +49,7 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
DrawWhiteBox(XS-(CornerSlope*2),CornerSlope);
// Frame itself.
if( P.bWindowFocused )
if (P.bWindowFocused)
Canvas.SetDrawColor(32,6,6,255);
else Canvas.SetDrawColor(16,2,2,P.FrameOpacity);
Canvas.SetPos(0,TitleHeight);
@ -70,14 +70,14 @@ function RenderFramedWindow( KFGUI_FloatingWindow P )
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
// Title.
if( P.WindowTitle!="" )
if (P.WindowTitle != "")
{
Canvas.SetDrawColor(250,250,250,P.FrameOpacity);
Canvas.SetPos(CornerSlope,0);
DrawText(P.WindowTitle);
}
}
function RenderWindow( KFGUI_Page P )
function RenderWindow( KFGUI_Page P)
{
local int XS,YS,CornerSlope;
@ -86,7 +86,7 @@ function RenderWindow( KFGUI_Page P )
CornerSlope = DefaultHeight*0.4;
// Frame itself.
if( P.bWindowFocused )
if (P.bWindowFocused)
Canvas.SetDrawColor(64,64,64,255);
else Canvas.SetDrawColor(32,32,32,P.FrameOpacity);
Canvas.SetPos(0,0);
@ -106,7 +106,7 @@ function RenderWindow( KFGUI_Page P )
Canvas.SetPos(XS-CornerSlope,CornerSlope);
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
}
function RenderToolTip( KFGUI_Tooltip TT )
function RenderToolTip( KFGUI_Tooltip TT)
{
local int i;
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
@ -115,9 +115,9 @@ function RenderToolTip( KFGUI_Tooltip TT )
// First compute textbox size.
TY = DefaultHeight*TT.Lines.Length;
for( i=0; i<TT.Lines.Length; ++i )
for (i=0; i < TT.Lines.Length; ++i)
{
if( TT.Lines[i]!="" )
if (TT.Lines[i] != "")
Canvas.TextSize(TT.Lines[i],XS,YS);
TX = FMax(XS,TX);
}
@ -131,12 +131,12 @@ function RenderToolTip( KFGUI_Tooltip TT )
Y = TT.CompPos[1]+24.f;
// Then check if too close to window edge, then move it to another pivot.
if( (X+TX)>TT.Owner.ScreenSize.X )
if ((X+TX) > TT.Owner.ScreenSize.X)
X = TT.Owner.ScreenSize.X-TX;
if( (Y+TY)>TT.Owner.ScreenSize.Y )
if ((Y+TY) > TT.Owner.ScreenSize.Y)
Y = TT.CompPos[1]-TY;
if( TT.CurrentAlpha<255 )
if (TT.CurrentAlpha < 255)
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
// Reset clipping.
@ -157,39 +157,39 @@ function RenderToolTip( KFGUI_Tooltip TT )
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
X+=TOOLTIP_BORDER;
Y+=TOOLTIP_BORDER;
for( i=0; i<TT.Lines.Length; ++i )
for (i=0; i < TT.Lines.Length; ++i)
{
Canvas.SetPos(X,Y);
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
Y+=DefFontHeight;
}
}
function RenderScrollBar( KFGUI_ScrollBarBase S )
function RenderScrollBar( KFGUI_ScrollBarBase S)
{
local float A;
local byte i;
if( S.bDisabled )
if (S.bDisabled)
Canvas.SetDrawColor(5, 5, 5, 0);
else if( S.bFocused || S.bGrabbedScroller )
else if (S.bFocused || S.bGrabbedScroller)
Canvas.SetDrawColor(15, 15, 15, 160);
else Canvas.SetDrawColor(15, 15, 15, 160);
DrawRectBox (0.f, 0.f, S.CompPos[2], S.CompPos[3], 4);
if( S.bDisabled )
if (S.bDisabled)
return;
if( S.bVertical )
if (S.bVertical)
i = 3;
else i = 2;
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
if( S.bGrabbedScroller )
if (S.bGrabbedScroller)
{
// Track mouse.
if( S.bVertical )
if (S.bVertical)
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
@ -200,27 +200,27 @@ function RenderScrollBar( KFGUI_ScrollBarBase S )
A = float(S.CurrentScroll) / float(S.MaxRange);
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
if( S.bGrabbedScroller )
if (S.bGrabbedScroller)
Canvas.SetDrawColor(255,0,0,200);
else if( S.bFocused )
else if (S.bFocused)
Canvas.SetDrawColor(200,0,0,200);
else Canvas.SetDrawColor(150,0,0,200);
if( S.bVertical )
if (S.bVertical)
DrawRectBox (0.f, S.ButtonOffset, S.CompPos[2], S.SliderScale, 4);
else DrawRectBox (S.ButtonOffset, 0.f, S.SliderScale, S.CompPos[3], 4);
}
function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Index, bool bFocus, bool bSort )
function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Index, bool bFocus, bool bSort)
{
local int XS;
if( bSort )
if (bSort)
{
if( bFocus )
if (bFocus)
Canvas.SetDrawColor(175,240,8,255);
else Canvas.SetDrawColor(128,200,56,255);
}
else if( bFocus )
else if (bFocus)
Canvas.SetDrawColor(220,220,8,255);
else Canvas.SetDrawColor(220,86,56,255);
@ -236,45 +236,45 @@ function RenderColumnHeader( KFGUI_ColumnTop C, float XPos, float Width, int Ind
Canvas.SetPos(XPos+XS,(C.CompPos[3]-C.ListOwner.TextHeight)*0.5f);
C.ListOwner.DrawStrClipped(C.ListOwner.Columns[Index].Text);
}
function RenderCheckbox( KFGUI_CheckBox C )
function RenderCheckbox( KFGUI_CheckBox C)
{
if( C.bDisabled )
if (C.bDisabled)
Canvas.SetDrawColor(86,86,86,255);
else if( C.bPressedDown )
else if (C.bPressedDown)
Canvas.SetDrawColor(128,255,128,255);
else if( C.bFocused )
else if (C.bFocused)
Canvas.SetDrawColor(150,200,128,255);
else Canvas.SetDrawColor(128,186,128,255);
Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(LoadedTex[0],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[0].GetSurfaceWidth(),LoadedTex[0].GetSurfaceHeight());
if( C.bChecked )
if (C.bChecked)
{
if( C.bDisabled )
if (C.bDisabled)
Canvas.SetDrawColor(128,128,128,255);
else Canvas.SetDrawColor(255,255,255,255);
Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(LoadedTex[1],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[1].GetSurfaceWidth(),LoadedTex[1].GetSurfaceHeight());
}
}
function RenderComboBox( KFGUI_ComboBox C )
function RenderComboBox( KFGUI_ComboBox C)
{
if( C.bDisabled )
if (C.bDisabled)
Canvas.SetDrawColor(64,4,4,255);
else if( C.bPressedDown )
else if (C.bPressedDown)
Canvas.SetDrawColor(220,56,56,255);
else if( C.bFocused )
else if (C.bFocused)
Canvas.SetDrawColor(190,48,48,255);
else Canvas.SetDrawColor(186,4,4,255);
Canvas.SetPos(0.f,0.f);
DrawWhiteBox(C.CompPos[2],C.CompPos[3]);
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" )
if (C.SelectedIndex < C.Values.Length && C.Values[C.SelectedIndex] != "")
{
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
if( C.bDisabled )
if (C.bDisabled)
Canvas.DrawColor = C.TextColor*0.5f;
else Canvas.DrawColor = C.TextColor;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
@ -282,7 +282,7 @@ function RenderComboBox( KFGUI_ComboBox C )
Canvas.PopMaskRegion();
}
}
function RenderComboList( KFGUI_ComboSelector C )
function RenderComboList( KFGUI_ComboSelector C)
{
local float X,Y,YL,YP,Edge;
local int i;
@ -301,7 +301,7 @@ function RenderComboList( KFGUI_ComboSelector C )
X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = C.Combo.TextFont;
YL = C.Combo.TextHeight;
@ -310,9 +310,9 @@ function RenderComboList( KFGUI_ComboSelector C )
C.CurrentRow = -1;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.Combo.Values.Length; ++i )
for (i=0; i < C.Combo.Values.Length; ++i)
{
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
if (bCheckMouse && Y >= YP && Y <= (YP+YL))
{
bCheckMouse = false;
C.CurrentRow = i;
@ -322,7 +322,7 @@ function RenderComboList( KFGUI_ComboSelector C )
}
Canvas.SetPos(Edge,YP);
if( i==C.Combo.SelectedIndex )
if (i == C.Combo.SelectedIndex)
Canvas.DrawColor = C.Combo.SelectedTextColor;
else Canvas.DrawColor = C.Combo.TextColor;
@ -331,13 +331,13 @@ function RenderComboList( KFGUI_ComboSelector C )
YP+=YL;
}
Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow )
if (C.OldRow != C.CurrentRow)
{
C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange);
}
}
function RenderRightClickMenu( KFGUI_RightClickMenu C )
function RenderRightClickMenu( KFGUI_RightClickMenu C)
{
local float X,Y,YP,Edge,TextScale,TexDefHieght;
local int i;
@ -355,7 +355,7 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
X = C.Owner.MousePosition.X - Canvas.OrgX;
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
bCheckMouse = (X > 0.f && X < C.CompPos[2] && Y > 0.f && Y < C.CompPos[3]);
Canvas.Font = PickFont(TextScale);
@ -365,9 +365,9 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
TexDefHieght = DefaultHeight;
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
for( i=0; i<C.ItemRows.Length; ++i )
for (i=0; i < C.ItemRows.Length; ++i)
{
if( bCheckMouse && Y>=YP && Y<=(YP+TexDefHieght) )
if (bCheckMouse && Y >= YP && Y <= (YP+TexDefHieght))
{
bCheckMouse = false;
C.CurrentRow = i;
@ -377,14 +377,14 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
}
Canvas.SetPos(Edge,YP);
if( C.ItemRows[i].bSplitter )
if (C.ItemRows[i].bSplitter)
{
Canvas.SetDrawColor(0,0,0,255);
Canvas.DrawText("-------",,TextScale,TextScale);
}
else
{
if( C.ItemRows[i].bDisabled )
if (C.ItemRows[i].bDisabled)
Canvas.SetDrawColor(148,148,148,255);
else Canvas.SetDrawColor(248,248,248,255);
Canvas.DrawText(C.ItemRows[i].Text,,TextScale,TextScale);
@ -393,26 +393,26 @@ function RenderRightClickMenu( KFGUI_RightClickMenu C )
YP+=TexDefHieght;
}
Canvas.PopMaskRegion();
if( C.OldRow!=C.CurrentRow )
if (C.OldRow != C.CurrentRow)
{
C.OldRow = C.CurrentRow;
C.PlayMenuSound(MN_DropdownChange);
}
}
function RenderButton( KFGUI_Button B )
function RenderButton( KFGUI_Button B)
{
local float XL,YL,TS;
local byte i;
if( B.bDisabled )
if (B.bDisabled)
Canvas.SetDrawColor(32,0,0,255);
else if( B.bPressedDown )
else if (B.bPressedDown)
Canvas.SetDrawColor(255,64,64,255);
else if( B.bFocused )
else if (B.bFocused)
Canvas.SetDrawColor(180,45,45,255);
else Canvas.SetDrawColor(164,8,8,255);
if( B.bIsHighlighted )
if (B.bIsHighlighted)
{
Canvas.DrawColor.R = Min(Canvas.DrawColor.R+25,255);
Canvas.DrawColor.G = Min(Canvas.DrawColor.G+25,255);
@ -420,29 +420,29 @@ function RenderButton( KFGUI_Button B )
}
Canvas.SetPos(0.f,0.f);
if( B.ExtravDir==255 )
if (B.ExtravDir == 255)
DrawWhiteBox(B.CompPos[2],B.CompPos[3]);
else DrawRectBox(0,0,B.CompPos[2],B.CompPos[3],Min(B.CompPos[2],B.CompPos[3])*0.2,B.ExtravDir);
if( B.OverlayTexture.Texture!=None )
if (B.OverlayTexture.Texture != None)
{
Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL);
}
if( B.ButtonText!="" )
if (B.ButtonText != "")
{
// Chose the best font to fit this button.
i = Min(B.FontScale,MaxFontScale);
while( true )
while( true)
{
Canvas.Font = PickFont(TS);
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
if( i==0 || (XL<(B.CompPos[2]*0.95) && YL<(B.CompPos[3]*0.95)) )
if (i == 0 || (XL < (B.CompPos[2]*0.95) && YL < (B.CompPos[3]*0.95)))
break;
--i;
}
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
if( B.bDisabled )
if (B.bDisabled)
Canvas.DrawColor = B.TextColor*0.5f;
else Canvas.DrawColor = B.TextColor;
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);

View File

@ -28,18 +28,18 @@ static final function HSVColour RGBToHSV(const LinearColor RGB)
Chroma = Max - Min;
//If Chroma is 0, then S is 0 by definition, and H is undefined but 0 by convention.
if(Chroma != 0)
if (Chroma != 0)
{
if(RGB.R == Max)
if (RGB.R == Max)
{
HSV.H = (RGB.G - RGB.B) / Chroma;
if(HSV.H < 0.0)
if (HSV.H < 0.0)
{
HSV.H += 6.0;
}
}
else if(RGB.G == Max)
else if (RGB.G == Max)
{
HSV.H = ((RGB.B - RGB.R) / Chroma) + 2.0;
}
@ -70,32 +70,32 @@ static final function LinearColor HSVToRGB(const HSVColour HSV)
Hdash = HSV.H / 60.0;
X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0));
if(Hdash < 1.0)
if (Hdash < 1.0)
{
RGB.R = Chroma;
RGB.G = X;
}
else if(Hdash < 2.0)
else if (Hdash < 2.0)
{
RGB.R = X;
RGB.G = Chroma;
}
else if(Hdash < 3.0)
else if (Hdash < 3.0)
{
RGB.G = Chroma;
RGB.B = X;
}
else if(Hdash < 4.0)
else if (Hdash < 4.0)
{
RGB.G= X;
RGB.B = Chroma;
}
else if(Hdash < 5.0)
else if (Hdash < 5.0)
{
RGB.R = X;
RGB.B = Chroma;
}
else if(Hdash < 6.0)
else if (Hdash < 6.0)
{
RGB.R = Chroma;
RGB.B = X;

View File

@ -34,13 +34,13 @@ var() bool bDisabled,bClickable,bCanFocus;
var bool bFocusedPostDrawItem; // If this component has been given input focus, should it receive draw menu call after everything else been drawn?
var transient bool bFocused,bTextureInit,bVisible;
var bool bIsHUDWidget,bEnableInputs,bNoLookInputs;
var array<name> TimerNames;
var array < name> TimerNames;
function InitMenu(); // Menu was initialized for the first time.
function ShowMenu(); // Menu was opened.
function PreDraw()
{
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
@ -56,13 +56,13 @@ function MenuTick( float DeltaTime );
final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer')
{
if( InRate <= 0.f )
if (InRate <= 0.f)
{
ClearTimer(inTimerFunc);
return;
}
if( TimerNames.Find(inTimerFunc) == INDEX_NONE )
if (TimerNames.Find(inTimerFunc) == INDEX_NONE)
{
TimerNames.AddItem(inTimerFunc);
}
@ -71,7 +71,7 @@ final function SetTimer(float InRate, optional bool inbLoop, optional Name inTim
}
final function ClearTimer(optional Name inTimerFunc='Timer')
{
if( TimerNames.Find(inTimerFunc) != INDEX_NONE )
if (TimerNames.Find(inTimerFunc) != INDEX_NONE)
{
TimerNames.RemoveItem(inTimerFunc);
}
@ -109,7 +109,7 @@ final function PlayerController GetPlayer()
return Owner.PlayerOwner;
}
function SetDisabled( bool bDisable )
function SetDisabled( bool bDisable)
{
bDisabled = bDisable;
}
@ -126,14 +126,14 @@ final function ComputeCoords()
function bool CaptureMouse()
{
return bVisible && ( Owner.MousePosition.X>=CompPos[0] && Owner.MousePosition.Y>=CompPos[1] && Owner.MousePosition.X<=(CompPos[0]+CompPos[2]) && Owner.MousePosition.Y<=(CompPos[1]+CompPos[3]) );
return bVisible && ( Owner.MousePosition.X >= CompPos[0] && Owner.MousePosition.Y >= CompPos[1] && Owner.MousePosition.X <= (CompPos[0]+CompPos[2]) && Owner.MousePosition.Y <= (CompPos[1]+CompPos[3]) );
}
final function KFGUI_Base GetMouseFocus()
{
local KFGUI_Base M;
for( M=Self; M.MouseArea!=None; M=M.MouseArea )
for (M=Self; M.MouseArea != None; M=M.MouseArea)
{}
return M;
}
@ -147,12 +147,12 @@ function DoClose()
{
local int i;
for( i=0; i<TimerNames.Length; i++ )
for (i=0; i < TimerNames.Length; i++)
{
ClearTimer(TimerNames[i]);
}
if( ParentComponent!=None )
if (ParentComponent != None)
ParentComponent.DoClose();
else Owner.PopCloseMenu(Self);
}
@ -164,50 +164,50 @@ function byte GetCursorStyle()
function UserPressedEsc() // user pressed escape while this menu was active.
{
if( ParentComponent!=None )
if (ParentComponent != None)
ParentComponent.UserPressedEsc();
else DoClose();
}
function bool BringPageToFront()
{
if( ParentComponent!=None )
if (ParentComponent != None)
return ParentComponent.BringPageToFront();
return true; // Allow user to bring this page to front.
}
final function bool IsTopMenu()
{
return (Owner.ActiveMenus.Length>0 && GetPageTop()==Owner.ActiveMenus[0]);
return (Owner.ActiveMenus.Length > 0 && GetPageTop() == Owner.ActiveMenus[0]);
}
final function KFGUI_Page GetPageTop()
{
local KFGUI_Base M;
for( M=Self; M.ParentComponent!=None; M=M.ParentComponent )
for (M=Self; M.ParentComponent != None; M=M.ParentComponent)
{}
return KFGUI_Page(M);
}
function KFGUI_Base FindComponentID( name InID )
function KFGUI_Base FindComponentID( name InID)
{
if( ID==InID )
if (ID == InID)
return Self;
return None;
}
function FindAllComponentID( name InID, out array<KFGUI_Base> Res )
function FindAllComponentID( name InID, out array < KFGUI_Base> Res)
{
if( ID==InID )
if (ID == InID)
Res[Res.Length] = Self;
}
function RemoveComponent( KFGUI_Base B );
function GetInputFocus()
{
if( Owner.InputFocus!=None )
if (Owner.InputFocus != None)
Owner.InputFocus.LostInputFocus();
Owner.InputFocus = Self;
}
function DropInputFocus()
{
if( Owner.InputFocus==Self )
if (Owner.InputFocus == Self)
{
Owner.InputFocus.LostInputFocus();
Owner.InputFocus = None;
@ -222,20 +222,20 @@ final function GrabKeyFocus()
}
final function ReleaseKeyFocus()
{
if( Owner.KeyboardFocus==Self )
if (Owner.KeyboardFocus == Self)
Owner.GrabInputFocus(None);
}
function LostKeyFocus();
function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, float AmountDepressed, bool bGamepad )
function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, float AmountDepressed, bool bGamepad)
{
if( bIsHUDWidget && bEnableInputs )
if (bIsHUDWidget && bEnableInputs)
{
switch( Key )
switch( Key)
{
case 'XboxTypeS_Start':
case 'Escape':
if( Event==IE_Pressed )
if (Event == IE_Pressed)
UserPressedEsc();
return true;
case 'XboxTypeS_DPad_Up':
@ -246,19 +246,19 @@ function bool NotifyInputKey( int ControllerId, name Key, EInputEvent Event, flo
case 'MouseScrollUp':
case 'MouseScrollDown':
case 'MouseScrollUp':
if( Event==IE_Pressed )
ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left');
if (Event == IE_Pressed)
ScrollMouseWheel(Key == 'MouseScrollUp' || Key == 'XboxTypeS_DPad_Up' || Key == 'XboxTypeS_DPad_Left');
return true;
}
}
return false;
}
function bool NotifyInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad )
function bool NotifyInputAxis( int ControllerId, name Key, float Delta, float DeltaTime, bool bGamepad)
{
return false;
}
function bool NotifyInputChar( int ControllerId, string Unicode )
function bool NotifyInputChar( int ControllerId, string Unicode)
{
return false;
}
@ -269,25 +269,25 @@ function InputMouseMoved();
// Notify any focused menu element that mouse has been idle over it.
function NotifyMousePaused();
final function GetActualPos( out float X, out float Y )
final function GetActualPos( out float X, out float Y)
{
X = ((XPosition+X)*InputPos[2]) + InputPos[0];
Y = ((YPosition+Y)*InputPos[3]) + InputPos[1];
}
final function GetRealtivePos( out float X, out float Y )
final function GetRealtivePos( out float X, out float Y)
{
X = X / CompPos[2];
Y = Y / CompPos[2];
}
simulated final function PlayMenuSound( EMenuSound Slot )
simulated final function PlayMenuSound( EMenuSound Slot)
{
local SoundCue S;
local KFGameEngine Engine;
Engine = KFGameEngine(class'Engine'.static.GetEngine());
switch( Slot )
switch( Slot)
{
case MN_FocusHover:
case MN_Focus:
@ -308,7 +308,7 @@ simulated final function PlayMenuSound( EMenuSound Slot )
break;
}
if( S!=None )
if (S != None)
{
S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f);
GetPlayer().PlaySound(S,true,,false);
@ -318,7 +318,7 @@ simulated final function PlayMenuSound( EMenuSound Slot )
// Pre level change notification.
function NotifyLevelChange();
final function SetPosition( float X, float Y, float XS, float YS )
final function SetPosition( float X, float Y, float XS, float YS)
{
XPosition = X;
YPosition = Y;
@ -326,7 +326,7 @@ final function SetPosition( float X, float Y, float XS, float YS )
YSize = YS;
}
static final function string MakeSortStr( int Value )
static final function string MakeSortStr( int Value)
{
local string S;
local int i;
@ -334,7 +334,7 @@ static final function string MakeSortStr( int Value )
// Prefix with zeroes to properly sort this string.
S = string(Value);
i = Len(S);
if( i<10 )
if (i < 10)
return Mid("0000000000",i)$S;
return S;
}

View File

@ -21,9 +21,9 @@ function bool GetUsingGamepad()
return Owner.bUsingGamepad && GamepadButtonName != "";
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
if( bRight )
if (bRight)
OnClickRight(Self);
else OnClickLeft(Self);
}

View File

@ -15,37 +15,37 @@ function DrawMenu()
local bool bDrawOverride;
bDrawOverride = DrawOverride(Canvas, Self);
if( !bDrawOverride )
if (!bDrawOverride)
{
if( bDisabled )
if (bDisabled)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED];
else if( bPressedDown )
else if (bPressedDown)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED];
else if( bFocused || bIsHighlighted )
else if (bFocused || bIsHighlighted)
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_NORMAL];
else Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_HIGHLIGHTED];
Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(Mat,CompPos[2],CompPos[3],0,0,32,32);
if( OverlayTexture.Texture!=None )
if (OverlayTexture.Texture != None)
{
Canvas.SetPos(0.f,0.f);
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL);
}
}
if( ButtonText!="" )
if (ButtonText != "")
{
Canvas.Font = Owner.CurrentStyle.MainFont;
TS = Owner.CurrentStyle.GetFontScaler();
TS *= FontScale;
while( true )
while( true)
{
Canvas.TextSize(ButtonText,XL,YL,TS,TS);
if( XL<(CompPos[2]*0.9) && YL<(CompPos[3]*0.9) )
if (XL < (CompPos[2]*0.9) && YL < (CompPos[3]*0.9))
break;
TS -= 0.001;
@ -55,12 +55,12 @@ function DrawMenu()
TextY = (CompPos[3]-YL)*0.5;
Canvas.SetPos(TextX, TextY);
if( bDisabled )
if (bDisabled)
Canvas.DrawColor = TextColor*0.5f;
else Canvas.DrawColor = TextColor;
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
if( Icon != None )
if (Icon != None)
{
Canvas.DrawColor = IconColor;

View File

@ -10,7 +10,7 @@ struct FCategoryItems
var name ID;
var KFGUI_Base Item;
};
var array<FCategoryItems> CategoryItems;
var array < FCategoryItems> CategoryItems;
function AddCategory(name CatID, string CatName, optional Texture2D IconMat, optional Color IconClr, optional float XS=1.f, optional float YS=1.f)
{
@ -25,7 +25,7 @@ function AddCategory(name CatID, string CatName, optional Texture2D IconMat, opt
B.OnClickRight = SelectedCategory;
}
function KFGUI_Base AddItemToCategory(name CatID, class<KFGUI_Base> Item)
function KFGUI_Base AddItemToCategory(name CatID, class < KFGUI_Base> Item)
{
local FCategoryItems CatItem;
local KFGUI_Base G;
@ -48,28 +48,28 @@ function SelectedCategory(KFGUI_Button Sender)
local KFGUI_CategoryButton CatB;
CatB = KFGUI_CategoryButton(Sender);
if( CatB == None )
if (CatB == None)
return;
Index = ItemComponents.Find(Sender);
if( Index != INDEX_NONE )
if (Index != INDEX_NONE)
{
if( !CatB.bOpened )
if (!CatB.bOpened)
{
CatB.bOpened = true;
j = Index+1;
for( i=0; i<CategoryItems.Length; i++ )
for (i=0; i < CategoryItems.Length; i++)
{
if( CategoryItems[i].ID == CatB.ID )
if (CategoryItems[i].ID == CatB.ID)
AddItemAtIndex(j++, CategoryItems[i].Item);
}
}
else
{
CatB.bOpened = false;
for( i=0; i<CategoryItems.Length; i++ )
for (i=0; i < CategoryItems.Length; i++)
{
if( CategoryItems[i].ID == CatB.ID )
if (CategoryItems[i].ID == CatB.ID)
ItemComponents.RemoveItem(CategoryItems[i].Item);
}
}
@ -80,9 +80,9 @@ function EmptyList()
{
local int i;
for( i=0; i<ItemComponents.Length; i++ )
for (i=0; i < ItemComponents.Length; i++)
{
if( KFGUI_CategoryButton(ItemComponents[i]) == None )
if (KFGUI_CategoryButton(ItemComponents[i]) == None)
ItemComponents.Remove(i, 1);
}
CategoryItems.Length = 0;

View File

@ -10,7 +10,7 @@ var() bool bForceUniform,bChecked;
function UpdateSizes()
{
Super.UpdateSizes();
if( bForceUniform )
if (bForceUniform)
XSize = (YSize*InputPos[3]) / InputPos[2];
}
@ -19,7 +19,7 @@ function DrawMenu()
Owner.CurrentStyle.RenderCheckbox(Self);
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
bChecked = !bChecked;
OnCheckChange(Self);

View File

@ -20,21 +20,21 @@ function InitMenu()
Super.InitMenu();
bClickable = !bDisabled;
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( !bDisabled )
if (!bDisabled)
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
}
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( !bDisabled && PressedDown[byte(bRight)]==1 )
if (!bDisabled && PressedDown[byte(bRight)] == 1)
{
PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
HandleMouseClick(bRight);
}
}
@ -48,11 +48,11 @@ function MouseLeave()
function MouseEnter()
{
Super.MouseEnter();
if( !bDisabled && bHoverSound )
if (!bDisabled && bHoverSound)
PlayMenuSound(MN_FocusHover);
}
function SetDisabled( bool bDisable )
function SetDisabled( bool bDisable)
{
Super.SetDisabled(bDisable);
bClickable = !bDisable;
@ -63,9 +63,9 @@ function SetDisabled( bool bDisable )
function NotifyMousePaused()
{
if( Owner.InputFocus==None && ToolTip!="" )
if (Owner.InputFocus == None && ToolTip != "")
{
if( ToolTipItem==None )
if (ToolTipItem == None)
{
ToolTipItem = New(None)Class'KFGUI_Tooltip';
ToolTipItem.Owner = Owner;
@ -79,9 +79,9 @@ function NotifyMousePaused()
ToolTipItem.GetInputFocus();
}
}
final function ChangeToolTip( string S )
final function ChangeToolTip( string S)
{
if( ToolTipItem!=None )
if (ToolTipItem != None)
ToolTipItem.SetText(S);
else ToolTip = S;
}

View File

@ -42,7 +42,7 @@ function SetDefaultColor(Color Def)
ASlider.UpdateListVis();
}
final function KFGUI_Slider AddSlider( string Cap, name IDN, int MinValue, int MaxValue, out KFGUI_TextLable Label, out KFGUI_TextLable ColorValueLabel )
final function KFGUI_Slider AddSlider( string Cap, name IDN, int MinValue, int MaxValue, out KFGUI_TextLable Label, out KFGUI_TextLable ColorValueLabel)
{
local KFGUI_Slider SL;
local KFGUI_MultiComponent MC;

View File

@ -13,8 +13,8 @@ struct FColumnItem
var transient bool bHidden;
var transient int X,XSize;
};
var() array<FColumnItem> Columns;
var() class<KFGUI_ListItem> ListItemClass;
var() array < FColumnItem> Columns;
var() class < KFGUI_ListItem> ListItemClass;
var() float FontSize;
var() color FocusedLineColor,SelectedLineColor;
var() float EdgeSize;
@ -36,13 +36,13 @@ var() bool bCanSortColumn; // Allow user to sort columns.
delegate OnSelectedRow( KFGUI_ListItem Item, int Row, bool bRight, bool bDblClick );
function KFGUI_ListItem AddLine( string Value, optional int iValue, optional string SortValue, optional int Index=-1 )
function KFGUI_ListItem AddLine( string Value, optional int iValue, optional string SortValue, optional int Index=-1)
{
local KFGUI_ListItem N,O;
local int i;
// Allocate list item object.
if( UnusedItem!=None )
if (UnusedItem != None)
{
N = UnusedItem;
UnusedItem = N.Next;
@ -54,27 +54,27 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
N.SetValue(Value,iValue,SortValue);
// Insert into list.
if( bShouldSortList && Index==-1 )
if (bShouldSortList && Index == -1)
{
N.Temp = N.GetSortStr(LastSortedColumn);
if( ListCount==0 ) // No sorting needed yet.
if (ListCount == 0 ) // No sorting needed yet.
{
N.Next = FirstItem;
FirstItem = N;
}
else if( bLastSortedReverse )
else if (bLastSortedReverse)
{
if( FirstItem.Temp<N.Temp )
if (FirstItem.Temp < N.Temp)
{
N.Next = FirstItem;
FirstItem = N;
}
else
{
for( O=FirstItem; O!=None; O=O.Next )
for (O=FirstItem; O != None; O=O.Next)
{
if( O.Next==None || O.Next.Temp<N.Temp )
if (O.Next == None || O.Next.Temp < N.Temp)
{
N.Next = O.Next;
O.Next = N;
@ -83,16 +83,16 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
}
}
}
else if( FirstItem.Temp>N.Temp )
else if (FirstItem.Temp > N.Temp)
{
N.Next = FirstItem;
FirstItem = N;
}
else
{
for( O=FirstItem; O!=None; O=O.Next )
for (O=FirstItem; O != None; O=O.Next)
{
if( O.Next==None || O.Next.Temp>N.Temp )
if (O.Next == None || O.Next.Temp > N.Temp)
{
N.Next = O.Next;
O.Next = N;
@ -101,9 +101,9 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
}
}
}
else if( Index==-1 || Index>ListCount )
else if (Index == -1 || Index > ListCount)
Index = ListCount;
if( Index==0 )
if (Index == 0)
{
N.Next = FirstItem;
FirstItem = N;
@ -111,9 +111,9 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
else
{
i = 0;
for( O=FirstItem; O!=None; O=O.Next )
for (O=FirstItem; O != None; O=O.Next)
{
if( (++i)==Index )
if ((++i) == Index)
{
N.Next = O.Next;
O.Next = N;
@ -125,26 +125,26 @@ function KFGUI_ListItem AddLine( string Value, optional int iValue, optional str
return N;
}
final function RemoveLine( KFGUI_ListItem I )
final function RemoveLine( KFGUI_ListItem I)
{
local KFGUI_ListItem N;
if( I.Index==-1 )
if (I.Index == -1)
return;
// Update selected row info.
if( SelectedRowIndex==I.Index )
if (SelectedRowIndex == I.Index)
SelectedRowIndex = -1;
else if( SelectedRowIndex>I.Index )
else if (SelectedRowIndex > I.Index)
--SelectedRowIndex;
// Remove from list.
if( FirstItem==I )
if (FirstItem == I)
FirstItem = I.Next;
else
{
for( N=FirstItem; N!=None; N=N.Next )
if( N.Next==I )
for (N=FirstItem; N != None; N=N.Next)
if (N.Next == I)
{
N.Next = I.Next;
break;
@ -162,7 +162,7 @@ final function EmptyList()
{
local KFGUI_ListItem N,I;
for( I=FirstItem; I!=None; I=N )
for (I=FirstItem; I != None; I=N)
{
N = I.Next;
@ -176,25 +176,25 @@ final function EmptyList()
UpdateListSize();
}
final function KFGUI_ListItem GetFromIndex( int Index )
final function KFGUI_ListItem GetFromIndex( int Index)
{
local KFGUI_ListItem N;
if( Index<0 || Index>=ListCount )
if (Index < 0 || Index >= ListCount)
return None;
for( N=FirstItem; N!=None; N=N.Next )
if( (Index--)==0 )
for (N=FirstItem; N != None; N=N.Next)
if ((Index--) == 0)
return N;
return None;
}
function SortColumn( int Column, optional bool bReverse )
function SortColumn( int Column, optional bool bReverse)
{
local array<KFGUI_ListItem> List;
local array < KFGUI_ListItem> List;
local KFGUI_ListItem Sel,N,P;
local int i;
if( !bCanSortColumn || Column<0 || Column>=Columns.Length )
if (!bCanSortColumn || Column < 0 || Column >= Columns.Length)
return;
LastSortedColumn = Column;
@ -210,20 +210,20 @@ function SortColumn( int Column, optional bool bReverse )
SelectedRowIndex = -1;
// Slow, sort it all.
for( N=FirstItem; N!=None; N=N.Next )
for (N=FirstItem; N != None; N=N.Next)
{
N.Temp = N.GetSortStr(Column);
if( bReverse )
if (bReverse)
{
for( i=0; i<List.Length; ++i )
if( List[i].Temp<N.Temp )
for (i=0; i < List.Length; ++i)
if (List[i].Temp < N.Temp)
break;
}
else
{
for( i=0; i<List.Length; ++i )
if( List[i].Temp>N.Temp )
for (i=0; i < List.Length; ++i)
if (List[i].Temp > N.Temp)
break;
}
List.Insert(i,1);
@ -233,14 +233,14 @@ function SortColumn( int Column, optional bool bReverse )
// Rebuild list.
FirstItem = None;
P = None;
for( i=0; i<List.Length; ++i )
for (i=0; i < List.Length; ++i)
{
N = List[i];
if( Sel==N )
if (Sel == N)
SelectedRowIndex = i;
N.Index = i;
N.Next = None;
if( P==None )
if (P == None)
FirstItem = N;
else P.Next = N;
P = N;
@ -254,7 +254,7 @@ final function UpdateListSize()
local KFGUI_ListItem N;
ListCount = 0;
for( N=FirstItem; N!=None; N=N.Next )
for (N=FirstItem; N != None; N=N.Next)
N.Index = ListCount++;
bListSizeDirty = true;
}
@ -266,7 +266,7 @@ function InitMenu()
ColumnComp = KFGUI_ColumnTop(FindComponentID('Columns'));
}
final function DrawStrClipped( string S, optional bool bOnlyTextures )
final function DrawStrClipped( string S, optional bool bOnlyTextures)
{
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
Owner.CurrentStyle.DrawTexturedString(S,Canvas.CurX,Canvas.CurY,TextScaler,LineFontInfo,false,bOnlyTextures);
@ -287,38 +287,38 @@ function DrawMenu()
// Mouse focused item check.
bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1;
if( bCheckMouse )
if (bCheckMouse)
MouseYHit = Owner.MousePosition.Y - CompPos[1];
n = ScrollBar.CurrentScroll;
i = 0;
for( C=FirstItem; C!=None; C=C.Next )
if( (i++)==n )
for (C=FirstItem; C != None; C=C.Next)
if ((i++) == n)
break;
Y = 0.f;
TextY = (ItemHeight-TextHeight)*0.5f;
XOffset = TextY*0.75;
Canvas.SetDrawColor(250,250,250,255);
for( i=0; (i<ListItemsPerPage && C!=None); ++i )
for (i=0; (i < ListItemsPerPage && C != None); ++i)
{
// Check for mouse hit.
if( bCheckMouse && FocusMouseItem==-1 )
if (bCheckMouse && FocusMouseItem == -1)
{
if( MouseYHit<ItemHeight )
if (MouseYHit < ItemHeight)
FocusMouseItem = n;
else MouseYHit-=ItemHeight;
else MouseYHit -= ItemHeight;
}
// Draw selection background.
if( SelectedRowIndex==n ) // Selected
if (SelectedRowIndex == n ) // Selected
{
Canvas.SetPos(EdgeSize,Y);
Canvas.DrawColor = SelectedLineColor;
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
Canvas.SetDrawColor(250,250,250,255);
}
else if( FocusMouseItem==n ) // Focused
else if (FocusMouseItem == n ) // Focused
{
Canvas.SetPos(EdgeSize,Y);
Canvas.DrawColor = FocusedLineColor;
@ -327,8 +327,8 @@ function DrawMenu()
}
// Draw columns of text
for( j=0; j<Columns.Length; ++j )
if( !Columns[j].bHidden )
for (j=0; j < Columns.Length; ++j)
if (!Columns[j].bHidden)
{
//Canvas.SetClip(Columns[j].X+Columns[j].XSize+EdgeSize,YClip);
Canvas.SetPos(Columns[j].X+XOffset+EdgeSize,TextY);
@ -346,7 +346,7 @@ function PreDraw()
local byte j;
local float XS,SpaceX;
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
@ -356,7 +356,7 @@ function PreDraw()
TextScaler *= FontSize;
Canvas.TextSize("ABC",XS,TextHeight,TextScaler,TextScaler);
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
{
ScrollBar.InputPos[j] = CompPos[j];
ColumnComp.InputPos[j] = CompPos[j];
@ -364,7 +364,7 @@ function PreDraw()
// Setup positioning.
// First compute the width scrollbar.
if( OldXSize!=InputPos[2] )
if (OldXSize != InputPos[2])
{
OldXSize = InputPos[2];
ScalerSize = ScrollBar.GetWidth();
@ -388,9 +388,9 @@ function PreDraw()
ItemHeight = TextHeight*1.025;
ListItemsPerPage = CompPos[3]/ItemHeight;
ItemHeight = CompPos[3]/ListItemsPerPage;
if( OldItemsPerFrame!=ListItemsPerPage || bListSizeDirty )
if (OldItemsPerFrame != ListItemsPerPage || bListSizeDirty)
{
if( SelectedRowIndex>=ListCount )
if (SelectedRowIndex >= ListCount)
SelectedRowIndex = -1;
OldItemsPerFrame = ListItemsPerPage;
bListSizeDirty = false;
@ -411,12 +411,12 @@ function PreDraw()
CompPos[2] += SpaceX;
CompPos[3] += ColumnComp.CompPos[3];
}
function InternalClickedItem( int Index, bool bRight, int MouseX, int MouseY )
function InternalClickedItem( int Index, bool bRight, int MouseX, int MouseY)
{
SelectedRowIndex = Index;
OnSelectedRow(GetFromIndex(Index),Index,bRight,false);
}
function InternalDblClickedItem( int Index, bool bRight, int MouseX, int MouseY )
function InternalDblClickedItem( int Index, bool bRight, int MouseX, int MouseY)
{
SelectedRowIndex = Index;
OnSelectedRow(GetFromIndex(Index),Index,bRight,true);

View File

@ -27,37 +27,37 @@ function DrawMenu()
MinSize = ColumnMinSize / CompPos[2];
// Scale column
if( bScaleColumn )
if (bScaleColumn)
{
MouseX = Owner.MousePosition.X - CompPos[0];
for( i=0; i<ScalingColumn; ++i )
MouseX-=(ListOwner.Columns[i].Width * CompPos[2]);
for (i=0; i < ScalingColumn; ++i)
MouseX -= (ListOwner.Columns[i].Width * CompPos[2]);
ListOwner.Columns[ScalingColumn].Width = MouseX / CompPos[2];
// Make sure no column is scrolled off screen.
X = 0;
for( i=0; i<(ListOwner.Columns.Length-1); ++i )
for (i=0; i < (ListOwner.Columns.Length-1); ++i)
{
if( ListOwner.Columns[i].Width<MinSize )
if (ListOwner.Columns[i].Width < MinSize)
ListOwner.Columns[i].Width = MinSize;
X+=ListOwner.Columns[i].Width;
if( X>=(1.f-MinSize) )
if (X >= (1.f-MinSize))
{
MouseX = X-(1.f-MinSize); // Grab overshoot.
// Then push back!
for( j=i; j>=0; --j )
for (j=i; j >= 0; --j)
{
if( (ListOwner.Columns[j].Width-MouseX)>MinSize ) // This column has enough space to retract.
if ((ListOwner.Columns[j].Width-MouseX) > MinSize ) // This column has enough space to retract.
{
ListOwner.Columns[j].Width-=MouseX;
ListOwner.Columns[j].Width -= MouseX;
MouseX = 0;
break;
}
else if( ListOwner.Columns[j].Width>MinSize ) // This column has limited space to retract.
else if (ListOwner.Columns[j].Width > MinSize ) // This column has limited space to retract.
{
MouseX-=(ListOwner.Columns[j].Width-MinSize);
MouseX -= (ListOwner.Columns[j].Width-MinSize);
ListOwner.Columns[j].Width = MinSize;
}
}
@ -69,7 +69,7 @@ function DrawMenu()
// Init mouse check.
MouseColumn = -1;
bCheckMouse = (bClickable && bFocused);
if( bCheckMouse )
if (bCheckMouse)
{
GrabWidth = CompPos[3]*0.175;
MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth;
@ -79,17 +79,17 @@ function DrawMenu()
// Draw the columns and compute the scalings.
X = 0;
j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1);
for( i=0; i<ListOwner.Columns.Length; ++i )
for (i=0; i < ListOwner.Columns.Length; ++i)
{
if( ListOwner.Columns[i].Width<MinSize )
if (ListOwner.Columns[i].Width < MinSize)
ListOwner.Columns[i].Width = MinSize;
Wd = ListOwner.Columns[i].Width * CompPos[2];
if( i==(ListOwner.Columns.Length-1) ) // Final column, give infinitive width.
if (i == (ListOwner.Columns.Length-1) ) // Final column, give infinitive width.
{
Wd = (CompPos[2]-X);
}
if( Wd<=0 ) // Impossible.
if (Wd <= 0 ) // Impossible.
{
ListOwner.Columns[i].bHidden = true;
continue;
@ -98,14 +98,14 @@ function DrawMenu()
ListOwner.Columns[i].X = X;
ListOwner.Columns[i].XSize = Wd;
if( bCheckMouse && (MouseX-=Wd)<=0.f )
if (bCheckMouse && (MouseX -= Wd) <= 0.f)
{
MouseColumn = i;
bCheckMouse = false;
bMouseScaler = (MouseX>=GrabWidth) && ((i+1)<ListOwner.Columns.Length);
bMouseScaler = (MouseX >= GrabWidth) && ((i+1) < ListOwner.Columns.Length);
}
if( X>=CompPos[2] )
if (X >= CompPos[2])
ListOwner.Columns[i].bHidden = true;
else
{
@ -113,13 +113,13 @@ function DrawMenu()
//Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]);
// Draw column.
if( i==j )
if (i == j)
{
if( MouseColumn==i && !bMouseScaler )
if (MouseColumn == i && !bMouseScaler)
Canvas.SetDrawColor(175,240,8,255);
else Canvas.SetDrawColor(128,200,56,255);
}
else if( MouseColumn==i && !bMouseScaler )
else if (MouseColumn == i && !bMouseScaler)
Canvas.SetDrawColor(220,220,8,255);
XS = Owner.CurrentStyle.DefaultHeight*0.5;
@ -134,14 +134,14 @@ function DrawMenu()
}
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( !ListOwner.bDisabled && bClickable )
if (!ListOwner.bDisabled && bClickable)
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
if( !bRight && bMouseScaler )
if (!bRight && bMouseScaler)
{
PlayMenuSound(MN_ClickButton);
bScaleColumn = true;
@ -150,24 +150,24 @@ function MouseClick( bool bRight )
}
}
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( bScaleColumn && !bRight )
if (bScaleColumn && !bRight)
{
bScaleColumn = false;
DropInputFocus();
return;
}
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 )
if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{
PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
if( MouseColumn>=0 )
if (MouseColumn >= 0)
{
ListOwner.SortColumn(MouseColumn,(PrevSortedColumn==MouseColumn));
if( PrevSortedColumn==MouseColumn )
ListOwner.SortColumn(MouseColumn,(PrevSortedColumn == MouseColumn));
if (PrevSortedColumn == MouseColumn)
PrevSortedColumn = -1;
else PrevSortedColumn = MouseColumn;
}
@ -175,14 +175,14 @@ function MouseRelease( bool bRight )
}
function byte GetCursorStyle()
{
if( bClickable )
if (bClickable)
return (bMouseScaler ? 2 : 1);
return 0;
}
function MouseLeave()
{
Super.MouseLeave();
if( !bScaleColumn )
if (!bScaleColumn)
{
PressedDown[0] = 0;
PressedDown[1] = 0;

View File

@ -6,7 +6,7 @@ Class KFGUI_ComboBox extends KFGUI_EditControl;
var KFGUI_ComboSelector Selection;
var float BorderSize;
var() array<string> Values;
var() array < string> Values;
var() int SelectedIndex;
var() color SelectedTextColor,TextColor;
var() bool bButtonStretched;
@ -14,7 +14,7 @@ var() bool bButtonStretched;
function UpdateSizes()
{
// Update height.
if( bScaleByFontSize )
if (bScaleByFontSize)
YSize = (TextHeight + (BorderSize*2)) / InputPos[3];
}
@ -23,10 +23,10 @@ function DrawMenu()
Owner.CurrentStyle.RenderComboBox(Self);
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
PlayMenuSound(MN_Dropdown);
if( Selection==None )
if (Selection == None)
{
Selection = New(None)Class'KFGUI_ComboSelector';
Selection.Owner = Owner;
@ -37,22 +37,22 @@ function HandleMouseClick( bool bRight )
Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y;
Selection.XSize = CompPos[2] / Owner.ScreenSize.X;
Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y);
if( (Selection.YPosition+Selection.YSize)>1.f )
Selection.YPosition-=((Selection.YPosition+Selection.YSize)-1.f);
if ((Selection.YPosition+Selection.YSize) > 1.f)
Selection.YPosition -= ((Selection.YPosition+Selection.YSize)-1.f);
Selection.GetInputFocus();
}
final function string GetCurrent()
{
if( SelectedIndex<Values.Length )
if (SelectedIndex < Values.Length)
return Values[SelectedIndex];
return "";
}
final function bool SetValue( string S )
final function bool SetValue( string S)
{
local int i;
i = Values.Find(S);
if( i==-1 )
if (i == -1)
return false;
SelectedIndex = i;
return true;

View File

@ -11,11 +11,11 @@ function DrawMenu()
Owner.CurrentStyle.RenderComboList(Self);
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
PlayMenuSound(MN_ClickButton);
DropInputFocus();
if( CurrentRow>=0 )
if (CurrentRow >= 0)
{
Combo.SelectedIndex = CurrentRow;
Combo.OnComboChanged(Combo);

View File

@ -6,20 +6,20 @@ Class KFGUI_ComponentList extends KFGUI_List;
var int VisRange[2];
var() int NumColumns;
var array<KFGUI_Base> ItemComponents;
var array < KFGUI_Base> ItemComponents;
// REMEMBER to call InitMenu() on the newly created component after values are init!!!
final function KFGUI_Base AddListComponent( class<KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f )
final function KFGUI_Base AddListComponent( class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f)
{
return AddComponentAtIndex(ItemComponents.Length, CompClass, XS, YS);
}
final function KFGUI_Base CreateComponent(class<KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f)
final function KFGUI_Base CreateComponent(class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f)
{
local KFGUI_Base G;
G = new(Self)CompClass;
if( G==None )
if (G == None)
return None;
G.XPosition = (1.f - XS) * 0.5f;
@ -30,17 +30,17 @@ final function KFGUI_Base CreateComponent(class<KFGUI_Base> CompClass, optional
return G;
}
final function AddItem( KFGUI_Base Item )
final function AddItem( KFGUI_Base Item)
{
AddItemAtIndex(ItemComponents.Length, Item);
}
final function AddItemAtIndex( int i, KFGUI_Base Item )
final function AddItemAtIndex( int i, KFGUI_Base Item)
{
ItemComponents.InsertItem(i, Item);
}
final function KFGUI_Base AddComponentAtIndex( int i, class<KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f )
final function KFGUI_Base AddComponentAtIndex( int i, class < KFGUI_Base> CompClass, optional float XS=1.f, optional float YS=1.f)
{
local KFGUI_Base G;
@ -66,7 +66,7 @@ function InitMenu()
function DrawMenu()
{
if( bDrawBackground )
if (bDrawBackground)
{
Canvas.SetDrawColor(250,250,250,255);
Canvas.SetPos(0.f,0.f);
@ -79,25 +79,25 @@ function PreDraw()
local int i;
local byte j;
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
// Update list size
i = ItemComponents.Length / NumColumns;
if( i!=NumColumns )
if (i != NumColumns)
{
ListCount = i;
UpdateListVis();
}
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{
// First draw scrollbar to allow it to resize itself.
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
ScrollBar.InputPos[j] = CompPos[j];
if( OldXSize!=InputPos[2] )
if (OldXSize != InputPos[2])
{
OldXSize = InputPos[2];
}
@ -132,7 +132,7 @@ function PreDrawListItems()
YS = CompPos[3] / ListItemsPerPage;
VisRange[0] = (ScrollBar.CurrentScroll*NumColumns);
VisRange[1] = ItemComponents.Length;
for( i=VisRange[0]; i<VisRange[1]; ++i )
for (i=VisRange[0]; i < VisRange[1]; ++i)
{
ItemComponents[i].Canvas = Canvas;
ItemComponents[i].InputPos[0] = CompPos[0]+XS*XNum;
@ -141,10 +141,10 @@ function PreDrawListItems()
ItemComponents[i].InputPos[3] = YS;
ItemComponents[i].PreDraw();
if( ++XNum==NumColumns )
if (++XNum == NumColumns)
{
XNum = 0;
if( ++r==ListItemsPerPage )
if (++r == ListItemsPerPage)
{
VisRange[1] = i+1;
break;
@ -170,11 +170,11 @@ function bool CaptureMouse()
{
local int i;
if( ItemComponents.Length > 0 )
if (ItemComponents.Length > 0)
{
for( i=VisRange[1] - 1; i>=VisRange[0] && i<ItemComponents.Length; i-- )
for (i=VisRange[1] - 1; i >= VisRange[0] && i < ItemComponents.Length; i--)
{
if( ItemComponents[i].CaptureMouse() )
if (ItemComponents[i].CaptureMouse())
{
MouseArea = ItemComponents[i];
return true;
@ -188,7 +188,7 @@ function CloseMenu()
{
local int i;
for( i=0; i<ItemComponents.Length; ++i )
for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].CloseMenu();
Super.CloseMenu();
}
@ -196,7 +196,7 @@ function NotifyLevelChange()
{
local int i;
for( i=0; i<ItemComponents.Length; ++i )
for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].NotifyLevelChange();
Super.NotifyLevelChange();
}
@ -204,15 +204,15 @@ function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
{
local int i;
for( i=0; i<ItemComponents.Length; ++i )
for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].InventoryChanged(Wep,bRemove);
}
function MenuTick( float DeltaTime )
function MenuTick( float DeltaTime)
{
local int i;
Super.MenuTick(DeltaTime);
for( i=0; i<ItemComponents.Length; ++i )
for (i=0; i < ItemComponents.Length; ++i)
ItemComponents[i].MenuTick(DeltaTime);
}

View File

@ -23,7 +23,7 @@ function InitMenu()
{
Super.InitMenu();
if ( bIntOnly || bFloatOnly )
if (bIntOnly || bFloatOnly)
{
AllowedCharSet = "0123456789";
@ -55,31 +55,31 @@ function bool NotifyInputChar(int Key, string Unicode)
if (bReadOnly)
return false;
if( UniCode!="" )
if (UniCode != "")
S = Unicode;
else S = Chr(Key);
if( Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27 )
if (Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27)
return false;
if( bCtrl )
if (bCtrl)
return false;
if(bAllSelected)
if (bAllSelected)
{
TextStr="";
CaretPos=0;
bAllSelected=false;
}
if ( (AllowedCharSet=="") || ( (bIncludeSign) && ( (S=="-") || (S=="+") ) && (TextStr=="") ) || (InStr(AllowedCharSet,S)>=0) )
if ((AllowedCharSet == "") || ( (bIncludeSign) && ( (S == "-") || (S == "+") ) && (TextStr == "") ) || (InStr(AllowedCharSet,S) >= 0))
{
if ( (MaxWidth==0) || (Len(TextStr)<MaxWidth) )
if ((MaxWidth == 0) || (Len(TextStr) < MaxWidth))
{
if ( (bConvertSpaces) && ((S==" ") || (S=="?") || (S=="\\")) )
if ((bConvertSpaces) && ((S == " ") || (S == "?") || (S == "\\")))
S = "_";
if ( (TextStr=="") || ( CaretPos==Len(TextStr) ) )
if ((TextStr == "") || ( CaretPos == Len(TextStr) ))
{
TextStr = TextStr$S;
CaretPos=Len(TextStr);
@ -181,7 +181,7 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
{
local string Temp;
if( bReadOnly )
if (bReadOnly)
{
return false;
}
@ -190,9 +190,9 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
{
return false;
}
else if( Key == 'Escape' && Event == IE_Pressed )
else if (Key == 'Escape' && Event == IE_Pressed)
{
if( TextStr!="" )
if (TextStr != "")
{
SetInputText("");
CaretPos = 0;
@ -200,20 +200,20 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
}
else
{
if( ParentComponent != None )
if (ParentComponent != None)
{
ParentComponent.UserPressedEsc();
return true;
}
}
}
else if( Key=='Enter' && Event == IE_Released )
else if (Key == 'Enter' && Event == IE_Released)
{
if( TextStr!="" )
if (TextStr != "")
{
Temp = TextStr;
OnTextFinished(self, Temp);
if( !bNoClearOnEnter )
if (!bNoClearOnEnter)
{
SetInputText("");
CaretPos = 0;
@ -222,26 +222,26 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
return true;
}
else if ( Key=='Home' )
else if (Key == 'Home')
{
CaretPos = 0;
return true;
}
else if ( Key=='End' )
else if (Key == 'End')
{
CaretPos = Len(TextStr);
return true;
}
else if( Event == IE_Pressed || Event == IE_Repeat )
else if (Event == IE_Pressed || Event == IE_Repeat)
{
if( Key=='Backspace' || Key=='Delete' )
if (Key == 'Backspace' || Key == 'Delete')
{
if( bAllSelected )
if (bAllSelected)
{
SetInputText("");
CaretPos = 0;
}
else if( CaretPos>0 )
else if (CaretPos > 0)
{
SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos));
CaretPos -= 1;
@ -249,12 +249,12 @@ function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, floa
return true;
}
else if ( Key=='Left' )
else if (Key == 'Left')
{
CaretPos = Max(0, CaretPos - 1);
return true;
}
else if ( Key=='Right' )
else if (Key == 'Right')
{
CaretPos = Min(Len(TextStr), CaretPos + 1);
return true;
@ -272,15 +272,15 @@ function string ConvertIllegal(string InputStr)
i = 0;
Max = Len(InputStr);
while ( i < Max )
while ( i < Max)
{
C = Mid(InputStr,i,1);
if ( AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0 )
if (AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0)
{
C = "";
}
if ( bConvertSpaces &&
((C == " ") || (C =="?") || (C=="\\") ))
if (bConvertSpaces &&
((C == " ") || (C =="?") || (C == "\\") ))
{
C = "_";
}
@ -313,7 +313,7 @@ function DrawMenu()
Super.DrawMenu();
if( bDrawBackground )
if (bDrawBackground)
{
Canvas.SetDrawColor(250,250,250,255);
Canvas.SetPos(0.f,0.f);
@ -327,12 +327,12 @@ function DrawMenu()
Storage = TextStr;
if ( bMaskText && Len(Storage)>0 )
if (bMaskText && Len(Storage) > 0)
{
StorageLength = Len(Storage);
Storage = "";
for(MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++ )
for (MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++)
{
Storage $= "*";
}
@ -343,16 +343,16 @@ function DrawMenu()
BoxWidth=CompPos[2]*0.9875;
if ( (Len(Storage) != LastLength) || (CaretPos!=LastCaret) )
if ((Len(Storage) != LastLength) || (CaretPos != LastCaret))
{
if (CaretPos<=FirstVis)
if (CaretPos <= FirstVis)
FirstVis = Max(0,CaretPos-1);
else
{
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale);
while ( (XL>=BoxWidth) && (FirstVis<Len(Storage)) )
while ( (XL >= BoxWidth) && (FirstVis < Len(Storage)))
{
FirstVis++;
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
@ -371,7 +371,7 @@ function DrawMenu()
if (!bReadOnly && (Owner.KeyboardFocus == self || bForceShowCaret))
{
if ( (FirstVis==CaretPos) || (Len(FinalDraw)==0) )
if ((FirstVis == CaretPos) || (Len(FinalDraw) == 0))
{
Canvas.TextSize("W", XL, YL, FontScale, FontScale);
XL = BorderSize;
@ -385,7 +385,7 @@ function DrawMenu()
CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2);
if(bAllSelected)
if (bAllSelected)
{
Canvas.SetDrawColor(255,255,255,195);
Canvas.SetPos(BorderSize, CursorY);
@ -404,9 +404,9 @@ function DrawMenu()
Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI);
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
if( Owner.KeyboardFocus != self )
if (Owner.KeyboardFocus != self)
{
GrabKeyFocus();
}

View File

@ -16,7 +16,7 @@ var(Lable) bool bScaleByFontSize; // Scale this component height by font height.
function InitMenu()
{
if( LableString=="" )
if (LableString == "")
TextLable = None;
else
{
@ -40,7 +40,7 @@ function InitMenu()
function UpdateSizes()
{
// Update height.
if( bScaleByFontSize )
if (bScaleByFontSize)
YSize = ((TextHeight*1.05) + 6) / InputPos[3];
}
@ -59,26 +59,26 @@ function PreDraw()
UpdateSizes();
Super.PreDraw();
if( TextLable!=None )
if (TextLable != None)
{
TextLable.YSize = YSize;
TextLable.Canvas = Canvas;
for( i=0; i<4; ++i )
for (i=0; i < 4; ++i)
TextLable.InputPos[i] = InputPos[i];
TextLable.PreDraw();
}
}
final function DrawClippedText( string S, float TScale, float MaxX )
final function DrawClippedText( string S, float TScale, float MaxX)
{
local int i,l;
local float X,XL,YL;
l = Len(S);
for( i=0; i<l; ++i )
for (i=0; i < l; ++i)
{
Canvas.TextSize(Mid(S,i,1),XL,YL,TScale,TScale);
if( (Canvas.CurX+X+XL)>MaxX )
if ((Canvas.CurX+X+XL) > MaxX)
{
--i;
break;

View File

@ -29,25 +29,25 @@ function DrawMenu()
{
local float TempSize;
if( bUseAnimation )
if (bUseAnimation)
{
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime);
if ( WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity )
if (WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity)
FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
}
Owner.CurrentStyle.RenderFramedWindow(Self);
if( HeaderComp!=None )
if (HeaderComp != None)
{
HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight;
HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height.
}
}
function SetWindowDrag( bool bDrag )
function SetWindowDrag( bool bDrag)
{
bDragWindow = bDrag;
if( bDrag )
if (bDrag)
{
DragOffset[0] = Owner.MousePosition.X-CompPos[0];
DragOffset[1] = Owner.MousePosition.Y-CompPos[1];
@ -57,15 +57,15 @@ function bool CaptureMouse()
{
local int i;
if( bDragWindow && HeaderComp!=None ) // Always keep focus on window frame now!
if (bDragWindow && HeaderComp != None ) // Always keep focus on window frame now!
{
MouseArea = HeaderComp;
return true;
}
for( i=0; i<Components.Length; i++ )
for (i=0; i < Components.Length; i++)
{
if( Components[i].CaptureMouse() )
if (Components[i].CaptureMouse())
{
MouseArea = Components[i];
return true;
@ -80,7 +80,7 @@ function PreDraw()
{
local float Frac, CenterX, CenterY;
if( bUseAnimation )
if (bUseAnimation)
{
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
@ -92,7 +92,7 @@ function PreDraw()
XPosition = Lerp(CenterX, default.XPosition, Frac);
YPosition = Lerp(CenterY, default.YPosition, Frac);
if( bDragWindow )
if (bDragWindow)
{
XPosition = FClamp(Owner.MousePosition.X-DragOffset[0],0,InputPos[2]-CompPos[2]) / InputPos[2];
YPosition = FClamp(Owner.MousePosition.Y-DragOffset[1],0,InputPos[3]-CompPos[3]) / InputPos[3];

View File

@ -9,14 +9,14 @@ function PreDraw()
{
ComputeCoords();
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( !bRight )
if (!bRight)
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(true);
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( !bRight )
if (!bRight)
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(false);
}

View File

@ -18,14 +18,14 @@ function DrawMenu()
{
local float TempSize;
if( bUseAnimation )
if (bUseAnimation)
{
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime);
if ( WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity )
if (WindowFadeInTime - TempSize > 0 && FrameOpacity != default.FrameOpacity)
FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
}
if( bDrawBackground )
if (bDrawBackground)
{
OnDrawFrame(Canvas, CompPos[2], CompPos[3]);
}
@ -36,13 +36,13 @@ delegate OnDrawFrame(Canvas C, float W, Float H)
local float T,XL,YL,HeaderH;
local FontRenderInfo FRI;
if( FrameTex == None )
if (FrameTex == None)
{
return;
}
C.SetDrawColor(255,255,255,FrameOpacity);
if( bUseLegacyDrawTile )
if (bUseLegacyDrawTile)
{
Owner.CurrentStyle.DrawTileStretched(FrameTex,0,0,W,H);
}
@ -52,7 +52,7 @@ delegate OnDrawFrame(Canvas C, float W, Float H)
Canvas.DrawTileStretched(FrameTex,W,H,0,0,FrameTex.GetSurfaceWidth(),FrameTex.GetSurfaceHeight());
}
if( bDrawHeader && WindowTitle!="" )
if (bDrawHeader && WindowTitle != "")
{
FRI.bClipText = true;
FRI.bEnableShadow = true;
@ -64,7 +64,7 @@ delegate OnDrawFrame(Canvas C, float W, Float H)
C.TextSize(WindowTitle, XL, YL, T, T);
HeaderH = EdgeSize[1]-HeaderSize[1];
if( bHeaderCenter )
if (bHeaderCenter)
C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2));
else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2));
@ -78,10 +78,10 @@ function PreDraw()
local byte j;
local float Frac, CenterX, CenterY;
if( !bVisible )
if (!bVisible)
return;
if( bUseAnimation )
if (bUseAnimation)
{
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
@ -100,10 +100,10 @@ function PreDraw()
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu();
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
Components[i].Canvas = Canvas;
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
{
Components[i].InputPos[j] = CompPos[j]+EdgeSize[j];
}

View File

@ -25,7 +25,7 @@ function DrawMenu()
{
local float X, Y, XL, YL;
if( Image == None )
if (Image == None)
return;
DrawBackground(Canvas, CompPos[2], CompPos[3]);
@ -35,17 +35,17 @@ function DrawMenu()
switch (ImageStyle)
{
case ISTY_Normal:
if( X1 != -1 )
if (X1 != -1)
X = X1;
else X = 0;
if( Y1 != -1 )
if (Y1 != -1)
Y = Y1;
else Y = 0;
if( bForceUniformSize )
if (bForceUniformSize)
{
if( ScaleStyle == ISTY_Height )
if (ScaleStyle == ISTY_Height)
{
YL = CompPos[3];
XL = YL;
@ -58,16 +58,16 @@ function DrawMenu()
}
else
{
if( Y2 == -1 )
if (Y2 == -1)
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
else YL = (Y2-Y1);
if( X2 == -1 )
if (X2 == -1)
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
else XL = (X2-X1);
}
if( bAlignCenter )
if (bAlignCenter)
{
Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2));
Canvas.DrawTile(Image, XL, YL, X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
@ -80,21 +80,21 @@ function DrawMenu()
break;
case ISTY_Stretched:
if ( X1 < 0 && X2 < 0 && Y1 < 0 && Y2 < 0 )
if (X1 < 0 && X2 < 0 && Y1 < 0 && Y2 < 0 )
Owner.CurrentStyle.DrawTileStretched(Image, 0.f, 0.f, CompPos[2], CompPos[3]);
else
{
if ( X1 != -1 )
if (X1 != -1)
X = X1;
else X = 0;
if( Y1 != -1 )
if (Y1 != -1)
Y = Y1;
else Y = 0;
if( bForceUniformSize )
if (bForceUniformSize)
{
if( ScaleStyle == ISTY_Height )
if (ScaleStyle == ISTY_Height)
{
YL = CompPos[3];
XL = YL;
@ -107,16 +107,16 @@ function DrawMenu()
}
else
{
if( Y2 == -1 )
if (Y2 == -1)
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
else YL = (Y2-Y1);
if( X2 == -1 )
if (X2 == -1)
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
else XL = (X2-X1);
}
if( bAlignCenter )
if (bAlignCenter)
{
Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2));
Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());

View File

@ -36,7 +36,7 @@ function DrawMenu()
local float Y;
local bool bCheckMouse;
if( bDrawBackground )
if (bDrawBackground)
{
Canvas.DrawColor = BackgroundColor;
Canvas.SetPos(0.f,0.f);
@ -46,30 +46,30 @@ function DrawMenu()
// Mouse focused item check.
bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1;
if( bCheckMouse )
if (bCheckMouse)
MouseYHit = Owner.MousePosition.Y - CompPos[1];
n = ScrollBar.CurrentScroll;
ItemHeight = CompPos[3] / ListItemsPerPage;
Y = 0.f;
for( i=0; i<ListItemsPerPage; ++i )
for (i=0; i < ListItemsPerPage; ++i)
{
if( n>=ListCount )
if (n >= ListCount)
break;
if( bCheckMouse && FocusMouseItem==-1 )
if (bCheckMouse && FocusMouseItem == -1)
{
if( MouseYHit<ItemHeight )
if (MouseYHit < ItemHeight)
FocusMouseItem = n;
else MouseYHit-=ItemHeight;
else MouseYHit -= ItemHeight;
}
OnDrawItem(Canvas,n,Y,ItemHeight,CompPos[2],(FocusMouseItem==n));
OnDrawItem(Canvas,n,Y,ItemHeight,CompPos[2],(FocusMouseItem == n));
Y+=ItemHeight;
++n;
}
if( LastFocusItem!=FocusMouseItem )
if (LastFocusItem != FocusMouseItem)
{
LastFocusItem = FocusMouseItem;
if( bUseFocusSound )
if (bUseFocusSound)
{
PlayMenuSound(MN_FocusHover);
}
@ -81,17 +81,17 @@ function PreDraw()
local int i;
local byte j;
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{
// First draw scrollbar to allow it to resize itself.
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
ScrollBar.InputPos[j] = CompPos[j];
if( OldXSize!=InputPos[2] )
if (OldXSize != InputPos[2])
{
OldXSize = InputPos[2];
ScrollBar.XPosition = 1.f - ScrollBar.GetWidth();
@ -114,12 +114,12 @@ function PreDraw()
}
// Then draw rest of components.
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
if( Components[i]!=ScrollBar )
if (Components[i] != ScrollBar)
{
Components[i].Canvas = Canvas;
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw();
}
@ -127,7 +127,7 @@ function PreDraw()
}
function UpdateListVis()
{
if( ListCount<=ListItemsPerPage )
if (ListCount <= ListItemsPerPage)
{
ScrollBar.UpdateScrollSize(0,1,1,1);
ScrollBar.SetDisabled(true);
@ -138,9 +138,9 @@ function UpdateListVis()
ScrollBar.SetDisabled(false);
}
}
function ChangeListSize( int NewSize )
function ChangeListSize( int NewSize)
{
if( ListCount==NewSize )
if (ListCount == NewSize)
return;
ListCount = NewSize;
UpdateListVis();
@ -150,29 +150,29 @@ final function int GetListSize()
return ListCount;
}
function DoubleMouseClick( bool bRight )
function DoubleMouseClick( bool bRight)
{
if( !bDisabled && bClickable )
if (!bDisabled && bClickable)
{
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnDblClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit);
}
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( !bDisabled && bClickable )
if (!bDisabled && bClickable)
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
}
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 )
if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit);
}
}
@ -189,15 +189,15 @@ function MouseEnter()
LastFocusItem = -1;
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
if( !ScrollBar.bDisabled )
if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp);
}
function NotifyMousePaused()
{
if( Owner.InputFocus==None && FocusMouseItem>=0 )
if (Owner.InputFocus == None && FocusMouseItem >= 0)
OnMouseRest(FocusMouseItem);
}

View File

@ -37,7 +37,7 @@ function DrawMenu()
local float X;
local bool bCheckMouse;
if( bDrawBackground )
if (bDrawBackground)
{
//Canvas.DrawColor = BackgroundColor;
Canvas.SetDrawColor(250,250,250,255);
@ -48,30 +48,30 @@ function DrawMenu()
// Mouse focused item check.
bCheckMouse = bClickable && bFocused;
FocusMouseItem = -1;
if( bCheckMouse )
if (bCheckMouse)
MouseXHit = Owner.MousePosition.X - CompPos[0];
n = ScrollBar.CurrentScroll;
ItemWidth = CompPos[2] / ListItemsPerPage;
X = 0.f;
for( i=0; i<ListItemsPerPage; ++i )
for (i=0; i < ListItemsPerPage; ++i)
{
if( n>=ListCount )
if (n >= ListCount)
break;
if( bCheckMouse && FocusMouseItem==-1 )
if (bCheckMouse && FocusMouseItem == -1)
{
if( MouseXHit<ItemWidth )
if (MouseXHit < ItemWidth)
FocusMouseItem = n;
else MouseXHit-=ItemWidth;
else MouseXHit -= ItemWidth;
}
OnDrawItem(Canvas,n,X,CompPos[3],ItemWidth,(FocusMouseItem==n));
OnDrawItem(Canvas,n,X,CompPos[3],ItemWidth,(FocusMouseItem == n));
X+=ItemWidth;
++n;
}
if( LastFocusItem!=FocusMouseItem )
if (LastFocusItem != FocusMouseItem)
{
LastFocusItem = FocusMouseItem;
if( bUseFocusSound )
if (bUseFocusSound)
{
PlayMenuSound(MN_FocusHover);
}
@ -83,17 +83,17 @@ function PreDraw()
local int i;
local byte j;
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
if (!ScrollBar.bDisabled && !ScrollBar.bHideScrollbar)
{
// First draw scrollbar to allow it to resize itself.
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
ScrollBar.InputPos[j] = CompPos[j];
if( OldYSize!=InputPos[3] )
if (OldYSize != InputPos[3])
{
OldYSize = InputPos[3];
ScrollBar.YPosition = 1.f - ScrollBar.GetWidth();
@ -116,12 +116,12 @@ function PreDraw()
}
// Then draw rest of components.
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
if( Components[i]!=ScrollBar )
if (Components[i] != ScrollBar)
{
Components[i].Canvas = Canvas;
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw();
}
@ -129,7 +129,7 @@ function PreDraw()
}
function UpdateListVis()
{
if( ListCount<=ListItemsPerPage )
if (ListCount <= ListItemsPerPage)
{
ScrollBar.UpdateScrollSize(0,1,1,1);
ScrollBar.SetDisabled(true);
@ -140,9 +140,9 @@ function UpdateListVis()
ScrollBar.SetDisabled(false);
}
}
function ChangeListSize( int NewSize )
function ChangeListSize( int NewSize)
{
if( ListCount==NewSize )
if (ListCount == NewSize)
return;
ListCount = NewSize;
UpdateListVis();
@ -152,31 +152,31 @@ final function int GetListSize()
return ListCount;
}
function DoubleMouseClick( bool bRight )
function DoubleMouseClick( bool bRight)
{
if( !bDisabled && bClickable )
if (!bDisabled && bClickable)
{
PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnDblClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]);
}
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( !bDisabled && bClickable )
if (!bDisabled && bClickable)
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
}
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 )
if (!bDisabled && bClickable && PressedDown[byte(bRight)] == 1)
{
PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
OnClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]);
}
}
@ -191,19 +191,19 @@ function MouseEnter()
{
Super.MouseEnter();
LastFocusItem = -1;
if( !bDisabled && bClickable && bUseFocusSound )
if (!bDisabled && bClickable && bUseFocusSound)
PlayMenuSound(MN_FocusHover);
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
if( !ScrollBar.bDisabled )
if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp);
}
function NotifyMousePaused()
{
if( Owner.InputFocus==None && FocusMouseItem>=0 )
if (Owner.InputFocus == None && FocusMouseItem >= 0)
OnMouseRest(FocusMouseItem);
}

View File

@ -5,37 +5,37 @@ Class KFGUI_ListItem extends Object
`include(Logger.uci)
var KFGUI_ListItem Next;
var array<string> Columns,SortColumns;
var array < string> Columns,SortColumns;
var int Index,Value;
var transient string Temp; // Cache sorting key.
function SetValue( string S, int i, string SortStr )
function SetValue( string S, int i, string SortStr)
{
ParseStringIntoArray(S,Columns,"\n",false);
if( SortStr=="" )
if (SortStr == "")
SortColumns.Length = 0;
else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false);
Value = i;
}
// Return string to draw on HUD.
function string GetDisplayStr( int Column )
function string GetDisplayStr( int Column)
{
if( Column<Columns.Length )
if (Column < Columns.Length)
return Columns[Column];
return "";
}
// Return string to compare string with.
function string GetSortStr( int Column )
function string GetSortStr( int Column)
{
if( SortColumns.Length>0 )
if (SortColumns.Length > 0)
{
if( Column<SortColumns.Length )
if (Column < SortColumns.Length)
return SortColumns[Column];
}
if( Column<Columns.Length )
if (Column < Columns.Length)
return Caps(Columns[Column]);
return "";
}

View File

@ -3,13 +3,13 @@ Class KFGUI_MultiComponent extends KFGUI_Base;
`include(Build.uci)
`include(Logger.uci)
var() export editinline array<KFGUI_Base> Components;
var() export editinline array < KFGUI_Base> Components;
function InitMenu()
{
local int i;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
Components[i].Owner = Owner;
Components[i].ParentComponent = Self;
@ -20,7 +20,7 @@ function ShowMenu()
{
local int i;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].ShowMenu();
}
function PreDraw()
@ -28,7 +28,7 @@ function PreDraw()
local int i;
local byte j;
if( !bVisible )
if (!bVisible)
return;
ComputeCoords();
@ -36,10 +36,10 @@ function PreDraw()
Canvas.SetOrigin(CompPos[0],CompPos[1]);
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu();
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
Components[i].Canvas = Canvas;
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j];
Components[i].PreDraw();
}
@ -48,19 +48,19 @@ function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
{
local int i;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].InventoryChanged(Wep,bRemove);
}
function MenuTick( float DeltaTime )
function MenuTick( float DeltaTime)
{
local int i;
Super.MenuTick(DeltaTime);
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].MenuTick(DeltaTime);
}
function AddComponent( KFGUI_Base C )
function AddComponent( KFGUI_Base C)
{
Components[Components.Length] = C;
C.Owner = Owner;
@ -72,16 +72,16 @@ function CloseMenu()
{
local int i;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].CloseMenu();
}
function bool CaptureMouse()
{
local int i;
for( i=Components.Length - 1; i>=0; i-- )
for (i=Components.Length - 1; i >= 0; i--)
{
if( Components[i].CaptureMouse() )
if (Components[i].CaptureMouse())
{
MouseArea = Components[i];
return true;
@ -94,9 +94,9 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
{
local int i;
for( i=Components.Length - 1; i>=0; i-- )
for (i=Components.Length - 1; i >= 0; i--)
{
if( Components[i].ReceievedControllerInput(ControllerId, Key, Event) )
if (Components[i].ReceievedControllerInput(ControllerId, Key, Event))
{
return true;
}
@ -104,47 +104,47 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
return Super.ReceievedControllerInput(ControllerId, Key, Event);
}
function KFGUI_Base FindComponentID( name InID )
function KFGUI_Base FindComponentID( name InID)
{
local int i;
local KFGUI_Base Result;
if( ID==InID )
if (ID == InID)
Result = Self;
else
{
for( i=0; i<Components.Length && Result==None; ++i )
for (i=0; i < Components.Length && Result == None; ++i)
Result = Components[i].FindComponentID(InID);
}
return Result;
}
function FindAllComponentID( name InID, out array<KFGUI_Base> Res )
function FindAllComponentID( name InID, out array < KFGUI_Base> Res)
{
local int i;
if( ID==InID )
if (ID == InID)
Res[Res.Length] = Self;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].FindAllComponentID(InID,Res);
}
function RemoveComponent( KFGUI_Base B )
function RemoveComponent( KFGUI_Base B)
{
local int i;
for( i=0; i<Components.Length; ++i )
if( Components[i]==B )
for (i=0; i < Components.Length; ++i)
if (Components[i] == B)
{
Components.Remove(i,1);
B.CloseMenu();
return;
}
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].RemoveComponent(B);
}
function NotifyLevelChange()
{
local int i;
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
Components[i].NotifyLevelChange();
}

View File

@ -15,7 +15,7 @@ var bool bWindowFocused; // This page is currently focused.
function DrawMenu()
{
if( !bNoBackground )
if (!bNoBackground)
{
Owner.CurrentStyle.RenderWindow(Self);
}

View File

@ -44,12 +44,12 @@ function DrawMenu()
{
W = CaptionWidth;
if( W < 1.0 )
if (W < 1.0)
{
W *= Width;
}
if( W > Width )
if (W > Width)
{
W = Width;
}
@ -60,21 +60,21 @@ function DrawMenu()
Width -= W;
}
if ( (bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0)
if ((bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0)
{
W = ValueRightWidth;
if( W < 1.0 )
if (W < 1.0)
{
W *= Width;
}
if( W > Width )
if (W > Width)
{
W = Width;
}
if( bShowValue && bShowHigh )
if (bShowValue && bShowHigh)
{
S = int(Value)$"/"$int(High);
}
@ -99,12 +99,12 @@ function DrawMenu()
}
Canvas.SetDrawColor(255, 255, 255, 255);
if( Width > 0.0 && BarBack != None )
if (Width > 0.0 && BarBack != None)
{
Owner.CurrentStyle.DrawTileStretched(BarBack, Left, Top, Width, Height);
}
if( Width > 0.0 && BarTop != None && Value > Low )
if (Width > 0.0 && BarTop != None && Value > Low)
{
Canvas.DrawColor = BarColor;
Owner.CurrentStyle.DrawTileStretched(BarTop, Left + BorderSize, Top + BorderSize, (Width - (BorderSize * 2)) * (Value/High), Height - (BorderSize * 2));

View File

@ -8,14 +8,14 @@ struct FRowItem
var string Text,ToolTip;
var bool bSplitter,bDisabled;
};
var array<FRowItem> ItemRows;
var array < FRowItem> ItemRows;
var int CurrentRow,OldRow;
var int EdgeSize;
var int OldSizeX;
var transient bool bDrawToolTip;
var Color BoxColor,OutlineColor;
function OpenMenu( KFGUI_Base Menu )
function OpenMenu( KFGUI_Base Menu)
{
Owner = Menu.Owner;
InitMenu();
@ -29,10 +29,10 @@ final function ComputeSize()
local int i;
local string S;
if( OldSizeX == Owner.ScreenSize.X )
if (OldSizeX == Owner.ScreenSize.X)
return;
if( ItemRows.Length==0 )
if (ItemRows.Length == 0)
{
YS = 0;
XS = 50;
@ -40,9 +40,9 @@ final function ComputeSize()
else
{
Canvas.Font = Owner.CurrentStyle.PickFont(Scalar);
for( i=0; i<ItemRows.Length; ++i )
for (i=0; i < ItemRows.Length; ++i)
{
if( ItemRows[i].bSplitter )
if (ItemRows[i].bSplitter)
S = "----";
else S = ItemRows[i].Text;
@ -63,18 +63,18 @@ function ComputePosition()
{
XPosition = float(Owner.MousePosition.X+4) / Owner.ScreenSize.X;
YPosition = float(Owner.MousePosition.Y+4) / Owner.ScreenSize.Y;
if( (XPosition+XSize)>1.f )
if ((XPosition+XSize) > 1.f)
YPosition = (float(Owner.MousePosition.X) / Owner.ScreenSize.X) - XSize; // Move to left side of mouse pointer.
if( (YPosition+YSize)>1.f )
YPosition-=((YPosition+YSize)-1.f); // Move up until fit on screen.
if ((YPosition+YSize) > 1.f)
YPosition -= ((YPosition+YSize)-1.f); // Move up until fit on screen.
}
final function AddRow( string Text, bool bDisable, optional string AltToolTip )
final function AddRow( string Text, bool bDisable, optional string AltToolTip)
{
local int i;
i = ItemRows.Length;
ItemRows.Length = i+1;
if( Text=="-" )
if (Text == "-")
ItemRows[i].bSplitter = true;
else
{
@ -92,9 +92,9 @@ function DrawMenu()
{
Owner.CurrentStyle.RenderRightClickMenu(Self);
if( bDrawToolTip )
if (bDrawToolTip)
{
if( OldRow != CurrentRow )
if (OldRow != CurrentRow)
bDrawToolTip = false;
DrawToolTip();
}
@ -117,7 +117,7 @@ function DrawToolTip()
BoxW = XL * 1.05f;
BoxH = YL * 1.25f;
while( (X + BoxW) > Canvas.ClipX )
while( (X + BoxW) > Canvas.ClipX)
{
X -= 0.01;
}
@ -131,9 +131,9 @@ function DrawToolTip()
Canvas.SetPos(TextX, TextY);
Canvas.DrawText(S,,Scalar,Scalar);
}
function HandleMouseClick( bool bRight )
function HandleMouseClick( bool bRight)
{
if( CurrentRow>=0 && (ItemRows[CurrentRow].bSplitter || ItemRows[CurrentRow].bDisabled) )
if (CurrentRow >= 0 && (ItemRows[CurrentRow].bSplitter || ItemRows[CurrentRow].bDisabled))
return;
OnSelectedItem(CurrentRow);
PlayMenuSound(MN_ClickButton);
@ -147,7 +147,7 @@ function LostInputFocus()
}
function NotifyMousePaused()
{
if(CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "")
if (CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "")
bDrawToolTip = true;
}

View File

@ -15,7 +15,7 @@ var transient bool bGrabbedScroller;
var bool bVertical, bHideScrollbar;
final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepStride, optional int MnRange )
final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepStride, optional int MnRange)
{
MaxRange = MxRange;
MinRange = MnRange;
@ -23,11 +23,11 @@ final function UpdateScrollSize( int Current, int MxRange, int Stride, int StepS
PageStep = StepStride;
SetValue(Current);
}
final function AddValue( int V )
final function AddValue( int V)
{
SetValue(CurrentScroll+V);
}
final function SetValue( int V )
final function SetValue( int V)
{
CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange);
OnScrollChange(Self,CurrentScroll);
@ -47,53 +47,53 @@ function float GetWidth()
function PreDraw()
{
// Auto scale to match width to screen size.
if( bVertical )
if (bVertical)
XSize = GetWidth();
else YSize = GetWidth();
Super.PreDraw();
}
function DrawMenu()
{
if( !bHideScrollbar )
if (!bHideScrollbar)
{
Owner.CurrentStyle.RenderScrollBar(Self);
}
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( bRight || bDisabled )
if (bRight || bDisabled)
return;
bPressedDown = true;
PlayMenuSound(MN_ClickButton);
if( bVertical )
if (bVertical)
{
if( Owner.MousePosition.Y>=(CompPos[1]+ButtonOffset) && Owner.MousePosition.Y<=(CompPos[1]+ButtonOffset+SliderScale) ) // Grabbed scrollbar!
if (Owner.MousePosition.Y >= (CompPos[1]+ButtonOffset) && Owner.MousePosition.Y <= (CompPos[1]+ButtonOffset+SliderScale) ) // Grabbed scrollbar!
{
GrabbedOffset = Owner.MousePosition.Y - (CompPos[1]+ButtonOffset);
bGrabbedScroller = true;
GetInputFocus();
}
else if( Owner.MousePosition.Y<(CompPos[1]+ButtonOffset) ) // Page up.
else if (Owner.MousePosition.Y < (CompPos[1]+ButtonOffset) ) // Page up.
AddValue(-PageStep);
else AddValue(PageStep);
}
else
{
if( Owner.MousePosition.X>=(CompPos[0]+ButtonOffset) && Owner.MousePosition.X<=(CompPos[0]+ButtonOffset+SliderScale) ) // Grabbed scrollbar!
if (Owner.MousePosition.X >= (CompPos[0]+ButtonOffset) && Owner.MousePosition.X <= (CompPos[0]+ButtonOffset+SliderScale) ) // Grabbed scrollbar!
{
GrabbedOffset = Owner.MousePosition.X - (CompPos[0]+ButtonOffset);
bGrabbedScroller = true;
GetInputFocus();
}
else if( Owner.MousePosition.X<(CompPos[0]+ButtonOffset) ) // Page left.
else if (Owner.MousePosition.X < (CompPos[0]+ButtonOffset) ) // Page left.
AddValue(-PageStep);
else AddValue(PageStep);
}
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
if( !bRight )
if (!bRight)
DropInputFocus();
}
@ -103,11 +103,11 @@ function LostInputFocus()
bPressedDown = false;
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
if( bDisabled )
if (bDisabled)
return;
if( bUp )
if (bUp)
AddValue(-ScrollStride);
else AddValue(ScrollStride);
}

View File

@ -38,9 +38,9 @@ function UpdateListVis()
ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue);
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
if( !ScrollBar.bDisabled )
if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp);
}

View File

@ -4,13 +4,13 @@ Class KFGUI_SwitchMenuBar extends KFGUI_MultiComponent;
`include(Build.uci)
`include(Logger.uci)
var array<KFGUI_Base> SubPages;
var array < KFGUI_Base> SubPages;
var() byte ButtonPosition; // 0 = top, 1 = bottom, 2 = left, 3 = right
var() float BorderWidth,ButtonAxisSize; // Width for buttons.
var() float PagePadding; // Padding for pages
var int NumButtons,CurrentPageNum,PageComponentIndex;
var array<KFGUI_Button> PageButtons;
var array < KFGUI_Button> PageButtons;
function ShowMenu()
{
@ -25,7 +25,7 @@ function CloseMenu()
}
// Remember to call InitMenu() on the newly created page after.
final function KFGUI_Base AddPage( class<KFGUI_Base> PageClass, string Caption, string Hint, optional out KFGUI_Button Button )
final function KFGUI_Base AddPage( class < KFGUI_Base> PageClass, string Caption, string Hint, optional out KFGUI_Button Button)
{
local KFGUI_Base P;
local KFGUI_Button B;
@ -44,29 +44,29 @@ final function KFGUI_Base AddPage( class<KFGUI_Base> PageClass, string Caption,
B.OnClickRight = PageSwitched;
B.IDValue = NumButtons;
if( ButtonPosition<2 )
if (ButtonPosition < 2)
{
B.XPosition = NumButtons*ButtonAxisSize;
B.XSize = ButtonAxisSize*0.99;
if( ButtonPosition==0 )
if (ButtonPosition == 0)
B.YPosition = 0.f;
else B.YPosition = YSize-BorderWidth*0.99;
B.YSize = BorderWidth*0.99;
if( NumButtons>0 )
if (NumButtons > 0)
PageButtons[PageButtons.Length-1].ExtravDir = 1;
}
else
{
if( ButtonPosition==2 )
if (ButtonPosition == 2)
B.XPosition = 0.f;
else B.XPosition = XSize-BorderWidth*0.99;
B.XSize = BorderWidth*0.99;
B.YPosition = NumButtons*ButtonAxisSize;
B.YSize = ButtonAxisSize*0.99;
if( NumButtons>0 )
if (NumButtons > 0)
PageButtons[PageButtons.Length-1].ExtravDir = 2;
}
@ -77,24 +77,24 @@ final function KFGUI_Base AddPage( class<KFGUI_Base> PageClass, string Caption,
return P;
}
function PageSwitched( KFGUI_Button Sender )
function PageSwitched( KFGUI_Button Sender)
{
SelectPage(Sender.IDValue);
}
final function SelectPage( int Index )
final function SelectPage( int Index)
{
PlayMenuSound(MN_LostFocus);
if( CurrentPageNum>=0 )
if (CurrentPageNum >= 0)
{
PageButtons[CurrentPageNum].bIsHighlighted = false;
SubPages[CurrentPageNum].CloseMenu();
Components.Remove(PageComponentIndex,1);
PageComponentIndex = -1;
}
CurrentPageNum = (Index>=0 && Index<SubPages.Length) ? Index : -1;
if( CurrentPageNum>=0 )
CurrentPageNum = (Index >= 0 && Index < SubPages.Length) ? Index : -1;
if (CurrentPageNum >= 0)
{
PageButtons[CurrentPageNum].bIsHighlighted = true;
SubPages[CurrentPageNum].ShowMenu();
@ -108,23 +108,23 @@ function PreDraw()
local int i;
local byte j;
if( !bVisible )
if (!bVisible)
return;
if( CurrentPageNum==-1 && NumButtons>0 )
if (CurrentPageNum == -1 && NumButtons > 0)
SelectPage(0);
ComputeCoords();
Canvas.SetOrigin(CompPos[0],CompPos[1]);
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
DrawMenu();
for( i=0; i<Components.Length; ++i )
for (i=0; i < Components.Length; ++i)
{
Components[i].Canvas = Canvas;
for( j=0; j<4; ++j )
for (j=0; j < 4; ++j)
Components[i].InputPos[j] = CompPos[j];
if( i==PageComponentIndex )
if (i == PageComponentIndex)
{
switch( ButtonPosition )
switch( ButtonPosition)
{
case 0:
Components[i].InputPos[1] += (InputPos[3]*BorderWidth*PagePadding);
@ -146,11 +146,11 @@ function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent E
switch(Key)
{
case 'XboxTypeS_LeftShoulder':
if( Event == IE_Pressed )
if (Event == IE_Pressed)
SelectPage(Clamp(CurrentPageNum - 1, 0, NumButtons));
return true;
case 'XboxTypeS_RightShoulder':
if( Event == IE_Pressed )
if (Event == IE_Pressed)
SelectPage(Clamp(CurrentPageNum + 1, 0, NumButtons));
return true;
}

View File

@ -24,7 +24,7 @@ struct FTextPart
};
struct FTextLineInfo
{
var array<FTextPart> Text;
var array < FTextPart> Text;
var float Y;
};
var KFGUI_ScrollBarV ScrollBar;
@ -36,14 +36,14 @@ var() Canvas.FontRenderInfo TextFontInfo;
var() float FontScale,MessageDisplayTime,MessageFadeInTime,MessageFadeOutTime;
var() bool bNoReset,bFadeInOut,bUseOutlineText;
var() int MaxHistory, OutlineSize;
var protected transient array<FTextLineInfo> Lines,OrgLines;
var protected transient array < FTextLineInfo> Lines,OrgLines;
var transient float MaxHeight,ScrollWidth,OldSize[2],InitFontScale,TextHeight,FadeStartTime;
var transient Font InitFont;
var transient bool bShowScrollbar,bTextParsed;
function SetText( string S )
function SetText( string S)
{
if( Text==S )
if (Text == S)
return;
Text = S;
OldSize[0] = -1; // Force to refresh.
@ -51,7 +51,7 @@ function SetText( string S )
OrgLines.Length = 0;
bTextParsed = false;
}
function AddText( string S, optional bool bIgnoreSpam )
function AddText( string S, optional bool bIgnoreSpam)
{
Text $= S;
OldSize[0] = -1;
@ -66,7 +66,7 @@ final function string GetText()
final function ParseTextLines()
{
local array<string> SA;
local array < string> SA;
local int i,j,z;
local string S;
local color C;
@ -76,19 +76,19 @@ final function ParseTextLines()
Lines.Length = SA.Length;
C.A = 0;
TextType = TEXT_FIELD_NONE;
for( i=0; i<SA.Length; ++i )
for (i=0; i < SA.Length; ++i)
{
Lines[i].Text.Length = 0;
S = SA[i];
if( S=="" )
if (S == "")
continue;
z = 0;
while( true )
while( true)
{
j = InStr(S,"#{");
if( j>0 )
if (j > 0)
{
Lines[i].Text.Length = z+1;
Lines[i].Text[z].S = Left(S,j);
@ -96,29 +96,29 @@ final function ParseTextLines()
Lines[i].Text[z].TextType = TextType;
++z;
}
else if( j==-1 )
else if (j == -1)
break;
S = Mid(S,j+2);
if( Left(S,4)=="DEF}" )
if (Left(S,4) == "DEF}")
{
C.A = 0;
S = Mid(S,4);
TextType = TEXT_FIELD_NONE;
}
else if( Left(S,4)=="HSV}" )
else if (Left(S,4) == "HSV}")
{
C.A = 0;
S = Mid(S,4);
TextType = TEXT_FIELD_HSV;
}
else if( Left(S,6)=="FLASH}" )
else if (Left(S,6) == "FLASH}")
{
C.A = 0;
S = Mid(S,6);
TextType = TEXT_FIELD_FLASH;
}
else if( Left(S,7)=="CFLASH=" )
else if (Left(S,7) == "CFLASH=")
{
C.A = 0;
S = Mid(S,7);
@ -147,21 +147,21 @@ final function ParseTextLines()
}
OrgLines = Lines; // Create a backup.
}
final function byte GrabHexValue( string S )
final function byte GrabHexValue( string S)
{
local byte n;
n = (HexToInt(Asc(Left(S,1)))<<4) | HexToInt(Asc(Right(S,1)));
n = (HexToInt(Asc(Left(S,1))) << 4) | HexToInt(Asc(Right(S,1)));
S = Mid(S,2);
return n;
}
final function byte HexToInt( byte n )
final function byte HexToInt( byte n)
{
if( n>=48 && n<=57 ) // '0' - '9'
if (n >= 48 && n <= 57 ) // '0' - '9'
return n-48;
if( n>=65 && n<=70 ) // 'A' - 'F'
if (n >= 65 && n <= 70 ) // 'A' - 'F'
return n-55; // 'A' - 10
if( n>=97 && n<=102 ) // 'a' - 'f'
if (n >= 97 && n <= 102 ) // 'a' - 'f'
return n-87; // 'a' - 10
return 0;
}
@ -172,12 +172,12 @@ function InitSize()
local float XS;
local int MaxScrollRange;
if( Canvas == None )
if (Canvas == None)
return;
OldSize[0] = CompPos[2];
OldSize[1] = CompPos[3];
if( !bTextParsed )
if (!bTextParsed)
{
ParseTextLines();
bTextParsed = true;
@ -193,13 +193,13 @@ function InitSize()
ParseLines(CompPos[2] / InitFontScale);
MaxHeight = (Lines.Length * TextHeight);
bShowScrollbar = (MaxHeight>=CompPos[3]);
bShowScrollbar = (MaxHeight >= CompPos[3]);
bClickable = bShowScrollbar;
bCanFocus = bShowScrollbar;
if( bShowScrollbar )
if (bShowScrollbar)
{
if( ScrollBar==None )
if (ScrollBar == None)
{
ScrollBar = new(Self) class'KFGUI_ScrollBarV';
ScrollBar.SetPosition(0.9,0.0,0.1,1.0);
@ -210,7 +210,7 @@ function InitSize()
}
// Compute scrollbar size and X-position.
for( i=0; i<4; ++i )
for (i=0; i < 4; ++i)
ScrollBar.InputPos[i] = CompPos[i];
ScrollWidth = ScrollBar.GetWidth();
ScrollBar.XPosition = 1.f - ScrollWidth;
@ -222,32 +222,32 @@ function InitSize()
Lines = OrgLines;
ParseLines((CompPos[2]-ScrollWidth) / InitFontScale);
if( Components.Find(ScrollBar)==-1 )
if (Components.Find(ScrollBar) == -1)
Components.AddItem(ScrollBar);
MaxHeight = (Lines.Length * TextHeight);
MaxScrollRange = Max(((MaxHeight-CompPos[3])/TextHeight),1);
ScrollBar.UpdateScrollSize(bNoReset ? MaxScrollRange : 0,MaxScrollRange,1,1);
}
else if( ScrollBar!=None )
else if (ScrollBar != None)
Components.RemoveItem(ScrollBar);
}
// Parse textlines to see if they're too long.
final function ParseLines( float ClipX )
final function ParseLines( float ClipX)
{
local float X,XS,YS;
local int i,j,z,n;
for( i=0; i<Lines.Length; ++i )
for (i=0; i < Lines.Length; ++i)
{
Lines[i].Y = i*TextHeight;
X = 0.f;
for( j=0; j<Lines[i].Text.Length; ++j )
for (j=0; j < Lines[i].Text.Length; ++j)
{
Lines[i].Text[j].X = (X*InitFontScale);
Canvas.TextSize(Lines[i].Text[j].S,XS,YS);
if( (X+XS)>ClipX )
if ((X+XS) > ClipX)
{
z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX);
@ -255,7 +255,7 @@ final function ParseLines( float ClipX )
Lines.Insert(i+1,1);
// Append the remaining lines there.
for( n=j; n<Lines[i].Text.Length; ++n )
for (n=j; n < Lines[i].Text.Length; ++n)
Lines[i+1].Text.AddItem(Lines[i].Text[n]);
// Split the string at wrapping point.
@ -265,7 +265,7 @@ final function ParseLines( float ClipX )
Lines[i+1].Text[0].S = StripWhiteSpaces(Lines[i+1].Text[0].S);
// If empty, clean it up.
if( Lines[i+1].Text[0].S=="" )
if (Lines[i+1].Text[0].S == "")
Lines[i+1].Text.Remove(0,1);
// End the current line at wrapping point.
@ -279,24 +279,24 @@ final function ParseLines( float ClipX )
}
// Slow, find wrapped splitting point in text.
final function int FindSplitPoint( string S, float X, float ClipX )
final function int FindSplitPoint( string S, float X, float ClipX)
{
local int i,l,PrevWord;
local float XL,YL;
local bool bWasWhite,bStartedZero;
bStartedZero = (X==0.f);
bStartedZero = (X == 0.f);
Canvas.TextSize(Mid(S,0,1),XL,YL);
X += XL;
i = 1;
l = Len(S);
PrevWord = 0;
bWasWhite = true;
while( i<l )
while( i < l)
{
if( Mid(S,i,1)==" " )
if (Mid(S,i,1) == " ")
{
if( !bWasWhite )
if (!bWasWhite)
{
PrevWord = i;
bWasWhite = true;
@ -308,9 +308,9 @@ final function int FindSplitPoint( string S, float X, float ClipX )
}
Canvas.TextSize(Mid(S,i,1),XL,YL);
X+=XL;
if( X>ClipX ) // Split here if possible.
if (X > ClipX ) // Split here if possible.
{
if( PrevWord==0 )
if (PrevWord == 0)
return (bStartedZero ? i : 0); // No wrap.
return PrevWord;
}
@ -318,9 +318,9 @@ final function int FindSplitPoint( string S, float X, float ClipX )
}
return l;
}
final function string StripWhiteSpaces( string S )
final function string StripWhiteSpaces( string S)
{
if( Left(S,1)==" " )
if (Left(S,1) == " ")
S = Mid(S,1);
return S;
}
@ -335,19 +335,19 @@ function DrawMenu()
local int i,j,Index;
local float Y;
if( Text=="" || !bVisible )
if (Text == "" || !bVisible)
return;
// Need to figure out best fitting font.
if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] )
if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3])
InitSize();
if( MaxHistory != 0 )
if (MaxHistory != 0)
{
if( Lines.Length >= MaxHistory )
if (Lines.Length >= MaxHistory)
{
Index = InStr(Text, LineSplitter);
if( Index == INDEX_NONE )
if (Index == INDEX_NONE)
Lines.Remove(0, 1);
else SetText(Mid(Text, Index+Len(LineSplitter)));
}
@ -355,24 +355,24 @@ function DrawMenu()
Canvas.Font = InitFont;
if( bShowScrollbar )
if (bShowScrollbar)
{
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
i = ScrollBar.GetValue();
}
else i = 0;
if( i<Lines.Length )
if (i < Lines.Length)
{
Y = Lines[i].Y;
for( i=i; i<Lines.Length; ++i )
for (i=i; i < Lines.Length; ++i)
{
if( Lines[i].Text.Length!=0 )
if (Lines[i].Text.Length != 0)
{
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
if ((Lines[i].Y-Y+TextHeight) >= CompPos[3])
break;
for( j=0; j<Lines[i].Text.Length; ++j )
for (j=0; j < Lines[i].Text.Length; ++j)
{
DrawTextField(Lines[i].Text[j].S, i, Lines[i].Text[j].X, Lines[i].Y-Y, Lines[i].Text[j].C, Lines[i].Text[j].TextType);
}
@ -388,24 +388,24 @@ function DrawTextField(string S, int Index, float X, float Y, optional Color C,
local Color MainColor;
MainColor = C;
if( MainColor.A==0 )
if (MainColor.A == 0)
MainColor = TextColor;
Canvas.DrawColor = GetColorFromStyle(MainColor, TextStyle);
if( bFadeInOut )
if (bFadeInOut)
{
TempSize = `TimeSinceEx(GetPlayer(), FadeStartTime);
if ( TempSize > MessageDisplayTime )
if (TempSize > MessageDisplayTime)
{
return;
}
if ( TempSize < MessageFadeInTime )
if (TempSize < MessageFadeInTime)
{
FadeAlpha = int((TempSize / MessageFadeInTime) * 255.0);
}
else if ( TempSize > MessageDisplayTime - MessageFadeOutTime )
else if (TempSize > MessageDisplayTime - MessageFadeOutTime)
{
FadeAlpha = int((1.0 - ((TempSize - (MessageDisplayTime - MessageFadeOutTime)) / MessageFadeOutTime)) * 255.0);
}
@ -417,7 +417,7 @@ function DrawTextField(string S, int Index, float X, float Y, optional Color C,
Canvas.DrawColor.A = FadeAlpha;
}
if( bUseOutlineText )
if (bUseOutlineText)
{
Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale);
}
@ -433,7 +433,7 @@ function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle)
local float ColorHUE,Value;
local HSVColour HSV;
if( TextStyle == TEXT_FIELD_HSV )
if (TextStyle == TEXT_FIELD_HSV)
{
ColorHUE = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 335);
@ -444,7 +444,7 @@ function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle)
return class'KFColorHelper'.static.LinearColorToColor(class'KFColorHelper'.static.HSVToRGB(HSV));
}
else if( TextStyle == TEXT_FIELD_FLASH )
else if (TextStyle == TEXT_FIELD_FLASH)
{
Value = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 1);
HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor));
@ -461,9 +461,9 @@ function bool CaptureMouse()
return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope.
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
if( bShowScrollbar )
if (bShowScrollbar)
ScrollBar.ScrollMouseWheel(bUp);
}
@ -471,7 +471,7 @@ function SetVisibility(bool Visible)
{
Super.SetVisibility(Visible);
if( ScrollBar != None )
if (ScrollBar != None)
{
ScrollBar.SetVisibility(Visible);
}

View File

@ -24,15 +24,15 @@ function InitSize()
TS = Owner.CurrentStyle.GetFontScaler();
TS *= FontScale;
while( true )
while( true)
{
Canvas.Font = Owner.CurrentStyle.MainFont;
if( TextFontInfo.bClipText )
if (TextFontInfo.bClipText)
Canvas.TextSize(Text,XL,YL,TS,TS);
else
{
Canvas.SetPos(0,0);
if( TS==1 )
if (TS == 1)
Canvas.StrLen(Text,XL,YL);
else
{
@ -42,7 +42,7 @@ function InitSize()
YL*=TS;
}
}
if( (XL<(CompPos[2]*0.99) && YL<(CompPos[3]*0.99)) )
if ((XL < (CompPos[2]*0.99) && YL < (CompPos[3]*0.99)))
break;
TS -= 0.001;
@ -51,7 +51,7 @@ function InitSize()
InitFont = Canvas.Font;
InitFontScale = TS;
switch( AlignX )
switch( AlignX)
{
case 0:
InitOffset[0] = 0;
@ -62,7 +62,7 @@ function InitSize()
default:
InitOffset[0] = CompPos[2]-(XL+1);
}
switch( AlignY )
switch( AlignY)
{
case 0:
InitOffset[1] = 0;
@ -74,9 +74,9 @@ function InitSize()
InitOffset[1] = CompPos[3]-YL;
}
}
function SetText( string S )
function SetText( string S)
{
if( Text==S )
if (Text == S)
return;
Text = S;
OldSize[0] = -1; // Force to refresh.
@ -88,16 +88,16 @@ final function string GetText()
function DrawMenu()
{
if( Text=="" )
if (Text == "")
return;
// Need to figure out best fitting font.
if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] )
if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3])
InitSize();
Canvas.Font = InitFont;
Canvas.DrawColor = TextColor;
if( bUseOutline )
if (bUseOutline)
{
Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale);
}

View File

@ -7,10 +7,10 @@ var float ScrollSpeed;
var transient float CharStartTime;
var transient bool bScrollCompleted, bTextDirty;
var transient array<bool> RowsCompleted;
var transient array < bool> RowsCompleted;
var transient int MaxIndex, RowsDropped;
function SetText( string S )
function SetText( string S)
{
Super.SetText(S);
@ -32,38 +32,38 @@ function DrawMenu()
local Texture CurrentCursor;
local ETextFieldStyles TextStyle;
if( bScrollCompleted )
if (bScrollCompleted)
{
Super.DrawMenu();
return;
}
if( Text=="" )
if (Text == "")
return;
// Need to figure out best fitting font.
if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] )
if (OldSize[0] != CompPos[2] || OldSize[1] != CompPos[3])
InitSize();
Canvas.Font = InitFont;
if( bShowScrollbar )
if (bShowScrollbar)
{
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
i = ScrollBar.GetValue();
}
else i = 0;
if( ScrollBar != None )
if (ScrollBar != None)
{
if( bTextDirty )
if (bTextDirty)
{
ScrollBar.bDisabled = true;
RowsCompleted.Length = Lines.Length;
bTextDirty = false;
}
if( RowsCompleted[Lines.Length-1] )
if (RowsCompleted[Lines.Length-1])
{
ScrollBar.AddValue(1);
ScrollBar.bDisabled = false;
@ -74,7 +74,7 @@ function DrawMenu()
return;
}
else if( MaxIndex != 0 && RowsCompleted[MaxIndex] )
else if (MaxIndex != 0 && RowsCompleted[MaxIndex])
{
MaxIndex = 0;
ScrollBar.AddValue(1);
@ -85,13 +85,13 @@ function DrawMenu()
}
}
if( RowsDropped > 0 )
if (RowsDropped > 0)
{
for( i=0; i<=RowsDropped; ++i )
for (i=0; i <= RowsDropped; ++i)
{
for( j=0; j<Lines[i].Text.Length; ++j )
for (j=0; j < Lines[i].Text.Length; ++j)
{
for( k=0; k<=Len(Lines[i].Text[j].S); ++k )
for (k=0; k <= Len(Lines[i].Text[j].S); ++k)
{
CharTime += ScrollSpeed;
}
@ -100,24 +100,24 @@ function DrawMenu()
}
DTime = `TimeSinceEx(GetPlayer(), CharStartTime);
if( i<Lines.Length )
if (i < Lines.Length)
{
CurrentCursor = Owner.DefaultPens[GetCursorStyle()];
Y = Lines[i].Y;
for( i=i; i<Lines.Length; ++i )
for (i=i; i < Lines.Length; ++i)
{
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
if ((Lines[i].Y-Y+TextHeight) >= CompPos[3])
{
MaxIndex = i-1;
break;
}
if( Lines[i].Text.Length!=0 )
if (Lines[i].Text.Length != 0)
{
for( j=0; j<Lines[i].Text.Length; ++j )
for (j=0; j < Lines[i].Text.Length; ++j)
{
MainTextColor = Lines[i].Text[j].C;
if( MainTextColor.A==0 )
if (MainTextColor.A == 0)
MainTextColor = TextColor;
TextStyle = Lines[i].Text[j].TextType;
@ -128,15 +128,15 @@ function DrawMenu()
SLen = Len(MainString);
CurrentIndex = 0;
for( k=0; k<=SLen; ++k )
for (k=0; k <= SLen; ++k)
{
CharTime += ScrollSpeed;
Canvas.TextSize(Mid(MainString, 0, k), XL, YL, InitFontScale, InitFontScale);
if ( CharTime > DTime )
if (CharTime > DTime)
{
if( CurrentIndex == k )
if (CurrentIndex == k)
{
Canvas.SetDrawColor(255,255,255,255);
Canvas.SetPos(MainX+XL,MainY);
@ -152,7 +152,7 @@ function DrawMenu()
CurrentIndex = k+1;
if( k >= SLen )
if (k >= SLen)
{
RowsCompleted[i] = true;
}
@ -168,12 +168,12 @@ function bool CaptureMouse()
return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse();
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
if( bScrollCompleted )
if (bScrollCompleted)
return;
if( ScrollBar != None )
if (ScrollBar != None)
ScrollBar.bDisabled = false;
bScrollCompleted = true;

View File

@ -3,7 +3,7 @@ Class KFGUI_Tooltip extends KFGUI_Base;
`include(Build.uci)
`include(Logger.uci)
var() array<string> Lines;
var() array < string> Lines;
var() Canvas.FontRenderInfo TextFontInfo;
var byte CurrentAlpha;
@ -11,11 +11,11 @@ function InputMouseMoved()
{
DropInputFocus();
}
function MouseClick( bool bRight )
function MouseClick( bool bRight)
{
DropInputFocus();
}
function MouseRelease( bool bRight )
function MouseRelease( bool bRight)
{
DropInputFocus();
}
@ -24,14 +24,14 @@ function ShowMenu()
CurrentAlpha = 1;
}
final function SetText( string S )
final function SetText( string S)
{
ParseStringIntoArray(S,Lines,"<SEPERATOR>",false);
ParseStringIntoArray(S,Lines," < SEPERATOR > ",false);
}
function PreDraw()
{
if( !bVisible )
if (!bVisible)
return;
Owner.CurrentStyle.RenderToolTip(Self);

View File

@ -13,7 +13,7 @@ var KFGUI_List PlayersList;
var Texture2D DefaultAvatar;
var KFGameReplicationInfo KFGRI;
var array<KFPlayerReplicationInfo> KFPRIArray;
var array < KFPlayerReplicationInfo> KFPRIArray;
var KFPlayerController OwnerPC;
@ -21,8 +21,8 @@ var Color PingColor;
var float PingBars;
// Ranks
var array<RankInfo> CustomRanks;
var array<UIDRankRelation> RankRelations;
var array < RankInfo> CustomRanks;
var array < UIDRankRelation> RankRelations;
var SCESettings Settings;
@ -37,27 +37,27 @@ static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC
{
local Texture2D Avatar;
if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar )
if (KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar)
{
Avatar = FindAvatar(PC, KFPRI.UniqueId);
if( Avatar == None )
if (Avatar == None)
Avatar = default.DefaultAvatar;
KFPRI.Avatar = Avatar;
}
}
delegate bool InOrder( KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2 )
delegate bool InOrder( KFPlayerReplicationInfo P1, KFPlayerReplicationInfo P2)
{
if( P1 == None || P2 == None )
if (P1 == None || P2 == None)
return true;
if( P1.GetTeamNum() < P2.GetTeamNum() )
if (P1.GetTeamNum() < P2.GetTeamNum())
return false;
if( P1.Kills == P2.Kills )
if (P1.Kills == P2.Kills)
{
if( P1.Assists == P2.Assists )
if (P1.Assists == P2.Assists)
return true;
return P1.Assists < P2.Assists;
@ -71,7 +71,7 @@ function string WaveText()
local int CurrentWaveNum;
CurrentWaveNum = KFGRI.WaveNum;
if(KFGRI.IsBossWave())
if (KFGRI.IsBossWave())
{
return class'KFGFxHUD_WaveInfo'.default.BossWaveString;
}
@ -103,23 +103,23 @@ function DrawMenu()
local float BorderSize;
PC = GetPlayer();
if( KFGRI==None )
if (KFGRI == None)
{
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
if( KFGRI==None )
if (KFGRI == None)
return;
}
// Sort player list.
if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds )
if (NextScoreboardRefresh < PC.WorldInfo.TimeSeconds)
{
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1;
for( i=(KFGRI.PRIArray.Length-1); i>0; --i )
for (i=(KFGRI.PRIArray.Length-1); i > 0; --i)
{
for( j=i-1; j>=0; --j )
for (j=i-1; j >= 0; --j)
{
if( !InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])) )
if (!InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])))
{
PRI = KFGRI.PRIArray[i];
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
@ -132,30 +132,30 @@ function DrawMenu()
// Check players.
PlayerIndex = -1;
NumPlayer = 0;
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i)
{
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
if( KFPRI==None )
if (KFPRI == None)
continue;
if( KFPRI.bOnlySpectator )
if (KFPRI.bOnlySpectator)
{
++NumSpec;
continue;
}
if( KFPRI.PlayerHealth>0 && KFPRI.PlayerHealthPercent>0 && KFPRI.GetTeamNum()==0 )
if (KFPRI.PlayerHealth > 0 && KFPRI.PlayerHealthPercent > 0 && KFPRI.GetTeamNum() == 0)
++NumAlivePlayer;
++NumPlayer;
}
KFPRIArray.Length = NumPlayer;
j = KFPRIArray.Length;
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
for (i=(KFGRI.PRIArray.Length-1); i >= 0; --i)
{
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
if( KFPRI!=None && !KFPRI.bOnlySpectator )
if (KFPRI != None && !KFPRI.bOnlySpectator)
{
KFPRIArray[--j] = KFPRI;
if( KFPRI==PC.PlayerReplicationInfo )
if (KFPRI == PC.PlayerReplicationInfo)
PlayerIndex = j;
}
}
@ -316,7 +316,7 @@ function SetDrawColor(Canvas C, ColorRGBA RGBA)
C.SetDrawColor(RGBA.R, RGBA.G, RGBA.B, RGBA.A);
}
function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus )
function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus)
{
local string S, StrValue;
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
@ -368,7 +368,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
}
// Now all players belongs to 'Rank'
if( KFGRI.bVersusGame )
if (KFGRI.bVersusGame)
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
XPos = 0.f;
@ -378,15 +378,15 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
Canvas.TextSize("ABC", XL, YL, FontScalar, FontScalar);
// change rect color by HP
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{
SetDrawColor(C, Settings.Style.LeftStateBoxColor);
}
else if ( !KFGRI.bMatchHasBegun )
else if (!KFGRI.bMatchHasBegun)
{
SetDrawColor(C, Settings.Style.LeftStateBoxColor);
}
else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None )
else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None)
{
SetDrawColor(C, Settings.Style.LeftStateBoxColor);
}
@ -447,7 +447,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawTextShadowHLeftVCenter(S, RankXPos, TextYOffset, FontScalar);
// Perk
if( bIsZED )
if (bIsZED)
{
if (CurrentRank.ApplyColorToFields.Perk)
SetDrawColor(C, CurrentRank.TextColor);
@ -461,7 +461,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
}
else
{
if( KFPRI.CurrentPerkClass!=None )
if (KFPRI.CurrentPerkClass != None)
{
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
Level = KFPRI.GetActivePerkLevel();
@ -525,9 +525,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
}
// Avatar
if( KFPRI.Avatar != None )
if (KFPRI.Avatar != None)
{
if( KFPRI.Avatar == default.DefaultAvatar )
if (KFPRI.Avatar == default.DefaultAvatar)
CheckAvatar(KFPRI, OwnerPC);
C.SetDrawColor(255,255,255,255);
@ -535,7 +535,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
C.DrawTile(KFPRI.Avatar,Height - 6,Height - 6,0,0,KFPRI.Avatar.SizeX,KFPRI.Avatar.SizeY);
Owner.CurrentStyle.DrawBoxHollow(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f), Height - 6, Height - 6, 1);
}
else if( !KFPRI.bBot )
else if (!KFPRI.bBot)
CheckAvatar(KFPRI, OwnerPC);
// Player
@ -561,7 +561,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
// Cash
if( bIsZED )
if (bIsZED)
{
SetDrawColor(C, Settings.Style.ZedTextColor);
StrValue = "Brains!";
@ -577,12 +577,12 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawTextShadowHVCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
// State
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
if (!KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun)
{
SetDrawColor(C, Settings.Style.StateTextColorLobby);
S = "LOBBY";
}
else if( !KFGRI.bMatchHasBegun )
else if (!KFGRI.bMatchHasBegun)
{
if (KFPRI.bReadyToPlay)
{
@ -595,7 +595,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
S = "Not Ready";
}
}
else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None )
else if (bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None)
{
SetDrawColor(C, Settings.Style.StateTextColor);
S = "Unknown";
@ -659,7 +659,7 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
DrawPingBars(C, YOffset + (Height/2) - ((Height*0.5)/2), Width - (Height*0.5) - (Owner.HUDOwner.ScaledBorderSize*2), Height*0.5, Height*0.5, float(Ping));
}
final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, float H, float Ping )
final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, float H, float Ping)
{
local float PingMul, BarW, BarH, BaseH, XPos, YPos;
local byte i;
@ -671,7 +671,7 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl
PingColor.R = (1.f - PingMul) * 255;
PingColor.G = PingMul * 255;
for(i=1; i<PingBars; i++)
for (i=1; i < PingBars; i++)
{
BarH = BaseH * i;
XPos = XOffset + ((i - 1) * BarW);
@ -681,7 +681,7 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl
C.SetDrawColor(20, 20, 20, 255);
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
if( PingMul >= (i / PingBars) )
if (PingMul >= (i / PingBars))
{
C.SetPos(XPos,YPos);
C.DrawColor = PingColor;
@ -693,26 +693,26 @@ final function DrawPingBars( Canvas C, float YOffset, float XOffset, float W, fl
}
}
static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID )
static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID)
{
local string S;
S = PC.GetSteamAvatar(ClientID);
if( S=="" )
if (S == "")
return None;
return Texture2D(PC.FindObject(S,class'Texture2D'));
}
final static function string GetNiceSize(int Num)
{
if( Num < 1000 ) return string(Num);
else if( Num < 1000000 ) return (Num / 1000) $ "K";
else if( Num < 1000000000 ) return (Num / 1000000) $ "M";
if (Num < 1000 ) return string(Num);
else if (Num < 1000000 ) return (Num / 1000) $ "K";
else if (Num < 1000000000 ) return (Num / 1000000) $ "M";
return (Num / 1000000000) $ "B";
}
function ScrollMouseWheel( bool bUp )
function ScrollMouseWheel( bool bUp)
{
PlayersList.ScrollMouseWheel(bUp);
}

View File

@ -5,4 +5,4 @@ class PlayerRankRelations extends Object
`include(Build.uci)
`include(Logger.uci)
var config array<RankRelation> Relation;
var config array < RankRelation> Relation;

View File

@ -7,9 +7,9 @@ class ScoreboardExtHUD extends KFGFxHudWrapper
const HUDBorderSize = 3;
var float ScaledBorderSize;
var array<KFGUI_Base> HUDWidgets;
var array < KFGUI_Base> HUDWidgets;
var class<KFScoreBoard> ScoreboardClass;
var class < KFScoreBoard> ScoreboardClass;
var KFScoreBoard Scoreboard;
var transient KF2GUIController GUIController;
@ -29,16 +29,16 @@ simulated function PostBeginPlay()
function PostRender()
{
if( KFGRI == None )
if (KFGRI == None)
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
if( GUIController!=None && PlayerOwner.PlayerInput==None )
if (GUIController != None && PlayerOwner.PlayerInput == None)
GUIController.NotifyLevelChange();
if( GUIController==None || GUIController.bIsInvalid )
if (GUIController == None || GUIController.bIsInvalid)
{
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
if( GUIController!=None )
if (GUIController != None)
{
GUIStyle = GUIController.CurrentStyle;
GUIStyle.HUDOwner = self;
@ -48,7 +48,7 @@ function PostRender()
GUIStyle.Canvas = Canvas;
GUIStyle.PickDefaultFontSize(Canvas.ClipY);
if( !GUIController.bIsInMenuState )
if (!GUIController.bIsInMenuState)
GUIController.HandleDrawMenu();
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
@ -66,9 +66,9 @@ function bool NotifyInputKey(int ControllerId, Name Key, EInputEvent Event, floa
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad) )
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad))
return true;
}
@ -79,9 +79,9 @@ function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float Del
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad) )
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad))
return true;
}
@ -92,9 +92,9 @@ function bool NotifyInputChar(int ControllerId, string Unicode)
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode) )
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode))
return true;
}

View File

@ -17,10 +17,10 @@ struct SClient
var KFPlayerController KFPC;
};
var private array<SClient> RepClients;
var private array<UIDRankRelation> UIDRankRelationsPlayers;
var private array<UIDRankRelation> UIDRankRelationsSteamGroups;
var private array<UIDRankRelation> UIDRankRelationsActive;
var private array < SClient> RepClients;
var private array < UIDRankRelation> UIDRankRelationsPlayers;
var private array < UIDRankRelation> UIDRankRelationsSteamGroups;
var private array < UIDRankRelation> UIDRankRelationsActive;
var private SCESettings Settings;
function PostBeginPlay()

View File

@ -11,9 +11,9 @@ var private KFScoreBoard SC;
var private OnlineSubsystemSteamworks SW;
// Fitst time replication
var public array<UIDRankRelation> SteamGroupRelations;
var private array<UIDRankRelation> RankRelations;
var public array<RankInfo> CustomRanks;
var public array < UIDRankRelation> SteamGroupRelations;
var private array < UIDRankRelation> RankRelations;
var public array < RankInfo> CustomRanks;
var public SCESettings Settings;
var public UIDRankRelation RankRelation; // Current player rank relation

View File

@ -5,7 +5,7 @@ class SteamGroupRankRelations extends Object
`include(Build.uci)
`include(Logger.uci)
var config array<RankRelation> Relation;
var config array < RankRelation> Relation;
DefaultProperties
{