improve scoreboard and replace spaces with tabs
This commit is contained in:
parent
04262cb27b
commit
6af64d1f51
@ -2,405 +2,405 @@ Class ClassicStyle extends KF2Style;
|
|||||||
|
|
||||||
function RenderFramedWindow( KFGUI_FloatingWindow P )
|
function RenderFramedWindow( KFGUI_FloatingWindow P )
|
||||||
{
|
{
|
||||||
local int XS,YS,TitleHeight;
|
local int XS,YS,TitleHeight;
|
||||||
local float XL, YL, FontScale;
|
local float XL, YL, FontScale;
|
||||||
|
|
||||||
XS = Canvas.ClipX-Canvas.OrgX;
|
|
||||||
YS = Canvas.ClipY-Canvas.OrgY;
|
|
||||||
TitleHeight = DefaultHeight;
|
|
||||||
|
|
||||||
if( P.bWindowFocused )
|
XS = Canvas.ClipX-Canvas.OrgX;
|
||||||
Canvas.SetDrawColor(105,105,105,255);
|
YS = Canvas.ClipY-Canvas.OrgY;
|
||||||
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
|
TitleHeight = DefaultHeight;
|
||||||
|
|
||||||
// Frame Header
|
if( P.bWindowFocused )
|
||||||
Canvas.SetPos(0, 0);
|
Canvas.SetDrawColor(105,105,105,255);
|
||||||
Canvas.DrawTileStretched(TabTextures[`TAB_TOP],XS,TitleHeight,0,0,128,16);
|
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
|
||||||
|
|
||||||
// Frame itself.
|
// Frame Header
|
||||||
Canvas.SetPos(0, TitleHeight);
|
Canvas.SetPos(0, 0);
|
||||||
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS-TitleHeight,0,0,128,128);
|
Canvas.DrawTileStretched(TabTextures[`TAB_TOP],XS,TitleHeight,0,0,128,16);
|
||||||
|
|
||||||
// Title.
|
// Frame itself.
|
||||||
if( P.WindowTitle!="" )
|
Canvas.SetPos(0, TitleHeight);
|
||||||
{
|
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS-TitleHeight,0,0,128,128);
|
||||||
Canvas.Font = PickFont(FontScale);
|
|
||||||
Canvas.TextSize(P.WindowTitle,XL,YL,FontScale,FontScale);
|
// Title.
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
if( P.WindowTitle!="" )
|
||||||
Canvas.SetPos((XS*0.5)-(XL*0.5),0);
|
{
|
||||||
Canvas.DrawText(P.WindowTitle,,FontScale,FontScale);
|
Canvas.Font = PickFont(FontScale);
|
||||||
}
|
Canvas.TextSize(P.WindowTitle,XL,YL,FontScale,FontScale);
|
||||||
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
|
Canvas.SetPos((XS*0.5)-(XL*0.5),0);
|
||||||
|
Canvas.DrawText(P.WindowTitle,,FontScale,FontScale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RenderWindow( KFGUI_Page P )
|
function RenderWindow( KFGUI_Page P )
|
||||||
{
|
{
|
||||||
local int XS,YS;
|
local int XS,YS;
|
||||||
|
|
||||||
XS = Canvas.ClipX-Canvas.OrgX;
|
|
||||||
YS = Canvas.ClipY-Canvas.OrgY;
|
|
||||||
|
|
||||||
// Frame itself.
|
XS = Canvas.ClipX-Canvas.OrgX;
|
||||||
if( P.bWindowFocused )
|
YS = Canvas.ClipY-Canvas.OrgY;
|
||||||
Canvas.SetDrawColor(105,105,105,255);
|
|
||||||
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
|
// Frame itself.
|
||||||
|
if( P.bWindowFocused )
|
||||||
Canvas.SetPos(0, 0);
|
Canvas.SetDrawColor(105,105,105,255);
|
||||||
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],XS,YS,0,0,128,128);
|
else Canvas.SetDrawColor(85,85,85,P.FrameOpacity);
|
||||||
|
|
||||||
|
Canvas.SetPos(0, 0);
|
||||||
|
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 int i;
|
||||||
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
|
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
|
||||||
|
|
||||||
Canvas.Font = PickFont(TS);
|
Canvas.Font = PickFont(TS);
|
||||||
|
|
||||||
// First compute textbox size.
|
// First compute textbox size.
|
||||||
TY = DefaultHeight*TT.Lines.Length;
|
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);
|
Canvas.TextSize(TT.Lines[i],XS,YS);
|
||||||
TX = FMax(XS,TX);
|
TX = FMax(XS,TX);
|
||||||
}
|
}
|
||||||
TX*=TS;
|
TX*=TS;
|
||||||
|
|
||||||
// Give some borders.
|
|
||||||
TX += TOOLTIP_BORDER*2;
|
|
||||||
TY += TOOLTIP_BORDER*2;
|
|
||||||
|
|
||||||
X = TT.CompPos[0];
|
// Give some borders.
|
||||||
Y = TT.CompPos[1]+24.f;
|
TX += TOOLTIP_BORDER*2;
|
||||||
|
TY += TOOLTIP_BORDER*2;
|
||||||
|
|
||||||
// Then check if too close to window edge, then move it to another pivot.
|
X = TT.CompPos[0];
|
||||||
if( (X+TX)>TT.Owner.ScreenSize.X )
|
Y = TT.CompPos[1]+24.f;
|
||||||
X = TT.Owner.ScreenSize.X-TX;
|
|
||||||
if( (Y+TY)>TT.Owner.ScreenSize.Y )
|
|
||||||
Y = TT.CompPos[1]-TY;
|
|
||||||
|
|
||||||
if( TT.CurrentAlpha<255 )
|
|
||||||
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
|
|
||||||
|
|
||||||
// Reset clipping.
|
// Then check if too close to window edge, then move it to another pivot.
|
||||||
Canvas.SetOrigin(0,0);
|
if( (X+TX)>TT.Owner.ScreenSize.X )
|
||||||
Canvas.SetClip(TT.Owner.ScreenSize.X,TT.Owner.ScreenSize.Y);
|
X = TT.Owner.ScreenSize.X-TX;
|
||||||
|
if( (Y+TY)>TT.Owner.ScreenSize.Y )
|
||||||
|
Y = TT.CompPos[1]-TY;
|
||||||
|
|
||||||
// Draw frame.
|
if( TT.CurrentAlpha<255 )
|
||||||
Canvas.SetDrawColor(115,115,115,TT.CurrentAlpha);
|
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
|
||||||
Canvas.SetPos(X-2,Y-2);
|
|
||||||
DrawBoxHollow(X-2,Y-2,TX+4,TY+4,2);
|
|
||||||
Canvas.SetDrawColor(5,5,5,TT.CurrentAlpha);
|
|
||||||
Canvas.SetPos(X,Y);
|
|
||||||
DrawWhiteBox(TX,TY);
|
|
||||||
|
|
||||||
DefFontHeight = DefaultHeight;
|
|
||||||
|
|
||||||
// Draw text.
|
// Reset clipping.
|
||||||
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
|
Canvas.SetOrigin(0,0);
|
||||||
X+=TOOLTIP_BORDER;
|
Canvas.SetClip(TT.Owner.ScreenSize.X,TT.Owner.ScreenSize.Y);
|
||||||
Y+=TOOLTIP_BORDER;
|
|
||||||
for( i=0; i<TT.Lines.Length; ++i )
|
// Draw frame.
|
||||||
{
|
Canvas.SetDrawColor(115,115,115,TT.CurrentAlpha);
|
||||||
Canvas.SetPos(X,Y);
|
Canvas.SetPos(X-2,Y-2);
|
||||||
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
|
DrawBoxHollow(X-2,Y-2,TX+4,TY+4,2);
|
||||||
Y+=DefFontHeight;
|
Canvas.SetDrawColor(5,5,5,TT.CurrentAlpha);
|
||||||
}
|
Canvas.SetPos(X,Y);
|
||||||
|
DrawWhiteBox(TX,TY);
|
||||||
|
|
||||||
|
DefFontHeight = DefaultHeight;
|
||||||
|
|
||||||
|
// Draw text.
|
||||||
|
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
|
||||||
|
X+=TOOLTIP_BORDER;
|
||||||
|
Y+=TOOLTIP_BORDER;
|
||||||
|
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 float A;
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
if( S.bDisabled )
|
if( S.bDisabled )
|
||||||
Canvas.SetDrawColor(5, 5, 5, 0);
|
Canvas.SetDrawColor(5, 5, 5, 0);
|
||||||
else if( S.bFocused || S.bGrabbedScroller )
|
else if( S.bFocused || S.bGrabbedScroller )
|
||||||
Canvas.SetDrawColor(15, 15, 15, 160);
|
Canvas.SetDrawColor(15, 15, 15, 160);
|
||||||
else Canvas.SetDrawColor(15, 15, 15, 160);
|
else Canvas.SetDrawColor(15, 15, 15, 160);
|
||||||
|
|
||||||
Canvas.SetPos(0.f, 0.f);
|
Canvas.SetPos(0.f, 0.f);
|
||||||
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],S.CompPos[2],S.CompPos[3],0,0,128,128);
|
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],S.CompPos[2],S.CompPos[3],0,0,128,128);
|
||||||
|
|
||||||
if( S.bDisabled )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( S.bVertical )
|
if( S.bDisabled )
|
||||||
i = 3;
|
return;
|
||||||
else i = 2;
|
|
||||||
|
|
||||||
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
|
|
||||||
|
|
||||||
if( S.bGrabbedScroller )
|
|
||||||
{
|
|
||||||
// Track mouse.
|
|
||||||
if( S.bVertical )
|
|
||||||
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
|
|
||||||
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
|
|
||||||
|
|
||||||
A /= ((S.CompPos[i]-S.SliderScale) / float(S.MaxRange));
|
|
||||||
S.SetValue(A);
|
|
||||||
}
|
|
||||||
|
|
||||||
A = float(S.CurrentScroll) / float(S.MaxRange);
|
if( S.bVertical )
|
||||||
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
|
i = 3;
|
||||||
|
else i = 2;
|
||||||
|
|
||||||
if( S.bGrabbedScroller )
|
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
|
||||||
Canvas.SetDrawColor(125,125,125,200);
|
|
||||||
else if( S.bFocused )
|
|
||||||
Canvas.SetDrawColor(200,200,200,200);
|
|
||||||
else Canvas.SetDrawColor(255,255,255,200);
|
|
||||||
|
|
||||||
if( S.bVertical )
|
if( S.bGrabbedScroller )
|
||||||
{
|
{
|
||||||
Canvas.SetPos(0.f, S.ButtonOffset);
|
// Track mouse.
|
||||||
Canvas.DrawTileStretched(ScrollTexture,S.CompPos[2],S.SliderScale,0,0,32,32);
|
if( S.bVertical )
|
||||||
}
|
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
|
||||||
else
|
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
|
||||||
{
|
|
||||||
Canvas.SetPos(S.ButtonOffset, 0.f);
|
A /= ((S.CompPos[i]-S.SliderScale) / float(S.MaxRange));
|
||||||
Canvas.DrawTileStretched(ScrollTexture,S.SliderScale,S.CompPos[3],0,0,32,32);
|
S.SetValue(A);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
A = float(S.CurrentScroll) / float(S.MaxRange);
|
||||||
|
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
|
||||||
|
|
||||||
|
if( S.bGrabbedScroller )
|
||||||
|
Canvas.SetDrawColor(125,125,125,200);
|
||||||
|
else if( S.bFocused )
|
||||||
|
Canvas.SetDrawColor(200,200,200,200);
|
||||||
|
else Canvas.SetDrawColor(255,255,255,200);
|
||||||
|
|
||||||
|
if( S.bVertical )
|
||||||
|
{
|
||||||
|
Canvas.SetPos(0.f, S.ButtonOffset);
|
||||||
|
Canvas.DrawTileStretched(ScrollTexture,S.CompPos[2],S.SliderScale,0,0,32,32);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.SetPos(S.ButtonOffset, 0.f);
|
||||||
|
Canvas.DrawTileStretched(ScrollTexture,S.SliderScale,S.CompPos[3],0,0,32,32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RenderCheckbox( KFGUI_CheckBox C )
|
function RenderCheckbox( KFGUI_CheckBox C )
|
||||||
{
|
{
|
||||||
local Texture CheckMark;
|
local Texture CheckMark;
|
||||||
|
|
||||||
DrawTileStretched(ItemBoxTextures[`ITEMBOX_DISABLED],0.f,0.f,C.CompPos[2],C.CompPos[3]);
|
|
||||||
|
|
||||||
if( C.bChecked )
|
DrawTileStretched(ItemBoxTextures[`ITEMBOX_DISABLED],0.f,0.f,C.CompPos[2],C.CompPos[3]);
|
||||||
{
|
|
||||||
if( C.bDisabled )
|
if( C.bChecked )
|
||||||
CheckMark = CheckBoxTextures[`CHECKMARK_DISABLED];
|
{
|
||||||
else if( C.bFocused )
|
if( C.bDisabled )
|
||||||
CheckMark = CheckBoxTextures[`CHECKMARK_HIGHLIGHTED];
|
CheckMark = CheckBoxTextures[`CHECKMARK_DISABLED];
|
||||||
else CheckMark = CheckBoxTextures[`CHECKMARK_NORMAL];
|
else if( C.bFocused )
|
||||||
|
CheckMark = CheckBoxTextures[`CHECKMARK_HIGHLIGHTED];
|
||||||
Canvas.SetDrawColor(255,255,255,255);
|
else CheckMark = CheckBoxTextures[`CHECKMARK_NORMAL];
|
||||||
Canvas.SetPos(0.f,0.f);
|
|
||||||
Canvas.DrawTile(CheckMark,C.CompPos[2],C.CompPos[3],0,0,CheckMark.GetSurfaceWidth(),CheckMark.GetSurfaceHeight());
|
Canvas.SetDrawColor(255,255,255,255);
|
||||||
}
|
Canvas.SetPos(0.f,0.f);
|
||||||
|
Canvas.DrawTile(CheckMark,C.CompPos[2],C.CompPos[3],0,0,CheckMark.GetSurfaceWidth(),CheckMark.GetSurfaceHeight());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RenderComboBox( KFGUI_ComboBox C )
|
function RenderComboBox( KFGUI_ComboBox C )
|
||||||
{
|
{
|
||||||
if( C.bDisabled )
|
if( C.bDisabled )
|
||||||
Canvas.SetDrawColor(64,64,64,255);
|
Canvas.SetDrawColor(64,64,64,255);
|
||||||
else if( C.bPressedDown )
|
else if( C.bPressedDown )
|
||||||
Canvas.SetDrawColor(220,220,220,255);
|
Canvas.SetDrawColor(220,220,220,255);
|
||||||
else if( C.bFocused )
|
else if( C.bFocused )
|
||||||
Canvas.SetDrawColor(190,190,190,255);
|
Canvas.SetDrawColor(190,190,190,255);
|
||||||
|
|
||||||
Canvas.SetPos(0.f,0.f);
|
|
||||||
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],C.CompPos[2],C.CompPos[3],0,0,128,128);
|
|
||||||
|
|
||||||
DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32);
|
|
||||||
|
|
||||||
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" )
|
Canvas.SetPos(0.f,0.f);
|
||||||
{
|
Canvas.DrawTileStretched(BorderTextures[`BOX_INNERBORDER],C.CompPos[2],C.CompPos[3],0,0,128,128);
|
||||||
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
|
|
||||||
if( C.bDisabled )
|
DrawArrowBox(3, C.CompPos[2]-32, 0.5f, 32, 32);
|
||||||
Canvas.DrawColor = C.TextColor*0.5f;
|
|
||||||
else Canvas.DrawColor = C.TextColor;
|
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" )
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
|
{
|
||||||
Canvas.DrawText(C.Values[C.SelectedIndex],,C.TextScale,C.TextScale,C.TextFontInfo);
|
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
|
||||||
Canvas.PopMaskRegion();
|
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);
|
||||||
|
Canvas.DrawText(C.Values[C.SelectedIndex],,C.TextScale,C.TextScale,C.TextFontInfo);
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RenderComboList( KFGUI_ComboSelector C )
|
function RenderComboList( KFGUI_ComboSelector C )
|
||||||
{
|
{
|
||||||
local float X,Y,YL,YP,Edge;
|
local float X,Y,YL,YP,Edge;
|
||||||
local int i;
|
local int i;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
// Draw background.
|
|
||||||
Edge = C.Combo.BorderSize;
|
|
||||||
Canvas.SetPos(0.f, 0.f);
|
|
||||||
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],C.CompPos[2],C.CompPos[3],0,0,128,128);
|
|
||||||
|
|
||||||
// While rendering, figure out mouse focus row.
|
// Draw background.
|
||||||
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
Edge = C.Combo.BorderSize;
|
||||||
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
Canvas.SetPos(0.f, 0.f);
|
||||||
|
Canvas.DrawTileStretched(BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],C.CompPos[2],C.CompPos[3],0,0,128,128);
|
||||||
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
|
||||||
|
|
||||||
Canvas.Font = C.Combo.TextFont;
|
|
||||||
YL = C.Combo.TextHeight;
|
|
||||||
|
|
||||||
YP = Edge;
|
// While rendering, figure out mouse focus row.
|
||||||
C.CurrentRow = -1;
|
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
||||||
|
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
||||||
|
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
||||||
for( i=0; i<C.Combo.Values.Length; ++i )
|
|
||||||
{
|
|
||||||
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
|
|
||||||
{
|
|
||||||
bCheckMouse = false;
|
|
||||||
C.CurrentRow = i;
|
|
||||||
Canvas.SetPos(4.f,YP);
|
|
||||||
Canvas.SetDrawColor(128,48,48,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
|
||||||
}
|
|
||||||
Canvas.SetPos(Edge,YP);
|
|
||||||
|
|
||||||
if( i==C.Combo.SelectedIndex )
|
|
||||||
Canvas.DrawColor = C.Combo.SelectedTextColor;
|
|
||||||
else Canvas.DrawColor = C.Combo.TextColor;
|
|
||||||
|
|
||||||
Canvas.DrawText(C.Combo.Values[i],,C.Combo.TextScale,C.Combo.TextScale,C.Combo.TextFontInfo);
|
Canvas.Font = C.Combo.TextFont;
|
||||||
|
YL = C.Combo.TextHeight;
|
||||||
YP+=YL;
|
|
||||||
}
|
YP = Edge;
|
||||||
Canvas.PopMaskRegion();
|
C.CurrentRow = -1;
|
||||||
if( C.OldRow!=C.CurrentRow )
|
|
||||||
{
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
||||||
C.OldRow = C.CurrentRow;
|
for( i=0; i<C.Combo.Values.Length; ++i )
|
||||||
C.PlayMenuSound(MN_DropdownChange);
|
{
|
||||||
}
|
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
|
||||||
|
{
|
||||||
|
bCheckMouse = false;
|
||||||
|
C.CurrentRow = i;
|
||||||
|
Canvas.SetPos(4.f,YP);
|
||||||
|
Canvas.SetDrawColor(128,48,48,255);
|
||||||
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
||||||
|
}
|
||||||
|
Canvas.SetPos(Edge,YP);
|
||||||
|
|
||||||
|
if( i==C.Combo.SelectedIndex )
|
||||||
|
Canvas.DrawColor = C.Combo.SelectedTextColor;
|
||||||
|
else Canvas.DrawColor = C.Combo.TextColor;
|
||||||
|
|
||||||
|
Canvas.DrawText(C.Combo.Values[i],,C.Combo.TextScale,C.Combo.TextScale,C.Combo.TextFontInfo);
|
||||||
|
|
||||||
|
YP+=YL;
|
||||||
|
}
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
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 float X,Y,XL,YL,YP,Edge,TextScale;
|
||||||
local int i;
|
local int i;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
local string S;
|
local string S;
|
||||||
|
|
||||||
// Draw background.
|
|
||||||
Edge = C.EdgeSize;
|
|
||||||
DrawOutlinedBox(0.f,0.f,C.CompPos[2],C.CompPos[3],Edge,C.BoxColor,C.OutlineColor);
|
|
||||||
|
|
||||||
// While rendering, figure out mouse focus row.
|
// Draw background.
|
||||||
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
Edge = C.EdgeSize;
|
||||||
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
DrawOutlinedBox(0.f,0.f,C.CompPos[2],C.CompPos[3],Edge,C.BoxColor,C.OutlineColor);
|
||||||
|
|
||||||
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
|
||||||
|
|
||||||
PickFont(TextScale);
|
|
||||||
|
|
||||||
YP = Edge*2;
|
// While rendering, figure out mouse focus row.
|
||||||
C.CurrentRow = -1;
|
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
||||||
|
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
|
||||||
for( i=0; i<C.ItemRows.Length; ++i )
|
|
||||||
{
|
|
||||||
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) )
|
|
||||||
{
|
|
||||||
bCheckMouse = false;
|
|
||||||
C.CurrentRow = i;
|
|
||||||
Canvas.SetPos(Edge,YP);
|
|
||||||
Canvas.SetDrawColor(128,0,0,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.SetPos(Edge*6,YP);
|
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
||||||
if( C.ItemRows[i].bSplitter )
|
|
||||||
Canvas.SetDrawColor(255,255,255,255);
|
PickFont(TextScale);
|
||||||
else
|
|
||||||
{
|
YP = Edge*2;
|
||||||
if( C.ItemRows[i].bDisabled )
|
C.CurrentRow = -1;
|
||||||
Canvas.SetDrawColor(148,148,148,255);
|
|
||||||
else Canvas.SetDrawColor(248,248,248,255);
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
||||||
}
|
for( i=0; i<C.ItemRows.Length; ++i )
|
||||||
Canvas.DrawText(S,,TextScale,TextScale);
|
{
|
||||||
|
if( C.ItemRows[i].bSplitter )
|
||||||
YP+=YL;
|
S = "-------";
|
||||||
}
|
else S = C.ItemRows[i].Text;
|
||||||
Canvas.PopMaskRegion();
|
|
||||||
if( C.OldRow!=C.CurrentRow )
|
Canvas.TextSize(S,XL,YL,TextScale,TextScale);
|
||||||
{
|
|
||||||
C.OldRow = C.CurrentRow;
|
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
|
||||||
C.PlayMenuSound(MN_FocusHover);
|
{
|
||||||
}
|
bCheckMouse = false;
|
||||||
|
C.CurrentRow = i;
|
||||||
|
Canvas.SetPos(Edge,YP);
|
||||||
|
Canvas.SetDrawColor(128,0,0,255);
|
||||||
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.SetPos(Edge*6,YP);
|
||||||
|
if( C.ItemRows[i].bSplitter )
|
||||||
|
Canvas.SetDrawColor(255,255,255,255);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( C.ItemRows[i].bDisabled )
|
||||||
|
Canvas.SetDrawColor(148,148,148,255);
|
||||||
|
else Canvas.SetDrawColor(248,248,248,255);
|
||||||
|
}
|
||||||
|
Canvas.DrawText(S,,TextScale,TextScale);
|
||||||
|
|
||||||
|
YP+=YL;
|
||||||
|
}
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
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 float XL,YL,TS,AX,AY,GamepadTexSize;
|
||||||
local Texture2D Mat, ButtonTex;
|
local Texture2D Mat, ButtonTex;
|
||||||
local bool bDrawOverride;
|
local bool bDrawOverride;
|
||||||
|
|
||||||
bDrawOverride = B.DrawOverride(Canvas, B);
|
bDrawOverride = B.DrawOverride(Canvas, B);
|
||||||
if( !bDrawOverride )
|
if( !bDrawOverride )
|
||||||
{
|
{
|
||||||
if( B.bDisabled )
|
if( B.bDisabled )
|
||||||
Mat = ButtonTextures[`BUTTON_DISABLED];
|
Mat = ButtonTextures[`BUTTON_DISABLED];
|
||||||
else if( B.bPressedDown )
|
else if( B.bPressedDown )
|
||||||
Mat = ButtonTextures[`BUTTON_PRESSED];
|
Mat = ButtonTextures[`BUTTON_PRESSED];
|
||||||
else if( B.bFocused || B.bIsHighlighted )
|
else if( B.bFocused || B.bIsHighlighted )
|
||||||
Mat = ButtonTextures[`BUTTON_HIGHLIGHTED];
|
Mat = ButtonTextures[`BUTTON_HIGHLIGHTED];
|
||||||
else Mat = ButtonTextures[`BUTTON_NORMAL];
|
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 )
|
Canvas.SetPos(0.f,0.f);
|
||||||
{
|
Canvas.DrawTileStretched(Mat,B.CompPos[2],B.CompPos[3],0,0,32,32);
|
||||||
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.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!="" )
|
}
|
||||||
{
|
}
|
||||||
Canvas.Font = MainFont;
|
|
||||||
|
if( B.ButtonText!="" )
|
||||||
GamepadTexSize = B.CompPos[3] / 1.25;
|
{
|
||||||
|
Canvas.Font = MainFont;
|
||||||
TS = GetFontScaler();
|
|
||||||
TS *= B.FontScale;
|
GamepadTexSize = B.CompPos[3] / 1.25;
|
||||||
|
|
||||||
while( true )
|
TS = GetFontScaler();
|
||||||
{
|
TS *= B.FontScale;
|
||||||
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
|
|
||||||
if( XL<(B.CompPos[2]*0.9) && YL<(B.CompPos[3]*0.9) )
|
while( true )
|
||||||
break;
|
{
|
||||||
|
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
|
||||||
TS -= 0.001;
|
if( XL<(B.CompPos[2]*0.9) && YL<(B.CompPos[3]*0.9) )
|
||||||
}
|
break;
|
||||||
|
|
||||||
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
|
TS -= 0.001;
|
||||||
if( B.bDisabled )
|
}
|
||||||
Canvas.DrawColor = B.TextColor*0.5f;
|
|
||||||
else Canvas.DrawColor = B.TextColor;
|
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
|
||||||
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
|
if( B.bDisabled )
|
||||||
|
Canvas.DrawColor = B.TextColor*0.5f;
|
||||||
if( B.GetUsingGamepad() )
|
else Canvas.DrawColor = B.TextColor;
|
||||||
{
|
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
|
||||||
ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D'));
|
|
||||||
if( ButtonTex != None )
|
if( B.GetUsingGamepad() )
|
||||||
{
|
{
|
||||||
B.GetRealtivePos(AX, AY);
|
ButtonTex = Texture2D(DynamicLoadObject("UI_Controller."$B.GamepadButtonName$"_Asset", class'Texture2D'));
|
||||||
while( (Canvas.CurX-(GamepadTexSize*1.25))<AX )
|
if( ButtonTex != None )
|
||||||
{
|
{
|
||||||
GamepadTexSize *= 0.95;
|
B.GetRealtivePos(AX, AY);
|
||||||
}
|
while( (Canvas.CurX-(GamepadTexSize*1.25))<AX )
|
||||||
|
{
|
||||||
switch(ButtonTex.Name)
|
GamepadTexSize *= 0.95;
|
||||||
{
|
}
|
||||||
case 'XboxTypeS_A_Asset':
|
|
||||||
case 'XboxTypeS_B_Asset':
|
switch(ButtonTex.Name)
|
||||||
case 'XboxTypeS_X_Asset':
|
{
|
||||||
case 'XboxTypeS_Y_Asset':
|
case 'XboxTypeS_A_Asset':
|
||||||
Canvas.SetDrawColor(255, 255, 255, 145);
|
case 'XboxTypeS_B_Asset':
|
||||||
break;
|
case 'XboxTypeS_X_Asset':
|
||||||
default:
|
case 'XboxTypeS_Y_Asset':
|
||||||
Canvas.SetDrawColor(0, 0, 0, 145);
|
Canvas.SetDrawColor(255, 255, 255, 145);
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
Canvas.SetDrawColor(0, 0, 0, 145);
|
||||||
Canvas.SetPos(Canvas.CurX-(GamepadTexSize*1.25),(B.CompPos[3]-GamepadTexSize)*0.5);
|
break;
|
||||||
Canvas.DrawRect(GamepadTexSize,GamepadTexSize,ButtonTex);
|
}
|
||||||
}
|
|
||||||
}
|
Canvas.SetPos(Canvas.CurX-(GamepadTexSize*1.25),(B.CompPos[3]-GamepadTexSize)*0.5);
|
||||||
}
|
Canvas.DrawRect(GamepadTexSize,GamepadTexSize,ButtonTex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -6,55 +6,55 @@ var PlayerInput BaseInput;
|
|||||||
|
|
||||||
function DrawHUD( HUD H )
|
function DrawHUD( HUD H )
|
||||||
{
|
{
|
||||||
//ControllerOwner.RenderMenu(H.Canvas);
|
//ControllerOwner.RenderMenu(H.Canvas);
|
||||||
}
|
}
|
||||||
function PostRender( Canvas Canvas )
|
function PostRender( Canvas Canvas )
|
||||||
{
|
{
|
||||||
if( ControllerOwner.bIsInMenuState )
|
if( ControllerOwner.bIsInMenuState )
|
||||||
ControllerOwner.HandleDrawMenu();
|
ControllerOwner.HandleDrawMenu();
|
||||||
//ControllerOwner.RenderMenu(Canvas);
|
//ControllerOwner.RenderMenu(Canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Postprocess the player's input.
|
// Postprocess the player's input.
|
||||||
function PlayerInput( float DeltaTime )
|
function PlayerInput( float DeltaTime )
|
||||||
{
|
{
|
||||||
// Do not move.
|
// Do not move.
|
||||||
ControllerOwner.MenuInput(DeltaTime);
|
ControllerOwner.MenuInput(DeltaTime);
|
||||||
|
|
||||||
if( !ControllerOwner.bAbsorbInput )
|
if( !ControllerOwner.bAbsorbInput )
|
||||||
{
|
{
|
||||||
aMouseX = 0;
|
aMouseX = 0;
|
||||||
aMouseY = 0;
|
aMouseY = 0;
|
||||||
aBaseX = BaseInput.aBaseX;
|
aBaseX = BaseInput.aBaseX;
|
||||||
aBaseY = BaseInput.aBaseY;
|
aBaseY = BaseInput.aBaseY;
|
||||||
aBaseZ = BaseInput.aBaseZ;
|
aBaseZ = BaseInput.aBaseZ;
|
||||||
aForward = BaseInput.aForward;
|
aForward = BaseInput.aForward;
|
||||||
aTurn = BaseInput.aTurn;
|
aTurn = BaseInput.aTurn;
|
||||||
aStrafe = BaseInput.aStrafe;
|
aStrafe = BaseInput.aStrafe;
|
||||||
aUp = BaseInput.aUp;
|
aUp = BaseInput.aUp;
|
||||||
aLookUp = BaseInput.aLookUp;
|
aLookUp = BaseInput.aLookUp;
|
||||||
Super.PlayerInput(DeltaTime);
|
Super.PlayerInput(DeltaTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aMouseX = 0;
|
aMouseX = 0;
|
||||||
aMouseY = 0;
|
aMouseY = 0;
|
||||||
aBaseX = 0;
|
aBaseX = 0;
|
||||||
aBaseY = 0;
|
aBaseY = 0;
|
||||||
aBaseZ = 0;
|
aBaseZ = 0;
|
||||||
aForward = 0;
|
aForward = 0;
|
||||||
aTurn = 0;
|
aTurn = 0;
|
||||||
aStrafe = 0;
|
aStrafe = 0;
|
||||||
aUp = 0;
|
aUp = 0;
|
||||||
aLookUp = 0;
|
aLookUp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreClientTravel( string PendingURL, ETravelType TravelType, bool bIsSeamlessTravel)
|
function PreClientTravel( string PendingURL, ETravelType TravelType, bool bIsSeamlessTravel)
|
||||||
{
|
{
|
||||||
`Log("PreClientTravel"@PendingURL@TravelType@bIsSeamlessTravel);
|
`Log("PreClientTravel"@PendingURL@TravelType@bIsSeamlessTravel);
|
||||||
ControllerOwner.BackupInput.PreClientTravel(PendingURL,TravelType,bIsSeamlessTravel); // Let original mod do stuff too!
|
ControllerOwner.BackupInput.PreClientTravel(PendingURL,TravelType,bIsSeamlessTravel); // Let original mod do stuff too!
|
||||||
ControllerOwner.NotifyLevelChange(); // Close menu NOW!
|
ControllerOwner.NotifyLevelChange(); // Close menu NOW!
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
|
@ -5,448 +5,448 @@ const TOOLTIP_BORDER=4;
|
|||||||
|
|
||||||
function InitStyle()
|
function InitStyle()
|
||||||
{
|
{
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
Super.InitStyle();
|
Super.InitStyle();
|
||||||
|
|
||||||
LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D'));
|
LoadedTex[0] = Texture2D(DynamicLoadObject("EditorMaterials.CASC_ModuleEnable",class'Texture2D'));
|
||||||
LoadedTex[1] = Texture2D(DynamicLoadObject("EditorMaterials.Tick",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';
|
LoadedTex[i] = Texture2D'EngineMaterials.DefaultWhiteGrid';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function RenderFramedWindow( KFGUI_FloatingWindow P )
|
function RenderFramedWindow( KFGUI_FloatingWindow P )
|
||||||
{
|
{
|
||||||
local int XS,YS,CornerSlope,TitleHeight;
|
local int XS,YS,CornerSlope,TitleHeight;
|
||||||
|
|
||||||
XS = Canvas.ClipX-Canvas.OrgX;
|
|
||||||
YS = Canvas.ClipY-Canvas.OrgY;
|
|
||||||
CornerSlope = DefaultHeight*0.4;
|
|
||||||
TitleHeight = DefaultHeight;
|
|
||||||
|
|
||||||
// Frame Header
|
XS = Canvas.ClipX-Canvas.OrgX;
|
||||||
if( P.bWindowFocused )
|
YS = Canvas.ClipY-Canvas.OrgY;
|
||||||
Canvas.SetDrawColor(220,2,2,255);
|
CornerSlope = DefaultHeight*0.4;
|
||||||
else Canvas.SetDrawColor(100,1,1,P.FrameOpacity);
|
TitleHeight = DefaultHeight;
|
||||||
Canvas.SetPos(0,0);
|
|
||||||
DrawCornerTex(CornerSlope,0);
|
// Frame Header
|
||||||
Canvas.SetPos(0,TitleHeight);
|
if( P.bWindowFocused )
|
||||||
DrawCornerTex(CornerSlope,3);
|
Canvas.SetDrawColor(220,2,2,255);
|
||||||
Canvas.SetPos(XS-CornerSlope,0);
|
else Canvas.SetDrawColor(100,1,1,P.FrameOpacity);
|
||||||
DrawCornerTex(CornerSlope,1);
|
Canvas.SetPos(0,0);
|
||||||
Canvas.SetPos(XS-CornerSlope,TitleHeight);
|
DrawCornerTex(CornerSlope,0);
|
||||||
DrawCornerTex(CornerSlope,2);
|
Canvas.SetPos(0,TitleHeight);
|
||||||
|
DrawCornerTex(CornerSlope,3);
|
||||||
// Header filling
|
Canvas.SetPos(XS-CornerSlope,0);
|
||||||
Canvas.SetPos(0,CornerSlope);
|
DrawCornerTex(CornerSlope,1);
|
||||||
DrawWhiteBox(XS,TitleHeight-CornerSlope);
|
Canvas.SetPos(XS-CornerSlope,TitleHeight);
|
||||||
Canvas.SetPos(CornerSlope,0);
|
DrawCornerTex(CornerSlope,2);
|
||||||
DrawWhiteBox(XS-(CornerSlope*2),CornerSlope);
|
|
||||||
|
// Header filling
|
||||||
// Frame itself.
|
Canvas.SetPos(0,CornerSlope);
|
||||||
if( P.bWindowFocused )
|
DrawWhiteBox(XS,TitleHeight-CornerSlope);
|
||||||
Canvas.SetDrawColor(32,6,6,255);
|
Canvas.SetPos(CornerSlope,0);
|
||||||
else Canvas.SetDrawColor(16,2,2,P.FrameOpacity);
|
DrawWhiteBox(XS-(CornerSlope*2),CornerSlope);
|
||||||
Canvas.SetPos(0,TitleHeight);
|
|
||||||
DrawCornerTex(CornerSlope,0);
|
// Frame itself.
|
||||||
Canvas.SetPos(XS-CornerSlope,TitleHeight);
|
if( P.bWindowFocused )
|
||||||
DrawCornerTex(CornerSlope,1);
|
Canvas.SetDrawColor(32,6,6,255);
|
||||||
Canvas.SetPos(0,YS-CornerSlope);
|
else Canvas.SetDrawColor(16,2,2,P.FrameOpacity);
|
||||||
DrawCornerTex(CornerSlope,2);
|
Canvas.SetPos(0,TitleHeight);
|
||||||
Canvas.SetPos(XS-CornerSlope,YS-CornerSlope);
|
DrawCornerTex(CornerSlope,0);
|
||||||
DrawCornerTex(CornerSlope,3);
|
Canvas.SetPos(XS-CornerSlope,TitleHeight);
|
||||||
|
DrawCornerTex(CornerSlope,1);
|
||||||
// Filling
|
Canvas.SetPos(0,YS-CornerSlope);
|
||||||
Canvas.SetPos(CornerSlope,TitleHeight);
|
DrawCornerTex(CornerSlope,2);
|
||||||
DrawWhiteBox(XS-(CornerSlope*2),YS-TitleHeight);
|
Canvas.SetPos(XS-CornerSlope,YS-CornerSlope);
|
||||||
Canvas.SetPos(0,TitleHeight+CornerSlope);
|
DrawCornerTex(CornerSlope,3);
|
||||||
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
|
|
||||||
Canvas.SetPos(XS-CornerSlope,TitleHeight+CornerSlope);
|
// Filling
|
||||||
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
|
Canvas.SetPos(CornerSlope,TitleHeight);
|
||||||
|
DrawWhiteBox(XS-(CornerSlope*2),YS-TitleHeight);
|
||||||
// Title.
|
Canvas.SetPos(0,TitleHeight+CornerSlope);
|
||||||
if( P.WindowTitle!="" )
|
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
|
||||||
{
|
Canvas.SetPos(XS-CornerSlope,TitleHeight+CornerSlope);
|
||||||
Canvas.SetDrawColor(250,250,250,P.FrameOpacity);
|
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2)-TitleHeight);
|
||||||
Canvas.SetPos(CornerSlope,0);
|
|
||||||
DrawText(P.WindowTitle);
|
// Title.
|
||||||
}
|
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;
|
local int XS,YS,CornerSlope;
|
||||||
|
|
||||||
XS = Canvas.ClipX-Canvas.OrgX;
|
|
||||||
YS = Canvas.ClipY-Canvas.OrgY;
|
|
||||||
CornerSlope = DefaultHeight*0.4;
|
|
||||||
|
|
||||||
// Frame itself.
|
XS = Canvas.ClipX-Canvas.OrgX;
|
||||||
if( P.bWindowFocused )
|
YS = Canvas.ClipY-Canvas.OrgY;
|
||||||
Canvas.SetDrawColor(64,64,64,255);
|
CornerSlope = DefaultHeight*0.4;
|
||||||
else Canvas.SetDrawColor(32,32,32,P.FrameOpacity);
|
|
||||||
Canvas.SetPos(0,0);
|
// Frame itself.
|
||||||
DrawCornerTex(CornerSlope,0);
|
if( P.bWindowFocused )
|
||||||
Canvas.SetPos(XS-CornerSlope,0);
|
Canvas.SetDrawColor(64,64,64,255);
|
||||||
DrawCornerTex(CornerSlope,1);
|
else Canvas.SetDrawColor(32,32,32,P.FrameOpacity);
|
||||||
Canvas.SetPos(0,YS-CornerSlope);
|
Canvas.SetPos(0,0);
|
||||||
DrawCornerTex(CornerSlope,2);
|
DrawCornerTex(CornerSlope,0);
|
||||||
Canvas.SetPos(XS-CornerSlope,YS-CornerSlope);
|
Canvas.SetPos(XS-CornerSlope,0);
|
||||||
DrawCornerTex(CornerSlope,3);
|
DrawCornerTex(CornerSlope,1);
|
||||||
|
Canvas.SetPos(0,YS-CornerSlope);
|
||||||
// Filling
|
DrawCornerTex(CornerSlope,2);
|
||||||
Canvas.SetPos(CornerSlope,0);
|
Canvas.SetPos(XS-CornerSlope,YS-CornerSlope);
|
||||||
DrawWhiteBox(XS-(CornerSlope*2),YS);
|
DrawCornerTex(CornerSlope,3);
|
||||||
Canvas.SetPos(0,CornerSlope);
|
|
||||||
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
|
// Filling
|
||||||
Canvas.SetPos(XS-CornerSlope,CornerSlope);
|
Canvas.SetPos(CornerSlope,0);
|
||||||
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
|
DrawWhiteBox(XS-(CornerSlope*2),YS);
|
||||||
|
Canvas.SetPos(0,CornerSlope);
|
||||||
|
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
|
||||||
|
Canvas.SetPos(XS-CornerSlope,CornerSlope);
|
||||||
|
DrawWhiteBox(CornerSlope,YS-(CornerSlope*2));
|
||||||
}
|
}
|
||||||
function RenderToolTip( KFGUI_Tooltip TT )
|
function RenderToolTip( KFGUI_Tooltip TT )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
|
local float X,Y,XS,YS,TX,TY,TS,DefFontHeight;
|
||||||
|
|
||||||
Canvas.Font = PickFont(TS);
|
Canvas.Font = PickFont(TS);
|
||||||
|
|
||||||
// First compute textbox size.
|
// First compute textbox size.
|
||||||
TY = DefaultHeight*TT.Lines.Length;
|
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);
|
Canvas.TextSize(TT.Lines[i],XS,YS);
|
||||||
TX = FMax(XS,TX);
|
TX = FMax(XS,TX);
|
||||||
}
|
}
|
||||||
TX*=TS;
|
TX*=TS;
|
||||||
|
|
||||||
// Give some borders.
|
|
||||||
TX += TOOLTIP_BORDER*2;
|
|
||||||
TY += TOOLTIP_BORDER*2;
|
|
||||||
|
|
||||||
X = TT.CompPos[0];
|
// Give some borders.
|
||||||
Y = TT.CompPos[1]+24.f;
|
TX += TOOLTIP_BORDER*2;
|
||||||
|
TY += TOOLTIP_BORDER*2;
|
||||||
|
|
||||||
// Then check if too close to window edge, then move it to another pivot.
|
X = TT.CompPos[0];
|
||||||
if( (X+TX)>TT.Owner.ScreenSize.X )
|
Y = TT.CompPos[1]+24.f;
|
||||||
X = TT.Owner.ScreenSize.X-TX;
|
|
||||||
if( (Y+TY)>TT.Owner.ScreenSize.Y )
|
|
||||||
Y = TT.CompPos[1]-TY;
|
|
||||||
|
|
||||||
if( TT.CurrentAlpha<255 )
|
|
||||||
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
|
|
||||||
|
|
||||||
// Reset clipping.
|
// Then check if too close to window edge, then move it to another pivot.
|
||||||
Canvas.SetOrigin(0,0);
|
if( (X+TX)>TT.Owner.ScreenSize.X )
|
||||||
Canvas.SetClip(TT.Owner.ScreenSize.X,TT.Owner.ScreenSize.Y);
|
X = TT.Owner.ScreenSize.X-TX;
|
||||||
|
if( (Y+TY)>TT.Owner.ScreenSize.Y )
|
||||||
|
Y = TT.CompPos[1]-TY;
|
||||||
|
|
||||||
// Draw frame.
|
if( TT.CurrentAlpha<255 )
|
||||||
Canvas.SetDrawColor(200,200,80,TT.CurrentAlpha);
|
TT.CurrentAlpha = Min(TT.CurrentAlpha+25,255);
|
||||||
Canvas.SetPos(X-2,Y-2);
|
|
||||||
DrawBoxHollow(X-2,Y-2,TX+4,TY+4,2);
|
|
||||||
Canvas.SetDrawColor(80,10,80,TT.CurrentAlpha);
|
|
||||||
Canvas.SetPos(X,Y);
|
|
||||||
DrawWhiteBox(TX,TY);
|
|
||||||
|
|
||||||
DefFontHeight = DefaultHeight;
|
|
||||||
|
|
||||||
// Draw text.
|
// Reset clipping.
|
||||||
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
|
Canvas.SetOrigin(0,0);
|
||||||
X+=TOOLTIP_BORDER;
|
Canvas.SetClip(TT.Owner.ScreenSize.X,TT.Owner.ScreenSize.Y);
|
||||||
Y+=TOOLTIP_BORDER;
|
|
||||||
for( i=0; i<TT.Lines.Length; ++i )
|
// Draw frame.
|
||||||
{
|
Canvas.SetDrawColor(200,200,80,TT.CurrentAlpha);
|
||||||
Canvas.SetPos(X,Y);
|
Canvas.SetPos(X-2,Y-2);
|
||||||
Canvas.DrawText(TT.Lines[i],,TS,TS,TT.TextFontInfo);
|
DrawBoxHollow(X-2,Y-2,TX+4,TY+4,2);
|
||||||
Y+=DefFontHeight;
|
Canvas.SetDrawColor(80,10,80,TT.CurrentAlpha);
|
||||||
}
|
Canvas.SetPos(X,Y);
|
||||||
|
DrawWhiteBox(TX,TY);
|
||||||
|
|
||||||
|
DefFontHeight = DefaultHeight;
|
||||||
|
|
||||||
|
// Draw text.
|
||||||
|
Canvas.SetDrawColor(255,255,255,TT.CurrentAlpha);
|
||||||
|
X+=TOOLTIP_BORDER;
|
||||||
|
Y+=TOOLTIP_BORDER;
|
||||||
|
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 float A;
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
if( S.bDisabled )
|
if( S.bDisabled )
|
||||||
Canvas.SetDrawColor(5, 5, 5, 0);
|
Canvas.SetDrawColor(5, 5, 5, 0);
|
||||||
else if( S.bFocused || S.bGrabbedScroller )
|
else if( S.bFocused || S.bGrabbedScroller )
|
||||||
Canvas.SetDrawColor(15, 15, 15, 160);
|
Canvas.SetDrawColor(15, 15, 15, 160);
|
||||||
else 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);
|
DrawRectBox (0.f, 0.f, S.CompPos[2], S.CompPos[3], 4);
|
||||||
|
|
||||||
if( S.bDisabled )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( S.bVertical )
|
if( S.bDisabled )
|
||||||
i = 3;
|
return;
|
||||||
else i = 2;
|
|
||||||
|
|
||||||
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
|
|
||||||
|
|
||||||
if( S.bGrabbedScroller )
|
|
||||||
{
|
|
||||||
// Track mouse.
|
|
||||||
if( S.bVertical )
|
|
||||||
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
|
|
||||||
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
|
|
||||||
|
|
||||||
A /= ((S.CompPos[i]-S.SliderScale) / float(S.MaxRange));
|
|
||||||
S.SetValue(A);
|
|
||||||
}
|
|
||||||
|
|
||||||
A = float(S.CurrentScroll) / float(S.MaxRange);
|
if( S.bVertical )
|
||||||
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
|
i = 3;
|
||||||
|
else i = 2;
|
||||||
|
|
||||||
if( S.bGrabbedScroller )
|
S.SliderScale = FMax(S.PageStep * (S.CompPos[i] - 32.f) / (S.MaxRange + S.PageStep),S.CalcButtonScale);
|
||||||
Canvas.SetDrawColor(255,0,0,200);
|
|
||||||
else if( S.bFocused )
|
|
||||||
Canvas.SetDrawColor(200,0,0,200);
|
|
||||||
else Canvas.SetDrawColor(150,0,0,200);
|
|
||||||
|
|
||||||
if( S.bVertical )
|
if( S.bGrabbedScroller )
|
||||||
DrawRectBox (0.f, S.ButtonOffset, S.CompPos[2], S.SliderScale, 4);
|
{
|
||||||
else DrawRectBox (S.ButtonOffset, 0.f, S.SliderScale, S.CompPos[3], 4);
|
// Track mouse.
|
||||||
|
if( S.bVertical )
|
||||||
|
A = S.Owner.MousePosition.Y - S.CompPos[1] - S.GrabbedOffset;
|
||||||
|
else A = S.Owner.MousePosition.X - S.CompPos[0] - S.GrabbedOffset;
|
||||||
|
|
||||||
|
A /= ((S.CompPos[i]-S.SliderScale) / float(S.MaxRange));
|
||||||
|
S.SetValue(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
A = float(S.CurrentScroll) / float(S.MaxRange);
|
||||||
|
S.ButtonOffset = A*(S.CompPos[i]-S.SliderScale);
|
||||||
|
|
||||||
|
if( S.bGrabbedScroller )
|
||||||
|
Canvas.SetDrawColor(255,0,0,200);
|
||||||
|
else if( S.bFocused )
|
||||||
|
Canvas.SetDrawColor(200,0,0,200);
|
||||||
|
else Canvas.SetDrawColor(150,0,0,200);
|
||||||
|
|
||||||
|
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;
|
local int XS;
|
||||||
|
|
||||||
if( bSort )
|
if( bSort )
|
||||||
{
|
{
|
||||||
if( bFocus )
|
if( bFocus )
|
||||||
Canvas.SetDrawColor(175,240,8,255);
|
Canvas.SetDrawColor(175,240,8,255);
|
||||||
else Canvas.SetDrawColor(128,200,56,255);
|
else Canvas.SetDrawColor(128,200,56,255);
|
||||||
}
|
}
|
||||||
else if( bFocus )
|
else if( bFocus )
|
||||||
Canvas.SetDrawColor(220,220,8,255);
|
Canvas.SetDrawColor(220,220,8,255);
|
||||||
else Canvas.SetDrawColor(220,86,56,255);
|
else Canvas.SetDrawColor(220,86,56,255);
|
||||||
|
|
||||||
XS = DefaultHeight*0.125;
|
XS = DefaultHeight*0.125;
|
||||||
Canvas.SetPos(XPos,0.f);
|
Canvas.SetPos(XPos,0.f);
|
||||||
DrawCornerTexNU(XS,C.CompPos[3],0);
|
DrawCornerTexNU(XS,C.CompPos[3],0);
|
||||||
Canvas.SetPos(XPos+XS,0.f);
|
Canvas.SetPos(XPos+XS,0.f);
|
||||||
DrawWhiteBox(Width-(XS*2),C.CompPos[3]);
|
DrawWhiteBox(Width-(XS*2),C.CompPos[3]);
|
||||||
Canvas.SetPos(XPos+Width-(XS*2),0.f);
|
Canvas.SetPos(XPos+Width-(XS*2),0.f);
|
||||||
DrawCornerTexNU(XS,C.CompPos[3],1);
|
DrawCornerTexNU(XS,C.CompPos[3],1);
|
||||||
|
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
Canvas.SetPos(XPos+XS,(C.CompPos[3]-C.ListOwner.TextHeight)*0.5f);
|
Canvas.SetPos(XPos+XS,(C.CompPos[3]-C.ListOwner.TextHeight)*0.5f);
|
||||||
C.ListOwner.DrawStrClipped(C.ListOwner.Columns[Index].Text);
|
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);
|
Canvas.SetDrawColor(86,86,86,255);
|
||||||
else if( C.bPressedDown )
|
else if( C.bPressedDown )
|
||||||
Canvas.SetDrawColor(128,255,128,255);
|
Canvas.SetDrawColor(128,255,128,255);
|
||||||
else if( C.bFocused )
|
else if( C.bFocused )
|
||||||
Canvas.SetDrawColor(150,200,128,255);
|
Canvas.SetDrawColor(150,200,128,255);
|
||||||
else Canvas.SetDrawColor(128,186,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 )
|
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.bDisabled )
|
|
||||||
Canvas.SetDrawColor(128,128,128,255);
|
if( C.bChecked )
|
||||||
else Canvas.SetDrawColor(255,255,255,255);
|
{
|
||||||
Canvas.SetPos(0.f,0.f);
|
if( C.bDisabled )
|
||||||
Canvas.DrawTile(LoadedTex[1],C.CompPos[2],C.CompPos[3],0,0,LoadedTex[1].GetSurfaceWidth(),LoadedTex[1].GetSurfaceHeight());
|
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);
|
Canvas.SetDrawColor(64,4,4,255);
|
||||||
else if( C.bPressedDown )
|
else if( C.bPressedDown )
|
||||||
Canvas.SetDrawColor(220,56,56,255);
|
Canvas.SetDrawColor(220,56,56,255);
|
||||||
else if( C.bFocused )
|
else if( C.bFocused )
|
||||||
Canvas.SetDrawColor(190,48,48,255);
|
Canvas.SetDrawColor(190,48,48,255);
|
||||||
else Canvas.SetDrawColor(186,4,4,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]!="" )
|
Canvas.SetPos(0.f,0.f);
|
||||||
{
|
DrawWhiteBox(C.CompPos[2],C.CompPos[3]);
|
||||||
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
|
|
||||||
if( C.bDisabled )
|
if( C.SelectedIndex<C.Values.Length && C.Values[C.SelectedIndex]!="" )
|
||||||
Canvas.DrawColor = C.TextColor*0.5f;
|
{
|
||||||
else Canvas.DrawColor = C.TextColor;
|
Canvas.SetPos(C.BorderSize,(C.CompPos[3]-C.TextHeight)*0.5);
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
|
if( C.bDisabled )
|
||||||
Canvas.DrawText(C.Values[C.SelectedIndex],,C.TextScale,C.TextScale,C.TextFontInfo);
|
Canvas.DrawColor = C.TextColor*0.5f;
|
||||||
Canvas.PopMaskRegion();
|
else Canvas.DrawColor = C.TextColor;
|
||||||
}
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX-C.BorderSize,Canvas.ClipY);
|
||||||
|
Canvas.DrawText(C.Values[C.SelectedIndex],,C.TextScale,C.TextScale,C.TextFontInfo);
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function RenderComboList( KFGUI_ComboSelector C )
|
function RenderComboList( KFGUI_ComboSelector C )
|
||||||
{
|
{
|
||||||
local float X,Y,YL,YP,Edge;
|
local float X,Y,YL,YP,Edge;
|
||||||
local int i;
|
local int i;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
// Draw background.
|
|
||||||
Edge = C.Combo.BorderSize;
|
|
||||||
Canvas.SetPos(0.f,0.f);
|
|
||||||
Canvas.SetDrawColor(128,4,4,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2],C.CompPos[3]);
|
|
||||||
Canvas.SetPos(Edge,Edge);
|
|
||||||
Canvas.SetDrawColor(64,4,4,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),C.CompPos[3]-(Edge*2.f));
|
|
||||||
|
|
||||||
// While rendering, figure out mouse focus row.
|
// Draw background.
|
||||||
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
Edge = C.Combo.BorderSize;
|
||||||
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
Canvas.SetPos(0.f,0.f);
|
||||||
|
Canvas.SetDrawColor(128,4,4,255);
|
||||||
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
DrawWhiteBox(C.CompPos[2],C.CompPos[3]);
|
||||||
|
Canvas.SetPos(Edge,Edge);
|
||||||
Canvas.Font = C.Combo.TextFont;
|
Canvas.SetDrawColor(64,4,4,255);
|
||||||
YL = C.Combo.TextHeight;
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),C.CompPos[3]-(Edge*2.f));
|
||||||
|
|
||||||
YP = Edge;
|
// While rendering, figure out mouse focus row.
|
||||||
C.CurrentRow = -1;
|
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
||||||
|
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
||||||
|
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
||||||
for( i=0; i<C.Combo.Values.Length; ++i )
|
|
||||||
{
|
|
||||||
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
|
|
||||||
{
|
|
||||||
bCheckMouse = false;
|
|
||||||
C.CurrentRow = i;
|
|
||||||
Canvas.SetPos(4.f,YP);
|
|
||||||
Canvas.SetDrawColor(128,48,48,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
|
||||||
}
|
|
||||||
Canvas.SetPos(Edge,YP);
|
|
||||||
|
|
||||||
if( i==C.Combo.SelectedIndex )
|
|
||||||
Canvas.DrawColor = C.Combo.SelectedTextColor;
|
|
||||||
else Canvas.DrawColor = C.Combo.TextColor;
|
|
||||||
|
|
||||||
Canvas.DrawText(C.Combo.Values[i],,C.Combo.TextScale,C.Combo.TextScale,C.Combo.TextFontInfo);
|
Canvas.Font = C.Combo.TextFont;
|
||||||
|
YL = C.Combo.TextHeight;
|
||||||
YP+=YL;
|
|
||||||
}
|
YP = Edge;
|
||||||
Canvas.PopMaskRegion();
|
C.CurrentRow = -1;
|
||||||
if( C.OldRow!=C.CurrentRow )
|
|
||||||
{
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
||||||
C.OldRow = C.CurrentRow;
|
for( i=0; i<C.Combo.Values.Length; ++i )
|
||||||
C.PlayMenuSound(MN_DropdownChange);
|
{
|
||||||
}
|
if( bCheckMouse && Y>=YP && Y<=(YP+YL) )
|
||||||
|
{
|
||||||
|
bCheckMouse = false;
|
||||||
|
C.CurrentRow = i;
|
||||||
|
Canvas.SetPos(4.f,YP);
|
||||||
|
Canvas.SetDrawColor(128,48,48,255);
|
||||||
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),YL);
|
||||||
|
}
|
||||||
|
Canvas.SetPos(Edge,YP);
|
||||||
|
|
||||||
|
if( i==C.Combo.SelectedIndex )
|
||||||
|
Canvas.DrawColor = C.Combo.SelectedTextColor;
|
||||||
|
else Canvas.DrawColor = C.Combo.TextColor;
|
||||||
|
|
||||||
|
Canvas.DrawText(C.Combo.Values[i],,C.Combo.TextScale,C.Combo.TextScale,C.Combo.TextFontInfo);
|
||||||
|
|
||||||
|
YP+=YL;
|
||||||
|
}
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
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 float X,Y,YP,Edge,TextScale,TexDefHieght;
|
||||||
local int i;
|
local int i;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
// Draw background.
|
|
||||||
Edge = C.EdgeSize;
|
|
||||||
Canvas.SetDrawColor(148,4,4,255);
|
|
||||||
DrawBoxHollow(0.f,0.f,C.CompPos[2],C.CompPos[3],Edge);
|
|
||||||
Canvas.SetPos(Edge,Edge);
|
|
||||||
Canvas.SetDrawColor(64,4,4,200);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),C.CompPos[3]-(Edge*2.f));
|
|
||||||
|
|
||||||
// While rendering, figure out mouse focus row.
|
// Draw background.
|
||||||
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
Edge = C.EdgeSize;
|
||||||
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
Canvas.SetDrawColor(148,4,4,255);
|
||||||
|
DrawBoxHollow(0.f,0.f,C.CompPos[2],C.CompPos[3],Edge);
|
||||||
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
Canvas.SetPos(Edge,Edge);
|
||||||
|
Canvas.SetDrawColor(64,4,4,200);
|
||||||
Canvas.Font = PickFont(TextScale);
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),C.CompPos[3]-(Edge*2.f));
|
||||||
|
|
||||||
YP = Edge;
|
// While rendering, figure out mouse focus row.
|
||||||
C.CurrentRow = -1;
|
X = C.Owner.MousePosition.X - Canvas.OrgX;
|
||||||
|
Y = C.Owner.MousePosition.Y - Canvas.OrgY;
|
||||||
|
|
||||||
TexDefHieght = DefaultHeight;
|
bCheckMouse = (X>0.f && X<C.CompPos[2] && Y>0.f && Y<C.CompPos[3]);
|
||||||
|
|
||||||
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
Canvas.Font = PickFont(TextScale);
|
||||||
for( i=0; i<C.ItemRows.Length; ++i )
|
|
||||||
{
|
|
||||||
if( bCheckMouse && Y>=YP && Y<=(YP+TexDefHieght) )
|
|
||||||
{
|
|
||||||
bCheckMouse = false;
|
|
||||||
C.CurrentRow = i;
|
|
||||||
Canvas.SetPos(4.f,YP);
|
|
||||||
Canvas.SetDrawColor(128,48,48,255);
|
|
||||||
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),TexDefHieght);
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.SetPos(Edge,YP);
|
YP = Edge;
|
||||||
if( C.ItemRows[i].bSplitter )
|
C.CurrentRow = -1;
|
||||||
{
|
|
||||||
Canvas.SetDrawColor(0,0,0,255);
|
TexDefHieght = DefaultHeight;
|
||||||
Canvas.DrawText("-------",,TextScale,TextScale);
|
|
||||||
}
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
||||||
else
|
for( i=0; i<C.ItemRows.Length; ++i )
|
||||||
{
|
{
|
||||||
if( C.ItemRows[i].bDisabled )
|
if( bCheckMouse && Y>=YP && Y<=(YP+TexDefHieght) )
|
||||||
Canvas.SetDrawColor(148,148,148,255);
|
{
|
||||||
else Canvas.SetDrawColor(248,248,248,255);
|
bCheckMouse = false;
|
||||||
Canvas.DrawText(C.ItemRows[i].Text,,TextScale,TextScale);
|
C.CurrentRow = i;
|
||||||
}
|
Canvas.SetPos(4.f,YP);
|
||||||
|
Canvas.SetDrawColor(128,48,48,255);
|
||||||
YP+=TexDefHieght;
|
DrawWhiteBox(C.CompPos[2]-(Edge*2.f),TexDefHieght);
|
||||||
}
|
}
|
||||||
Canvas.PopMaskRegion();
|
|
||||||
if( C.OldRow!=C.CurrentRow )
|
Canvas.SetPos(Edge,YP);
|
||||||
{
|
if( C.ItemRows[i].bSplitter )
|
||||||
C.OldRow = C.CurrentRow;
|
{
|
||||||
C.PlayMenuSound(MN_DropdownChange);
|
Canvas.SetDrawColor(0,0,0,255);
|
||||||
}
|
Canvas.DrawText("-------",,TextScale,TextScale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
YP+=TexDefHieght;
|
||||||
|
}
|
||||||
|
Canvas.PopMaskRegion();
|
||||||
|
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 float XL,YL,TS;
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
if( B.bDisabled )
|
if( B.bDisabled )
|
||||||
Canvas.SetDrawColor(32,0,0,255);
|
Canvas.SetDrawColor(32,0,0,255);
|
||||||
else if( B.bPressedDown )
|
else if( B.bPressedDown )
|
||||||
Canvas.SetDrawColor(255,64,64,255);
|
Canvas.SetDrawColor(255,64,64,255);
|
||||||
else if( B.bFocused )
|
else if( B.bFocused )
|
||||||
Canvas.SetDrawColor(180,45,45,255);
|
Canvas.SetDrawColor(180,45,45,255);
|
||||||
else Canvas.SetDrawColor(164,8,8,255);
|
else Canvas.SetDrawColor(164,8,8,255);
|
||||||
|
|
||||||
if( B.bIsHighlighted )
|
|
||||||
{
|
|
||||||
Canvas.DrawColor.R = Min(Canvas.DrawColor.R+25,255);
|
|
||||||
Canvas.DrawColor.G = Min(Canvas.DrawColor.G+25,255);
|
|
||||||
Canvas.DrawColor.B = Min(Canvas.DrawColor.B+25,255);
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.SetPos(0.f,0.f);
|
if( B.bIsHighlighted )
|
||||||
if( B.ExtravDir==255 )
|
{
|
||||||
DrawWhiteBox(B.CompPos[2],B.CompPos[3]);
|
Canvas.DrawColor.R = Min(Canvas.DrawColor.R+25,255);
|
||||||
else DrawRectBox(0,0,B.CompPos[2],B.CompPos[3],Min(B.CompPos[2],B.CompPos[3])*0.2,B.ExtravDir);
|
Canvas.DrawColor.G = Min(Canvas.DrawColor.G+25,255);
|
||||||
|
Canvas.DrawColor.B = Min(Canvas.DrawColor.B+25,255);
|
||||||
|
}
|
||||||
|
|
||||||
if( B.OverlayTexture.Texture!=None )
|
Canvas.SetPos(0.f,0.f);
|
||||||
{
|
if( B.ExtravDir==255 )
|
||||||
Canvas.SetPos(0.f,0.f);
|
DrawWhiteBox(B.CompPos[2],B.CompPos[3]);
|
||||||
Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL);
|
else DrawRectBox(0,0,B.CompPos[2],B.CompPos[3],Min(B.CompPos[2],B.CompPos[3])*0.2,B.ExtravDir);
|
||||||
}
|
|
||||||
if( B.ButtonText!="" )
|
if( B.OverlayTexture.Texture!=None )
|
||||||
{
|
{
|
||||||
// Chose the best font to fit this button.
|
Canvas.SetPos(0.f,0.f);
|
||||||
i = Min(B.FontScale,MaxFontScale);
|
Canvas.DrawTile(B.OverlayTexture.Texture,B.CompPos[2],B.CompPos[3],B.OverlayTexture.U,B.OverlayTexture.V,B.OverlayTexture.UL,B.OverlayTexture.VL);
|
||||||
while( true )
|
}
|
||||||
{
|
if( B.ButtonText!="" )
|
||||||
Canvas.Font = PickFont(TS);
|
{
|
||||||
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
|
// Chose the best font to fit this button.
|
||||||
if( i==0 || (XL<(B.CompPos[2]*0.95) && YL<(B.CompPos[3]*0.95)) )
|
i = Min(B.FontScale,MaxFontScale);
|
||||||
break;
|
while( true )
|
||||||
--i;
|
{
|
||||||
}
|
Canvas.Font = PickFont(TS);
|
||||||
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
|
Canvas.TextSize(B.ButtonText,XL,YL,TS,TS);
|
||||||
if( B.bDisabled )
|
if( i==0 || (XL<(B.CompPos[2]*0.95) && YL<(B.CompPos[3]*0.95)) )
|
||||||
Canvas.DrawColor = B.TextColor*0.5f;
|
break;
|
||||||
else Canvas.DrawColor = B.TextColor;
|
--i;
|
||||||
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
|
}
|
||||||
}
|
Canvas.SetPos((B.CompPos[2]-XL)*0.5,(B.CompPos[3]-YL)*0.5);
|
||||||
|
if( B.bDisabled )
|
||||||
|
Canvas.DrawColor = B.TextColor*0.5f;
|
||||||
|
else Canvas.DrawColor = B.TextColor;
|
||||||
|
Canvas.DrawText(B.ButtonText,,TS,TS,B.TextFontInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
MaxFontScale=5
|
MaxFontScale=5
|
||||||
}
|
}
|
@ -1,120 +1,120 @@
|
|||||||
//All code here was done by Mr Evil.
|
//All code here was done by Mr Evil.
|
||||||
class KFColorHelper extends Object
|
class KFColorHelper extends Object
|
||||||
transient;
|
transient;
|
||||||
|
|
||||||
struct HSVColour
|
struct HSVColour
|
||||||
{
|
{
|
||||||
var() float H, S, V, A;
|
var() float H, S, V, A;
|
||||||
|
|
||||||
structdefaultproperties
|
structdefaultproperties
|
||||||
{
|
{
|
||||||
A=1.0
|
A=1.0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static final function HSVColour RGBToHSV(const LinearColor RGB)
|
static final function HSVColour RGBToHSV(const LinearColor RGB)
|
||||||
{
|
{
|
||||||
local float Max;
|
local float Max;
|
||||||
local float Min;
|
local float Min;
|
||||||
local float Chroma;
|
local float Chroma;
|
||||||
local HSVColour HSV;
|
local HSVColour HSV;
|
||||||
|
|
||||||
Min = FMin(FMin(RGB.R, RGB.G), RGB.B);
|
Min = FMin(FMin(RGB.R, RGB.G), RGB.B);
|
||||||
Max = FMax(FMax(RGB.R, RGB.G), RGB.B);
|
Max = FMax(FMax(RGB.R, RGB.G), RGB.B);
|
||||||
Chroma = Max - Min;
|
Chroma = Max - Min;
|
||||||
|
|
||||||
//If Chroma is 0, then S is 0 by definition, and H is undefined but 0 by convention.
|
//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;
|
HSV.H = (RGB.G - RGB.B) / Chroma;
|
||||||
|
|
||||||
if(HSV.H < 0.0)
|
if(HSV.H < 0.0)
|
||||||
{
|
{
|
||||||
HSV.H += 6.0;
|
HSV.H += 6.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(RGB.G == Max)
|
else if(RGB.G == Max)
|
||||||
{
|
{
|
||||||
HSV.H = ((RGB.B - RGB.R) / Chroma) + 2.0;
|
HSV.H = ((RGB.B - RGB.R) / Chroma) + 2.0;
|
||||||
}
|
}
|
||||||
else //RGB.B == Max
|
else //RGB.B == Max
|
||||||
{
|
{
|
||||||
HSV.H = ((RGB.R - RGB.G) / Chroma) + 4.0;
|
HSV.H = ((RGB.R - RGB.G) / Chroma) + 4.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HSV.H *= 60.0;
|
HSV.H *= 60.0;
|
||||||
HSV.S = Chroma / Max;
|
HSV.S = Chroma / Max;
|
||||||
}
|
}
|
||||||
|
|
||||||
HSV.V = Max;
|
HSV.V = Max;
|
||||||
HSV.A = RGB.A;
|
HSV.A = RGB.A;
|
||||||
|
|
||||||
return HSV;
|
return HSV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final function LinearColor HSVToRGB(const HSVColour HSV)
|
static final function LinearColor HSVToRGB(const HSVColour HSV)
|
||||||
{
|
{
|
||||||
local float Min;
|
local float Min;
|
||||||
local float Chroma;
|
local float Chroma;
|
||||||
local float Hdash;
|
local float Hdash;
|
||||||
local float X;
|
local float X;
|
||||||
local LinearColor RGB;
|
local LinearColor RGB;
|
||||||
|
|
||||||
Chroma = HSV.S * HSV.V;
|
Chroma = HSV.S * HSV.V;
|
||||||
Hdash = HSV.H / 60.0;
|
Hdash = HSV.H / 60.0;
|
||||||
X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0));
|
X = Chroma * (1.0 - Abs((Hdash % 2.0) - 1.0));
|
||||||
|
|
||||||
if(Hdash < 1.0)
|
if(Hdash < 1.0)
|
||||||
{
|
{
|
||||||
RGB.R = Chroma;
|
RGB.R = Chroma;
|
||||||
RGB.G = X;
|
RGB.G = X;
|
||||||
}
|
}
|
||||||
else if(Hdash < 2.0)
|
else if(Hdash < 2.0)
|
||||||
{
|
{
|
||||||
RGB.R = X;
|
RGB.R = X;
|
||||||
RGB.G = Chroma;
|
RGB.G = Chroma;
|
||||||
}
|
}
|
||||||
else if(Hdash < 3.0)
|
else if(Hdash < 3.0)
|
||||||
{
|
{
|
||||||
RGB.G = Chroma;
|
RGB.G = Chroma;
|
||||||
RGB.B = X;
|
RGB.B = X;
|
||||||
}
|
}
|
||||||
else if(Hdash < 4.0)
|
else if(Hdash < 4.0)
|
||||||
{
|
{
|
||||||
RGB.G= X;
|
RGB.G= X;
|
||||||
RGB.B = Chroma;
|
RGB.B = Chroma;
|
||||||
}
|
}
|
||||||
else if(Hdash < 5.0)
|
else if(Hdash < 5.0)
|
||||||
{
|
{
|
||||||
RGB.R = X;
|
RGB.R = X;
|
||||||
RGB.B = Chroma;
|
RGB.B = Chroma;
|
||||||
}
|
}
|
||||||
else if(Hdash < 6.0)
|
else if(Hdash < 6.0)
|
||||||
{
|
{
|
||||||
RGB.R = Chroma;
|
RGB.R = Chroma;
|
||||||
RGB.B = X;
|
RGB.B = X;
|
||||||
}
|
}
|
||||||
|
|
||||||
Min = HSV.V - Chroma;
|
Min = HSV.V - Chroma;
|
||||||
|
|
||||||
RGB.R += Min;
|
RGB.R += Min;
|
||||||
RGB.G += Min;
|
RGB.G += Min;
|
||||||
RGB.B += Min;
|
RGB.B += Min;
|
||||||
RGB.A = HSV.A;
|
RGB.A = HSV.A;
|
||||||
|
|
||||||
return RGB;
|
return RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final function Color LinearColorToColor(const LinearColor RGB)
|
static final function Color LinearColorToColor(const LinearColor RGB)
|
||||||
{
|
{
|
||||||
local Color TrueRGB;
|
local Color TrueRGB;
|
||||||
|
|
||||||
TrueRGB.R = RGB.R * 255;
|
TrueRGB.R = RGB.R * 255;
|
||||||
TrueRGB.G = RGB.G * 255;
|
TrueRGB.G = RGB.G * 255;
|
||||||
TrueRGB.B = RGB.B * 255;
|
TrueRGB.B = RGB.B * 255;
|
||||||
TrueRGB.A = RGB.A * 255;
|
TrueRGB.A = RGB.A * 255;
|
||||||
|
|
||||||
return TrueRGB;
|
return TrueRGB;
|
||||||
}
|
}
|
@ -5,5 +5,5 @@ var KF2GUIController OutputObject;
|
|||||||
|
|
||||||
function PostRender_Console(Canvas Canvas)
|
function PostRender_Console(Canvas Canvas)
|
||||||
{
|
{
|
||||||
OutputObject.RenderMenu(Canvas);
|
OutputObject.RenderMenu(Canvas);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Menu system written by Marco.
|
// Menu system written by Marco.
|
||||||
Class KFGUI_Base extends Object
|
Class KFGUI_Base extends Object
|
||||||
abstract;
|
abstract;
|
||||||
|
|
||||||
var KF2GUIController Owner;
|
var KF2GUIController Owner;
|
||||||
var ScoreboardExtHUD HUDOwner;
|
var ScoreboardExtHUD HUDOwner;
|
||||||
@ -9,14 +9,14 @@ var transient Canvas Canvas;
|
|||||||
|
|
||||||
enum EMenuSound
|
enum EMenuSound
|
||||||
{
|
{
|
||||||
MN_Focus,
|
MN_Focus,
|
||||||
MN_LostFocus,
|
MN_LostFocus,
|
||||||
MN_FocusHover,
|
MN_FocusHover,
|
||||||
MN_ClickButton,
|
MN_ClickButton,
|
||||||
MN_ClickCheckboxOn,
|
MN_ClickCheckboxOn,
|
||||||
MN_ClickCheckboxOff,
|
MN_ClickCheckboxOff,
|
||||||
MN_Dropdown,
|
MN_Dropdown,
|
||||||
MN_DropdownChange,
|
MN_DropdownChange,
|
||||||
};
|
};
|
||||||
|
|
||||||
var() float XPosition,YPosition,XSize,YSize;
|
var() float XPosition,YPosition,XSize,YSize;
|
||||||
@ -36,14 +36,14 @@ function InitMenu(); // Menu was initialized for the first time.
|
|||||||
function ShowMenu(); // Menu was opened.
|
function ShowMenu(); // Menu was opened.
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
if( !bVisible )
|
if( !bVisible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ComputeCoords();
|
ComputeCoords();
|
||||||
Canvas.SetDrawColor(255,255,255);
|
Canvas.SetDrawColor(255,255,255);
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
DrawMenu();
|
DrawMenu();
|
||||||
}
|
}
|
||||||
function DrawMenu(); // Draw menu now.
|
function DrawMenu(); // Draw menu now.
|
||||||
function CloseMenu(); // Menu was closed.
|
function CloseMenu(); // Menu was closed.
|
||||||
@ -52,211 +52,211 @@ function MenuTick( float DeltaTime );
|
|||||||
|
|
||||||
final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer')
|
final function SetTimer(float InRate, optional bool inbLoop, optional Name inTimerFunc='Timer')
|
||||||
{
|
{
|
||||||
if( InRate <= 0.f )
|
if( InRate <= 0.f )
|
||||||
{
|
{
|
||||||
ClearTimer(inTimerFunc);
|
ClearTimer(inTimerFunc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( TimerNames.Find(inTimerFunc) == INDEX_NONE )
|
if( TimerNames.Find(inTimerFunc) == INDEX_NONE )
|
||||||
{
|
{
|
||||||
TimerNames.AddItem(inTimerFunc);
|
TimerNames.AddItem(inTimerFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
`TimerHelper.SetTimer( InRate, inbLoop, inTimerFunc, self );
|
`TimerHelper.SetTimer( InRate, inbLoop, inTimerFunc, self );
|
||||||
}
|
}
|
||||||
final function ClearTimer(optional Name inTimerFunc='Timer')
|
final function ClearTimer(optional Name inTimerFunc='Timer')
|
||||||
{
|
{
|
||||||
if( TimerNames.Find(inTimerFunc) != INDEX_NONE )
|
if( TimerNames.Find(inTimerFunc) != INDEX_NONE )
|
||||||
{
|
{
|
||||||
TimerNames.RemoveItem(inTimerFunc);
|
TimerNames.RemoveItem(inTimerFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
`TimerHelper.ClearTimer( inTimerFunc, self );
|
`TimerHelper.ClearTimer( inTimerFunc, self );
|
||||||
}
|
}
|
||||||
function Timer();
|
function Timer();
|
||||||
|
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
bFocused = true;
|
bFocused = true;
|
||||||
OnFocus(Self,True);
|
OnFocus(Self,True);
|
||||||
}
|
}
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
bFocused = false;
|
bFocused = false;
|
||||||
OnFocus(Self,False);
|
OnFocus(Self,False);
|
||||||
}
|
}
|
||||||
function MouseClick( bool bRight );
|
function MouseClick( bool bRight );
|
||||||
function MouseRelease( bool bRight );
|
function MouseRelease( bool bRight );
|
||||||
function DoubleMouseClick( bool bRight ) // User rapidly double clicked this component.
|
function DoubleMouseClick( bool bRight ) // User rapidly double clicked this component.
|
||||||
{
|
{
|
||||||
MouseClick(bRight);
|
MouseClick(bRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp );
|
function ScrollMouseWheel( bool bUp );
|
||||||
|
|
||||||
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function PlayerController GetPlayer()
|
final function PlayerController GetPlayer()
|
||||||
{
|
{
|
||||||
return Owner.PlayerOwner;
|
return Owner.PlayerOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDisabled( bool bDisable )
|
function SetDisabled( bool bDisable )
|
||||||
{
|
{
|
||||||
bDisabled = bDisable;
|
bDisabled = bDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnFocus( KFGUI_Base Sender, bool bBecame );
|
Delegate OnFocus( KFGUI_Base Sender, bool bBecame );
|
||||||
|
|
||||||
final function ComputeCoords()
|
final function ComputeCoords()
|
||||||
{
|
{
|
||||||
CompPos[0] = XPosition*InputPos[2]+InputPos[0];
|
CompPos[0] = XPosition*InputPos[2]+InputPos[0];
|
||||||
CompPos[1] = YPosition*InputPos[3]+InputPos[1];
|
CompPos[1] = YPosition*InputPos[3]+InputPos[1];
|
||||||
CompPos[2] = XSize*InputPos[2];
|
CompPos[2] = XSize*InputPos[2];
|
||||||
CompPos[3] = YSize*InputPos[3];
|
CompPos[3] = YSize*InputPos[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool CaptureMouse()
|
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()
|
final function KFGUI_Base GetMouseFocus()
|
||||||
{
|
{
|
||||||
local KFGUI_Base M;
|
local KFGUI_Base M;
|
||||||
|
|
||||||
for( M=Self; M.MouseArea!=None; M=M.MouseArea )
|
for( M=Self; M.MouseArea!=None; M=M.MouseArea )
|
||||||
{}
|
{}
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetVisibility(bool Visible)
|
function SetVisibility(bool Visible)
|
||||||
{
|
{
|
||||||
bVisible = Visible;
|
bVisible = Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoClose()
|
function DoClose()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<TimerNames.Length; i++ )
|
for( i=0; i<TimerNames.Length; i++ )
|
||||||
{
|
{
|
||||||
ClearTimer(TimerNames[i]);
|
ClearTimer(TimerNames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ParentComponent!=None )
|
if( ParentComponent!=None )
|
||||||
ParentComponent.DoClose();
|
ParentComponent.DoClose();
|
||||||
else Owner.PopCloseMenu(Self);
|
else Owner.PopCloseMenu(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function byte GetCursorStyle()
|
function byte GetCursorStyle()
|
||||||
{
|
{
|
||||||
return (bClickable ? `PEN_BLACK : `PEN_WHITE);
|
return (bClickable ? `PEN_BLACK : `PEN_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UserPressedEsc() // user pressed escape while this menu was active.
|
function UserPressedEsc() // user pressed escape while this menu was active.
|
||||||
{
|
{
|
||||||
if( ParentComponent!=None )
|
if( ParentComponent!=None )
|
||||||
ParentComponent.UserPressedEsc();
|
ParentComponent.UserPressedEsc();
|
||||||
else DoClose();
|
else DoClose();
|
||||||
}
|
}
|
||||||
function bool BringPageToFront()
|
function bool BringPageToFront()
|
||||||
{
|
{
|
||||||
if( ParentComponent!=None )
|
if( ParentComponent!=None )
|
||||||
return ParentComponent.BringPageToFront();
|
return ParentComponent.BringPageToFront();
|
||||||
return true; // Allow user to bring this page to front.
|
return true; // Allow user to bring this page to front.
|
||||||
}
|
}
|
||||||
final function bool IsTopMenu()
|
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()
|
final function KFGUI_Page GetPageTop()
|
||||||
{
|
{
|
||||||
local KFGUI_Base M;
|
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);
|
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 Self;
|
||||||
return None;
|
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;
|
Res[Res.Length] = Self;
|
||||||
}
|
}
|
||||||
function RemoveComponent( KFGUI_Base B );
|
function RemoveComponent( KFGUI_Base B );
|
||||||
|
|
||||||
function GetInputFocus()
|
function GetInputFocus()
|
||||||
{
|
{
|
||||||
if( Owner.InputFocus!=None )
|
if( Owner.InputFocus!=None )
|
||||||
Owner.InputFocus.LostInputFocus();
|
Owner.InputFocus.LostInputFocus();
|
||||||
Owner.InputFocus = Self;
|
Owner.InputFocus = Self;
|
||||||
}
|
}
|
||||||
function DropInputFocus()
|
function DropInputFocus()
|
||||||
{
|
{
|
||||||
if( Owner.InputFocus==Self )
|
if( Owner.InputFocus==Self )
|
||||||
{
|
{
|
||||||
Owner.InputFocus.LostInputFocus();
|
Owner.InputFocus.LostInputFocus();
|
||||||
Owner.InputFocus = None;
|
Owner.InputFocus = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function LostInputFocus();
|
function LostInputFocus();
|
||||||
|
|
||||||
// Obtain keyboard focus.
|
// Obtain keyboard focus.
|
||||||
final function GrabKeyFocus()
|
final function GrabKeyFocus()
|
||||||
{
|
{
|
||||||
Owner.GrabInputFocus(Self);
|
Owner.GrabInputFocus(Self);
|
||||||
}
|
}
|
||||||
final function ReleaseKeyFocus()
|
final function ReleaseKeyFocus()
|
||||||
{
|
{
|
||||||
if( Owner.KeyboardFocus==Self )
|
if( Owner.KeyboardFocus==Self )
|
||||||
Owner.GrabInputFocus(None);
|
Owner.GrabInputFocus(None);
|
||||||
}
|
}
|
||||||
function LostKeyFocus();
|
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 'XboxTypeS_Start':
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
if( Event==IE_Pressed )
|
if( Event==IE_Pressed )
|
||||||
UserPressedEsc();
|
UserPressedEsc();
|
||||||
return true;
|
return true;
|
||||||
case 'XboxTypeS_DPad_Up':
|
case 'XboxTypeS_DPad_Up':
|
||||||
case 'XboxTypeS_DPad_Down':
|
case 'XboxTypeS_DPad_Down':
|
||||||
case 'XboxTypeS_DPad_Left':
|
case 'XboxTypeS_DPad_Left':
|
||||||
case 'XboxTypeS_DPad_Right':
|
case 'XboxTypeS_DPad_Right':
|
||||||
case 'MouseScrollDown':
|
case 'MouseScrollDown':
|
||||||
case 'MouseScrollUp':
|
case 'MouseScrollUp':
|
||||||
case 'MouseScrollDown':
|
case 'MouseScrollDown':
|
||||||
case 'MouseScrollUp':
|
case 'MouseScrollUp':
|
||||||
if( Event==IE_Pressed )
|
if( Event==IE_Pressed )
|
||||||
ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left');
|
ScrollMouseWheel(Key=='MouseScrollUp' || Key=='XboxTypeS_DPad_Up' || Key=='XboxTypeS_DPad_Left');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
function bool NotifyInputChar( int ControllerId, string Unicode )
|
function bool NotifyInputChar( int ControllerId, string Unicode )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// While on input focus mode, notify that mouse just moved over the threshold.
|
// While on input focus mode, notify that mouse just moved over the threshold.
|
||||||
@ -267,48 +267,48 @@ 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];
|
X = ((XPosition+X)*InputPos[2]) + InputPos[0];
|
||||||
Y = ((YPosition+Y)*InputPos[3]) + InputPos[1];
|
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];
|
X = X / CompPos[2];
|
||||||
Y = Y / CompPos[2];
|
Y = Y / CompPos[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
simulated final function PlayMenuSound( EMenuSound Slot )
|
simulated final function PlayMenuSound( EMenuSound Slot )
|
||||||
{
|
{
|
||||||
local SoundCue S;
|
local SoundCue S;
|
||||||
local KFGameEngine Engine;
|
local KFGameEngine Engine;
|
||||||
|
|
||||||
Engine = KFGameEngine(class'Engine'.static.GetEngine());
|
Engine = KFGameEngine(class'Engine'.static.GetEngine());
|
||||||
|
|
||||||
switch( Slot )
|
switch( Slot )
|
||||||
{
|
{
|
||||||
case MN_FocusHover:
|
case MN_FocusHover:
|
||||||
case MN_Focus:
|
case MN_Focus:
|
||||||
S = Owner.CurrentStyle.MenuHover;
|
S = Owner.CurrentStyle.MenuHover;
|
||||||
break;
|
break;
|
||||||
case MN_LostFocus:
|
case MN_LostFocus:
|
||||||
S = Owner.CurrentStyle.MenuFade;
|
S = Owner.CurrentStyle.MenuFade;
|
||||||
break;
|
break;
|
||||||
case MN_ClickButton:
|
case MN_ClickButton:
|
||||||
case MN_ClickCheckboxOff:
|
case MN_ClickCheckboxOff:
|
||||||
S = Owner.CurrentStyle.MenuClick;
|
S = Owner.CurrentStyle.MenuClick;
|
||||||
break;
|
break;
|
||||||
case MN_Dropdown:
|
case MN_Dropdown:
|
||||||
S = Owner.CurrentStyle.MenuDown;
|
S = Owner.CurrentStyle.MenuDown;
|
||||||
break;
|
break;
|
||||||
case MN_DropdownChange:
|
case MN_DropdownChange:
|
||||||
S = Owner.CurrentStyle.MenuEdit;
|
S = Owner.CurrentStyle.MenuEdit;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( S!=None )
|
if( S!=None )
|
||||||
{
|
{
|
||||||
S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f);
|
S.VolumeMultiplier = (Engine.SFxVolumeMultiplier/100.f) * (Engine.MasterVolumeMultiplier/100.f);
|
||||||
GetPlayer().PlaySound(S,true,,false);
|
GetPlayer().PlaySound(S,true,,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre level change notification.
|
// Pre level change notification.
|
||||||
@ -316,29 +316,29 @@ 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;
|
XPosition = X;
|
||||||
YPosition = Y;
|
YPosition = Y;
|
||||||
XSize = XS;
|
XSize = XS;
|
||||||
YSize = YS;
|
YSize = YS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final function string MakeSortStr( int Value )
|
static final function string MakeSortStr( int Value )
|
||||||
{
|
{
|
||||||
local string S;
|
local string S;
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
// Prefix with zeroes to properly sort this string.
|
// Prefix with zeroes to properly sort this string.
|
||||||
S = string(Value);
|
S = string(Value);
|
||||||
i = Len(S);
|
i = Len(S);
|
||||||
if( i<10 )
|
if( i<10 )
|
||||||
return Mid("0000000000",i)$S;
|
return Mid("0000000000",i)$S;
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
XSize=1
|
XSize=1
|
||||||
YSize=1
|
YSize=1
|
||||||
bCanFocus=true
|
bCanFocus=true
|
||||||
bVisible=true
|
bVisible=true
|
||||||
}
|
}
|
@ -9,19 +9,19 @@ var bool bIsHighlighted;
|
|||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderButton(Self);
|
Owner.CurrentStyle.RenderButton(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool GetUsingGamepad()
|
function bool GetUsingGamepad()
|
||||||
{
|
{
|
||||||
return Owner.bUsingGamepad && GamepadButtonName != "";
|
return Owner.bUsingGamepad && GamepadButtonName != "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight )
|
function HandleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( bRight )
|
if( bRight )
|
||||||
OnClickRight(Self);
|
OnClickRight(Self);
|
||||||
else OnClickLeft(Self);
|
else OnClickLeft(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnClickLeft( KFGUI_Button Sender );
|
Delegate OnClickLeft( KFGUI_Button Sender );
|
||||||
@ -29,13 +29,13 @@ Delegate OnClickRight( KFGUI_Button Sender );
|
|||||||
|
|
||||||
Delegate bool DrawOverride(Canvas C, KFGUI_Button B)
|
Delegate bool DrawOverride(Canvas C, KFGUI_Button B)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ButtonText="Button!"
|
ButtonText="Button!"
|
||||||
TextColor=(R=0,G=0,B=0,A=255)
|
TextColor=(R=0,G=0,B=0,A=255)
|
||||||
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
||||||
FontScale=1
|
FontScale=1
|
||||||
}
|
}
|
@ -6,73 +6,73 @@ var Color IconColor;
|
|||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local float XL,YL,TS,TextX,TextY;
|
local float XL,YL,TS,TextX,TextY;
|
||||||
local Texture2D Mat;
|
local Texture2D Mat;
|
||||||
local bool bDrawOverride;
|
local bool bDrawOverride;
|
||||||
|
|
||||||
bDrawOverride = DrawOverride(Canvas, Self);
|
|
||||||
if( !bDrawOverride )
|
|
||||||
{
|
|
||||||
if( bDisabled )
|
|
||||||
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED];
|
|
||||||
else if( bPressedDown )
|
|
||||||
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED];
|
|
||||||
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 )
|
bDrawOverride = DrawOverride(Canvas, Self);
|
||||||
{
|
if( !bDrawOverride )
|
||||||
Canvas.SetPos(0.f,0.f);
|
{
|
||||||
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL);
|
if( bDisabled )
|
||||||
}
|
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_DISABLED];
|
||||||
}
|
else if( bPressedDown )
|
||||||
|
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_PRESSED];
|
||||||
if( ButtonText!="" )
|
else if( bFocused || bIsHighlighted )
|
||||||
{
|
Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_NORMAL];
|
||||||
Canvas.Font = Owner.CurrentStyle.MainFont;
|
else Mat = Owner.CurrentStyle.ButtonTextures[`BUTTON_HIGHLIGHTED];
|
||||||
|
|
||||||
TS = Owner.CurrentStyle.GetFontScaler();
|
Canvas.SetPos(0.f,0.f);
|
||||||
TS *= FontScale;
|
Canvas.DrawTileStretched(Mat,CompPos[2],CompPos[3],0,0,32,32);
|
||||||
|
|
||||||
while( true )
|
if( OverlayTexture.Texture!=None )
|
||||||
{
|
{
|
||||||
Canvas.TextSize(ButtonText,XL,YL,TS,TS);
|
Canvas.SetPos(0.f,0.f);
|
||||||
if( XL<(CompPos[2]*0.9) && YL<(CompPos[3]*0.9) )
|
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL);
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
TS -= 0.001;
|
|
||||||
}
|
if( ButtonText!="" )
|
||||||
|
{
|
||||||
TextX = (CompPos[2]-XL)*0.5;
|
Canvas.Font = Owner.CurrentStyle.MainFont;
|
||||||
TextY = (CompPos[3]-YL)*0.5;
|
|
||||||
|
TS = Owner.CurrentStyle.GetFontScaler();
|
||||||
Canvas.SetPos(TextX, TextY);
|
TS *= FontScale;
|
||||||
if( bDisabled )
|
|
||||||
Canvas.DrawColor = TextColor*0.5f;
|
while( true )
|
||||||
else Canvas.DrawColor = TextColor;
|
{
|
||||||
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
|
Canvas.TextSize(ButtonText,XL,YL,TS,TS);
|
||||||
|
if( XL<(CompPos[2]*0.9) && YL<(CompPos[3]*0.9) )
|
||||||
if( Icon != None )
|
break;
|
||||||
{
|
|
||||||
Canvas.DrawColor = IconColor;
|
TS -= 0.001;
|
||||||
|
}
|
||||||
Canvas.SetPos(TextX-CompPos[3], 0.f);
|
|
||||||
Canvas.DrawRect(CompPos[3], CompPos[3], Icon);
|
TextX = (CompPos[2]-XL)*0.5;
|
||||||
|
TextY = (CompPos[3]-YL)*0.5;
|
||||||
Canvas.SetPos(TextX+XL, 0.f);
|
|
||||||
Canvas.DrawRect(CompPos[3], CompPos[3], Icon);
|
Canvas.SetPos(TextX, TextY);
|
||||||
}
|
if( bDisabled )
|
||||||
}
|
Canvas.DrawColor = TextColor*0.5f;
|
||||||
|
else Canvas.DrawColor = TextColor;
|
||||||
Canvas.DrawColor = class'HUD'.default.WhiteColor;
|
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
|
||||||
Canvas.SetPos(0.f,0.f);
|
|
||||||
Canvas.DrawRect(CompPos[3], CompPos[3], bOpened ? Owner.CurrentStyle.ArrowTextures[`ARROW_DOWN] : Owner.CurrentStyle.ArrowTextures[`ARROW_RIGHT]);
|
if( Icon != None )
|
||||||
Canvas.SetPos(CompPos[2]-CompPos[3], 0.f);
|
{
|
||||||
Canvas.DrawRect(CompPos[3], CompPos[3], bOpened ? Owner.CurrentStyle.ArrowTextures[`ARROW_DOWN] : Owner.CurrentStyle.ArrowTextures[`ARROW_LEFT]);
|
Canvas.DrawColor = IconColor;
|
||||||
|
|
||||||
|
Canvas.SetPos(TextX-CompPos[3], 0.f);
|
||||||
|
Canvas.DrawRect(CompPos[3], CompPos[3], Icon);
|
||||||
|
|
||||||
|
Canvas.SetPos(TextX+XL, 0.f);
|
||||||
|
Canvas.DrawRect(CompPos[3], CompPos[3], Icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.DrawColor = class'HUD'.default.WhiteColor;
|
||||||
|
Canvas.SetPos(0.f,0.f);
|
||||||
|
Canvas.DrawRect(CompPos[3], CompPos[3], bOpened ? Owner.CurrentStyle.ArrowTextures[`ARROW_DOWN] : Owner.CurrentStyle.ArrowTextures[`ARROW_RIGHT]);
|
||||||
|
Canvas.SetPos(CompPos[2]-CompPos[3], 0.f);
|
||||||
|
Canvas.DrawRect(CompPos[3], CompPos[3], bOpened ? Owner.CurrentStyle.ArrowTextures[`ARROW_DOWN] : Owner.CurrentStyle.ArrowTextures[`ARROW_LEFT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
|
@ -3,85 +3,85 @@ class KFGUI_CategoryList extends KFGUI_ComponentList;
|
|||||||
// Broken, does not work correctly when closing a menu and re-opening it if a category is open
|
// Broken, does not work correctly when closing a menu and re-opening it if a category is open
|
||||||
struct FCategoryItems
|
struct FCategoryItems
|
||||||
{
|
{
|
||||||
var name ID;
|
var name ID;
|
||||||
var KFGUI_Base Item;
|
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)
|
function AddCategory(name CatID, string CatName, optional Texture2D IconMat, optional Color IconClr, optional float XS=1.f, optional float YS=1.f)
|
||||||
{
|
{
|
||||||
local KFGUI_CategoryButton B;
|
local KFGUI_CategoryButton B;
|
||||||
|
|
||||||
B = KFGUI_CategoryButton(AddListComponent(class'KFGUI_CategoryButton', XS, YS));
|
B = KFGUI_CategoryButton(AddListComponent(class'KFGUI_CategoryButton', XS, YS));
|
||||||
B.ButtonText = CatName;
|
B.ButtonText = CatName;
|
||||||
B.ID = CatID;
|
B.ID = CatID;
|
||||||
B.Icon = IconMat;
|
B.Icon = IconMat;
|
||||||
B.IconColor = IconClr;
|
B.IconColor = IconClr;
|
||||||
B.OnClickLeft = SelectedCategory;
|
B.OnClickLeft = SelectedCategory;
|
||||||
B.OnClickRight = SelectedCategory;
|
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 FCategoryItems CatItem;
|
||||||
local KFGUI_Base G;
|
local KFGUI_Base G;
|
||||||
|
|
||||||
G = CreateComponent(Item);
|
G = CreateComponent(Item);
|
||||||
G.ID = CatID;
|
G.ID = CatID;
|
||||||
G.Owner = Owner;
|
G.Owner = Owner;
|
||||||
G.ParentComponent = Self;
|
G.ParentComponent = Self;
|
||||||
|
|
||||||
CatItem.ID = CatID;
|
CatItem.ID = CatID;
|
||||||
CatItem.Item = G;
|
CatItem.Item = G;
|
||||||
CategoryItems.AddItem(CatItem);
|
CategoryItems.AddItem(CatItem);
|
||||||
|
|
||||||
return G;
|
return G;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectedCategory(KFGUI_Button Sender)
|
function SelectedCategory(KFGUI_Button Sender)
|
||||||
{
|
{
|
||||||
local int i, j, Index;
|
local int i, j, Index;
|
||||||
local KFGUI_CategoryButton CatB;
|
local KFGUI_CategoryButton CatB;
|
||||||
|
|
||||||
CatB = KFGUI_CategoryButton(Sender);
|
CatB = KFGUI_CategoryButton(Sender);
|
||||||
if( CatB == None )
|
if( CatB == None )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Index = ItemComponents.Find(Sender);
|
Index = ItemComponents.Find(Sender);
|
||||||
if( Index != INDEX_NONE )
|
if( Index != INDEX_NONE )
|
||||||
{
|
{
|
||||||
if( !CatB.bOpened )
|
if( !CatB.bOpened )
|
||||||
{
|
{
|
||||||
CatB.bOpened = true;
|
CatB.bOpened = true;
|
||||||
j = Index+1;
|
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);
|
AddItemAtIndex(j++, CategoryItems[i].Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CatB.bOpened = false;
|
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);
|
ItemComponents.RemoveItem(CategoryItems[i].Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyList()
|
function EmptyList()
|
||||||
{
|
{
|
||||||
local int i;
|
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);
|
ItemComponents.Remove(i, 1);
|
||||||
}
|
}
|
||||||
CategoryItems.Length = 0;
|
CategoryItems.Length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
|
@ -5,26 +5,26 @@ var() bool bForceUniform,bChecked;
|
|||||||
|
|
||||||
function UpdateSizes()
|
function UpdateSizes()
|
||||||
{
|
{
|
||||||
Super.UpdateSizes();
|
Super.UpdateSizes();
|
||||||
if( bForceUniform )
|
if( bForceUniform )
|
||||||
XSize = (YSize*InputPos[3]) / InputPos[2];
|
XSize = (YSize*InputPos[3]) / InputPos[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderCheckbox(Self);
|
Owner.CurrentStyle.RenderCheckbox(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight )
|
function HandleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
bChecked = !bChecked;
|
bChecked = !bChecked;
|
||||||
OnCheckChange(Self);
|
OnCheckChange(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnCheckChange( KFGUI_CheckBox Sender );
|
Delegate OnCheckChange( KFGUI_CheckBox Sender );
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bForceUniform=true
|
bForceUniform=true
|
||||||
LableWidth=0.85
|
LableWidth=0.85
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
Class KFGUI_Clickable extends KFGUI_Base
|
Class KFGUI_Clickable extends KFGUI_Base
|
||||||
abstract;
|
abstract;
|
||||||
|
|
||||||
var() int IntIndex; // More user variables.
|
var() int IntIndex; // More user variables.
|
||||||
var() string ToolTip;
|
var() string ToolTip;
|
||||||
@ -13,83 +13,83 @@ var bool bHoverSound;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
bClickable = !bDisabled;
|
bClickable = !bDisabled;
|
||||||
}
|
}
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bDisabled )
|
if( !bDisabled )
|
||||||
{
|
{
|
||||||
PressedDown[byte(bRight)] = 1;
|
PressedDown[byte(bRight)] = 1;
|
||||||
bPressedDown = true;
|
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);
|
PlayMenuSound(MN_ClickButton);
|
||||||
PressedDown[byte(bRight)] = 0;
|
PressedDown[byte(bRight)] = 0;
|
||||||
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
|
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
|
||||||
HandleMouseClick(bRight);
|
HandleMouseClick(bRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
Super.MouseLeave();
|
Super.MouseLeave();
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
Super.MouseEnter();
|
Super.MouseEnter();
|
||||||
if( !bDisabled && bHoverSound )
|
if( !bDisabled && bHoverSound )
|
||||||
PlayMenuSound(MN_FocusHover);
|
PlayMenuSound(MN_FocusHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDisabled( bool bDisable )
|
function SetDisabled( bool bDisable )
|
||||||
{
|
{
|
||||||
Super.SetDisabled(bDisable);
|
Super.SetDisabled(bDisable);
|
||||||
bClickable = !bDisable;
|
bClickable = !bDisable;
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NotifyMousePaused()
|
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 = New(None)Class'KFGUI_Tooltip';
|
||||||
ToolTipItem.Owner = Owner;
|
ToolTipItem.Owner = Owner;
|
||||||
ToolTipItem.ParentComponent = Self;
|
ToolTipItem.ParentComponent = Self;
|
||||||
ToolTipItem.InitMenu();
|
ToolTipItem.InitMenu();
|
||||||
ToolTipItem.SetText(ToolTip);
|
ToolTipItem.SetText(ToolTip);
|
||||||
}
|
}
|
||||||
ToolTipItem.ShowMenu();
|
ToolTipItem.ShowMenu();
|
||||||
ToolTipItem.CompPos[0] = Owner.MousePosition.X;
|
ToolTipItem.CompPos[0] = Owner.MousePosition.X;
|
||||||
ToolTipItem.CompPos[1] = Owner.MousePosition.Y;
|
ToolTipItem.CompPos[1] = Owner.MousePosition.Y;
|
||||||
ToolTipItem.GetInputFocus();
|
ToolTipItem.GetInputFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final function ChangeToolTip( string S )
|
final function ChangeToolTip( string S )
|
||||||
{
|
{
|
||||||
if( ToolTipItem!=None )
|
if( ToolTipItem!=None )
|
||||||
ToolTipItem.SetText(S);
|
ToolTipItem.SetText(S);
|
||||||
else ToolTip = S;
|
else ToolTip = S;
|
||||||
}
|
}
|
||||||
function SetVisibility(bool Visible)
|
function SetVisibility(bool Visible)
|
||||||
{
|
{
|
||||||
Super.SetVisibility(Visible);
|
Super.SetVisibility(Visible);
|
||||||
SetDisabled(!Visible);
|
SetDisabled(!Visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight );
|
function HandleMouseClick( bool bRight );
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bHoverSound=true
|
bHoverSound=true
|
||||||
}
|
}
|
@ -9,114 +9,114 @@ var string CaptionText;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
|
|
||||||
SettingsBox = KFGUI_ComponentList(FindComponentID('SettingsBox'));
|
SettingsBox = KFGUI_ComponentList(FindComponentID('SettingsBox'));
|
||||||
|
|
||||||
TextLable = KFGUI_TextLable(FindComponentID('CaptionText'));
|
TextLable = KFGUI_TextLable(FindComponentID('CaptionText'));
|
||||||
TextLable.SetText(CaptionText);
|
TextLable.SetText(CaptionText);
|
||||||
|
|
||||||
RSlider = AddSlider("Red:",'ColorSliderR',0,255,RedLabel,RedValue);
|
RSlider = AddSlider("Red:",'ColorSliderR',0,255,RedLabel,RedValue);
|
||||||
GSlider = AddSlider("Green:",'ColorSliderG',0,255,GreenLabel,GreenValue);
|
GSlider = AddSlider("Green:",'ColorSliderG',0,255,GreenLabel,GreenValue);
|
||||||
BSlider = AddSlider("Blue:",'ColorSliderB',0,255,BlueLabel,BlueValue);
|
BSlider = AddSlider("Blue:",'ColorSliderB',0,255,BlueLabel,BlueValue);
|
||||||
ASlider = AddSlider("Alpha:",'ColorSliderA',0,255,AlphaLabel,AlphaValue);
|
ASlider = AddSlider("Alpha:",'ColorSliderA',0,255,AlphaLabel,AlphaValue);
|
||||||
|
|
||||||
SetDefaultColor(DefaultColor);
|
SetDefaultColor(DefaultColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDefaultColor(Color Def)
|
function SetDefaultColor(Color Def)
|
||||||
{
|
{
|
||||||
RSlider.SetValue(Def.R);
|
RSlider.SetValue(Def.R);
|
||||||
RSlider.UpdateListVis();
|
RSlider.UpdateListVis();
|
||||||
|
|
||||||
GSlider.SetValue(Def.G);
|
GSlider.SetValue(Def.G);
|
||||||
GSlider.UpdateListVis();
|
GSlider.UpdateListVis();
|
||||||
|
|
||||||
BSlider.SetValue(Def.B);
|
BSlider.SetValue(Def.B);
|
||||||
BSlider.UpdateListVis();
|
BSlider.UpdateListVis();
|
||||||
|
|
||||||
ASlider.SetValue(Def.A);
|
ASlider.SetValue(Def.A);
|
||||||
ASlider.UpdateListVis();
|
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_Slider SL;
|
||||||
local KFGUI_MultiComponent MC;
|
local KFGUI_MultiComponent MC;
|
||||||
|
|
||||||
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
|
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
|
||||||
MC.InitMenu();
|
MC.InitMenu();
|
||||||
Label = new(MC) class'KFGUI_TextLable';
|
Label = new(MC) class'KFGUI_TextLable';
|
||||||
Label.SetText(Cap);
|
Label.SetText(Cap);
|
||||||
Label.XSize = 0.45;
|
Label.XSize = 0.45;
|
||||||
Label.FontScale = 1;
|
Label.FontScale = 1;
|
||||||
MC.AddComponent(Label);
|
MC.AddComponent(Label);
|
||||||
ColorValueLabel = new(MC) class'KFGUI_TextLable';
|
ColorValueLabel = new(MC) class'KFGUI_TextLable';
|
||||||
ColorValueLabel.XPosition = 0.95;
|
ColorValueLabel.XPosition = 0.95;
|
||||||
ColorValueLabel.XSize = 0.1;
|
ColorValueLabel.XSize = 0.1;
|
||||||
ColorValueLabel.FontScale = 1;
|
ColorValueLabel.FontScale = 1;
|
||||||
MC.AddComponent(ColorValueLabel);
|
MC.AddComponent(ColorValueLabel);
|
||||||
SL = new(MC) class'KFGUI_Slider';
|
SL = new(MC) class'KFGUI_Slider';
|
||||||
SL.XPosition = 0.575;
|
SL.XPosition = 0.575;
|
||||||
SL.XSize = 0.35;
|
SL.XSize = 0.35;
|
||||||
SL.MinValue = MinValue;
|
SL.MinValue = MinValue;
|
||||||
SL.MaxValue = MaxValue;
|
SL.MaxValue = MaxValue;
|
||||||
SL.ID = IDN;
|
SL.ID = IDN;
|
||||||
SL.OnValueChanged = OnValueChanged;
|
SL.OnValueChanged = OnValueChanged;
|
||||||
MC.AddComponent(SL);
|
MC.AddComponent(SL);
|
||||||
return SL;
|
return SL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnValueChanged(KFGUI_Slider Sender, int Value)
|
function OnValueChanged(KFGUI_Slider Sender, int Value)
|
||||||
{
|
{
|
||||||
switch(Sender.ID)
|
switch(Sender.ID)
|
||||||
{
|
{
|
||||||
case 'ColorSliderR':
|
case 'ColorSliderR':
|
||||||
RedValue.SetText(string(Value));
|
RedValue.SetText(string(Value));
|
||||||
TextLable.TextColor.R = Value;
|
TextLable.TextColor.R = Value;
|
||||||
break;
|
break;
|
||||||
case 'ColorSliderG':
|
case 'ColorSliderG':
|
||||||
GreenValue.SetText(string(Value));
|
GreenValue.SetText(string(Value));
|
||||||
TextLable.TextColor.G = Value;
|
TextLable.TextColor.G = Value;
|
||||||
break;
|
break;
|
||||||
case 'ColorSliderB':
|
case 'ColorSliderB':
|
||||||
BlueValue.SetText(string(Value));
|
BlueValue.SetText(string(Value));
|
||||||
TextLable.TextColor.B = Value;
|
TextLable.TextColor.B = Value;
|
||||||
break;
|
break;
|
||||||
case 'ColorSliderA':
|
case 'ColorSliderA':
|
||||||
AlphaValue.SetText(string(Value));
|
AlphaValue.SetText(string(Value));
|
||||||
TextLable.TextColor.A = Value;
|
TextLable.TextColor.A = Value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnColorSliderValueChanged(self, Sender, Value);
|
OnColorSliderValueChanged(self, Sender, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate OnColorSliderValueChanged(KFGUI_ColorSlider Sender, KFGUI_Slider Slider, int Value);
|
delegate OnColorSliderValueChanged(KFGUI_ColorSlider Sender, KFGUI_Slider Slider, int Value);
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL],0,0,CompPos[2],CompPos[3]);
|
Owner.CurrentStyle.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL],0,0,CompPos[2],CompPos[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
Begin Object Class=KFGUI_ComponentList Name=ClientSettingsBox
|
Begin Object Class=KFGUI_ComponentList Name=ClientSettingsBox
|
||||||
XPosition=0.05
|
XPosition=0.05
|
||||||
YPosition=0.1
|
YPosition=0.1
|
||||||
XSize=0.95
|
XSize=0.95
|
||||||
YSize=0.95
|
YSize=0.95
|
||||||
ID="SettingsBox"
|
ID="SettingsBox"
|
||||||
ListItemsPerPage=4
|
ListItemsPerPage=4
|
||||||
End Object
|
End Object
|
||||||
Components.Add(ClientSettingsBox)
|
Components.Add(ClientSettingsBox)
|
||||||
|
|
||||||
Begin Object Class=KFGUI_TextLable Name=CaptionLabel
|
Begin Object Class=KFGUI_TextLable Name=CaptionLabel
|
||||||
XSize=1
|
XSize=1
|
||||||
YSize=0.125
|
YSize=0.125
|
||||||
AlignX=1
|
AlignX=1
|
||||||
AlignY=1
|
AlignY=1
|
||||||
ID="CaptionText"
|
ID="CaptionText"
|
||||||
End Object
|
End Object
|
||||||
Components.Add(CaptionLabel)
|
Components.Add(CaptionLabel)
|
||||||
}
|
}
|
@ -3,12 +3,12 @@ Class KFGUI_ColumnList extends KFGUI_List;
|
|||||||
|
|
||||||
struct FColumnItem
|
struct FColumnItem
|
||||||
{
|
{
|
||||||
var() string Text;
|
var() string Text;
|
||||||
var() float Width;
|
var() float Width;
|
||||||
var() bool bOnlyTextures;
|
var() bool bOnlyTextures;
|
||||||
|
|
||||||
var transient bool bHidden;
|
var transient bool bHidden;
|
||||||
var transient int X,XSize;
|
var transient int X,XSize;
|
||||||
};
|
};
|
||||||
var() array<FColumnItem> Columns;
|
var() array<FColumnItem> Columns;
|
||||||
var() class<KFGUI_ListItem> ListItemClass;
|
var() class<KFGUI_ListItem> ListItemClass;
|
||||||
@ -35,411 +35,411 @@ delegate OnSelectedRow( KFGUI_ListItem Item, int Row, bool bRight, bool bDblClic
|
|||||||
|
|
||||||
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 KFGUI_ListItem N,O;
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
// Allocate list item object.
|
|
||||||
if( UnusedItem!=None )
|
|
||||||
{
|
|
||||||
N = UnusedItem;
|
|
||||||
UnusedItem = N.Next;
|
|
||||||
N.Next = None;
|
|
||||||
}
|
|
||||||
else N = new (None) ListItemClass;
|
|
||||||
|
|
||||||
// Setup column text value.
|
|
||||||
N.SetValue(Value,iValue,SortValue);
|
|
||||||
|
|
||||||
// Insert into list.
|
// Allocate list item object.
|
||||||
if( bShouldSortList && Index==-1 )
|
if( UnusedItem!=None )
|
||||||
{
|
{
|
||||||
N.Temp = N.GetSortStr(LastSortedColumn);
|
N = UnusedItem;
|
||||||
|
UnusedItem = N.Next;
|
||||||
if( ListCount==0 ) // No sorting needed yet.
|
N.Next = None;
|
||||||
{
|
}
|
||||||
N.Next = FirstItem;
|
else N = new (None) ListItemClass;
|
||||||
FirstItem = N;
|
|
||||||
}
|
// Setup column text value.
|
||||||
else if( bLastSortedReverse )
|
N.SetValue(Value,iValue,SortValue);
|
||||||
{
|
|
||||||
if( FirstItem.Temp<N.Temp )
|
// Insert into list.
|
||||||
{
|
if( bShouldSortList && Index==-1 )
|
||||||
N.Next = FirstItem;
|
{
|
||||||
FirstItem = N;
|
N.Temp = N.GetSortStr(LastSortedColumn);
|
||||||
}
|
|
||||||
else
|
if( ListCount==0 ) // No sorting needed yet.
|
||||||
{
|
{
|
||||||
for( O=FirstItem; O!=None; O=O.Next )
|
N.Next = FirstItem;
|
||||||
{
|
FirstItem = N;
|
||||||
if( O.Next==None || O.Next.Temp<N.Temp )
|
}
|
||||||
{
|
else if( bLastSortedReverse )
|
||||||
N.Next = O.Next;
|
{
|
||||||
O.Next = N;
|
if( FirstItem.Temp<N.Temp )
|
||||||
break;
|
{
|
||||||
}
|
N.Next = FirstItem;
|
||||||
}
|
FirstItem = N;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if( FirstItem.Temp>N.Temp )
|
{
|
||||||
{
|
for( O=FirstItem; O!=None; O=O.Next )
|
||||||
N.Next = FirstItem;
|
{
|
||||||
FirstItem = N;
|
if( O.Next==None || O.Next.Temp<N.Temp )
|
||||||
}
|
{
|
||||||
else
|
N.Next = O.Next;
|
||||||
{
|
O.Next = N;
|
||||||
for( O=FirstItem; O!=None; O=O.Next )
|
break;
|
||||||
{
|
}
|
||||||
if( O.Next==None || O.Next.Temp>N.Temp )
|
}
|
||||||
{
|
}
|
||||||
N.Next = O.Next;
|
}
|
||||||
O.Next = N;
|
else if( FirstItem.Temp>N.Temp )
|
||||||
break;
|
{
|
||||||
}
|
N.Next = FirstItem;
|
||||||
}
|
FirstItem = N;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if( Index==-1 || Index>ListCount )
|
{
|
||||||
Index = ListCount;
|
for( O=FirstItem; O!=None; O=O.Next )
|
||||||
if( Index==0 )
|
{
|
||||||
{
|
if( O.Next==None || O.Next.Temp>N.Temp )
|
||||||
N.Next = FirstItem;
|
{
|
||||||
FirstItem = N;
|
N.Next = O.Next;
|
||||||
}
|
O.Next = N;
|
||||||
else
|
break;
|
||||||
{
|
}
|
||||||
i = 0;
|
}
|
||||||
for( O=FirstItem; O!=None; O=O.Next )
|
}
|
||||||
{
|
}
|
||||||
if( (++i)==Index )
|
else if( Index==-1 || Index>ListCount )
|
||||||
{
|
Index = ListCount;
|
||||||
N.Next = O.Next;
|
if( Index==0 )
|
||||||
O.Next = N;
|
{
|
||||||
break;
|
N.Next = FirstItem;
|
||||||
}
|
FirstItem = N;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
UpdateListSize();
|
{
|
||||||
|
i = 0;
|
||||||
return N;
|
for( O=FirstItem; O!=None; O=O.Next )
|
||||||
|
{
|
||||||
|
if( (++i)==Index )
|
||||||
|
{
|
||||||
|
N.Next = O.Next;
|
||||||
|
O.Next = N;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpdateListSize();
|
||||||
|
|
||||||
|
return N;
|
||||||
}
|
}
|
||||||
final function RemoveLine( KFGUI_ListItem I )
|
final function RemoveLine( KFGUI_ListItem I )
|
||||||
{
|
{
|
||||||
local KFGUI_ListItem N;
|
local KFGUI_ListItem N;
|
||||||
|
|
||||||
if( I.Index==-1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Update selected row info.
|
|
||||||
if( SelectedRowIndex==I.Index )
|
|
||||||
SelectedRowIndex = -1;
|
|
||||||
else if( SelectedRowIndex>I.Index )
|
|
||||||
--SelectedRowIndex;
|
|
||||||
|
|
||||||
// Remove from list.
|
if( I.Index==-1 )
|
||||||
if( FirstItem==I )
|
return;
|
||||||
FirstItem = I.Next;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( N=FirstItem; N!=None; N=N.Next )
|
|
||||||
if( N.Next==I )
|
|
||||||
{
|
|
||||||
N.Next = I.Next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add to unused list.
|
|
||||||
I.Next = UnusedItem;
|
|
||||||
UnusedItem = I;
|
|
||||||
I.Index = -1;
|
|
||||||
|
|
||||||
UpdateListSize();
|
// Update selected row info.
|
||||||
|
if( SelectedRowIndex==I.Index )
|
||||||
|
SelectedRowIndex = -1;
|
||||||
|
else if( SelectedRowIndex>I.Index )
|
||||||
|
--SelectedRowIndex;
|
||||||
|
|
||||||
|
// Remove from list.
|
||||||
|
if( FirstItem==I )
|
||||||
|
FirstItem = I.Next;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( N=FirstItem; N!=None; N=N.Next )
|
||||||
|
if( N.Next==I )
|
||||||
|
{
|
||||||
|
N.Next = I.Next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to unused list.
|
||||||
|
I.Next = UnusedItem;
|
||||||
|
UnusedItem = I;
|
||||||
|
I.Index = -1;
|
||||||
|
|
||||||
|
UpdateListSize();
|
||||||
}
|
}
|
||||||
final function EmptyList()
|
final function EmptyList()
|
||||||
{
|
{
|
||||||
local KFGUI_ListItem N,I;
|
local KFGUI_ListItem N,I;
|
||||||
|
|
||||||
for( I=FirstItem; I!=None; I=N )
|
for( I=FirstItem; I!=None; I=N )
|
||||||
{
|
{
|
||||||
N = I.Next;
|
N = I.Next;
|
||||||
|
|
||||||
// Add to unused list.
|
|
||||||
I.Next = UnusedItem;
|
|
||||||
UnusedItem = I;
|
|
||||||
I.Index = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FirstItem = None;
|
// Add to unused list.
|
||||||
UpdateListSize();
|
I.Next = UnusedItem;
|
||||||
|
UnusedItem = I;
|
||||||
|
I.Index = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FirstItem = None;
|
||||||
|
UpdateListSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
final function KFGUI_ListItem GetFromIndex( int Index )
|
final function KFGUI_ListItem GetFromIndex( int Index )
|
||||||
{
|
{
|
||||||
local KFGUI_ListItem N;
|
local KFGUI_ListItem N;
|
||||||
|
|
||||||
if( Index<0 || Index>=ListCount )
|
if( Index<0 || Index>=ListCount )
|
||||||
return None;
|
return None;
|
||||||
for( N=FirstItem; N!=None; N=N.Next )
|
for( N=FirstItem; N!=None; N=N.Next )
|
||||||
if( (Index--)==0 )
|
if( (Index--)==0 )
|
||||||
return N;
|
return N;
|
||||||
return None;
|
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 KFGUI_ListItem Sel,N,P;
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
if( !bCanSortColumn || Column<0 || Column>=Columns.Length )
|
|
||||||
return;
|
|
||||||
|
|
||||||
LastSortedColumn = Column;
|
if( !bCanSortColumn || Column<0 || Column>=Columns.Length )
|
||||||
bLastSortedReverse = bReverse;
|
return;
|
||||||
bShouldSortList = true;
|
|
||||||
|
|
||||||
// Allocate memory space first.
|
LastSortedColumn = Column;
|
||||||
List.Length = ListCount;
|
bLastSortedReverse = bReverse;
|
||||||
List.Length = 0;
|
bShouldSortList = true;
|
||||||
|
|
||||||
// Grab current selected line.
|
|
||||||
Sel = GetFromIndex(SelectedRowIndex);
|
|
||||||
SelectedRowIndex = -1;
|
|
||||||
|
|
||||||
// Slow, sort it all.
|
|
||||||
for( N=FirstItem; N!=None; N=N.Next )
|
|
||||||
{
|
|
||||||
N.Temp = N.GetSortStr(Column);
|
|
||||||
|
|
||||||
if( bReverse )
|
// Allocate memory space first.
|
||||||
{
|
List.Length = ListCount;
|
||||||
for( i=0; i<List.Length; ++i )
|
List.Length = 0;
|
||||||
if( List[i].Temp<N.Temp )
|
|
||||||
break;
|
// Grab current selected line.
|
||||||
}
|
Sel = GetFromIndex(SelectedRowIndex);
|
||||||
else
|
SelectedRowIndex = -1;
|
||||||
{
|
|
||||||
for( i=0; i<List.Length; ++i )
|
// Slow, sort it all.
|
||||||
if( List[i].Temp>N.Temp )
|
for( N=FirstItem; N!=None; N=N.Next )
|
||||||
break;
|
{
|
||||||
}
|
N.Temp = N.GetSortStr(Column);
|
||||||
List.Insert(i,1);
|
|
||||||
List[i] = N;
|
if( bReverse )
|
||||||
}
|
{
|
||||||
|
for( i=0; i<List.Length; ++i )
|
||||||
// Rebuild list.
|
if( List[i].Temp<N.Temp )
|
||||||
FirstItem = None;
|
break;
|
||||||
P = None;
|
}
|
||||||
for( i=0; i<List.Length; ++i )
|
else
|
||||||
{
|
{
|
||||||
N = List[i];
|
for( i=0; i<List.Length; ++i )
|
||||||
if( Sel==N )
|
if( List[i].Temp>N.Temp )
|
||||||
SelectedRowIndex = i;
|
break;
|
||||||
N.Index = i;
|
}
|
||||||
N.Next = None;
|
List.Insert(i,1);
|
||||||
if( P==None )
|
List[i] = N;
|
||||||
FirstItem = N;
|
}
|
||||||
else P.Next = N;
|
|
||||||
P = N;
|
// Rebuild list.
|
||||||
}
|
FirstItem = None;
|
||||||
|
P = None;
|
||||||
|
for( i=0; i<List.Length; ++i )
|
||||||
|
{
|
||||||
|
N = List[i];
|
||||||
|
if( Sel==N )
|
||||||
|
SelectedRowIndex = i;
|
||||||
|
N.Index = i;
|
||||||
|
N.Next = None;
|
||||||
|
if( P==None )
|
||||||
|
FirstItem = N;
|
||||||
|
else P.Next = N;
|
||||||
|
P = N;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChangeListSize( int NewSize );
|
function ChangeListSize( int NewSize );
|
||||||
|
|
||||||
final function UpdateListSize()
|
final function UpdateListSize()
|
||||||
{
|
{
|
||||||
local KFGUI_ListItem N;
|
local KFGUI_ListItem N;
|
||||||
|
|
||||||
ListCount = 0;
|
ListCount = 0;
|
||||||
for( N=FirstItem; N!=None; N=N.Next )
|
for( N=FirstItem; N!=None; N=N.Next )
|
||||||
N.Index = ListCount++;
|
N.Index = ListCount++;
|
||||||
bListSizeDirty = true;
|
bListSizeDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
ListCount = 0;
|
ListCount = 0;
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ColumnComp = KFGUI_ColumnTop(FindComponentID('Columns'));
|
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);
|
Canvas.PushMaskRegion(Canvas.OrgX,Canvas.OrgY,Canvas.ClipX,Canvas.ClipY);
|
||||||
Owner.CurrentStyle.DrawTexturedString(S,Canvas.CurX,Canvas.CurY,TextScaler,LineFontInfo,false,bOnlyTextures);
|
Owner.CurrentStyle.DrawTexturedString(S,Canvas.CurX,Canvas.CurY,TextScaler,LineFontInfo,false,bOnlyTextures);
|
||||||
Canvas.PopMaskRegion();
|
Canvas.PopMaskRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,n,j;
|
local int i,n,j;
|
||||||
local float Y,TextY,XOffset;
|
local float Y,TextY,XOffset;
|
||||||
local KFGUI_ListItem C;
|
local KFGUI_ListItem C;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
Canvas.SetPos(0.f,0.f);
|
Canvas.SetPos(0.f,0.f);
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],CompPos[2],CompPos[3],0,0,128,128);
|
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL_SLIGHTTRANSPARENT],CompPos[2],CompPos[3],0,0,128,128);
|
||||||
|
|
||||||
// Mouse focused item check.
|
|
||||||
bCheckMouse = bClickable && bFocused;
|
|
||||||
FocusMouseItem = -1;
|
|
||||||
if( bCheckMouse )
|
|
||||||
MouseYHit = Owner.MousePosition.Y - CompPos[1];
|
|
||||||
|
|
||||||
n = ScrollBar.CurrentScroll;
|
// Mouse focused item check.
|
||||||
i = 0;
|
bCheckMouse = bClickable && bFocused;
|
||||||
for( C=FirstItem; C!=None; C=C.Next )
|
FocusMouseItem = -1;
|
||||||
if( (i++)==n )
|
if( bCheckMouse )
|
||||||
break;
|
MouseYHit = Owner.MousePosition.Y - CompPos[1];
|
||||||
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 )
|
n = ScrollBar.CurrentScroll;
|
||||||
{
|
i = 0;
|
||||||
// Check for mouse hit.
|
for( C=FirstItem; C!=None; C=C.Next )
|
||||||
if( bCheckMouse && FocusMouseItem==-1 )
|
if( (i++)==n )
|
||||||
{
|
break;
|
||||||
if( MouseYHit<ItemHeight )
|
Y = 0.f;
|
||||||
FocusMouseItem = n;
|
TextY = (ItemHeight-TextHeight)*0.5f;
|
||||||
else MouseYHit-=ItemHeight;
|
XOffset = TextY*0.75;
|
||||||
}
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
|
|
||||||
// Draw selection background.
|
for( i=0; (i<ListItemsPerPage && C!=None); ++i )
|
||||||
if( SelectedRowIndex==n ) // Selected
|
{
|
||||||
{
|
// Check for mouse hit.
|
||||||
Canvas.SetPos(EdgeSize,Y);
|
if( bCheckMouse && FocusMouseItem==-1 )
|
||||||
Canvas.DrawColor = SelectedLineColor;
|
{
|
||||||
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
|
if( MouseYHit<ItemHeight )
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
FocusMouseItem = n;
|
||||||
}
|
else MouseYHit-=ItemHeight;
|
||||||
else if( FocusMouseItem==n ) // Focused
|
}
|
||||||
{
|
|
||||||
Canvas.SetPos(EdgeSize,Y);
|
// Draw selection background.
|
||||||
Canvas.DrawColor = FocusedLineColor;
|
if( SelectedRowIndex==n ) // Selected
|
||||||
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
|
{
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
Canvas.SetPos(EdgeSize,Y);
|
||||||
}
|
Canvas.DrawColor = SelectedLineColor;
|
||||||
|
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
|
||||||
// Draw columns of text
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
for( j=0; j<Columns.Length; ++j )
|
}
|
||||||
if( !Columns[j].bHidden )
|
else if( FocusMouseItem==n ) // Focused
|
||||||
{
|
{
|
||||||
//Canvas.SetClip(Columns[j].X+Columns[j].XSize+EdgeSize,YClip);
|
Canvas.SetPos(EdgeSize,Y);
|
||||||
Canvas.SetPos(Columns[j].X+XOffset+EdgeSize,TextY);
|
Canvas.DrawColor = FocusedLineColor;
|
||||||
DrawStrClipped(C.GetDisplayStr(j), Columns[j].bOnlyTextures);
|
Owner.CurrentStyle.DrawWhiteBox(CompPos[2]-(EdgeSize*2),ItemHeight);
|
||||||
}
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
Y+=ItemHeight;
|
}
|
||||||
TextY+=ItemHeight;
|
|
||||||
++n;
|
// Draw columns of text
|
||||||
C = C.Next;
|
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);
|
||||||
|
DrawStrClipped(C.GetDisplayStr(j), Columns[j].bOnlyTextures);
|
||||||
|
}
|
||||||
|
Y+=ItemHeight;
|
||||||
|
TextY+=ItemHeight;
|
||||||
|
++n;
|
||||||
|
C = C.Next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local byte j;
|
local byte j;
|
||||||
local float XS,SpaceX;
|
local float XS,SpaceX;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ComputeCoords();
|
if( !bVisible )
|
||||||
|
return;
|
||||||
// Check font to use.
|
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(TextScaler);
|
|
||||||
TextScaler *= FontSize;
|
|
||||||
Canvas.TextSize("ABC",XS,TextHeight,TextScaler,TextScaler);
|
|
||||||
|
|
||||||
for( j=0; j<4; ++j )
|
|
||||||
{
|
|
||||||
ScrollBar.InputPos[j] = CompPos[j];
|
|
||||||
ColumnComp.InputPos[j] = CompPos[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup positioning.
|
|
||||||
// First compute the width scrollbar.
|
|
||||||
if( OldXSize!=InputPos[2] )
|
|
||||||
{
|
|
||||||
OldXSize = InputPos[2];
|
|
||||||
ScalerSize = ScrollBar.GetWidth();
|
|
||||||
ScrollBar.XPosition = 1.f - ScalerSize;
|
|
||||||
ColumnComp.XSize = ScrollBar.XPosition;
|
|
||||||
}
|
|
||||||
SpaceX = ScalerSize*CompPos[2];
|
|
||||||
CompPos[2] -= SpaceX;
|
|
||||||
ScrollBar.InputPos[3] = CompPos[3];
|
|
||||||
|
|
||||||
// Draw columns.
|
ComputeCoords();
|
||||||
ColumnComp.YSize = (TextHeight*1.05) / CompPos[3];
|
|
||||||
ColumnComp.Canvas = Canvas;
|
|
||||||
ColumnComp.PreDraw();
|
|
||||||
|
|
||||||
// Move down to give space for columns.
|
|
||||||
CompPos[1] += ColumnComp.CompPos[3];
|
|
||||||
CompPos[3] -= ColumnComp.CompPos[3];
|
|
||||||
|
|
||||||
// Compute how many rows fit in with this setting.
|
// Check font to use.
|
||||||
ItemHeight = TextHeight*1.025;
|
Canvas.Font = Owner.CurrentStyle.PickFont(TextScaler);
|
||||||
ListItemsPerPage = CompPos[3]/ItemHeight;
|
TextScaler *= FontSize;
|
||||||
ItemHeight = CompPos[3]/ListItemsPerPage;
|
Canvas.TextSize("ABC",XS,TextHeight,TextScaler,TextScaler);
|
||||||
if( OldItemsPerFrame!=ListItemsPerPage || bListSizeDirty )
|
|
||||||
{
|
|
||||||
if( SelectedRowIndex>=ListCount )
|
|
||||||
SelectedRowIndex = -1;
|
|
||||||
OldItemsPerFrame = ListItemsPerPage;
|
|
||||||
bListSizeDirty = false;
|
|
||||||
UpdateListVis();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw vertical scrollbar
|
for( j=0; j<4; ++j )
|
||||||
ScrollBar.Canvas = Canvas;
|
{
|
||||||
ScrollBar.PreDraw();
|
ScrollBar.InputPos[j] = CompPos[j];
|
||||||
|
ColumnComp.InputPos[j] = CompPos[j];
|
||||||
// Draw self.
|
}
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
// Setup positioning.
|
||||||
DrawMenu();
|
// First compute the width scrollbar.
|
||||||
|
if( OldXSize!=InputPos[2] )
|
||||||
// Reset scaling to allow mouse to capture input.
|
{
|
||||||
CompPos[1] -= ColumnComp.CompPos[3];
|
OldXSize = InputPos[2];
|
||||||
CompPos[2] += SpaceX;
|
ScalerSize = ScrollBar.GetWidth();
|
||||||
CompPos[3] += ColumnComp.CompPos[3];
|
ScrollBar.XPosition = 1.f - ScalerSize;
|
||||||
|
ColumnComp.XSize = ScrollBar.XPosition;
|
||||||
|
}
|
||||||
|
SpaceX = ScalerSize*CompPos[2];
|
||||||
|
CompPos[2] -= SpaceX;
|
||||||
|
ScrollBar.InputPos[3] = CompPos[3];
|
||||||
|
|
||||||
|
// Draw columns.
|
||||||
|
ColumnComp.YSize = (TextHeight*1.05) / CompPos[3];
|
||||||
|
ColumnComp.Canvas = Canvas;
|
||||||
|
ColumnComp.PreDraw();
|
||||||
|
|
||||||
|
// Move down to give space for columns.
|
||||||
|
CompPos[1] += ColumnComp.CompPos[3];
|
||||||
|
CompPos[3] -= ColumnComp.CompPos[3];
|
||||||
|
|
||||||
|
// Compute how many rows fit in with this setting.
|
||||||
|
ItemHeight = TextHeight*1.025;
|
||||||
|
ListItemsPerPage = CompPos[3]/ItemHeight;
|
||||||
|
ItemHeight = CompPos[3]/ListItemsPerPage;
|
||||||
|
if( OldItemsPerFrame!=ListItemsPerPage || bListSizeDirty )
|
||||||
|
{
|
||||||
|
if( SelectedRowIndex>=ListCount )
|
||||||
|
SelectedRowIndex = -1;
|
||||||
|
OldItemsPerFrame = ListItemsPerPage;
|
||||||
|
bListSizeDirty = false;
|
||||||
|
UpdateListVis();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw vertical scrollbar
|
||||||
|
ScrollBar.Canvas = Canvas;
|
||||||
|
ScrollBar.PreDraw();
|
||||||
|
|
||||||
|
// Draw self.
|
||||||
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
|
DrawMenu();
|
||||||
|
|
||||||
|
// Reset scaling to allow mouse to capture input.
|
||||||
|
CompPos[1] -= ColumnComp.CompPos[3];
|
||||||
|
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;
|
SelectedRowIndex = Index;
|
||||||
OnSelectedRow(GetFromIndex(Index),Index,bRight,false);
|
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;
|
SelectedRowIndex = Index;
|
||||||
OnSelectedRow(GetFromIndex(Index),Index,bRight,true);
|
OnSelectedRow(GetFromIndex(Index),Index,bRight,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ListItemClass=class'KFGUI_ListItem'
|
ListItemClass=class'KFGUI_ListItem'
|
||||||
OnClickedItem=InternalClickedItem
|
OnClickedItem=InternalClickedItem
|
||||||
OnDblClickedItem=InternalDblClickedItem
|
OnDblClickedItem=InternalDblClickedItem
|
||||||
SelectedRowIndex=-1
|
SelectedRowIndex=-1
|
||||||
FontSize=1.f
|
FontSize=1.f
|
||||||
EdgeSize=5.f
|
EdgeSize=5.f
|
||||||
bClickable=true
|
bClickable=true
|
||||||
FocusedLineColor=(R=64,G=3,B=48,A=255)
|
FocusedLineColor=(R=64,G=3,B=48,A=255)
|
||||||
SelectedLineColor=(R=84,G=26,B=128,A=255)
|
SelectedLineColor=(R=84,G=26,B=128,A=255)
|
||||||
bCanSortColumn=true
|
bCanSortColumn=true
|
||||||
|
|
||||||
Begin Object Class=KFGUI_ColumnTop Name=ColumnComps
|
Begin Object Class=KFGUI_ColumnTop Name=ColumnComps
|
||||||
XPosition=0
|
XPosition=0
|
||||||
YPosition=0
|
YPosition=0
|
||||||
XSize=1
|
XSize=1
|
||||||
YSize=0.04
|
YSize=0.04
|
||||||
ID="Columns"
|
ID="Columns"
|
||||||
End Object
|
End Object
|
||||||
Components.Add(ColumnComps)
|
Components.Add(ColumnComps)
|
||||||
|
|
||||||
LineFontInfo=(bClipText=true,bEnableShadow=false)
|
LineFontInfo=(bClipText=true,bEnableShadow=false)
|
||||||
}
|
}
|
@ -10,197 +10,197 @@ var transient bool bPressedDown,bScaleColumn,bMouseScaler;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ListOwner = KFGUI_ColumnList(ParentComponent);
|
ListOwner = KFGUI_ColumnList(ParentComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,j;
|
local int i,j;
|
||||||
local float X,XS,MouseX,GrabWidth,MinSize,Wd;
|
local float X,XS,MouseX,GrabWidth,MinSize,Wd;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
bClickable = ListOwner.bClickable;
|
bClickable = ListOwner.bClickable;
|
||||||
MinSize = ColumnMinSize / CompPos[2];
|
MinSize = ColumnMinSize / CompPos[2];
|
||||||
|
|
||||||
// Scale column
|
|
||||||
if( bScaleColumn )
|
|
||||||
{
|
|
||||||
MouseX = Owner.MousePosition.X - CompPos[0];
|
|
||||||
for( i=0; i<ScalingColumn; ++i )
|
|
||||||
MouseX-=(ListOwner.Columns[i].Width * CompPos[2]);
|
|
||||||
|
|
||||||
ListOwner.Columns[ScalingColumn].Width = MouseX / CompPos[2];
|
// Scale column
|
||||||
|
if( bScaleColumn )
|
||||||
// Make sure no column is scrolled off screen.
|
{
|
||||||
X = 0;
|
MouseX = Owner.MousePosition.X - CompPos[0];
|
||||||
for( i=0; i<(ListOwner.Columns.Length-1); ++i )
|
for( i=0; i<ScalingColumn; ++i )
|
||||||
{
|
MouseX-=(ListOwner.Columns[i].Width * CompPos[2]);
|
||||||
if( ListOwner.Columns[i].Width<MinSize )
|
|
||||||
ListOwner.Columns[i].Width = MinSize;
|
|
||||||
X+=ListOwner.Columns[i].Width;
|
|
||||||
if( X>=(1.f-MinSize) )
|
|
||||||
{
|
|
||||||
MouseX = X-(1.f-MinSize); // Grab overshoot.
|
|
||||||
|
|
||||||
// Then push back!
|
ListOwner.Columns[ScalingColumn].Width = MouseX / CompPos[2];
|
||||||
for( j=i; j>=0; --j )
|
|
||||||
{
|
|
||||||
if( (ListOwner.Columns[j].Width-MouseX)>MinSize ) // This column has enough space to retract.
|
|
||||||
{
|
|
||||||
ListOwner.Columns[j].Width-=MouseX;
|
|
||||||
MouseX = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if( ListOwner.Columns[j].Width>MinSize ) // This column has limited space to retract.
|
|
||||||
{
|
|
||||||
MouseX-=(ListOwner.Columns[j].Width-MinSize);
|
|
||||||
ListOwner.Columns[j].Width = MinSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
X = (1.f-MinSize); // Continue at maximum size.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init mouse check.
|
|
||||||
MouseColumn = -1;
|
|
||||||
bCheckMouse = (bClickable && bFocused);
|
|
||||||
if( bCheckMouse )
|
|
||||||
{
|
|
||||||
GrabWidth = CompPos[3]*0.175;
|
|
||||||
MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth;
|
|
||||||
GrabWidth *= -2.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the columns and compute the scalings.
|
// Make sure no column is scrolled off screen.
|
||||||
X = 0;
|
X = 0;
|
||||||
j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1);
|
for( i=0; i<(ListOwner.Columns.Length-1); ++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;
|
||||||
ListOwner.Columns[i].Width = MinSize;
|
X+=ListOwner.Columns[i].Width;
|
||||||
|
if( X>=(1.f-MinSize) )
|
||||||
|
{
|
||||||
|
MouseX = X-(1.f-MinSize); // Grab overshoot.
|
||||||
|
|
||||||
Wd = ListOwner.Columns[i].Width * CompPos[2];
|
// Then push back!
|
||||||
if( i==(ListOwner.Columns.Length-1) ) // Final column, give infinitive width.
|
for( j=i; j>=0; --j )
|
||||||
{
|
{
|
||||||
Wd = (CompPos[2]-X);
|
if( (ListOwner.Columns[j].Width-MouseX)>MinSize ) // This column has enough space to retract.
|
||||||
}
|
{
|
||||||
if( Wd<=0 ) // Impossible.
|
ListOwner.Columns[j].Width-=MouseX;
|
||||||
{
|
MouseX = 0;
|
||||||
ListOwner.Columns[i].bHidden = true;
|
break;
|
||||||
continue;
|
}
|
||||||
}
|
else if( ListOwner.Columns[j].Width>MinSize ) // This column has limited space to retract.
|
||||||
|
{
|
||||||
|
MouseX-=(ListOwner.Columns[j].Width-MinSize);
|
||||||
|
ListOwner.Columns[j].Width = MinSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
X = (1.f-MinSize); // Continue at maximum size.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListOwner.Columns[i].X = X;
|
// Init mouse check.
|
||||||
ListOwner.Columns[i].XSize = Wd;
|
MouseColumn = -1;
|
||||||
|
bCheckMouse = (bClickable && bFocused);
|
||||||
if( bCheckMouse && (MouseX-=Wd)<=0.f )
|
if( bCheckMouse )
|
||||||
{
|
{
|
||||||
MouseColumn = i;
|
GrabWidth = CompPos[3]*0.175;
|
||||||
bCheckMouse = false;
|
MouseX = Owner.MousePosition.X - CompPos[0] - GrabWidth;
|
||||||
bMouseScaler = (MouseX>=GrabWidth) && ((i+1)<ListOwner.Columns.Length);
|
GrabWidth *= -2.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( X>=CompPos[2] )
|
// Draw the columns and compute the scalings.
|
||||||
ListOwner.Columns[i].bHidden = true;
|
X = 0;
|
||||||
else
|
j = (ListOwner.bShouldSortList ? ListOwner.LastSortedColumn : -1);
|
||||||
{
|
for( i=0; i<ListOwner.Columns.Length; ++i )
|
||||||
ListOwner.Columns[i].bHidden = false;
|
{
|
||||||
//Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]);
|
if( ListOwner.Columns[i].Width<MinSize )
|
||||||
|
ListOwner.Columns[i].Width = MinSize;
|
||||||
// Draw column.
|
|
||||||
if( i==j )
|
|
||||||
{
|
|
||||||
if( MouseColumn==i && !bMouseScaler )
|
|
||||||
Canvas.SetDrawColor(175,240,8,255);
|
|
||||||
else Canvas.SetDrawColor(128,200,56,255);
|
|
||||||
}
|
|
||||||
else if( MouseColumn==i && !bMouseScaler )
|
|
||||||
Canvas.SetDrawColor(220,220,8,255);
|
|
||||||
|
|
||||||
XS = Owner.CurrentStyle.DefaultHeight*0.5;
|
Wd = ListOwner.Columns[i].Width * CompPos[2];
|
||||||
Canvas.SetPos(X,0.f);
|
if( i==(ListOwner.Columns.Length-1) ) // Final column, give infinitive width.
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.TabTextures[`TAB_TOP],Min(Wd,CompPos[2]-X),CompPos[3],0,0,128,16);
|
{
|
||||||
|
Wd = (CompPos[2]-X);
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
}
|
||||||
Canvas.SetPos(X+XS,(CompPos[3]-ListOwner.TextHeight)*0.5f);
|
if( Wd<=0 ) // Impossible.
|
||||||
ListOwner.DrawStrClipped(ListOwner.Columns[i].Text);
|
{
|
||||||
}
|
ListOwner.Columns[i].bHidden = true;
|
||||||
X+=Wd;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListOwner.Columns[i].X = X;
|
||||||
|
ListOwner.Columns[i].XSize = Wd;
|
||||||
|
|
||||||
|
if( bCheckMouse && (MouseX-=Wd)<=0.f )
|
||||||
|
{
|
||||||
|
MouseColumn = i;
|
||||||
|
bCheckMouse = false;
|
||||||
|
bMouseScaler = (MouseX>=GrabWidth) && ((i+1)<ListOwner.Columns.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( X>=CompPos[2] )
|
||||||
|
ListOwner.Columns[i].bHidden = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListOwner.Columns[i].bHidden = false;
|
||||||
|
//Canvas.SetClip(X+Wd,CompPos[1]+CompPos[3]);
|
||||||
|
|
||||||
|
// Draw column.
|
||||||
|
if( i==j )
|
||||||
|
{
|
||||||
|
if( MouseColumn==i && !bMouseScaler )
|
||||||
|
Canvas.SetDrawColor(175,240,8,255);
|
||||||
|
else Canvas.SetDrawColor(128,200,56,255);
|
||||||
|
}
|
||||||
|
else if( MouseColumn==i && !bMouseScaler )
|
||||||
|
Canvas.SetDrawColor(220,220,8,255);
|
||||||
|
|
||||||
|
XS = Owner.CurrentStyle.DefaultHeight*0.5;
|
||||||
|
Canvas.SetPos(X,0.f);
|
||||||
|
Canvas.DrawTileStretched(Owner.CurrentStyle.TabTextures[`TAB_TOP],Min(Wd,CompPos[2]-X),CompPos[3],0,0,128,16);
|
||||||
|
|
||||||
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
|
Canvas.SetPos(X+XS,(CompPos[3]-ListOwner.TextHeight)*0.5f);
|
||||||
|
ListOwner.DrawStrClipped(ListOwner.Columns[i].Text);
|
||||||
|
}
|
||||||
|
X+=Wd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( !ListOwner.bDisabled && bClickable )
|
if( !ListOwner.bDisabled && bClickable )
|
||||||
{
|
{
|
||||||
PressedDown[byte(bRight)] = 1;
|
PressedDown[byte(bRight)] = 1;
|
||||||
bPressedDown = true;
|
bPressedDown = true;
|
||||||
|
|
||||||
if( !bRight && bMouseScaler )
|
if( !bRight && bMouseScaler )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_ClickButton);
|
PlayMenuSound(MN_ClickButton);
|
||||||
bScaleColumn = true;
|
bScaleColumn = true;
|
||||||
ScalingColumn = MouseColumn;
|
ScalingColumn = MouseColumn;
|
||||||
GetInputFocus();
|
GetInputFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseRelease( bool bRight )
|
function MouseRelease( bool bRight )
|
||||||
{
|
{
|
||||||
if( bScaleColumn && !bRight )
|
if( bScaleColumn && !bRight )
|
||||||
{
|
{
|
||||||
bScaleColumn = false;
|
bScaleColumn = false;
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 )
|
if( !bDisabled && bClickable && PressedDown[byte(bRight)]==1 )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_ClickButton);
|
PlayMenuSound(MN_ClickButton);
|
||||||
PressedDown[byte(bRight)] = 0;
|
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));
|
ListOwner.SortColumn(MouseColumn,(PrevSortedColumn==MouseColumn));
|
||||||
if( PrevSortedColumn==MouseColumn )
|
if( PrevSortedColumn==MouseColumn )
|
||||||
PrevSortedColumn = -1;
|
PrevSortedColumn = -1;
|
||||||
else PrevSortedColumn = MouseColumn;
|
else PrevSortedColumn = MouseColumn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function byte GetCursorStyle()
|
function byte GetCursorStyle()
|
||||||
{
|
{
|
||||||
if( bClickable )
|
if( bClickable )
|
||||||
return (bMouseScaler ? 2 : 1);
|
return (bMouseScaler ? 2 : 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
Super.MouseLeave();
|
Super.MouseLeave();
|
||||||
if( !bScaleColumn )
|
if( !bScaleColumn )
|
||||||
{
|
{
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
Super.MouseEnter();
|
Super.MouseEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
function LostInputFocus()
|
function LostInputFocus()
|
||||||
{
|
{
|
||||||
bScaleColumn = false;
|
bScaleColumn = false;
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bClickable=true
|
bClickable=true
|
||||||
ColumnMinSize=8
|
ColumnMinSize=8
|
||||||
}
|
}
|
@ -10,55 +10,55 @@ var() bool bButtonStretched;
|
|||||||
|
|
||||||
function UpdateSizes()
|
function UpdateSizes()
|
||||||
{
|
{
|
||||||
// Update height.
|
// Update height.
|
||||||
if( bScaleByFontSize )
|
if( bScaleByFontSize )
|
||||||
YSize = (TextHeight + (BorderSize*2)) / InputPos[3];
|
YSize = (TextHeight + (BorderSize*2)) / InputPos[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderComboBox(Self);
|
Owner.CurrentStyle.RenderComboBox(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight )
|
function HandleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_Dropdown);
|
PlayMenuSound(MN_Dropdown);
|
||||||
if( Selection==None )
|
if( Selection==None )
|
||||||
{
|
{
|
||||||
Selection = New(None)Class'KFGUI_ComboSelector';
|
Selection = New(None)Class'KFGUI_ComboSelector';
|
||||||
Selection.Owner = Owner;
|
Selection.Owner = Owner;
|
||||||
Selection.Combo = Self;
|
Selection.Combo = Self;
|
||||||
Selection.InitMenu();
|
Selection.InitMenu();
|
||||||
}
|
}
|
||||||
Selection.XPosition = CompPos[0] / Owner.ScreenSize.X;
|
Selection.XPosition = CompPos[0] / Owner.ScreenSize.X;
|
||||||
Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y;
|
Selection.YPosition = (CompPos[1]+CompPos[3]) / Owner.ScreenSize.Y;
|
||||||
Selection.XSize = CompPos[2] / Owner.ScreenSize.X;
|
Selection.XSize = CompPos[2] / Owner.ScreenSize.X;
|
||||||
Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y);
|
Selection.YSize = (TextHeight / Owner.ScreenSize.Y) * Values.Length + ((BorderSize*2) / Owner.ScreenSize.Y);
|
||||||
if( (Selection.YPosition+Selection.YSize)>1.f )
|
if( (Selection.YPosition+Selection.YSize)>1.f )
|
||||||
Selection.YPosition-=((Selection.YPosition+Selection.YSize)-1.f);
|
Selection.YPosition-=((Selection.YPosition+Selection.YSize)-1.f);
|
||||||
Selection.GetInputFocus();
|
Selection.GetInputFocus();
|
||||||
}
|
}
|
||||||
final function string GetCurrent()
|
final function string GetCurrent()
|
||||||
{
|
{
|
||||||
if( SelectedIndex<Values.Length )
|
if( SelectedIndex<Values.Length )
|
||||||
return Values[SelectedIndex];
|
return Values[SelectedIndex];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
final function bool SetValue( string S )
|
final function bool SetValue( string S )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
i = Values.Find(S);
|
i = Values.Find(S);
|
||||||
if( i==-1 )
|
if( i==-1 )
|
||||||
return false;
|
return false;
|
||||||
SelectedIndex = i;
|
SelectedIndex = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Delegate OnComboChanged( KFGUI_ComboBox Sender );
|
Delegate OnComboChanged( KFGUI_ComboBox Sender );
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
SelectedTextColor=(R=255,G=128,B=128,A=255)
|
SelectedTextColor=(R=255,G=128,B=128,A=255)
|
||||||
TextColor=(R=255,G=255,B=255,A=255)
|
TextColor=(R=255,G=255,B=255,A=255)
|
||||||
BorderSize=4
|
BorderSize=4
|
||||||
}
|
}
|
@ -5,23 +5,23 @@ var int CurrentRow,OldRow;
|
|||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderComboList(Self);
|
Owner.CurrentStyle.RenderComboList(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight )
|
function HandleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_ClickButton);
|
PlayMenuSound(MN_ClickButton);
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
if( CurrentRow>=0 )
|
if( CurrentRow>=0 )
|
||||||
{
|
{
|
||||||
Combo.SelectedIndex = CurrentRow;
|
Combo.SelectedIndex = CurrentRow;
|
||||||
Combo.OnComboChanged(Combo);
|
Combo.OnComboChanged(Combo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
CurrentRow=-1
|
CurrentRow=-1
|
||||||
OldRow=-1
|
OldRow=-1
|
||||||
bFocusedPostDrawItem=true
|
bFocusedPostDrawItem=true
|
||||||
}
|
}
|
@ -8,146 +8,146 @@ var array<KFGUI_Base> ItemComponents;
|
|||||||
// REMEMBER to call InitMenu() on the newly created component after values are init!!!
|
// 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);
|
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;
|
local KFGUI_Base G;
|
||||||
|
|
||||||
G = new(Self)CompClass;
|
G = new(Self)CompClass;
|
||||||
if( G==None )
|
if( G==None )
|
||||||
return None;
|
return None;
|
||||||
|
|
||||||
G.XPosition = (1.f - XS) * 0.5f;
|
G.XPosition = (1.f - XS) * 0.5f;
|
||||||
G.YPosition = (1.f - YS) * 0.5f;
|
G.YPosition = (1.f - YS) * 0.5f;
|
||||||
G.XSize = XS;
|
G.XSize = XS;
|
||||||
G.YSize = YS;
|
G.YSize = YS;
|
||||||
|
|
||||||
return G;
|
return G;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function AddItem( KFGUI_Base Item )
|
final function AddItem( KFGUI_Base Item )
|
||||||
{
|
{
|
||||||
AddItemAtIndex(ItemComponents.Length, 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);
|
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;
|
local KFGUI_Base G;
|
||||||
|
|
||||||
G = CreateComponent(CompClass, XS, YS);
|
G = CreateComponent(CompClass, XS, YS);
|
||||||
G.Owner = Owner;
|
G.Owner = Owner;
|
||||||
G.ParentComponent = Self;
|
G.ParentComponent = Self;
|
||||||
ItemComponents.InsertItem(i, G);
|
ItemComponents.InsertItem(i, G);
|
||||||
|
|
||||||
return G;
|
return G;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyList()
|
function EmptyList()
|
||||||
{
|
{
|
||||||
ItemComponents.Length = 0;
|
ItemComponents.Length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ListCount = 0;
|
ListCount = 0;
|
||||||
NumColumns = Max(NumColumns,1);
|
NumColumns = Max(NumColumns,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
if( bDrawBackground )
|
if( bDrawBackground )
|
||||||
{
|
{
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
Canvas.SetPos(0.f,0.f);
|
Canvas.SetPos(0.f,0.f);
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ComputeCoords();
|
if( !bVisible )
|
||||||
|
return;
|
||||||
// Update list size
|
|
||||||
i = ItemComponents.Length / NumColumns;
|
ComputeCoords();
|
||||||
if( i!=NumColumns )
|
|
||||||
{
|
// Update list size
|
||||||
ListCount = i;
|
i = ItemComponents.Length / NumColumns;
|
||||||
UpdateListVis();
|
if( i!=NumColumns )
|
||||||
}
|
{
|
||||||
|
ListCount = i;
|
||||||
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
UpdateListVis();
|
||||||
{
|
}
|
||||||
// First draw scrollbar to allow it to resize itself.
|
|
||||||
for( j=0; j<4; ++j )
|
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
||||||
ScrollBar.InputPos[j] = CompPos[j];
|
{
|
||||||
if( OldXSize!=InputPos[2] )
|
// First draw scrollbar to allow it to resize itself.
|
||||||
{
|
for( j=0; j<4; ++j )
|
||||||
OldXSize = InputPos[2];
|
ScrollBar.InputPos[j] = CompPos[j];
|
||||||
}
|
if( OldXSize!=InputPos[2] )
|
||||||
ScrollBar.Canvas = Canvas;
|
{
|
||||||
ScrollBar.PreDraw();
|
OldXSize = InputPos[2];
|
||||||
|
}
|
||||||
// Then downscale our selves to give room for scrollbar.
|
ScrollBar.Canvas = Canvas;
|
||||||
CompPos[2] -= ScrollBar.CompPos[2];
|
ScrollBar.PreDraw();
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
// Then downscale our selves to give room for scrollbar.
|
||||||
DrawMenu();
|
CompPos[2] -= ScrollBar.CompPos[2];
|
||||||
PreDrawListItems();
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
CompPos[2] += ScrollBar.CompPos[2];
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
}
|
DrawMenu();
|
||||||
else
|
PreDrawListItems();
|
||||||
{
|
CompPos[2] += ScrollBar.CompPos[2];
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
}
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
else
|
||||||
DrawMenu();
|
{
|
||||||
PreDrawListItems();
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
}
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
|
DrawMenu();
|
||||||
|
PreDrawListItems();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDrawListItems()
|
function PreDrawListItems()
|
||||||
{
|
{
|
||||||
local int i,XNum,r;
|
local int i,XNum,r;
|
||||||
local float XS,YS;
|
local float XS,YS;
|
||||||
|
|
||||||
XNum = 0;
|
|
||||||
r = 0;
|
|
||||||
XS = CompPos[2] / NumColumns;
|
|
||||||
YS = CompPos[3] / ListItemsPerPage;
|
|
||||||
VisRange[0] = (ScrollBar.CurrentScroll*NumColumns);
|
|
||||||
VisRange[1] = ItemComponents.Length;
|
|
||||||
for( i=VisRange[0]; i<VisRange[1]; ++i )
|
|
||||||
{
|
|
||||||
ItemComponents[i].Canvas = Canvas;
|
|
||||||
ItemComponents[i].InputPos[0] = CompPos[0]+XS*XNum;
|
|
||||||
ItemComponents[i].InputPos[1] = CompPos[1]+YS*r;
|
|
||||||
ItemComponents[i].InputPos[2] = XS;
|
|
||||||
ItemComponents[i].InputPos[3] = YS;
|
|
||||||
ItemComponents[i].PreDraw();
|
|
||||||
|
|
||||||
if( ++XNum==NumColumns )
|
XNum = 0;
|
||||||
{
|
r = 0;
|
||||||
XNum = 0;
|
XS = CompPos[2] / NumColumns;
|
||||||
if( ++r==ListItemsPerPage )
|
YS = CompPos[3] / ListItemsPerPage;
|
||||||
{
|
VisRange[0] = (ScrollBar.CurrentScroll*NumColumns);
|
||||||
VisRange[1] = i+1;
|
VisRange[1] = ItemComponents.Length;
|
||||||
break;
|
for( i=VisRange[0]; i<VisRange[1]; ++i )
|
||||||
}
|
{
|
||||||
}
|
ItemComponents[i].Canvas = Canvas;
|
||||||
}
|
ItemComponents[i].InputPos[0] = CompPos[0]+XS*XNum;
|
||||||
|
ItemComponents[i].InputPos[1] = CompPos[1]+YS*r;
|
||||||
|
ItemComponents[i].InputPos[2] = XS;
|
||||||
|
ItemComponents[i].InputPos[3] = YS;
|
||||||
|
ItemComponents[i].PreDraw();
|
||||||
|
|
||||||
|
if( ++XNum==NumColumns )
|
||||||
|
{
|
||||||
|
XNum = 0;
|
||||||
|
if( ++r==ListItemsPerPage )
|
||||||
|
{
|
||||||
|
VisRange[1] = i+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChangeListSize( int NewSize );
|
function ChangeListSize( int NewSize );
|
||||||
@ -156,67 +156,67 @@ function MouseClick( bool bRight );
|
|||||||
function MouseRelease( bool bRight );
|
function MouseRelease( bool bRight );
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
Super(KFGUI_Base).MouseLeave();
|
Super(KFGUI_Base).MouseLeave();
|
||||||
}
|
}
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
Super(KFGUI_Base).MouseEnter();
|
Super(KFGUI_Base).MouseEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
local int i;
|
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];
|
MouseArea = ItemComponents[i];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Super.CaptureMouse();
|
return Super.CaptureMouse();
|
||||||
}
|
}
|
||||||
function CloseMenu()
|
function CloseMenu()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<ItemComponents.Length; ++i )
|
for( i=0; i<ItemComponents.Length; ++i )
|
||||||
ItemComponents[i].CloseMenu();
|
ItemComponents[i].CloseMenu();
|
||||||
Super.CloseMenu();
|
Super.CloseMenu();
|
||||||
}
|
}
|
||||||
function NotifyLevelChange()
|
function NotifyLevelChange()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<ItemComponents.Length; ++i )
|
for( i=0; i<ItemComponents.Length; ++i )
|
||||||
ItemComponents[i].NotifyLevelChange();
|
ItemComponents[i].NotifyLevelChange();
|
||||||
Super.NotifyLevelChange();
|
Super.NotifyLevelChange();
|
||||||
}
|
}
|
||||||
function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
|
function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<ItemComponents.Length; ++i )
|
for( i=0; i<ItemComponents.Length; ++i )
|
||||||
ItemComponents[i].InventoryChanged(Wep,bRemove);
|
ItemComponents[i].InventoryChanged(Wep,bRemove);
|
||||||
}
|
}
|
||||||
function MenuTick( float DeltaTime )
|
function MenuTick( float DeltaTime )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
Super.MenuTick(DeltaTime);
|
Super.MenuTick(DeltaTime);
|
||||||
for( i=0; i<ItemComponents.Length; ++i )
|
for( i=0; i<ItemComponents.Length; ++i )
|
||||||
ItemComponents[i].MenuTick(DeltaTime);
|
ItemComponents[i].MenuTick(DeltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ListCount=0
|
ListCount=0
|
||||||
NumColumns=1
|
NumColumns=1
|
||||||
bClickable=true
|
bClickable=true
|
||||||
bDrawBackground=false
|
bDrawBackground=false
|
||||||
}
|
}
|
@ -2,9 +2,9 @@ Class KFGUI_EditBox extends KFGUI_Clickable;
|
|||||||
|
|
||||||
var enum eTextCase
|
var enum eTextCase
|
||||||
{
|
{
|
||||||
TXTC_None,
|
TXTC_None,
|
||||||
TXTC_Upper,
|
TXTC_Upper,
|
||||||
TXTC_Lower,
|
TXTC_Lower,
|
||||||
} TextCase;
|
} TextCase;
|
||||||
|
|
||||||
var Color FontColor;
|
var Color FontColor;
|
||||||
@ -18,398 +18,398 @@ var float TextScale;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
|
|
||||||
if ( bIntOnly || bFloatOnly )
|
if ( bIntOnly || bFloatOnly )
|
||||||
{
|
{
|
||||||
AllowedCharSet = "0123456789";
|
AllowedCharSet = "0123456789";
|
||||||
|
|
||||||
if (bFloatOnly)
|
if (bFloatOnly)
|
||||||
AllowedCharSet $= ".";
|
AllowedCharSet $= ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
bAllSelected = true;
|
bAllSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetText(string NewText, optional bool bIgnoreDelegate)
|
function SetText(string NewText, optional bool bIgnoreDelegate)
|
||||||
{
|
{
|
||||||
local bool bChanged;
|
local bool bChanged;
|
||||||
|
|
||||||
bChanged = bAlwaysNotify || TextStr != NewText;
|
bChanged = bAlwaysNotify || TextStr != NewText;
|
||||||
TextStr = NewText;
|
TextStr = NewText;
|
||||||
CaretPos = Len(TextStr);
|
CaretPos = Len(TextStr);
|
||||||
|
|
||||||
if (bChanged && !bIgnoreDelegate)
|
if (bChanged && !bIgnoreDelegate)
|
||||||
TextChanged();
|
TextChanged();
|
||||||
|
|
||||||
bAllSelected=true;
|
bAllSelected=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool NotifyInputChar(int Key, string Unicode)
|
function bool NotifyInputChar(int Key, string Unicode)
|
||||||
{
|
{
|
||||||
local string Temp,S;
|
local string Temp,S;
|
||||||
|
|
||||||
if (bReadOnly)
|
if (bReadOnly)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( UniCode!="" )
|
if( UniCode!="" )
|
||||||
S = Unicode;
|
S = Unicode;
|
||||||
else S = Chr(Key);
|
else S = Chr(Key);
|
||||||
|
|
||||||
if( Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( bCtrl )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(bAllSelected)
|
if( Asc(S) == 13 || Asc(S) == 8 || Asc(S) == 27 )
|
||||||
{
|
return false;
|
||||||
TextStr="";
|
|
||||||
CaretPos=0;
|
|
||||||
bAllSelected=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (AllowedCharSet=="") || ( (bIncludeSign) && ( (S=="-") || (S=="+") ) && (TextStr=="") ) || (InStr(AllowedCharSet,S)>=0) )
|
if( bCtrl )
|
||||||
{
|
return false;
|
||||||
if ( (MaxWidth==0) || (Len(TextStr)<MaxWidth) )
|
|
||||||
{
|
|
||||||
if ( (bConvertSpaces) && ((S==" ") || (S=="?") || (S=="\\")) )
|
|
||||||
S = "_";
|
|
||||||
|
|
||||||
if ( (TextStr=="") || ( CaretPos==Len(TextStr) ) )
|
if(bAllSelected)
|
||||||
{
|
{
|
||||||
TextStr = TextStr$S;
|
TextStr="";
|
||||||
CaretPos=Len(TextStr);
|
CaretPos=0;
|
||||||
}
|
bAllSelected=false;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
Temp = Left(TextStr,CaretPos)$S$Mid(TextStr,CaretPos);
|
|
||||||
TextStr = Temp;
|
|
||||||
CaretPos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextChanged();
|
if ( (AllowedCharSet=="") || ( (bIncludeSign) && ( (S=="-") || (S=="+") ) && (TextStr=="") ) || (InStr(AllowedCharSet,S)>=0) )
|
||||||
return true;
|
{
|
||||||
}
|
if ( (MaxWidth==0) || (Len(TextStr)<MaxWidth) )
|
||||||
}
|
{
|
||||||
|
if ( (bConvertSpaces) && ((S==" ") || (S=="?") || (S=="\\")) )
|
||||||
|
S = "_";
|
||||||
|
|
||||||
return false;
|
if ( (TextStr=="") || ( CaretPos==Len(TextStr) ) )
|
||||||
|
{
|
||||||
|
TextStr = TextStr$S;
|
||||||
|
CaretPos=Len(TextStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Temp = Left(TextStr,CaretPos)$S$Mid(TextStr,CaretPos);
|
||||||
|
TextStr = Temp;
|
||||||
|
CaretPos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextChanged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetInputText(string S)
|
function SetInputText(string S)
|
||||||
{
|
{
|
||||||
switch(TextCase)
|
switch(TextCase)
|
||||||
{
|
{
|
||||||
case TXTC_Upper:
|
case TXTC_Upper:
|
||||||
S = Caps(S);
|
S = Caps(S);
|
||||||
break;
|
break;
|
||||||
case TXTC_Lower:
|
case TXTC_Lower:
|
||||||
S = Locs(S);
|
S = Locs(S);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextStr = S;
|
TextStr = S;
|
||||||
TextChanged();
|
TextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
function AppendInputText(string Text)
|
function AppendInputText(string Text)
|
||||||
{
|
{
|
||||||
local int Character;
|
local int Character;
|
||||||
|
|
||||||
while (Len(Text) > 0)
|
while (Len(Text) > 0)
|
||||||
{
|
{
|
||||||
Character = Asc(Left(Text, 1));
|
Character = Asc(Left(Text, 1));
|
||||||
Text = Mid(Text, 1);
|
Text = Mid(Text, 1);
|
||||||
|
|
||||||
if (Character >= 0x20 && Character < 0x100)
|
if (Character >= 0x20 && Character < 0x100)
|
||||||
{
|
{
|
||||||
SetInputText(Left(TextStr, CaretPos) $ Chr(Character) $ Right(TextStr, Len(TextStr) - CaretPos));
|
SetInputText(Left(TextStr, CaretPos) $ Chr(Character) $ Right(TextStr, Len(TextStr) - CaretPos));
|
||||||
CaretPos += 1;
|
CaretPos += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool ProcessControlKey(name Key, EInputEvent Event)
|
function bool ProcessControlKey(name Key, EInputEvent Event)
|
||||||
{
|
{
|
||||||
if (Key == 'LeftControl' || Key == 'RightControl')
|
if (Key == 'LeftControl' || Key == 'RightControl')
|
||||||
{
|
{
|
||||||
if (Event == IE_Released)
|
if (Event == IE_Released)
|
||||||
{
|
{
|
||||||
bCtrl = false;
|
bCtrl = false;
|
||||||
}
|
}
|
||||||
else if (Event == IE_Pressed)
|
else if (Event == IE_Pressed)
|
||||||
{
|
{
|
||||||
bCtrl = true;
|
bCtrl = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (bCtrl && Event == IE_Pressed && GetPlayer() != None)
|
else if (bCtrl && Event == IE_Pressed && GetPlayer() != None)
|
||||||
{
|
{
|
||||||
if (Key == 'V')
|
if (Key == 'V')
|
||||||
{
|
{
|
||||||
// paste
|
// paste
|
||||||
AppendInputText(GetPlayer().PasteFromClipboard());
|
AppendInputText(GetPlayer().PasteFromClipboard());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (Key == 'C')
|
else if (Key == 'C')
|
||||||
{
|
{
|
||||||
// copy
|
// copy
|
||||||
GetPlayer().CopyToClipboard(TextStr);
|
GetPlayer().CopyToClipboard(TextStr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (Key == 'X')
|
else if (Key == 'X')
|
||||||
{
|
{
|
||||||
// cut
|
// cut
|
||||||
if (TextStr != "")
|
if (TextStr != "")
|
||||||
{
|
{
|
||||||
GetPlayer().CopyToClipboard(TextStr);
|
GetPlayer().CopyToClipboard(TextStr);
|
||||||
SetInputText("");
|
SetInputText("");
|
||||||
CaretPos = 0;
|
CaretPos = 0;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
local string Temp;
|
local string Temp;
|
||||||
|
|
||||||
if( bReadOnly )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ProcessControlKey(Key, Event))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if( Key == 'Escape' && Event == IE_Pressed )
|
|
||||||
{
|
|
||||||
if( TextStr!="" )
|
|
||||||
{
|
|
||||||
SetInputText("");
|
|
||||||
CaretPos = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( ParentComponent != None )
|
|
||||||
{
|
|
||||||
ParentComponent.UserPressedEsc();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( Key=='Enter' && Event == IE_Released )
|
|
||||||
{
|
|
||||||
if( TextStr!="" )
|
|
||||||
{
|
|
||||||
Temp = TextStr;
|
|
||||||
OnTextFinished(self, Temp);
|
|
||||||
if( !bNoClearOnEnter )
|
|
||||||
{
|
|
||||||
SetInputText("");
|
|
||||||
CaretPos = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
if( bReadOnly )
|
||||||
}
|
{
|
||||||
else if ( Key=='Home' )
|
return false;
|
||||||
{
|
}
|
||||||
CaretPos = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if ( Key=='End' )
|
|
||||||
{
|
|
||||||
CaretPos = Len(TextStr);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if( Event == IE_Pressed || Event == IE_Repeat )
|
|
||||||
{
|
|
||||||
if( Key=='Backspace' || Key=='Delete' )
|
|
||||||
{
|
|
||||||
if( bAllSelected )
|
|
||||||
{
|
|
||||||
SetInputText("");
|
|
||||||
CaretPos = 0;
|
|
||||||
}
|
|
||||||
else if( CaretPos>0 )
|
|
||||||
{
|
|
||||||
SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos));
|
|
||||||
CaretPos -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
if (ProcessControlKey(Key, Event))
|
||||||
}
|
{
|
||||||
else if ( Key=='Left' )
|
return false;
|
||||||
{
|
}
|
||||||
CaretPos = Max(0, CaretPos - 1);
|
else if( Key == 'Escape' && Event == IE_Pressed )
|
||||||
return true;
|
{
|
||||||
}
|
if( TextStr!="" )
|
||||||
else if ( Key=='Right' )
|
{
|
||||||
{
|
SetInputText("");
|
||||||
CaretPos = Min(Len(TextStr), CaretPos + 1);
|
CaretPos = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
if( ParentComponent != None )
|
||||||
|
{
|
||||||
|
ParentComponent.UserPressedEsc();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( Key=='Enter' && Event == IE_Released )
|
||||||
|
{
|
||||||
|
if( TextStr!="" )
|
||||||
|
{
|
||||||
|
Temp = TextStr;
|
||||||
|
OnTextFinished(self, Temp);
|
||||||
|
if( !bNoClearOnEnter )
|
||||||
|
{
|
||||||
|
SetInputText("");
|
||||||
|
CaretPos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else if ( Key=='Home' )
|
||||||
|
{
|
||||||
|
CaretPos = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( Key=='End' )
|
||||||
|
{
|
||||||
|
CaretPos = Len(TextStr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( Event == IE_Pressed || Event == IE_Repeat )
|
||||||
|
{
|
||||||
|
if( Key=='Backspace' || Key=='Delete' )
|
||||||
|
{
|
||||||
|
if( bAllSelected )
|
||||||
|
{
|
||||||
|
SetInputText("");
|
||||||
|
CaretPos = 0;
|
||||||
|
}
|
||||||
|
else if( CaretPos>0 )
|
||||||
|
{
|
||||||
|
SetInputText(Left(TextStr,CaretPos-1) $ Right(TextStr, Len(TextStr) - CaretPos));
|
||||||
|
CaretPos -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( Key=='Left' )
|
||||||
|
{
|
||||||
|
CaretPos = Max(0, CaretPos - 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( Key=='Right' )
|
||||||
|
{
|
||||||
|
CaretPos = Min(Len(TextStr), CaretPos + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function string ConvertIllegal(string InputStr)
|
function string ConvertIllegal(string InputStr)
|
||||||
{
|
{
|
||||||
local int i, Max;
|
local int i, Max;
|
||||||
local string Retval;
|
local string Retval;
|
||||||
local string C;
|
local string C;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
Max = Len(InputStr);
|
Max = Len(InputStr);
|
||||||
while ( i < Max )
|
while ( i < Max )
|
||||||
{
|
{
|
||||||
C = Mid(InputStr,i,1);
|
C = Mid(InputStr,i,1);
|
||||||
if ( AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0 )
|
if ( AllowedCharSet != "" && InStr(AllowedCharSet,C) < 0 )
|
||||||
{
|
{
|
||||||
C = "";
|
C = "";
|
||||||
}
|
}
|
||||||
if ( bConvertSpaces &&
|
if ( bConvertSpaces &&
|
||||||
((C == " ") || (C =="?") || (C=="\\") ))
|
((C == " ") || (C =="?") || (C=="\\") ))
|
||||||
{
|
{
|
||||||
C = "_";
|
C = "_";
|
||||||
}
|
}
|
||||||
Retval = Retval $ C;
|
Retval = Retval $ C;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MaxWidth > 0)
|
if (MaxWidth > 0)
|
||||||
return Left(Retval,MaxWidth);
|
return Left(Retval,MaxWidth);
|
||||||
|
|
||||||
return Retval;
|
return Retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function string GetText()
|
function string GetText()
|
||||||
{
|
{
|
||||||
return TextStr;
|
return TextStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TextChanged()
|
function TextChanged()
|
||||||
{
|
{
|
||||||
OnChange(Self);
|
OnChange(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local string Storage,FinalDraw,TmpString;
|
local string Storage,FinalDraw,TmpString;
|
||||||
local int MaskIndex,StorageLength;
|
local int MaskIndex,StorageLength;
|
||||||
local float XL,YL,BoxWidth,FontScale,CursorY,BorderSize;
|
local float XL,YL,BoxWidth,FontScale,CursorY,BorderSize;
|
||||||
local FontRenderInfo FRI;
|
local FontRenderInfo FRI;
|
||||||
|
|
||||||
Super.DrawMenu();
|
|
||||||
|
|
||||||
if( bDrawBackground )
|
|
||||||
{
|
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
|
||||||
Canvas.SetPos(0.f,0.f);
|
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL],CompPos[2],CompPos[3],0,0,Owner.CurrentStyle.BorderTextures[`BOX_SMALL].GetSurfaceWidth(),Owner.CurrentStyle.BorderTextures[`BOX_SMALL].GetSurfaceHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
BorderSize = Owner.CurrentStyle.ScreenScale(4.f);
|
|
||||||
|
|
||||||
FRI.bClipText = true;
|
|
||||||
FRI.bEnableShadow = true;
|
|
||||||
|
|
||||||
Storage = TextStr;
|
Super.DrawMenu();
|
||||||
|
|
||||||
if ( bMaskText && Len(Storage)>0 )
|
if( bDrawBackground )
|
||||||
{
|
{
|
||||||
StorageLength = Len(Storage);
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
|
Canvas.SetPos(0.f,0.f);
|
||||||
Storage = "";
|
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_SMALL],CompPos[2],CompPos[3],0,0,Owner.CurrentStyle.BorderTextures[`BOX_SMALL].GetSurfaceWidth(),Owner.CurrentStyle.BorderTextures[`BOX_SMALL].GetSurfaceHeight());
|
||||||
for(MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++ )
|
}
|
||||||
{
|
|
||||||
Storage $= "*";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(FontScale);
|
|
||||||
FontScale *= TextScale;
|
|
||||||
|
|
||||||
BoxWidth=CompPos[2]*0.9875;
|
BorderSize = Owner.CurrentStyle.ScreenScale(4.f);
|
||||||
|
|
||||||
if ( (Len(Storage) != LastLength) || (CaretPos!=LastCaret) )
|
|
||||||
{
|
|
||||||
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)) )
|
FRI.bClipText = true;
|
||||||
{
|
FRI.bEnableShadow = true;
|
||||||
FirstVis++;
|
|
||||||
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
|
|
||||||
Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LastLength = Len(Storage);
|
|
||||||
|
|
||||||
if (bReadOnly)
|
Storage = TextStr;
|
||||||
{
|
|
||||||
FirstVis = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
FinalDraw = Mid(Storage, FirstVis, Len(Storage)-FirstVis);
|
if ( bMaskText && Len(Storage)>0 )
|
||||||
|
{
|
||||||
|
StorageLength = Len(Storage);
|
||||||
|
|
||||||
if (!bReadOnly && (Owner.KeyboardFocus == self || bForceShowCaret))
|
Storage = "";
|
||||||
{
|
for(MaskIndex=1; MaskIndex <= StorageLength; MaskIndex++ )
|
||||||
if ( (FirstVis==CaretPos) || (Len(FinalDraw)==0) )
|
{
|
||||||
{
|
Storage $= "*";
|
||||||
Canvas.TextSize("W", XL, YL, FontScale, FontScale);
|
}
|
||||||
XL = BorderSize;
|
}
|
||||||
bAllSelected=false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TmpString = Mid(FinalDraw, 0, CaretPos-FirstVis);
|
|
||||||
Canvas.TextSize(TmpString, XL, YL, FontScale, FontScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2);
|
Canvas.Font = Owner.CurrentStyle.PickFont(FontScale);
|
||||||
|
FontScale *= TextScale;
|
||||||
|
|
||||||
if(bAllSelected)
|
BoxWidth=CompPos[2]*0.9875;
|
||||||
{
|
|
||||||
Canvas.SetDrawColor(255,255,255,195);
|
if ( (Len(Storage) != LastLength) || (CaretPos!=LastCaret) )
|
||||||
Canvas.SetPos(BorderSize, CursorY);
|
{
|
||||||
Canvas.DrawTile( Owner.DefaultPens[`PEN_WHITE], XL, YL-Owner.HUDOwner.ScaledBorderSize, 0, 0, Owner.DefaultPens[`PEN_WHITE].GetSurfaceWidth(), Owner.DefaultPens[`PEN_WHITE].GetSurfaceHeight() );
|
if (CaretPos<=FirstVis)
|
||||||
}
|
FirstVis = Max(0,CaretPos-1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.SetDrawColor(255,255,255,Owner.CursorFlash);
|
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
|
||||||
Canvas.SetPos(XL + (Len(FinalDraw) == 0 ? 0 : 3), CursorY);
|
Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale);
|
||||||
Canvas.DrawTile( Owner.DefaultPens[`PEN_WHITE], 3, YL-Owner.HUDOwner.ScaledBorderSize, 0, 0, Owner.DefaultPens[`PEN_WHITE].GetSurfaceWidth(), Owner.DefaultPens[`PEN_WHITE].GetSurfaceHeight() );
|
|
||||||
}
|
while ( (XL>=BoxWidth) && (FirstVis<Len(Storage)) )
|
||||||
}
|
{
|
||||||
|
FirstVis++;
|
||||||
Canvas.DrawColor = FontColor;
|
FinalDraw = Mid(Storage, FirstVis, CaretPos-FirstVis);
|
||||||
Canvas.SetPos(BorderSize, (CompPos[3]/2) - (YL/2));
|
Canvas.TextSize(FinalDraw, XL, YL, FontScale, FontScale);
|
||||||
Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LastLength = Len(Storage);
|
||||||
|
|
||||||
|
if (bReadOnly)
|
||||||
|
{
|
||||||
|
FirstVis = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FinalDraw = Mid(Storage, FirstVis, Len(Storage)-FirstVis);
|
||||||
|
|
||||||
|
if (!bReadOnly && (Owner.KeyboardFocus == self || bForceShowCaret))
|
||||||
|
{
|
||||||
|
if ( (FirstVis==CaretPos) || (Len(FinalDraw)==0) )
|
||||||
|
{
|
||||||
|
Canvas.TextSize("W", XL, YL, FontScale, FontScale);
|
||||||
|
XL = BorderSize;
|
||||||
|
bAllSelected=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TmpString = Mid(FinalDraw, 0, CaretPos-FirstVis);
|
||||||
|
Canvas.TextSize(TmpString, XL, YL, FontScale, FontScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
CursorY = (CompPos[3]/2) - ((YL-Owner.HUDOwner.ScaledBorderSize)/2);
|
||||||
|
|
||||||
|
if(bAllSelected)
|
||||||
|
{
|
||||||
|
Canvas.SetDrawColor(255,255,255,195);
|
||||||
|
Canvas.SetPos(BorderSize, CursorY);
|
||||||
|
Canvas.DrawTile( Owner.DefaultPens[`PEN_WHITE], XL, YL-Owner.HUDOwner.ScaledBorderSize, 0, 0, Owner.DefaultPens[`PEN_WHITE].GetSurfaceWidth(), Owner.DefaultPens[`PEN_WHITE].GetSurfaceHeight() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.SetDrawColor(255,255,255,Owner.CursorFlash);
|
||||||
|
Canvas.SetPos(XL + (Len(FinalDraw) == 0 ? 0 : 3), CursorY);
|
||||||
|
Canvas.DrawTile( Owner.DefaultPens[`PEN_WHITE], 3, YL-Owner.HUDOwner.ScaledBorderSize, 0, 0, Owner.DefaultPens[`PEN_WHITE].GetSurfaceWidth(), Owner.DefaultPens[`PEN_WHITE].GetSurfaceHeight() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.DrawColor = FontColor;
|
||||||
|
Canvas.SetPos(BorderSize, (CompPos[3]/2) - (YL/2));
|
||||||
|
Canvas.DrawText(FinalDraw,,FontScale,FontScale,FRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
function HandleMouseClick( bool bRight )
|
function HandleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( Owner.KeyboardFocus != self )
|
if( Owner.KeyboardFocus != self )
|
||||||
{
|
{
|
||||||
GrabKeyFocus();
|
GrabKeyFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
CaretPos = Len(TextStr);
|
CaretPos = Len(TextStr);
|
||||||
bAllSelected = !bAllSelected;
|
bAllSelected = !bAllSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnChange(KFGUI_EditBox Sender);
|
Delegate OnChange(KFGUI_EditBox Sender);
|
||||||
@ -417,12 +417,12 @@ Delegate OnTextFinished(KFGUI_EditBox Sender, string S);
|
|||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
FontColor=(R=255,G=255,B=255,A=255)
|
FontColor=(R=255,G=255,B=255,A=255)
|
||||||
MaxWidth=768
|
MaxWidth=768
|
||||||
TextScale=1
|
TextScale=1
|
||||||
TextCase=TXTC_None
|
TextCase=TXTC_None
|
||||||
LastCaret=-1
|
LastCaret=-1
|
||||||
LastLength=-1
|
LastLength=-1
|
||||||
|
|
||||||
YSize=0.06
|
YSize=0.06
|
||||||
}
|
}
|
@ -13,90 +13,90 @@ var(Lable) bool bScaleByFontSize; // Scale this component height by font height.
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
if( LableString=="" )
|
if( LableString=="" )
|
||||||
TextLable = None;
|
TextLable = None;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextLable.SetText(LableString);
|
TextLable.SetText(LableString);
|
||||||
TextLable.FontScale = FontScale;
|
TextLable.FontScale = FontScale;
|
||||||
TextLable.XPosition = XPosition;
|
TextLable.XPosition = XPosition;
|
||||||
TextLable.YPosition = YPosition;
|
TextLable.YPosition = YPosition;
|
||||||
TextLable.XSize = (XSize*LableWidth*0.975);
|
TextLable.XSize = (XSize*LableWidth*0.975);
|
||||||
TextLable.YSize = YSize;
|
TextLable.YSize = YSize;
|
||||||
TextLable.Owner = Owner;
|
TextLable.Owner = Owner;
|
||||||
TextLable.TextColor = LableColor;
|
TextLable.TextColor = LableColor;
|
||||||
TextLable.ParentComponent = Self;
|
TextLable.ParentComponent = Self;
|
||||||
TextLable.InitMenu();
|
TextLable.InitMenu();
|
||||||
XPosition+=(XSize*LableWidth);
|
XPosition+=(XSize*LableWidth);
|
||||||
XSize*=(1.f-LableWidth);
|
XSize*=(1.f-LableWidth);
|
||||||
}
|
}
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
bClickable = !bDisabled;
|
bClickable = !bDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateSizes()
|
function UpdateSizes()
|
||||||
{
|
{
|
||||||
// Update height.
|
// Update height.
|
||||||
if( bScaleByFontSize )
|
if( bScaleByFontSize )
|
||||||
YSize = ((TextHeight*1.05) + 6) / InputPos[3];
|
YSize = ((TextHeight*1.05) + 6) / InputPos[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local float XS;
|
local float XS;
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(TextScale);
|
Canvas.Font = Owner.CurrentStyle.PickFont(TextScale);
|
||||||
|
|
||||||
TextScale *= FontScale;
|
|
||||||
TextFont = Canvas.Font;
|
|
||||||
|
|
||||||
Canvas.TextSize("ABC",XS,TextHeight,TextScale,TextScale);
|
|
||||||
|
|
||||||
UpdateSizes();
|
|
||||||
|
|
||||||
Super.PreDraw();
|
TextScale *= FontScale;
|
||||||
if( TextLable!=None )
|
TextFont = Canvas.Font;
|
||||||
{
|
|
||||||
TextLable.YSize = YSize;
|
Canvas.TextSize("ABC",XS,TextHeight,TextScale,TextScale);
|
||||||
TextLable.Canvas = Canvas;
|
|
||||||
for( i=0; i<4; ++i )
|
UpdateSizes();
|
||||||
TextLable.InputPos[i] = InputPos[i];
|
|
||||||
TextLable.PreDraw();
|
Super.PreDraw();
|
||||||
}
|
if( TextLable!=None )
|
||||||
|
{
|
||||||
|
TextLable.YSize = YSize;
|
||||||
|
TextLable.Canvas = Canvas;
|
||||||
|
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 int i,l;
|
||||||
local float X,XL,YL;
|
local float X,XL,YL;
|
||||||
|
|
||||||
l = Len(S);
|
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);
|
Canvas.TextSize(Mid(S,i,1),XL,YL,TScale,TScale);
|
||||||
if( (Canvas.CurX+X+XL)>MaxX )
|
if( (Canvas.CurX+X+XL)>MaxX )
|
||||||
{
|
{
|
||||||
--i;
|
--i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
X+=XL;
|
X+=XL;
|
||||||
}
|
}
|
||||||
Canvas.DrawText(Left(S,i),,TScale,TScale,TextFontInfo);
|
Canvas.DrawText(Left(S,i),,TScale,TScale,TextFontInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
LableColor=(R=255,G=255,B=255,A=255)
|
LableColor=(R=255,G=255,B=255,A=255)
|
||||||
FontScale=1
|
FontScale=1
|
||||||
LableWidth=0.5
|
LableWidth=0.5
|
||||||
bScaleByFontSize=true
|
bScaleByFontSize=true
|
||||||
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
||||||
|
|
||||||
Begin Object Class=KFGUI_TextLable Name=MyBoxLableText
|
Begin Object Class=KFGUI_TextLable Name=MyBoxLableText
|
||||||
AlignX=0
|
AlignX=0
|
||||||
AlignY=1
|
AlignY=1
|
||||||
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
||||||
End Object
|
End Object
|
||||||
TextLable=MyBoxLableText
|
TextLable=MyBoxLableText
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
Class KFGUI_FloatingWindow extends KFGUI_Page
|
Class KFGUI_FloatingWindow extends KFGUI_Page
|
||||||
abstract;
|
abstract;
|
||||||
|
|
||||||
var() string WindowTitle; // Title of this window.
|
var() string WindowTitle; // Title of this window.
|
||||||
var float DragOffset[2], OpenAnimSpeed;
|
var float DragOffset[2], OpenAnimSpeed;
|
||||||
@ -11,97 +11,97 @@ var transient float OpenStartTime,OpenEndTime;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
HeaderComp = new (Self) class'KFGUI_FloatingWindowHeader';
|
HeaderComp = new (Self) class'KFGUI_FloatingWindowHeader';
|
||||||
AddComponent(HeaderComp);
|
AddComponent(HeaderComp);
|
||||||
}
|
}
|
||||||
function ShowMenu()
|
function ShowMenu()
|
||||||
{
|
{
|
||||||
Super.ShowMenu();
|
Super.ShowMenu();
|
||||||
|
|
||||||
OpenStartTime = GetPlayer().WorldInfo.RealTimeSeconds;
|
OpenStartTime = GetPlayer().WorldInfo.RealTimeSeconds;
|
||||||
OpenEndTime = GetPlayer().WorldInfo.RealTimeSeconds + OpenAnimSpeed;
|
OpenEndTime = GetPlayer().WorldInfo.RealTimeSeconds + OpenAnimSpeed;
|
||||||
}
|
}
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local float TempSize;
|
local float TempSize;
|
||||||
|
|
||||||
if( bUseAnimation )
|
if( bUseAnimation )
|
||||||
{
|
{
|
||||||
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime);
|
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;
|
FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.CurrentStyle.RenderFramedWindow(Self);
|
Owner.CurrentStyle.RenderFramedWindow(Self);
|
||||||
|
|
||||||
if( HeaderComp!=None )
|
if( HeaderComp!=None )
|
||||||
{
|
{
|
||||||
HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight;
|
HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight;
|
||||||
HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height.
|
HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function SetWindowDrag( bool bDrag )
|
function SetWindowDrag( bool bDrag )
|
||||||
{
|
{
|
||||||
bDragWindow = bDrag;
|
bDragWindow = bDrag;
|
||||||
if( bDrag )
|
if( bDrag )
|
||||||
{
|
{
|
||||||
DragOffset[0] = Owner.MousePosition.X-CompPos[0];
|
DragOffset[0] = Owner.MousePosition.X-CompPos[0];
|
||||||
DragOffset[1] = Owner.MousePosition.Y-CompPos[1];
|
DragOffset[1] = Owner.MousePosition.Y-CompPos[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
local int i;
|
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;
|
MouseArea = HeaderComp;
|
||||||
return true;
|
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];
|
MouseArea = Components[i];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea = None;
|
MouseArea = None;
|
||||||
|
|
||||||
return Super(KFGUI_Base).CaptureMouse();
|
return Super(KFGUI_Base).CaptureMouse();
|
||||||
}
|
}
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local float Frac, CenterX, CenterY;
|
local float Frac, CenterX, CenterY;
|
||||||
|
|
||||||
if( bUseAnimation )
|
if( bUseAnimation )
|
||||||
{
|
{
|
||||||
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
|
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
|
||||||
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
|
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
|
||||||
YSize = Lerp(default.YSize*0.75, default.YSize, Frac);
|
YSize = Lerp(default.YSize*0.75, default.YSize, Frac);
|
||||||
|
|
||||||
CenterX = (default.XPosition + default.XSize * 0.5) - ((default.XSize*0.75)/2);
|
CenterX = (default.XPosition + default.XSize * 0.5) - ((default.XSize*0.75)/2);
|
||||||
CenterY = (default.YPosition + default.YSize * 0.5) - ((default.YSize*0.75)/2);
|
CenterY = (default.YPosition + default.YSize * 0.5) - ((default.YSize*0.75)/2);
|
||||||
|
|
||||||
XPosition = Lerp(CenterX, default.XPosition, Frac);
|
XPosition = Lerp(CenterX, default.XPosition, Frac);
|
||||||
YPosition = Lerp(CenterY, default.YPosition, 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];
|
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];
|
YPosition = FClamp(Owner.MousePosition.Y-DragOffset[1],0,InputPos[3]-CompPos[3]) / InputPos[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Super.PreDraw();
|
Super.PreDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bUseAnimation=true
|
bUseAnimation=true
|
||||||
OpenAnimSpeed=0.05f
|
OpenAnimSpeed=0.05f
|
||||||
WindowFadeInTime=0.2f
|
WindowFadeInTime=0.2f
|
||||||
}
|
}
|
@ -4,20 +4,20 @@ var bool bDragWindow;
|
|||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
ComputeCoords();
|
ComputeCoords();
|
||||||
}
|
}
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bRight )
|
if( !bRight )
|
||||||
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(true);
|
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(true);
|
||||||
}
|
}
|
||||||
function MouseRelease( bool bRight )
|
function MouseRelease( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bRight )
|
if( !bRight )
|
||||||
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(false);
|
KFGUI_FloatingWindow(ParentComponent).SetWindowDrag(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bClickable=true
|
bClickable=true
|
||||||
}
|
}
|
@ -8,121 +8,121 @@ var() float FontScale;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super(KFGUI_Page).InitMenu();
|
Super(KFGUI_Page).InitMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local float TempSize;
|
local float TempSize;
|
||||||
|
|
||||||
if( bUseAnimation )
|
if( bUseAnimation )
|
||||||
{
|
{
|
||||||
TempSize = `TimeSinceEx(GetPlayer(), OpenStartTime);
|
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;
|
FrameOpacity = (1.f - ((WindowFadeInTime - TempSize) / WindowFadeInTime)) * default.FrameOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bDrawBackground )
|
if( bDrawBackground )
|
||||||
{
|
{
|
||||||
OnDrawFrame(Canvas, CompPos[2], CompPos[3]);
|
OnDrawFrame(Canvas, CompPos[2], CompPos[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate OnDrawFrame(Canvas C, float W, Float H)
|
delegate OnDrawFrame(Canvas C, float W, Float H)
|
||||||
{
|
{
|
||||||
local float T,XL,YL,HeaderH;
|
local float T,XL,YL,HeaderH;
|
||||||
local FontRenderInfo FRI;
|
local FontRenderInfo FRI;
|
||||||
|
|
||||||
if( FrameTex == None )
|
if( FrameTex == None )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
C.SetDrawColor(255,255,255,FrameOpacity);
|
C.SetDrawColor(255,255,255,FrameOpacity);
|
||||||
if( bUseLegacyDrawTile )
|
if( bUseLegacyDrawTile )
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.DrawTileStretched(FrameTex,0,0,W,H);
|
Owner.CurrentStyle.DrawTileStretched(FrameTex,0,0,W,H);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.SetPos(0.f, 0.f);
|
Canvas.SetPos(0.f, 0.f);
|
||||||
Canvas.DrawTileStretched(FrameTex,W,H,0,0,FrameTex.GetSurfaceWidth(),FrameTex.GetSurfaceHeight());
|
Canvas.DrawTileStretched(FrameTex,W,H,0,0,FrameTex.GetSurfaceWidth(),FrameTex.GetSurfaceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bDrawHeader && WindowTitle!="" )
|
if( bDrawHeader && WindowTitle!="" )
|
||||||
{
|
{
|
||||||
FRI.bClipText = true;
|
FRI.bClipText = true;
|
||||||
FRI.bEnableShadow = true;
|
FRI.bEnableShadow = true;
|
||||||
|
|
||||||
C.Font = Owner.CurrentStyle.MainFont;
|
C.Font = Owner.CurrentStyle.MainFont;
|
||||||
T = Owner.CurrentStyle.ScreenScale(FontScale);
|
T = Owner.CurrentStyle.ScreenScale(FontScale);
|
||||||
|
|
||||||
C.SetDrawColor(250,250,250,FrameOpacity);
|
C.SetDrawColor(250,250,250,FrameOpacity);
|
||||||
C.TextSize(WindowTitle, XL, YL, T, T);
|
C.TextSize(WindowTitle, XL, YL, T, T);
|
||||||
|
|
||||||
HeaderH = EdgeSize[1]-HeaderSize[1];
|
HeaderH = EdgeSize[1]-HeaderSize[1];
|
||||||
if( bHeaderCenter )
|
if( bHeaderCenter )
|
||||||
C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2));
|
C.SetPos((W/2) - (XL/2),(HeaderH/2) - (YL/2));
|
||||||
else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2));
|
else C.SetPos(HeaderSize[0],(HeaderH/2) - (YL/2));
|
||||||
|
|
||||||
C.DrawText(WindowTitle,,T,T,FRI);
|
C.DrawText(WindowTitle,,T,T,FRI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
local float Frac, CenterX, CenterY;
|
local float Frac, CenterX, CenterY;
|
||||||
|
|
||||||
if( !bVisible )
|
if( !bVisible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( bUseAnimation )
|
if( bUseAnimation )
|
||||||
{
|
{
|
||||||
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
|
Frac = Owner.CurrentStyle.TimeFraction(OpenStartTime, OpenEndTime, GetPlayer().WorldInfo.RealTimeSeconds);
|
||||||
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
|
XSize = Lerp(default.XSize*0.75, default.XSize, Frac);
|
||||||
YSize = Lerp(default.YSize*0.75, default.YSize, Frac);
|
YSize = Lerp(default.YSize*0.75, default.YSize, Frac);
|
||||||
|
|
||||||
CenterX = (default.XPosition + default.XSize * 0.5) - ((default.XSize*0.75)/2);
|
CenterX = (default.XPosition + default.XSize * 0.5) - ((default.XSize*0.75)/2);
|
||||||
CenterY = (default.YPosition + default.YSize * 0.5) - ((default.YSize*0.75)/2);
|
CenterY = (default.YPosition + default.YSize * 0.5) - ((default.YSize*0.75)/2);
|
||||||
|
|
||||||
XPosition = Lerp(CenterX, default.XPosition, Frac);
|
XPosition = Lerp(CenterX, default.XPosition, Frac);
|
||||||
YPosition = Lerp(CenterY, default.YPosition, Frac);
|
YPosition = Lerp(CenterY, default.YPosition, Frac);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputeCoords();
|
ComputeCoords();
|
||||||
Canvas.SetDrawColor(255,255,255);
|
Canvas.SetDrawColor(255,255,255);
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
DrawMenu();
|
DrawMenu();
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
{
|
{
|
||||||
Components[i].Canvas = Canvas;
|
Components[i].Canvas = Canvas;
|
||||||
for( j=0; j<4; ++j )
|
for( j=0; j<4; ++j )
|
||||||
{
|
{
|
||||||
Components[i].InputPos[j] = CompPos[j]+EdgeSize[j];
|
Components[i].InputPos[j] = CompPos[j]+EdgeSize[j];
|
||||||
}
|
}
|
||||||
Components[i].PreDraw();
|
Components[i].PreDraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bUseAnimation=false
|
bUseAnimation=false
|
||||||
bDrawHeader=true
|
bDrawHeader=true
|
||||||
bUseLegacyDrawTile=true
|
bUseLegacyDrawTile=true
|
||||||
bDrawBackground=true
|
bDrawBackground=true
|
||||||
|
|
||||||
FontScale=0.35f
|
FontScale=0.35f
|
||||||
FrameOpacity=255
|
FrameOpacity=255
|
||||||
|
|
||||||
HeaderSize(0)=26.f
|
HeaderSize(0)=26.f
|
||||||
HeaderSize(1)=8.f
|
HeaderSize(1)=8.f
|
||||||
|
|
||||||
EdgeSize(0)=20
|
EdgeSize(0)=20
|
||||||
EdgeSize(1)=35
|
EdgeSize(1)=35
|
||||||
EdgeSize(2)=-40
|
EdgeSize(2)=-40
|
||||||
EdgeSize(3)=-50
|
EdgeSize(3)=-50
|
||||||
}
|
}
|
@ -2,14 +2,14 @@ Class KFGUI_Image extends KFGUI_Base;
|
|||||||
|
|
||||||
var enum eImageStyle
|
var enum eImageStyle
|
||||||
{
|
{
|
||||||
ISTY_Normal,
|
ISTY_Normal,
|
||||||
ISTY_Stretched
|
ISTY_Stretched
|
||||||
} ImageStyle;
|
} ImageStyle;
|
||||||
|
|
||||||
var enum eScaleStyle
|
var enum eScaleStyle
|
||||||
{
|
{
|
||||||
ISTY_Height,
|
ISTY_Height,
|
||||||
ISTY_Width
|
ISTY_Width
|
||||||
} ScaleStyle;
|
} ScaleStyle;
|
||||||
|
|
||||||
var Color ImageColor;
|
var Color ImageColor;
|
||||||
@ -20,124 +20,124 @@ var float ImageScale;
|
|||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local float X, Y, XL, YL;
|
local float X, Y, XL, YL;
|
||||||
|
|
||||||
if( Image == None )
|
|
||||||
return;
|
|
||||||
|
|
||||||
DrawBackground(Canvas, CompPos[2], CompPos[3]);
|
|
||||||
|
|
||||||
Canvas.DrawColor = ImageColor;
|
|
||||||
|
|
||||||
switch (ImageStyle)
|
|
||||||
{
|
|
||||||
case ISTY_Normal:
|
|
||||||
if( X1 != -1 )
|
|
||||||
X = X1;
|
|
||||||
else X = 0;
|
|
||||||
|
|
||||||
if( Y1 != -1 )
|
if( Image == None )
|
||||||
Y = Y1;
|
return;
|
||||||
else Y = 0;
|
|
||||||
|
|
||||||
if( bForceUniformSize )
|
|
||||||
{
|
|
||||||
if( ScaleStyle == ISTY_Height )
|
|
||||||
{
|
|
||||||
YL = CompPos[3];
|
|
||||||
XL = YL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XL = CompPos[2];
|
|
||||||
YL = XL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( Y2 == -1 )
|
|
||||||
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
|
|
||||||
else YL = (Y2-Y1);
|
|
||||||
|
|
||||||
if( X2 == -1 )
|
DrawBackground(Canvas, CompPos[2], CompPos[3]);
|
||||||
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
|
|
||||||
else XL = (X2-X1);
|
|
||||||
}
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Canvas.SetPos(0.f, 0.f);
|
|
||||||
Canvas.DrawTile(Image, XL, YL, X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case ISTY_Stretched:
|
|
||||||
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 )
|
|
||||||
X = X1;
|
|
||||||
else X = 0;
|
|
||||||
|
|
||||||
if( Y1 != -1 )
|
Canvas.DrawColor = ImageColor;
|
||||||
Y = Y1;
|
|
||||||
else Y = 0;
|
|
||||||
|
|
||||||
if( bForceUniformSize )
|
|
||||||
{
|
|
||||||
if( ScaleStyle == ISTY_Height )
|
|
||||||
{
|
|
||||||
YL = CompPos[3];
|
|
||||||
XL = YL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XL = CompPos[2];
|
|
||||||
YL = XL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( Y2 == -1 )
|
|
||||||
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
|
|
||||||
else YL = (Y2-Y1);
|
|
||||||
|
|
||||||
if( X2 == -1 )
|
switch (ImageStyle)
|
||||||
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
|
{
|
||||||
else XL = (X2-X1);
|
case ISTY_Normal:
|
||||||
}
|
if( X1 != -1 )
|
||||||
|
X = X1;
|
||||||
|
else X = 0;
|
||||||
|
|
||||||
if( bAlignCenter )
|
if( Y1 != -1 )
|
||||||
{
|
Y = Y1;
|
||||||
Canvas.SetPos((CompPos[2]/2) - (XL/2), (CompPos[3]/2) - (YL/2));
|
else Y = 0;
|
||||||
Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
|
|
||||||
}
|
if( bForceUniformSize )
|
||||||
else
|
{
|
||||||
{
|
if( ScaleStyle == ISTY_Height )
|
||||||
Canvas.SetPos(0.f, 0.f);
|
{
|
||||||
Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
|
YL = CompPos[3];
|
||||||
}
|
XL = YL;
|
||||||
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
break;
|
XL = CompPos[2];
|
||||||
}
|
YL = XL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Y2 == -1 )
|
||||||
|
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
|
||||||
|
else YL = (Y2-Y1);
|
||||||
|
|
||||||
|
if( X2 == -1 )
|
||||||
|
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
|
||||||
|
else XL = (X2-X1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.SetPos(0.f, 0.f);
|
||||||
|
Canvas.DrawTile(Image, XL, YL, X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ISTY_Stretched:
|
||||||
|
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 )
|
||||||
|
X = X1;
|
||||||
|
else X = 0;
|
||||||
|
|
||||||
|
if( Y1 != -1 )
|
||||||
|
Y = Y1;
|
||||||
|
else Y = 0;
|
||||||
|
|
||||||
|
if( bForceUniformSize )
|
||||||
|
{
|
||||||
|
if( ScaleStyle == ISTY_Height )
|
||||||
|
{
|
||||||
|
YL = CompPos[3];
|
||||||
|
XL = YL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XL = CompPos[2];
|
||||||
|
YL = XL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Y2 == -1 )
|
||||||
|
YL = FMin(CompPos[3], Image.GetSurfaceHeight());
|
||||||
|
else YL = (Y2-Y1);
|
||||||
|
|
||||||
|
if( X2 == -1 )
|
||||||
|
XL = FMin(CompPos[2], Image.GetSurfaceWidth());
|
||||||
|
else XL = (X2-X1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.SetPos(0.f, 0.f);
|
||||||
|
Canvas.DrawTile(Image, CompPos[2], CompPos[3], X, Y, Image.GetSurfaceWidth(), Image.GetSurfaceHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate DrawBackground(Canvas C, float W, Float H);
|
delegate DrawBackground(Canvas C, float W, Float H);
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ImageColor=(R=255,G=255,B=255,A=255)
|
ImageColor=(R=255,G=255,B=255,A=255)
|
||||||
ImageStyle=ISTY_Normal
|
ImageStyle=ISTY_Normal
|
||||||
X1=-1
|
X1=-1
|
||||||
X2=-1
|
X2=-1
|
||||||
Y1=-1
|
Y1=-1
|
||||||
Y2=-1
|
Y2=-1
|
||||||
}
|
}
|
@ -21,199 +21,199 @@ delegate OnDblClickedItem( int Index, bool bRight, int MouseX, int MouseY );
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ScrollBar = KFGUI_ScrollBarV(FindComponentID('Scrollbar'));
|
ScrollBar = KFGUI_ScrollBarV(FindComponentID('Scrollbar'));
|
||||||
ScrollBar.bHideScrollbar = bHideScrollbar;
|
ScrollBar.bHideScrollbar = bHideScrollbar;
|
||||||
UpdateListVis();
|
UpdateListVis();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,n;
|
local int i,n;
|
||||||
local float Y;
|
local float Y;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
if( bDrawBackground )
|
if( bDrawBackground )
|
||||||
{
|
{
|
||||||
Canvas.DrawColor = BackgroundColor;
|
Canvas.DrawColor = BackgroundColor;
|
||||||
Canvas.SetPos(0.f,0.f);
|
Canvas.SetPos(0.f,0.f);
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse focused item check.
|
// Mouse focused item check.
|
||||||
bCheckMouse = bClickable && bFocused;
|
bCheckMouse = bClickable && bFocused;
|
||||||
FocusMouseItem = -1;
|
FocusMouseItem = -1;
|
||||||
if( bCheckMouse )
|
if( bCheckMouse )
|
||||||
MouseYHit = Owner.MousePosition.Y - CompPos[1];
|
MouseYHit = Owner.MousePosition.Y - CompPos[1];
|
||||||
|
|
||||||
n = ScrollBar.CurrentScroll;
|
n = ScrollBar.CurrentScroll;
|
||||||
ItemHeight = CompPos[3] / ListItemsPerPage;
|
ItemHeight = CompPos[3] / ListItemsPerPage;
|
||||||
Y = 0.f;
|
Y = 0.f;
|
||||||
for( i=0; i<ListItemsPerPage; ++i )
|
for( i=0; i<ListItemsPerPage; ++i )
|
||||||
{
|
{
|
||||||
if( n>=ListCount )
|
if( n>=ListCount )
|
||||||
break;
|
break;
|
||||||
if( bCheckMouse && FocusMouseItem==-1 )
|
if( bCheckMouse && FocusMouseItem==-1 )
|
||||||
{
|
{
|
||||||
if( MouseYHit<ItemHeight )
|
if( MouseYHit<ItemHeight )
|
||||||
FocusMouseItem = n;
|
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;
|
Y+=ItemHeight;
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
if( LastFocusItem!=FocusMouseItem )
|
if( LastFocusItem!=FocusMouseItem )
|
||||||
{
|
{
|
||||||
LastFocusItem = FocusMouseItem;
|
LastFocusItem = FocusMouseItem;
|
||||||
if( bUseFocusSound )
|
if( bUseFocusSound )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_FocusHover);
|
PlayMenuSound(MN_FocusHover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ComputeCoords();
|
if( !bVisible )
|
||||||
|
return;
|
||||||
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
|
||||||
{
|
ComputeCoords();
|
||||||
// First draw scrollbar to allow it to resize itself.
|
|
||||||
for( j=0; j<4; ++j )
|
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
||||||
ScrollBar.InputPos[j] = CompPos[j];
|
{
|
||||||
if( OldXSize!=InputPos[2] )
|
// First draw scrollbar to allow it to resize itself.
|
||||||
{
|
for( j=0; j<4; ++j )
|
||||||
OldXSize = InputPos[2];
|
ScrollBar.InputPos[j] = CompPos[j];
|
||||||
ScrollBar.XPosition = 1.f - ScrollBar.GetWidth();
|
if( OldXSize!=InputPos[2] )
|
||||||
}
|
{
|
||||||
ScrollBar.Canvas = Canvas;
|
OldXSize = InputPos[2];
|
||||||
ScrollBar.PreDraw();
|
ScrollBar.XPosition = 1.f - ScrollBar.GetWidth();
|
||||||
|
}
|
||||||
// Then downscale our selves to give room for scrollbar.
|
ScrollBar.Canvas = Canvas;
|
||||||
CompPos[2] -= ScrollBar.CompPos[2];
|
ScrollBar.PreDraw();
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
// Then downscale our selves to give room for scrollbar.
|
||||||
DrawMenu();
|
CompPos[2] -= ScrollBar.CompPos[2];
|
||||||
CompPos[2] += ScrollBar.CompPos[2];
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
}
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
else
|
DrawMenu();
|
||||||
{
|
CompPos[2] += ScrollBar.CompPos[2];
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
}
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
else
|
||||||
DrawMenu();
|
{
|
||||||
}
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
// Then draw rest of components.
|
DrawMenu();
|
||||||
for( i=0; i<Components.Length; ++i )
|
}
|
||||||
{
|
|
||||||
if( Components[i]!=ScrollBar )
|
// Then draw rest of components.
|
||||||
{
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].Canvas = Canvas;
|
{
|
||||||
for( j=0; j<4; ++j )
|
if( Components[i]!=ScrollBar )
|
||||||
Components[i].InputPos[j] = CompPos[j];
|
{
|
||||||
Components[i].PreDraw();
|
Components[i].Canvas = Canvas;
|
||||||
}
|
for( j=0; j<4; ++j )
|
||||||
}
|
Components[i].InputPos[j] = CompPos[j];
|
||||||
|
Components[i].PreDraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function UpdateListVis()
|
function UpdateListVis()
|
||||||
{
|
{
|
||||||
if( ListCount<=ListItemsPerPage )
|
if( ListCount<=ListItemsPerPage )
|
||||||
{
|
{
|
||||||
ScrollBar.UpdateScrollSize(0,1,1,1);
|
ScrollBar.UpdateScrollSize(0,1,1,1);
|
||||||
ScrollBar.SetDisabled(true);
|
ScrollBar.SetDisabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScrollBar.UpdateScrollSize(ScrollBar.CurrentScroll,(ListCount-ListItemsPerPage),1,ListItemsPerPage);
|
ScrollBar.UpdateScrollSize(ScrollBar.CurrentScroll,(ListCount-ListItemsPerPage),1,ListItemsPerPage);
|
||||||
ScrollBar.SetDisabled(false);
|
ScrollBar.SetDisabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ChangeListSize( int NewSize )
|
function ChangeListSize( int NewSize )
|
||||||
{
|
{
|
||||||
if( ListCount==NewSize )
|
if( ListCount==NewSize )
|
||||||
return;
|
return;
|
||||||
ListCount = NewSize;
|
ListCount = NewSize;
|
||||||
UpdateListVis();
|
UpdateListVis();
|
||||||
}
|
}
|
||||||
final function int GetListSize()
|
final function int GetListSize()
|
||||||
{
|
{
|
||||||
return ListCount;
|
return ListCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoubleMouseClick( bool bRight )
|
function DoubleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bDisabled && bClickable )
|
if( !bDisabled && bClickable )
|
||||||
{
|
{
|
||||||
PressedDown[byte(bRight)] = 0;
|
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);
|
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;
|
PressedDown[byte(bRight)] = 1;
|
||||||
bPressedDown = true;
|
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;
|
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);
|
OnClickedItem(FocusMouseItem,bRight,Owner.MousePosition.X-CompPos[0],MouseYHit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
Super.MouseLeave();
|
Super.MouseLeave();
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
Super.MouseEnter();
|
Super.MouseEnter();
|
||||||
LastFocusItem = -1;
|
LastFocusItem = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
if( !ScrollBar.bDisabled )
|
if( !ScrollBar.bDisabled )
|
||||||
ScrollBar.ScrollMouseWheel(bUp);
|
ScrollBar.ScrollMouseWheel(bUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NotifyMousePaused()
|
function NotifyMousePaused()
|
||||||
{
|
{
|
||||||
if( Owner.InputFocus==None && FocusMouseItem>=0 )
|
if( Owner.InputFocus==None && FocusMouseItem>=0 )
|
||||||
OnMouseRest(FocusMouseItem);
|
OnMouseRest(FocusMouseItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnMouseRest( int Item );
|
Delegate OnMouseRest( int Item );
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ListItemsPerPage=7
|
ListItemsPerPage=7
|
||||||
ListCount=1
|
ListCount=1
|
||||||
BackgroundColor=(R=0,G=0,B=0,A=75)
|
BackgroundColor=(R=0,G=0,B=0,A=75)
|
||||||
bDrawBackground=false
|
bDrawBackground=false
|
||||||
bUseFocusSound=false
|
bUseFocusSound=false
|
||||||
|
|
||||||
Begin Object Class=KFGUI_ScrollBarV Name=ListScroller
|
Begin Object Class=KFGUI_ScrollBarV Name=ListScroller
|
||||||
XPosition=0.96
|
XPosition=0.96
|
||||||
YPosition=0
|
YPosition=0
|
||||||
XSize=0.04
|
XSize=0.04
|
||||||
YSize=1.05
|
YSize=1.05
|
||||||
ID="Scrollbar"
|
ID="Scrollbar"
|
||||||
End Object
|
End Object
|
||||||
Components.Add(ListScroller)
|
Components.Add(ListScroller)
|
||||||
}
|
}
|
@ -21,205 +21,205 @@ delegate OnDblClickedItem( int Index, bool bRight, int MouseX, int MouseY );
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ScrollBar = KFGUI_ScrollBarH(FindComponentID('Scrollbar'));
|
ScrollBar = KFGUI_ScrollBarH(FindComponentID('Scrollbar'));
|
||||||
ScrollBar.bHideScrollbar = bHideScrollbar;
|
ScrollBar.bHideScrollbar = bHideScrollbar;
|
||||||
ScrollBar.ButtonScale = ButtonScale <= 0.f ? 1.f : ButtonScale;
|
ScrollBar.ButtonScale = ButtonScale <= 0.f ? 1.f : ButtonScale;
|
||||||
UpdateListVis();
|
UpdateListVis();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,n;
|
local int i,n;
|
||||||
local float X;
|
local float X;
|
||||||
local bool bCheckMouse;
|
local bool bCheckMouse;
|
||||||
|
|
||||||
if( bDrawBackground )
|
if( bDrawBackground )
|
||||||
{
|
{
|
||||||
//Canvas.DrawColor = BackgroundColor;
|
//Canvas.DrawColor = BackgroundColor;
|
||||||
Canvas.SetDrawColor(250,250,250,255);
|
Canvas.SetDrawColor(250,250,250,255);
|
||||||
Canvas.SetPos(0.f,0.f);
|
Canvas.SetPos(0.f,0.f);
|
||||||
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse focused item check.
|
// Mouse focused item check.
|
||||||
bCheckMouse = bClickable && bFocused;
|
bCheckMouse = bClickable && bFocused;
|
||||||
FocusMouseItem = -1;
|
FocusMouseItem = -1;
|
||||||
if( bCheckMouse )
|
if( bCheckMouse )
|
||||||
MouseXHit = Owner.MousePosition.X - CompPos[0];
|
MouseXHit = Owner.MousePosition.X - CompPos[0];
|
||||||
|
|
||||||
n = ScrollBar.CurrentScroll;
|
n = ScrollBar.CurrentScroll;
|
||||||
ItemWidth = CompPos[2] / ListItemsPerPage;
|
ItemWidth = CompPos[2] / ListItemsPerPage;
|
||||||
X = 0.f;
|
X = 0.f;
|
||||||
for( i=0; i<ListItemsPerPage; ++i )
|
for( i=0; i<ListItemsPerPage; ++i )
|
||||||
{
|
{
|
||||||
if( n>=ListCount )
|
if( n>=ListCount )
|
||||||
break;
|
break;
|
||||||
if( bCheckMouse && FocusMouseItem==-1 )
|
if( bCheckMouse && FocusMouseItem==-1 )
|
||||||
{
|
{
|
||||||
if( MouseXHit<ItemWidth )
|
if( MouseXHit<ItemWidth )
|
||||||
FocusMouseItem = n;
|
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;
|
X+=ItemWidth;
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
if( LastFocusItem!=FocusMouseItem )
|
if( LastFocusItem!=FocusMouseItem )
|
||||||
{
|
{
|
||||||
LastFocusItem = FocusMouseItem;
|
LastFocusItem = FocusMouseItem;
|
||||||
if( bUseFocusSound )
|
if( bUseFocusSound )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_FocusHover);
|
PlayMenuSound(MN_FocusHover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ComputeCoords();
|
if( !bVisible )
|
||||||
|
return;
|
||||||
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
|
||||||
{
|
ComputeCoords();
|
||||||
// First draw scrollbar to allow it to resize itself.
|
|
||||||
for( j=0; j<4; ++j )
|
if( !ScrollBar.bDisabled && !ScrollBar.bHideScrollbar )
|
||||||
ScrollBar.InputPos[j] = CompPos[j];
|
{
|
||||||
if( OldYSize!=InputPos[3] )
|
// First draw scrollbar to allow it to resize itself.
|
||||||
{
|
for( j=0; j<4; ++j )
|
||||||
OldYSize = InputPos[3];
|
ScrollBar.InputPos[j] = CompPos[j];
|
||||||
ScrollBar.YPosition = 1.f - ScrollBar.GetWidth();
|
if( OldYSize!=InputPos[3] )
|
||||||
}
|
{
|
||||||
ScrollBar.Canvas = Canvas;
|
OldYSize = InputPos[3];
|
||||||
ScrollBar.PreDraw();
|
ScrollBar.YPosition = 1.f - ScrollBar.GetWidth();
|
||||||
|
}
|
||||||
// Then downscale our selves to give room for scrollbar.
|
ScrollBar.Canvas = Canvas;
|
||||||
CompPos[3] -= ScrollBar.CompPos[3]*1.15f;
|
ScrollBar.PreDraw();
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
// Then downscale our selves to give room for scrollbar.
|
||||||
DrawMenu();
|
CompPos[3] -= ScrollBar.CompPos[3]*1.15f;
|
||||||
CompPos[3] += ScrollBar.CompPos[3]*1.15f;
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
}
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
else
|
DrawMenu();
|
||||||
{
|
CompPos[3] += ScrollBar.CompPos[3]*1.15f;
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
}
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
else
|
||||||
DrawMenu();
|
{
|
||||||
}
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
// Then draw rest of components.
|
DrawMenu();
|
||||||
for( i=0; i<Components.Length; ++i )
|
}
|
||||||
{
|
|
||||||
if( Components[i]!=ScrollBar )
|
// Then draw rest of components.
|
||||||
{
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].Canvas = Canvas;
|
{
|
||||||
for( j=0; j<4; ++j )
|
if( Components[i]!=ScrollBar )
|
||||||
Components[i].InputPos[j] = CompPos[j];
|
{
|
||||||
Components[i].PreDraw();
|
Components[i].Canvas = Canvas;
|
||||||
}
|
for( j=0; j<4; ++j )
|
||||||
}
|
Components[i].InputPos[j] = CompPos[j];
|
||||||
|
Components[i].PreDraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function UpdateListVis()
|
function UpdateListVis()
|
||||||
{
|
{
|
||||||
if( ListCount<=ListItemsPerPage )
|
if( ListCount<=ListItemsPerPage )
|
||||||
{
|
{
|
||||||
ScrollBar.UpdateScrollSize(0,1,1,1);
|
ScrollBar.UpdateScrollSize(0,1,1,1);
|
||||||
ScrollBar.SetDisabled(true);
|
ScrollBar.SetDisabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScrollBar.UpdateScrollSize(ScrollBar.CurrentScroll,(ListCount-ListItemsPerPage),1,ListItemsPerPage);
|
ScrollBar.UpdateScrollSize(ScrollBar.CurrentScroll,(ListCount-ListItemsPerPage),1,ListItemsPerPage);
|
||||||
ScrollBar.SetDisabled(false);
|
ScrollBar.SetDisabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ChangeListSize( int NewSize )
|
function ChangeListSize( int NewSize )
|
||||||
{
|
{
|
||||||
if( ListCount==NewSize )
|
if( ListCount==NewSize )
|
||||||
return;
|
return;
|
||||||
ListCount = NewSize;
|
ListCount = NewSize;
|
||||||
UpdateListVis();
|
UpdateListVis();
|
||||||
}
|
}
|
||||||
final function int GetListSize()
|
final function int GetListSize()
|
||||||
{
|
{
|
||||||
return ListCount;
|
return ListCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DoubleMouseClick( bool bRight )
|
function DoubleMouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bDisabled && bClickable )
|
if( !bDisabled && bClickable )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_ClickButton);
|
PlayMenuSound(MN_ClickButton);
|
||||||
PressedDown[byte(bRight)] = 0;
|
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]);
|
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;
|
PressedDown[byte(bRight)] = 1;
|
||||||
bPressedDown = true;
|
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);
|
PlayMenuSound(MN_ClickButton);
|
||||||
PressedDown[byte(bRight)] = 0;
|
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]);
|
OnClickedItem(FocusMouseItem,bRight,MouseXHit,Owner.MousePosition.Y-CompPos[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseLeave()
|
function MouseLeave()
|
||||||
{
|
{
|
||||||
Super.MouseLeave();
|
Super.MouseLeave();
|
||||||
PressedDown[0] = 0;
|
PressedDown[0] = 0;
|
||||||
PressedDown[1] = 0;
|
PressedDown[1] = 0;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
function MouseEnter()
|
function MouseEnter()
|
||||||
{
|
{
|
||||||
Super.MouseEnter();
|
Super.MouseEnter();
|
||||||
LastFocusItem = -1;
|
LastFocusItem = -1;
|
||||||
if( !bDisabled && bClickable && bUseFocusSound )
|
if( !bDisabled && bClickable && bUseFocusSound )
|
||||||
PlayMenuSound(MN_FocusHover);
|
PlayMenuSound(MN_FocusHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
if( !ScrollBar.bDisabled )
|
if( !ScrollBar.bDisabled )
|
||||||
ScrollBar.ScrollMouseWheel(bUp);
|
ScrollBar.ScrollMouseWheel(bUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NotifyMousePaused()
|
function NotifyMousePaused()
|
||||||
{
|
{
|
||||||
if( Owner.InputFocus==None && FocusMouseItem>=0 )
|
if( Owner.InputFocus==None && FocusMouseItem>=0 )
|
||||||
OnMouseRest(FocusMouseItem);
|
OnMouseRest(FocusMouseItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnMouseRest( int Item );
|
Delegate OnMouseRest( int Item );
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ListItemsPerPage=7
|
ListItemsPerPage=7
|
||||||
ListCount=1
|
ListCount=1
|
||||||
BackgroundColor=(R=0,G=0,B=0,A=75)
|
BackgroundColor=(R=0,G=0,B=0,A=75)
|
||||||
bDrawBackground=false
|
bDrawBackground=false
|
||||||
bUseFocusSound=false
|
bUseFocusSound=false
|
||||||
|
|
||||||
Begin Object Class=KFGUI_ScrollBarH Name=ListScroller
|
Begin Object Class=KFGUI_ScrollBarH Name=ListScroller
|
||||||
XPosition=0
|
XPosition=0
|
||||||
YPosition=0.96
|
YPosition=0.96
|
||||||
XSize=1
|
XSize=1
|
||||||
YSize=0.04
|
YSize=0.04
|
||||||
ID="Scrollbar"
|
ID="Scrollbar"
|
||||||
End Object
|
End Object
|
||||||
Components.Add(ListScroller)
|
Components.Add(ListScroller)
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
Class KFGUI_ListItem extends Object
|
Class KFGUI_ListItem extends Object
|
||||||
transient;
|
transient;
|
||||||
|
|
||||||
var KFGUI_ListItem Next;
|
var KFGUI_ListItem Next;
|
||||||
var array<string> Columns,SortColumns;
|
var array<string> Columns,SortColumns;
|
||||||
@ -9,36 +9,36 @@ 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);
|
ParseStringIntoArray(S,Columns,"\n",false);
|
||||||
if( SortStr=="" )
|
if( SortStr=="" )
|
||||||
SortColumns.Length = 0;
|
SortColumns.Length = 0;
|
||||||
else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false);
|
else ParseStringIntoArray(Caps(SortStr),SortColumns,"\n",false);
|
||||||
Value = i;
|
Value = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return string to draw on HUD.
|
// 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 Columns[Column];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return string to compare string with.
|
// 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];
|
return SortColumns[Column];
|
||||||
}
|
}
|
||||||
if( Column<Columns.Length )
|
if( Column<Columns.Length )
|
||||||
return Caps(Columns[Column]);
|
return Caps(Columns[Column]);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear
|
// Clear
|
||||||
function Clear()
|
function Clear()
|
||||||
{
|
{
|
||||||
Columns.Length = 0;
|
Columns.Length = 0;
|
||||||
}
|
}
|
||||||
|
@ -4,144 +4,144 @@ var() export editinline array<KFGUI_Base> Components;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
{
|
{
|
||||||
Components[i].Owner = Owner;
|
Components[i].Owner = Owner;
|
||||||
Components[i].ParentComponent = Self;
|
Components[i].ParentComponent = Self;
|
||||||
Components[i].InitMenu();
|
Components[i].InitMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ShowMenu()
|
function ShowMenu()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].ShowMenu();
|
Components[i].ShowMenu();
|
||||||
}
|
}
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ComputeCoords();
|
if( !bVisible )
|
||||||
Canvas.SetDrawColor(255,255,255);
|
return;
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
ComputeCoords();
|
||||||
DrawMenu();
|
Canvas.SetDrawColor(255,255,255);
|
||||||
for( i=0; i<Components.Length; ++i )
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
{
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
Components[i].Canvas = Canvas;
|
DrawMenu();
|
||||||
for( j=0; j<4; ++j )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].InputPos[j] = CompPos[j];
|
{
|
||||||
Components[i].PreDraw();
|
Components[i].Canvas = Canvas;
|
||||||
}
|
for( j=0; j<4; ++j )
|
||||||
|
Components[i].InputPos[j] = CompPos[j];
|
||||||
|
Components[i].PreDraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
|
function InventoryChanged(optional KFWeapon Wep, optional bool bRemove)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].InventoryChanged(Wep,bRemove);
|
Components[i].InventoryChanged(Wep,bRemove);
|
||||||
}
|
}
|
||||||
function MenuTick( float DeltaTime )
|
function MenuTick( float DeltaTime )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
Super.MenuTick(DeltaTime);
|
Super.MenuTick(DeltaTime);
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].MenuTick(DeltaTime);
|
Components[i].MenuTick(DeltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddComponent( KFGUI_Base C )
|
function AddComponent( KFGUI_Base C )
|
||||||
{
|
{
|
||||||
Components[Components.Length] = C;
|
Components[Components.Length] = C;
|
||||||
C.Owner = Owner;
|
C.Owner = Owner;
|
||||||
C.ParentComponent = Self;
|
C.ParentComponent = Self;
|
||||||
C.InitMenu();
|
C.InitMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
function CloseMenu()
|
function CloseMenu()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].CloseMenu();
|
Components[i].CloseMenu();
|
||||||
}
|
}
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
local int i;
|
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];
|
MouseArea = Components[i];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea = None;
|
MouseArea = None;
|
||||||
return Super.CaptureMouse(); // check with frame itself.
|
return Super.CaptureMouse(); // check with frame itself.
|
||||||
}
|
}
|
||||||
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
||||||
{
|
{
|
||||||
local int i;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Super.ReceievedControllerInput(ControllerId, Key, Event);
|
return Super.ReceievedControllerInput(ControllerId, Key, Event);
|
||||||
}
|
}
|
||||||
function KFGUI_Base FindComponentID( name InID )
|
function KFGUI_Base FindComponentID( name InID )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local KFGUI_Base Result;
|
local KFGUI_Base Result;
|
||||||
|
|
||||||
if( ID==InID )
|
if( ID==InID )
|
||||||
Result = Self;
|
Result = Self;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( i=0; i<Components.Length && Result==None; ++i )
|
for( i=0; i<Components.Length && Result==None; ++i )
|
||||||
Result = Components[i].FindComponentID(InID);
|
Result = Components[i].FindComponentID(InID);
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
function FindAllComponentID( name InID, out array<KFGUI_Base> Res )
|
function FindAllComponentID( name InID, out array<KFGUI_Base> Res )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
if( ID==InID )
|
if( ID==InID )
|
||||||
Res[Res.Length] = Self;
|
Res[Res.Length] = Self;
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].FindAllComponentID(InID,Res);
|
Components[i].FindAllComponentID(InID,Res);
|
||||||
}
|
}
|
||||||
function RemoveComponent( KFGUI_Base B )
|
function RemoveComponent( KFGUI_Base B )
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
if( Components[i]==B )
|
if( Components[i]==B )
|
||||||
{
|
{
|
||||||
Components.Remove(i,1);
|
Components.Remove(i,1);
|
||||||
B.CloseMenu();
|
B.CloseMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].RemoveComponent(B);
|
Components[i].RemoveComponent(B);
|
||||||
}
|
}
|
||||||
function NotifyLevelChange()
|
function NotifyLevelChange()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
|
|
||||||
for( i=0; i<Components.Length; ++i )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].NotifyLevelChange();
|
Components[i].NotifyLevelChange();
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
Class KFGUI_Page extends KFGUI_MultiComponent
|
Class KFGUI_Page extends KFGUI_MultiComponent
|
||||||
abstract;
|
abstract;
|
||||||
|
|
||||||
var() byte FrameOpacity; // Transperancy of the frame.
|
var() byte FrameOpacity; // Transperancy of the frame.
|
||||||
var() bool bPersistant, // Reuse the same menu object throughout the level.
|
var() bool bPersistant, // Reuse the same menu object throughout the level.
|
||||||
bUnique, // If calling OpenMenu multiple times with same menu class, only open one instance of it.
|
bUnique, // If calling OpenMenu multiple times with same menu class, only open one instance of it.
|
||||||
bAlwaysTop, // This menu should stay always on top.
|
bAlwaysTop, // This menu should stay always on top.
|
||||||
bOnlyThisFocus, // Only this menu should stay focused.
|
bOnlyThisFocus, // Only this menu should stay focused.
|
||||||
bNoBackground; // Don't draw the background.
|
bNoBackground; // Don't draw the background.
|
||||||
|
|
||||||
var bool bWindowFocused; // This page is currently focused.
|
var bool bWindowFocused; // This page is currently focused.
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
if( !bNoBackground )
|
if( !bNoBackground )
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderWindow(Self);
|
Owner.CurrentStyle.RenderWindow(Self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bUnique=true
|
bUnique=true
|
||||||
bPersistant=true
|
bPersistant=true
|
||||||
FrameOpacity=175
|
FrameOpacity=175
|
||||||
}
|
}
|
@ -23,112 +23,112 @@ var byte BorderSize;
|
|||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local float Left, Top, Width, Height;
|
local float Left, Top, Width, Height;
|
||||||
local float W, Sc;
|
local float W, Sc;
|
||||||
local string S;
|
local string S;
|
||||||
|
|
||||||
Super.DrawMenu();
|
|
||||||
|
|
||||||
Left = 0.f;
|
Super.DrawMenu();
|
||||||
Top = 0.f;
|
|
||||||
Width = CompPos[2];
|
|
||||||
Height = CompPos[3];
|
|
||||||
|
|
||||||
// Select the right font in the Canvas
|
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(Sc);
|
|
||||||
|
|
||||||
if (CaptionWidth > 0.0 && Width > 0 && Len(Caption) > 0)
|
|
||||||
{
|
|
||||||
W = CaptionWidth;
|
|
||||||
|
|
||||||
if( W < 1.0 )
|
Left = 0.f;
|
||||||
{
|
Top = 0.f;
|
||||||
W *= Width;
|
Width = CompPos[2];
|
||||||
}
|
Height = CompPos[3];
|
||||||
|
|
||||||
if( W > Width )
|
// Select the right font in the Canvas
|
||||||
{
|
Canvas.Font = Owner.CurrentStyle.PickFont(Sc);
|
||||||
W = Width;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the label
|
if (CaptionWidth > 0.0 && Width > 0 && Len(Caption) > 0)
|
||||||
Owner.CurrentStyle.DrawTextJustified(CaptionAlign, Left, Top, Left + W, Top + Height, Caption, Sc, Sc);
|
{
|
||||||
Left += W;
|
W = CaptionWidth;
|
||||||
Width -= W;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0)
|
if( W < 1.0 )
|
||||||
{
|
{
|
||||||
W = ValueRightWidth;
|
W *= Width;
|
||||||
|
}
|
||||||
|
|
||||||
if( W < 1.0 )
|
if( W > Width )
|
||||||
{
|
{
|
||||||
W *= Width;
|
W = Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( W > Width )
|
// Draw the label
|
||||||
{
|
Owner.CurrentStyle.DrawTextJustified(CaptionAlign, Left, Top, Left + W, Top + Height, Caption, Sc, Sc);
|
||||||
W = Width;
|
Left += W;
|
||||||
}
|
Width -= W;
|
||||||
|
}
|
||||||
|
|
||||||
if( bShowValue && bShowHigh )
|
if ( (bShowHigh || bShowValue) && ValueRightWidth > 0.0 && Width > 0.0)
|
||||||
{
|
{
|
||||||
S = int(Value)$"/"$int(High);
|
W = ValueRightWidth;
|
||||||
}
|
|
||||||
else if (bShowValue)
|
|
||||||
{
|
|
||||||
S = string(int(Value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
S = string(int(High));
|
|
||||||
}
|
|
||||||
|
|
||||||
Owner.CurrentStyle.DrawTextJustified(ValueRightAlign, Left + Width - W, Top, Left + Width, Top + Height, S, Sc, Sc);
|
if( W < 1.0 )
|
||||||
|
{
|
||||||
|
W *= Width;
|
||||||
|
}
|
||||||
|
|
||||||
Width -= W;
|
if( W > Width )
|
||||||
}
|
{
|
||||||
|
W = Width;
|
||||||
if (Width > GraphicMargin)
|
}
|
||||||
{
|
|
||||||
Width -= GraphicMargin;
|
|
||||||
Left += GraphicMargin / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.SetDrawColor(255, 255, 255, 255);
|
if( bShowValue && bShowHigh )
|
||||||
if( Width > 0.0 && BarBack != None )
|
{
|
||||||
{
|
S = int(Value)$"/"$int(High);
|
||||||
Owner.CurrentStyle.DrawTileStretched(BarBack, Left, Top, Width, Height);
|
}
|
||||||
}
|
else if (bShowValue)
|
||||||
|
{
|
||||||
|
S = string(int(Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
S = string(int(High));
|
||||||
|
}
|
||||||
|
|
||||||
if( Width > 0.0 && BarTop != None && Value > Low )
|
Owner.CurrentStyle.DrawTextJustified(ValueRightAlign, Left + Width - W, Top, Left + Width, Top + Height, S, Sc, Sc);
|
||||||
{
|
|
||||||
Canvas.DrawColor = BarColor;
|
Width -= W;
|
||||||
Owner.CurrentStyle.DrawTileStretched(BarTop, Left + BorderSize, Top + BorderSize, (Width - (BorderSize * 2)) * (Value/High), Height - (BorderSize * 2));
|
}
|
||||||
}
|
|
||||||
|
if (Width > GraphicMargin)
|
||||||
|
{
|
||||||
|
Width -= GraphicMargin;
|
||||||
|
Left += GraphicMargin / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.SetDrawColor(255, 255, 255, 255);
|
||||||
|
if( Width > 0.0 && BarBack != None )
|
||||||
|
{
|
||||||
|
Owner.CurrentStyle.DrawTileStretched(BarBack, Left, Top, Width, Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetValue(float val)
|
function SetValue(float val)
|
||||||
{
|
{
|
||||||
Value=val;
|
Value=val;
|
||||||
}
|
}
|
||||||
|
|
||||||
function float GetValue()
|
function float GetValue()
|
||||||
{
|
{
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
BarColor=(R=255,G=255,B=255,A=255)
|
BarColor=(R=255,G=255,B=255,A=255)
|
||||||
Low=0.f
|
Low=0.f
|
||||||
High=100.f
|
High=100.f
|
||||||
Value=0.f
|
Value=0.f
|
||||||
bShowLow=false
|
bShowLow=false
|
||||||
bShowHigh=false
|
bShowHigh=false
|
||||||
bShowValue=true
|
bShowValue=true
|
||||||
CaptionWidth=0.45
|
CaptionWidth=0.45
|
||||||
ValueRightWidth=0.2
|
ValueRightWidth=0.2
|
||||||
ValueRightAlign=0
|
ValueRightAlign=0
|
||||||
NumDecimals=0
|
NumDecimals=0
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ Class KFGUI_RightClickMenu extends KFGUI_Clickable;
|
|||||||
|
|
||||||
struct FRowItem
|
struct FRowItem
|
||||||
{
|
{
|
||||||
var string Text,ToolTip;
|
var string Text,ToolTip;
|
||||||
var bool bSplitter,bDisabled;
|
var bool bSplitter,bDisabled;
|
||||||
};
|
};
|
||||||
var array<FRowItem> ItemRows;
|
var array<FRowItem> ItemRows;
|
||||||
var int CurrentRow,OldRow;
|
var int CurrentRow,OldRow;
|
||||||
@ -14,138 +14,138 @@ var Color BoxColor,OutlineColor;
|
|||||||
|
|
||||||
function OpenMenu( KFGUI_Base Menu )
|
function OpenMenu( KFGUI_Base Menu )
|
||||||
{
|
{
|
||||||
Owner = Menu.Owner;
|
Owner = Menu.Owner;
|
||||||
InitMenu();
|
InitMenu();
|
||||||
PlayMenuSound(MN_Dropdown);
|
PlayMenuSound(MN_Dropdown);
|
||||||
GetInputFocus();
|
GetInputFocus();
|
||||||
OldSizeX = 0;
|
OldSizeX = 0;
|
||||||
}
|
}
|
||||||
final function ComputeSize()
|
final function ComputeSize()
|
||||||
{
|
{
|
||||||
local float XS,YS,XL,YL,Scalar;
|
local float XS,YS,XL,YL,Scalar;
|
||||||
local int i;
|
local int i;
|
||||||
local string S;
|
local string S;
|
||||||
|
|
||||||
if( OldSizeX == Owner.ScreenSize.X )
|
if( OldSizeX == Owner.ScreenSize.X )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ItemRows.Length==0 )
|
if( ItemRows.Length==0 )
|
||||||
{
|
{
|
||||||
YS = 0;
|
YS = 0;
|
||||||
XS = 50;
|
XS = 50;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(Scalar);
|
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 = "----";
|
S = "----";
|
||||||
else S = ItemRows[i].Text;
|
else S = ItemRows[i].Text;
|
||||||
|
|
||||||
Canvas.TextSize(S,XL,YL,Scalar,Scalar);
|
Canvas.TextSize(S,XL,YL,Scalar,Scalar);
|
||||||
|
|
||||||
XS = FMax(XS,XL);
|
XS = FMax(XS,XL);
|
||||||
YS += YL;
|
YS += YL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XSize = (XS+(EdgeSize*12)) / Owner.ScreenSize.X;
|
XSize = (XS+(EdgeSize*12)) / Owner.ScreenSize.X;
|
||||||
YSize = (YS+(EdgeSize*4)) / Owner.ScreenSize.Y;
|
YSize = (YS+(EdgeSize*4)) / Owner.ScreenSize.Y;
|
||||||
|
|
||||||
ComputePosition();
|
ComputePosition();
|
||||||
|
|
||||||
OldSizeX = Owner.ScreenSize.X;
|
OldSizeX = Owner.ScreenSize.X;
|
||||||
}
|
}
|
||||||
function ComputePosition()
|
function ComputePosition()
|
||||||
{
|
{
|
||||||
XPosition = float(Owner.MousePosition.X+4) / Owner.ScreenSize.X;
|
XPosition = float(Owner.MousePosition.X+4) / Owner.ScreenSize.X;
|
||||||
YPosition = float(Owner.MousePosition.Y+4) / Owner.ScreenSize.Y;
|
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.
|
YPosition = (float(Owner.MousePosition.X) / Owner.ScreenSize.X) - XSize; // Move to left side of mouse pointer.
|
||||||
if( (YPosition+YSize)>1.f )
|
if( (YPosition+YSize)>1.f )
|
||||||
YPosition-=((YPosition+YSize)-1.f); // Move up until fit on screen.
|
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;
|
local int i;
|
||||||
|
|
||||||
i = ItemRows.Length;
|
i = ItemRows.Length;
|
||||||
ItemRows.Length = i+1;
|
ItemRows.Length = i+1;
|
||||||
if( Text=="-" )
|
if( Text=="-" )
|
||||||
ItemRows[i].bSplitter = true;
|
ItemRows[i].bSplitter = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemRows[i].Text = Text;
|
ItemRows[i].Text = Text;
|
||||||
ItemRows[i].ToolTip = AltToolTip;
|
ItemRows[i].ToolTip = AltToolTip;
|
||||||
ItemRows[i].bDisabled = bDisable;
|
ItemRows[i].bDisabled = bDisable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
ComputeSize();
|
ComputeSize();
|
||||||
Super.PreDraw();
|
Super.PreDraw();
|
||||||
}
|
}
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderRightClickMenu(Self);
|
Owner.CurrentStyle.RenderRightClickMenu(Self);
|
||||||
|
|
||||||
if( bDrawToolTip )
|
if( bDrawToolTip )
|
||||||
{
|
{
|
||||||
if( OldRow != CurrentRow )
|
if( OldRow != CurrentRow )
|
||||||
bDrawToolTip = false;
|
bDrawToolTip = false;
|
||||||
DrawToolTip();
|
DrawToolTip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function DrawToolTip()
|
function DrawToolTip()
|
||||||
{
|
{
|
||||||
local float X,Y,XL,YL,BoxW,BoxH,TextX,TextY,Scalar,CursorSize;
|
local float X,Y,XL,YL,BoxW,BoxH,TextX,TextY,Scalar,CursorSize;
|
||||||
local string S;
|
local string S;
|
||||||
|
|
||||||
Canvas.Reset();
|
Canvas.Reset();
|
||||||
Canvas.SetClip(float(Owner.ScreenSize.X), float(Owner.ScreenSize.Y));
|
Canvas.SetClip(float(Owner.ScreenSize.X), float(Owner.ScreenSize.Y));
|
||||||
|
|
||||||
S = ItemRows[CurrentRow].ToolTip;
|
S = ItemRows[CurrentRow].ToolTip;
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(Scalar);
|
Canvas.Font = Owner.CurrentStyle.PickFont(Scalar);
|
||||||
Canvas.TextSize(S,XL,YL,Scalar,Scalar);
|
Canvas.TextSize(S,XL,YL,Scalar,Scalar);
|
||||||
|
|
||||||
CursorSize = Owner.CurrentStyle.ScreenScale(Owner.CursorSize);
|
CursorSize = Owner.CurrentStyle.ScreenScale(Owner.CursorSize);
|
||||||
X = Owner.MousePosition.X+CursorSize;
|
X = Owner.MousePosition.X+CursorSize;
|
||||||
Y = Owner.MousePosition.Y+CursorSize;
|
Y = Owner.MousePosition.Y+CursorSize;
|
||||||
BoxW = XL * 1.05f;
|
BoxW = XL * 1.05f;
|
||||||
BoxH = YL * 1.25f;
|
BoxH = YL * 1.25f;
|
||||||
|
|
||||||
while( (X + BoxW) > Canvas.ClipX )
|
while( (X + BoxW) > Canvas.ClipX )
|
||||||
{
|
{
|
||||||
X -= 0.01;
|
X -= 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.CurrentStyle.DrawOutlinedBox(X, Y, BoxW, BoxH, EdgeSize, MakeColor(5,5,5,255), MakeColor(115,115,115,255));
|
Owner.CurrentStyle.DrawOutlinedBox(X, Y, BoxW, BoxH, EdgeSize, MakeColor(5,5,5,255), MakeColor(115,115,115,255));
|
||||||
|
|
||||||
TextX = X + (BoxW/2) - (XL/2) - (EdgeSize/2);
|
TextX = X + (BoxW/2) - (XL/2) - (EdgeSize/2);
|
||||||
TextY = Y + (BoxH/2) - (YL/2) - (EdgeSize/2);
|
TextY = Y + (BoxH/2) - (YL/2) - (EdgeSize/2);
|
||||||
|
|
||||||
Canvas.DrawColor = class'HUD'.default.WhiteColor;
|
Canvas.DrawColor = class'HUD'.default.WhiteColor;
|
||||||
Canvas.SetPos(TextX, TextY);
|
Canvas.SetPos(TextX, TextY);
|
||||||
Canvas.DrawText(S,,Scalar,Scalar);
|
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;
|
return;
|
||||||
OnSelectedItem(CurrentRow);
|
OnSelectedItem(CurrentRow);
|
||||||
PlayMenuSound(MN_ClickButton);
|
PlayMenuSound(MN_ClickButton);
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
}
|
}
|
||||||
function LostInputFocus()
|
function LostInputFocus()
|
||||||
{
|
{
|
||||||
OnBecameHidden(Self);
|
OnBecameHidden(Self);
|
||||||
OldRow = -1;
|
OldRow = -1;
|
||||||
CurrentRow = -1;
|
CurrentRow = -1;
|
||||||
}
|
}
|
||||||
function NotifyMousePaused()
|
function NotifyMousePaused()
|
||||||
{
|
{
|
||||||
if(CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "")
|
if(CurrentRow != -1 && ItemRows[CurrentRow].ToolTip != "")
|
||||||
bDrawToolTip = true;
|
bDrawToolTip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate OnSelectedItem( int Index );
|
Delegate OnSelectedItem( int Index );
|
||||||
@ -153,11 +153,11 @@ Delegate OnBecameHidden( KFGUI_RightClickMenu M );
|
|||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
CurrentRow=-1
|
CurrentRow=-1
|
||||||
OldRow=-1
|
OldRow=-1
|
||||||
bFocusedPostDrawItem=true
|
bFocusedPostDrawItem=true
|
||||||
bHoverSound=false
|
bHoverSound=false
|
||||||
EdgeSize=2
|
EdgeSize=2
|
||||||
BoxColor=(R=5,G=5,B=5,A=200)
|
BoxColor=(R=5,G=5,B=5,A=200)
|
||||||
OutlineColor=(R=115,G=115,B=115,A=255)
|
OutlineColor=(R=115,G=115,B=115,A=255)
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
Class KFGUI_ScrollBarBase extends KFGUI_Clickable
|
Class KFGUI_ScrollBarBase extends KFGUI_Clickable
|
||||||
abstract;
|
abstract;
|
||||||
|
|
||||||
var() int MinRange,MaxRange,ScrollStride,PageStep;
|
var() int MinRange,MaxRange,ScrollStride,PageStep;
|
||||||
var() float ButtonScale; // Button width (scaled by default font height).
|
var() float ButtonScale; // Button width (scaled by default font height).
|
||||||
@ -14,110 +14,110 @@ 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;
|
MaxRange = MxRange;
|
||||||
MinRange = MnRange;
|
MinRange = MnRange;
|
||||||
ScrollStride = Stride;
|
ScrollStride = Stride;
|
||||||
PageStep = StepStride;
|
PageStep = StepStride;
|
||||||
SetValue(Current);
|
SetValue(Current);
|
||||||
}
|
}
|
||||||
final function AddValue( int V )
|
final function AddValue( int V )
|
||||||
{
|
{
|
||||||
SetValue(CurrentScroll+V);
|
SetValue(CurrentScroll+V);
|
||||||
}
|
}
|
||||||
final function SetValue( int V )
|
final function SetValue( int V )
|
||||||
{
|
{
|
||||||
CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange);
|
CurrentScroll = Clamp((V / ScrollStride) * ScrollStride,MinRange,MaxRange);
|
||||||
OnScrollChange(Self,CurrentScroll);
|
OnScrollChange(Self,CurrentScroll);
|
||||||
}
|
}
|
||||||
final function int GetValue()
|
final function int GetValue()
|
||||||
{
|
{
|
||||||
return CurrentScroll;
|
return CurrentScroll;
|
||||||
}
|
}
|
||||||
Delegate OnScrollChange( KFGUI_ScrollBarBase Sender, int Value );
|
Delegate OnScrollChange( KFGUI_ScrollBarBase Sender, int Value );
|
||||||
|
|
||||||
// Get UI width.
|
// Get UI width.
|
||||||
function float GetWidth()
|
function float GetWidth()
|
||||||
{
|
{
|
||||||
CalcButtonScale = ButtonScale*Owner.CurrentStyle.DefaultHeight;
|
CalcButtonScale = ButtonScale*Owner.CurrentStyle.DefaultHeight;
|
||||||
return CalcButtonScale / (bVertical ? InputPos[2] : InputPos[3]);
|
return CalcButtonScale / (bVertical ? InputPos[2] : InputPos[3]);
|
||||||
}
|
}
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
// Auto scale to match width to screen size.
|
// Auto scale to match width to screen size.
|
||||||
if( bVertical )
|
if( bVertical )
|
||||||
XSize = GetWidth();
|
XSize = GetWidth();
|
||||||
else YSize = GetWidth();
|
else YSize = GetWidth();
|
||||||
Super.PreDraw();
|
Super.PreDraw();
|
||||||
}
|
}
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
if( !bHideScrollbar )
|
if( !bHideScrollbar )
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.RenderScrollBar(Self);
|
Owner.CurrentStyle.RenderScrollBar(Self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( bRight || bDisabled )
|
if( bRight || bDisabled )
|
||||||
return;
|
return;
|
||||||
bPressedDown = true;
|
bPressedDown = true;
|
||||||
PlayMenuSound(MN_ClickButton);
|
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);
|
GrabbedOffset = Owner.MousePosition.Y - (CompPos[1]+ButtonOffset);
|
||||||
bGrabbedScroller = true;
|
bGrabbedScroller = true;
|
||||||
GetInputFocus();
|
GetInputFocus();
|
||||||
}
|
}
|
||||||
else if( Owner.MousePosition.Y<(CompPos[1]+ButtonOffset) ) // Page up.
|
else if( Owner.MousePosition.Y<(CompPos[1]+ButtonOffset) ) // Page up.
|
||||||
AddValue(-PageStep);
|
AddValue(-PageStep);
|
||||||
else AddValue(PageStep);
|
else AddValue(PageStep);
|
||||||
}
|
}
|
||||||
else
|
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);
|
GrabbedOffset = Owner.MousePosition.X - (CompPos[0]+ButtonOffset);
|
||||||
bGrabbedScroller = true;
|
bGrabbedScroller = true;
|
||||||
GetInputFocus();
|
GetInputFocus();
|
||||||
}
|
}
|
||||||
else if( Owner.MousePosition.X<(CompPos[0]+ButtonOffset) ) // Page left.
|
else if( Owner.MousePosition.X<(CompPos[0]+ButtonOffset) ) // Page left.
|
||||||
AddValue(-PageStep);
|
AddValue(-PageStep);
|
||||||
else AddValue(PageStep);
|
else AddValue(PageStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function MouseRelease( bool bRight )
|
function MouseRelease( bool bRight )
|
||||||
{
|
{
|
||||||
if( !bRight )
|
if( !bRight )
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function LostInputFocus()
|
function LostInputFocus()
|
||||||
{
|
{
|
||||||
bGrabbedScroller = false;
|
bGrabbedScroller = false;
|
||||||
bPressedDown = false;
|
bPressedDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
if( bDisabled )
|
if( bDisabled )
|
||||||
return;
|
return;
|
||||||
if( bUp )
|
if( bUp )
|
||||||
AddValue(-ScrollStride);
|
AddValue(-ScrollStride);
|
||||||
else AddValue(ScrollStride);
|
else AddValue(ScrollStride);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetVisibility(bool Visible)
|
function SetVisibility(bool Visible)
|
||||||
{
|
{
|
||||||
bHideScrollbar = Visible;
|
bHideScrollbar = Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
MaxRange=100
|
MaxRange=100
|
||||||
ScrollStride=1
|
ScrollStride=1
|
||||||
PageStep=10
|
PageStep=10
|
||||||
ButtonScale=1
|
ButtonScale=1
|
||||||
}
|
}
|
@ -2,5 +2,5 @@ Class KFGUI_ScrollBarH extends KFGUI_ScrollBarBase;
|
|||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bVertical=false
|
bVertical=false
|
||||||
}
|
}
|
@ -2,5 +2,5 @@ Class KFGUI_ScrollBarV extends KFGUI_ScrollBarBase;
|
|||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bVertical=true
|
bVertical=true
|
||||||
}
|
}
|
@ -9,44 +9,44 @@ delegate OnValueChanged(KFGUI_Slider Sender, int Value);
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
ScrollBar = KFGUI_ScrollBarH(FindComponentID('Scrollbar'));
|
ScrollBar = KFGUI_ScrollBarH(FindComponentID('Scrollbar'));
|
||||||
ScrollBar.OnScrollChange = ValueChanged;
|
ScrollBar.OnScrollChange = ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
function int GetValue()
|
function int GetValue()
|
||||||
{
|
{
|
||||||
return CurrentValue;
|
return CurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetValue(int Value)
|
function SetValue(int Value)
|
||||||
{
|
{
|
||||||
CurrentValue = Clamp(Value, MinValue, MaxValue);
|
CurrentValue = Clamp(Value, MinValue, MaxValue);
|
||||||
OnValueChanged(self, CurrentValue);
|
OnValueChanged(self, CurrentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ValueChanged(KFGUI_ScrollBarBase Sender, int Value)
|
function ValueChanged(KFGUI_ScrollBarBase Sender, int Value)
|
||||||
{
|
{
|
||||||
SetValue(Value);
|
SetValue(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateListVis()
|
function UpdateListVis()
|
||||||
{
|
{
|
||||||
ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue);
|
ScrollBar.UpdateScrollSize(CurrentValue,MaxValue,1,1,MinValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
if( !ScrollBar.bDisabled )
|
if( !ScrollBar.bDisabled )
|
||||||
ScrollBar.ScrollMouseWheel(bUp);
|
ScrollBar.ScrollMouseWheel(bUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
Begin Object Class=KFGUI_ScrollBarH Name=SliderScroll
|
Begin Object Class=KFGUI_ScrollBarH Name=SliderScroll
|
||||||
XSize=1
|
XSize=1
|
||||||
YSize=0.5
|
YSize=0.5
|
||||||
ID="Scrollbar"
|
ID="Scrollbar"
|
||||||
End Object
|
End Object
|
||||||
Components.Add(SliderScroll)
|
Components.Add(SliderScroll)
|
||||||
}
|
}
|
||||||
|
@ -11,155 +11,155 @@ var array<KFGUI_Button> PageButtons;
|
|||||||
|
|
||||||
function ShowMenu()
|
function ShowMenu()
|
||||||
{
|
{
|
||||||
GrabKeyFocus();
|
GrabKeyFocus();
|
||||||
Super.ShowMenu();
|
Super.ShowMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
function CloseMenu()
|
function CloseMenu()
|
||||||
{
|
{
|
||||||
ReleaseKeyFocus();
|
ReleaseKeyFocus();
|
||||||
Super.CloseMenu();
|
Super.CloseMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember to call InitMenu() on the newly created page after.
|
// 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_Base P;
|
||||||
local KFGUI_Button B;
|
local KFGUI_Button B;
|
||||||
|
|
||||||
// Add page.
|
|
||||||
P = new (Self) PageClass;
|
|
||||||
P.Owner = Owner;
|
|
||||||
P.ParentComponent = Self;
|
|
||||||
SubPages.AddItem(P);
|
|
||||||
|
|
||||||
// Add page switch button.
|
// Add page.
|
||||||
B = new (Self) class'KFGUI_Button';
|
P = new (Self) PageClass;
|
||||||
B.ButtonText = Caption;
|
P.Owner = Owner;
|
||||||
B.ToolTip = Hint;
|
P.ParentComponent = Self;
|
||||||
B.OnClickLeft = PageSwitched;
|
SubPages.AddItem(P);
|
||||||
B.OnClickRight = PageSwitched;
|
|
||||||
B.IDValue = NumButtons;
|
|
||||||
|
|
||||||
if( ButtonPosition<2 )
|
|
||||||
{
|
|
||||||
B.XPosition = NumButtons*ButtonAxisSize;
|
|
||||||
B.XSize = ButtonAxisSize*0.99;
|
|
||||||
|
|
||||||
if( ButtonPosition==0 )
|
// Add page switch button.
|
||||||
B.YPosition = 0.f;
|
B = new (Self) class'KFGUI_Button';
|
||||||
else B.YPosition = YSize-BorderWidth*0.99;
|
B.ButtonText = Caption;
|
||||||
B.YSize = BorderWidth*0.99;
|
B.ToolTip = Hint;
|
||||||
|
B.OnClickLeft = PageSwitched;
|
||||||
if( NumButtons>0 )
|
B.OnClickRight = PageSwitched;
|
||||||
PageButtons[PageButtons.Length-1].ExtravDir = 1;
|
B.IDValue = NumButtons;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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 )
|
|
||||||
PageButtons[PageButtons.Length-1].ExtravDir = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
++NumButtons;
|
if( ButtonPosition<2 )
|
||||||
PageButtons.AddItem(B);
|
{
|
||||||
AddComponent(B);
|
B.XPosition = NumButtons*ButtonAxisSize;
|
||||||
Button = B;
|
B.XSize = ButtonAxisSize*0.99;
|
||||||
return P;
|
|
||||||
|
if( ButtonPosition==0 )
|
||||||
|
B.YPosition = 0.f;
|
||||||
|
else B.YPosition = YSize-BorderWidth*0.99;
|
||||||
|
B.YSize = BorderWidth*0.99;
|
||||||
|
|
||||||
|
if( NumButtons>0 )
|
||||||
|
PageButtons[PageButtons.Length-1].ExtravDir = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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 )
|
||||||
|
PageButtons[PageButtons.Length-1].ExtravDir = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
++NumButtons;
|
||||||
|
PageButtons.AddItem(B);
|
||||||
|
AddComponent(B);
|
||||||
|
Button = B;
|
||||||
|
return P;
|
||||||
}
|
}
|
||||||
|
|
||||||
function PageSwitched( KFGUI_Button Sender )
|
function PageSwitched( KFGUI_Button Sender )
|
||||||
{
|
{
|
||||||
SelectPage(Sender.IDValue);
|
SelectPage(Sender.IDValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function SelectPage( int Index )
|
final function SelectPage( int Index )
|
||||||
{
|
{
|
||||||
PlayMenuSound(MN_LostFocus);
|
PlayMenuSound(MN_LostFocus);
|
||||||
|
|
||||||
if( CurrentPageNum>=0 )
|
if( CurrentPageNum>=0 )
|
||||||
{
|
{
|
||||||
PageButtons[CurrentPageNum].bIsHighlighted = false;
|
PageButtons[CurrentPageNum].bIsHighlighted = false;
|
||||||
SubPages[CurrentPageNum].CloseMenu();
|
SubPages[CurrentPageNum].CloseMenu();
|
||||||
Components.Remove(PageComponentIndex,1);
|
Components.Remove(PageComponentIndex,1);
|
||||||
PageComponentIndex = -1;
|
PageComponentIndex = -1;
|
||||||
}
|
}
|
||||||
CurrentPageNum = (Index>=0 && Index<SubPages.Length) ? Index : -1;
|
CurrentPageNum = (Index>=0 && Index<SubPages.Length) ? Index : -1;
|
||||||
if( CurrentPageNum>=0 )
|
if( CurrentPageNum>=0 )
|
||||||
{
|
{
|
||||||
PageButtons[CurrentPageNum].bIsHighlighted = true;
|
PageButtons[CurrentPageNum].bIsHighlighted = true;
|
||||||
SubPages[CurrentPageNum].ShowMenu();
|
SubPages[CurrentPageNum].ShowMenu();
|
||||||
PageComponentIndex = Components.Length;
|
PageComponentIndex = Components.Length;
|
||||||
Components.AddItem(SubPages[CurrentPageNum]);
|
Components.AddItem(SubPages[CurrentPageNum]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
local byte j;
|
local byte j;
|
||||||
|
|
||||||
if( !bVisible )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( CurrentPageNum==-1 && NumButtons>0 )
|
if( !bVisible )
|
||||||
SelectPage(0);
|
return;
|
||||||
ComputeCoords();
|
|
||||||
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
if( CurrentPageNum==-1 && NumButtons>0 )
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
SelectPage(0);
|
||||||
DrawMenu();
|
ComputeCoords();
|
||||||
for( i=0; i<Components.Length; ++i )
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
||||||
{
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
Components[i].Canvas = Canvas;
|
DrawMenu();
|
||||||
for( j=0; j<4; ++j )
|
for( i=0; i<Components.Length; ++i )
|
||||||
Components[i].InputPos[j] = CompPos[j];
|
{
|
||||||
if( i==PageComponentIndex )
|
Components[i].Canvas = Canvas;
|
||||||
{
|
for( j=0; j<4; ++j )
|
||||||
switch( ButtonPosition )
|
Components[i].InputPos[j] = CompPos[j];
|
||||||
{
|
if( i==PageComponentIndex )
|
||||||
case 0:
|
{
|
||||||
Components[i].InputPos[1] += (InputPos[3]*BorderWidth*PagePadding);
|
switch( ButtonPosition )
|
||||||
case 1:
|
{
|
||||||
Components[i].InputPos[3] -= (InputPos[3]*BorderWidth*PagePadding);
|
case 0:
|
||||||
break;
|
Components[i].InputPos[1] += (InputPos[3]*BorderWidth*PagePadding);
|
||||||
case 2:
|
case 1:
|
||||||
Components[i].InputPos[0] += (InputPos[2]*BorderWidth*PagePadding);
|
Components[i].InputPos[3] -= (InputPos[3]*BorderWidth*PagePadding);
|
||||||
default:
|
break;
|
||||||
Components[i].InputPos[2] -= (InputPos[2]*BorderWidth*PagePadding);
|
case 2:
|
||||||
}
|
Components[i].InputPos[0] += (InputPos[2]*BorderWidth*PagePadding);
|
||||||
}
|
default:
|
||||||
Components[i].PreDraw();
|
Components[i].InputPos[2] -= (InputPos[2]*BorderWidth*PagePadding);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Components[i].PreDraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
function bool ReceievedControllerInput(int ControllerId, name Key, EInputEvent Event)
|
||||||
{
|
{
|
||||||
switch(Key)
|
switch(Key)
|
||||||
{
|
{
|
||||||
case 'XboxTypeS_LeftShoulder':
|
case 'XboxTypeS_LeftShoulder':
|
||||||
if( Event == IE_Pressed )
|
if( Event == IE_Pressed )
|
||||||
SelectPage(Clamp(CurrentPageNum - 1, 0, NumButtons));
|
SelectPage(Clamp(CurrentPageNum - 1, 0, NumButtons));
|
||||||
return true;
|
return true;
|
||||||
case 'XboxTypeS_RightShoulder':
|
case 'XboxTypeS_RightShoulder':
|
||||||
if( Event == IE_Pressed )
|
if( Event == IE_Pressed )
|
||||||
SelectPage(Clamp(CurrentPageNum + 1, 0, NumButtons));
|
SelectPage(Clamp(CurrentPageNum + 1, 0, NumButtons));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
PagePadding=1.0
|
PagePadding=1.0
|
||||||
BorderWidth=0.05
|
BorderWidth=0.05
|
||||||
ButtonAxisSize=0.08
|
ButtonAxisSize=0.08
|
||||||
CurrentPageNum=-1
|
CurrentPageNum=-1
|
||||||
PageComponentIndex=-1
|
PageComponentIndex=-1
|
||||||
}
|
}
|
@ -2,27 +2,27 @@ Class KFGUI_TextField extends KFGUI_MultiComponent;
|
|||||||
|
|
||||||
enum ETextFieldStyles
|
enum ETextFieldStyles
|
||||||
{
|
{
|
||||||
TEXT_FIELD_NONE,
|
TEXT_FIELD_NONE,
|
||||||
TEXT_FIELD_HSV,
|
TEXT_FIELD_HSV,
|
||||||
TEXT_FIELD_SCAN,
|
TEXT_FIELD_SCAN,
|
||||||
TEXT_FIELD_FLASH
|
TEXT_FIELD_FLASH
|
||||||
};
|
};
|
||||||
struct FTextPart
|
struct FTextPart
|
||||||
{
|
{
|
||||||
var string S;
|
var string S;
|
||||||
var ETextFieldStyles TextType;
|
var ETextFieldStyles TextType;
|
||||||
var Color C;
|
var Color C;
|
||||||
var float X;
|
var float X;
|
||||||
|
|
||||||
structdefaultproperties
|
structdefaultproperties
|
||||||
{
|
{
|
||||||
TextType=TEXT_FIELD_NONE
|
TextType=TEXT_FIELD_NONE
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct FTextLineInfo
|
struct FTextLineInfo
|
||||||
{
|
{
|
||||||
var array<FTextPart> Text;
|
var array<FTextPart> Text;
|
||||||
var float Y;
|
var float Y;
|
||||||
};
|
};
|
||||||
var KFGUI_ScrollBarV ScrollBar;
|
var KFGUI_ScrollBarV ScrollBar;
|
||||||
|
|
||||||
@ -40,451 +40,451 @@ var transient bool bShowScrollbar,bTextParsed;
|
|||||||
|
|
||||||
function SetText( string S )
|
function SetText( string S )
|
||||||
{
|
{
|
||||||
if( Text==S )
|
if( Text==S )
|
||||||
return;
|
return;
|
||||||
Text = S;
|
Text = S;
|
||||||
OldSize[0] = -1; // Force to refresh.
|
OldSize[0] = -1; // Force to refresh.
|
||||||
Lines.Length = 0;
|
Lines.Length = 0;
|
||||||
OrgLines.Length = 0;
|
OrgLines.Length = 0;
|
||||||
bTextParsed = false;
|
bTextParsed = false;
|
||||||
}
|
}
|
||||||
function AddText( string S, optional bool bIgnoreSpam )
|
function AddText( string S, optional bool bIgnoreSpam )
|
||||||
{
|
{
|
||||||
Text $= S;
|
Text $= S;
|
||||||
OldSize[0] = -1;
|
OldSize[0] = -1;
|
||||||
Lines.Length = 0;
|
Lines.Length = 0;
|
||||||
OrgLines.Length = 0;
|
OrgLines.Length = 0;
|
||||||
bTextParsed = false;
|
bTextParsed = false;
|
||||||
}
|
}
|
||||||
final function string GetText()
|
final function string GetText()
|
||||||
{
|
{
|
||||||
return Text;
|
return Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function ParseTextLines()
|
final function ParseTextLines()
|
||||||
{
|
{
|
||||||
local array<string> SA;
|
local array<string> SA;
|
||||||
local int i,j,z;
|
local int i,j,z;
|
||||||
local string S;
|
local string S;
|
||||||
local color C;
|
local color C;
|
||||||
local ETextFieldStyles TextType;
|
local ETextFieldStyles TextType;
|
||||||
|
|
||||||
ParseStringIntoArray(Text,SA,LineSplitter,false);
|
ParseStringIntoArray(Text,SA,LineSplitter,false);
|
||||||
Lines.Length = SA.Length;
|
Lines.Length = SA.Length;
|
||||||
C.A = 0;
|
C.A = 0;
|
||||||
TextType = TEXT_FIELD_NONE;
|
TextType = TEXT_FIELD_NONE;
|
||||||
for( i=0; i<SA.Length; ++i )
|
for( i=0; i<SA.Length; ++i )
|
||||||
{
|
{
|
||||||
Lines[i].Text.Length = 0;
|
Lines[i].Text.Length = 0;
|
||||||
|
|
||||||
S = SA[i];
|
|
||||||
if( S=="" )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
z = 0;
|
|
||||||
while( true )
|
|
||||||
{
|
|
||||||
j = InStr(S,"#{");
|
|
||||||
if( j>0 )
|
|
||||||
{
|
|
||||||
Lines[i].Text.Length = z+1;
|
|
||||||
Lines[i].Text[z].S = Left(S,j);
|
|
||||||
Lines[i].Text[z].C = C;
|
|
||||||
Lines[i].Text[z].TextType = TextType;
|
|
||||||
++z;
|
|
||||||
}
|
|
||||||
else if( j==-1 )
|
|
||||||
break;
|
|
||||||
|
|
||||||
S = Mid(S,j+2);
|
S = SA[i];
|
||||||
if( Left(S,4)=="DEF}" )
|
if( S=="" )
|
||||||
{
|
continue;
|
||||||
C.A = 0;
|
|
||||||
S = Mid(S,4);
|
z = 0;
|
||||||
TextType = TEXT_FIELD_NONE;
|
while( true )
|
||||||
}
|
{
|
||||||
else if( Left(S,4)=="HSV}" )
|
j = InStr(S,"#{");
|
||||||
{
|
if( j>0 )
|
||||||
C.A = 0;
|
{
|
||||||
S = Mid(S,4);
|
Lines[i].Text.Length = z+1;
|
||||||
TextType = TEXT_FIELD_HSV;
|
Lines[i].Text[z].S = Left(S,j);
|
||||||
}
|
Lines[i].Text[z].C = C;
|
||||||
else if( Left(S,6)=="FLASH}" )
|
Lines[i].Text[z].TextType = TextType;
|
||||||
{
|
++z;
|
||||||
C.A = 0;
|
}
|
||||||
S = Mid(S,6);
|
else if( j==-1 )
|
||||||
TextType = TEXT_FIELD_FLASH;
|
break;
|
||||||
}
|
|
||||||
else if( Left(S,7)=="CFLASH=" )
|
S = Mid(S,j+2);
|
||||||
{
|
if( Left(S,4)=="DEF}" )
|
||||||
C.A = 0;
|
{
|
||||||
S = Mid(S,7);
|
C.A = 0;
|
||||||
TextType = TEXT_FIELD_FLASH;
|
S = Mid(S,4);
|
||||||
|
TextType = TEXT_FIELD_NONE;
|
||||||
C.R = GrabHexValue(Mid(S,0,2));
|
}
|
||||||
C.G = GrabHexValue(Mid(S,2,2));
|
else if( Left(S,4)=="HSV}" )
|
||||||
C.B = GrabHexValue(Mid(S,4,2));
|
{
|
||||||
S = Mid(S,7);
|
C.A = 0;
|
||||||
C.A = 255;
|
S = Mid(S,4);
|
||||||
}
|
TextType = TEXT_FIELD_HSV;
|
||||||
else
|
}
|
||||||
{
|
else if( Left(S,6)=="FLASH}" )
|
||||||
C.R = GrabHexValue(Mid(S,0,2));
|
{
|
||||||
C.G = GrabHexValue(Mid(S,2,2));
|
C.A = 0;
|
||||||
C.B = GrabHexValue(Mid(S,4,2));
|
S = Mid(S,6);
|
||||||
S = Mid(S,7);
|
TextType = TEXT_FIELD_FLASH;
|
||||||
C.A = 255;
|
}
|
||||||
TextType = TEXT_FIELD_NONE;
|
else if( Left(S,7)=="CFLASH=" )
|
||||||
}
|
{
|
||||||
}
|
C.A = 0;
|
||||||
Lines[i].Text.Length = z+1;
|
S = Mid(S,7);
|
||||||
Lines[i].Text[z].S = S;
|
TextType = TEXT_FIELD_FLASH;
|
||||||
Lines[i].Text[z].C = C;
|
|
||||||
Lines[i].Text[z].TextType = TextType;
|
C.R = GrabHexValue(Mid(S,0,2));
|
||||||
}
|
C.G = GrabHexValue(Mid(S,2,2));
|
||||||
OrgLines = Lines; // Create a backup.
|
C.B = GrabHexValue(Mid(S,4,2));
|
||||||
|
S = Mid(S,7);
|
||||||
|
C.A = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
C.R = GrabHexValue(Mid(S,0,2));
|
||||||
|
C.G = GrabHexValue(Mid(S,2,2));
|
||||||
|
C.B = GrabHexValue(Mid(S,4,2));
|
||||||
|
S = Mid(S,7);
|
||||||
|
C.A = 255;
|
||||||
|
TextType = TEXT_FIELD_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Lines[i].Text.Length = z+1;
|
||||||
|
Lines[i].Text[z].S = S;
|
||||||
|
Lines[i].Text[z].C = C;
|
||||||
|
Lines[i].Text[z].TextType = TextType;
|
||||||
|
}
|
||||||
|
OrgLines = Lines; // Create a backup.
|
||||||
}
|
}
|
||||||
final function byte GrabHexValue( string S )
|
final function byte GrabHexValue( string S )
|
||||||
{
|
{
|
||||||
local byte n;
|
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);
|
S = Mid(S,2);
|
||||||
return n;
|
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;
|
return n-48;
|
||||||
if( n>=65 && n<=70 ) // 'A' - 'F'
|
if( n>=65 && n<=70 ) // 'A' - 'F'
|
||||||
return n-55; // 'A' - 10
|
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 n-87; // 'a' - 10
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitSize()
|
function InitSize()
|
||||||
{
|
{
|
||||||
local byte i;
|
local byte i;
|
||||||
local float XS;
|
local float XS;
|
||||||
local int MaxScrollRange;
|
local int MaxScrollRange;
|
||||||
|
|
||||||
if( Canvas == None )
|
if( Canvas == None )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OldSize[0] = CompPos[2];
|
|
||||||
OldSize[1] = CompPos[3];
|
|
||||||
if( !bTextParsed )
|
|
||||||
{
|
|
||||||
ParseTextLines();
|
|
||||||
bTextParsed = true;
|
|
||||||
}
|
|
||||||
else Lines = OrgLines;
|
|
||||||
|
|
||||||
InitFont = Owner.CurrentStyle.PickFont(InitFontScale);
|
OldSize[0] = CompPos[2];
|
||||||
InitFontScale *= FontScale;
|
OldSize[1] = CompPos[3];
|
||||||
|
if( !bTextParsed )
|
||||||
// Compute Y-offsets of each line.
|
{
|
||||||
Canvas.Font = InitFont;
|
ParseTextLines();
|
||||||
Canvas.TextSize("ABC",XS,TextHeight,InitFontScale,InitFontScale);
|
bTextParsed = true;
|
||||||
|
}
|
||||||
|
else Lines = OrgLines;
|
||||||
|
|
||||||
ParseLines(CompPos[2] / InitFontScale);
|
InitFont = Owner.CurrentStyle.PickFont(InitFontScale);
|
||||||
MaxHeight = (Lines.Length * TextHeight);
|
InitFontScale *= FontScale;
|
||||||
bShowScrollbar = (MaxHeight>=CompPos[3]);
|
|
||||||
bClickable = bShowScrollbar;
|
|
||||||
bCanFocus = bShowScrollbar;
|
|
||||||
|
|
||||||
if( bShowScrollbar )
|
|
||||||
{
|
|
||||||
if( ScrollBar==None )
|
|
||||||
{
|
|
||||||
ScrollBar = new(Self) class'KFGUI_ScrollBarV';
|
|
||||||
ScrollBar.SetPosition(0.9,0.0,0.1,1.0);
|
|
||||||
ScrollBar.Owner = Owner;
|
|
||||||
ScrollBar.ParentComponent = Self;
|
|
||||||
ScrollBar.InitMenu();
|
|
||||||
ScrollBar.SetVisibility(bVisible);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute scrollbar size and X-position.
|
|
||||||
for( i=0; i<4; ++i )
|
|
||||||
ScrollBar.InputPos[i] = CompPos[i];
|
|
||||||
ScrollWidth = ScrollBar.GetWidth();
|
|
||||||
ScrollBar.XPosition = 1.f - ScrollWidth;
|
|
||||||
ScrollWidth *= CompPos[2];
|
|
||||||
|
|
||||||
ScrollBar.ComputeCoords();
|
// Compute Y-offsets of each line.
|
||||||
|
Canvas.Font = InitFont;
|
||||||
|
Canvas.TextSize("ABC",XS,TextHeight,InitFontScale,InitFontScale);
|
||||||
|
|
||||||
// Recompute line sizes because we now have a scrollbar.
|
ParseLines(CompPos[2] / InitFontScale);
|
||||||
Lines = OrgLines;
|
MaxHeight = (Lines.Length * TextHeight);
|
||||||
ParseLines((CompPos[2]-ScrollWidth) / InitFontScale);
|
bShowScrollbar = (MaxHeight>=CompPos[3]);
|
||||||
|
bClickable = bShowScrollbar;
|
||||||
|
bCanFocus = bShowScrollbar;
|
||||||
|
|
||||||
if( Components.Find(ScrollBar)==-1 )
|
if( bShowScrollbar )
|
||||||
Components.AddItem(ScrollBar);
|
{
|
||||||
MaxHeight = (Lines.Length * TextHeight);
|
if( ScrollBar==None )
|
||||||
MaxScrollRange = Max(((MaxHeight-CompPos[3])/TextHeight),1);
|
{
|
||||||
ScrollBar.UpdateScrollSize(bNoReset ? MaxScrollRange : 0,MaxScrollRange,1,1);
|
ScrollBar = new(Self) class'KFGUI_ScrollBarV';
|
||||||
}
|
ScrollBar.SetPosition(0.9,0.0,0.1,1.0);
|
||||||
else if( ScrollBar!=None )
|
ScrollBar.Owner = Owner;
|
||||||
Components.RemoveItem(ScrollBar);
|
ScrollBar.ParentComponent = Self;
|
||||||
|
ScrollBar.InitMenu();
|
||||||
|
ScrollBar.SetVisibility(bVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute scrollbar size and X-position.
|
||||||
|
for( i=0; i<4; ++i )
|
||||||
|
ScrollBar.InputPos[i] = CompPos[i];
|
||||||
|
ScrollWidth = ScrollBar.GetWidth();
|
||||||
|
ScrollBar.XPosition = 1.f - ScrollWidth;
|
||||||
|
ScrollWidth *= CompPos[2];
|
||||||
|
|
||||||
|
ScrollBar.ComputeCoords();
|
||||||
|
|
||||||
|
// Recompute line sizes because we now have a scrollbar.
|
||||||
|
Lines = OrgLines;
|
||||||
|
ParseLines((CompPos[2]-ScrollWidth) / InitFontScale);
|
||||||
|
|
||||||
|
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 )
|
||||||
|
Components.RemoveItem(ScrollBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse textlines to see if they're too long.
|
// 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 float X,XS,YS;
|
||||||
local int i,j,z,n;
|
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;
|
Lines[i].Y = i*TextHeight;
|
||||||
X = 0.f;
|
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);
|
Lines[i].Text[j].X = (X*InitFontScale);
|
||||||
Canvas.TextSize(Lines[i].Text[j].S,XS,YS);
|
Canvas.TextSize(Lines[i].Text[j].S,XS,YS);
|
||||||
|
|
||||||
if( (X+XS)>ClipX )
|
|
||||||
{
|
|
||||||
z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX);
|
|
||||||
|
|
||||||
// Add new line.
|
if( (X+XS)>ClipX )
|
||||||
Lines.Insert(i+1,1);
|
{
|
||||||
|
z = FindSplitPoint(Lines[i].Text[j].S,X,ClipX);
|
||||||
// Append the remaining lines there.
|
|
||||||
for( n=j; n<Lines[i].Text.Length; ++n )
|
// Add new line.
|
||||||
Lines[i+1].Text.AddItem(Lines[i].Text[n]);
|
Lines.Insert(i+1,1);
|
||||||
|
|
||||||
// Split the string at wrapping point.
|
// Append the remaining lines there.
|
||||||
Lines[i+1].Text[0].S = Mid(Lines[i].Text[j].S,z);
|
for( n=j; n<Lines[i].Text.Length; ++n )
|
||||||
|
Lines[i+1].Text.AddItem(Lines[i].Text[n]);
|
||||||
// Remove whitespaces in front of the string.
|
|
||||||
Lines[i+1].Text[0].S = StripWhiteSpaces(Lines[i+1].Text[0].S);
|
// Split the string at wrapping point.
|
||||||
|
Lines[i+1].Text[0].S = Mid(Lines[i].Text[j].S,z);
|
||||||
// If empty, clean it up.
|
|
||||||
if( Lines[i+1].Text[0].S=="" )
|
// Remove whitespaces in front of the string.
|
||||||
Lines[i+1].Text.Remove(0,1);
|
Lines[i+1].Text[0].S = StripWhiteSpaces(Lines[i+1].Text[0].S);
|
||||||
|
|
||||||
// End the current line at wrapping point.
|
// If empty, clean it up.
|
||||||
Lines[i].Text[j].S = Left(Lines[i].Text[j].S,z);
|
if( Lines[i+1].Text[0].S=="" )
|
||||||
Lines[i].Text.Length = j+1;
|
Lines[i+1].Text.Remove(0,1);
|
||||||
break;
|
|
||||||
}
|
// End the current line at wrapping point.
|
||||||
X+=XS;
|
Lines[i].Text[j].S = Left(Lines[i].Text[j].S,z);
|
||||||
}
|
Lines[i].Text.Length = j+1;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
X+=XS;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow, find wrapped splitting point in text.
|
// 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 int i,l,PrevWord;
|
||||||
local float XL,YL;
|
local float XL,YL;
|
||||||
local bool bWasWhite,bStartedZero;
|
local bool bWasWhite,bStartedZero;
|
||||||
|
|
||||||
bStartedZero = (X==0.f);
|
bStartedZero = (X==0.f);
|
||||||
Canvas.TextSize(Mid(S,0,1),XL,YL);
|
Canvas.TextSize(Mid(S,0,1),XL,YL);
|
||||||
X += XL;
|
X += XL;
|
||||||
i = 1;
|
i = 1;
|
||||||
l = Len(S);
|
l = Len(S);
|
||||||
PrevWord = 0;
|
PrevWord = 0;
|
||||||
bWasWhite = true;
|
bWasWhite = true;
|
||||||
while( i<l )
|
while( i<l )
|
||||||
{
|
{
|
||||||
if( Mid(S,i,1)==" " )
|
if( Mid(S,i,1)==" " )
|
||||||
{
|
{
|
||||||
if( !bWasWhite )
|
if( !bWasWhite )
|
||||||
{
|
{
|
||||||
PrevWord = i;
|
PrevWord = i;
|
||||||
bWasWhite = true;
|
bWasWhite = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bWasWhite = false;
|
bWasWhite = false;
|
||||||
}
|
}
|
||||||
Canvas.TextSize(Mid(S,i,1),XL,YL);
|
Canvas.TextSize(Mid(S,i,1),XL,YL);
|
||||||
X+=XL;
|
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 (bStartedZero ? i : 0); // No wrap.
|
||||||
return PrevWord;
|
return PrevWord;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return l;
|
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);
|
S = Mid(S,1);
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
function byte GetCursorStyle()
|
function byte GetCursorStyle()
|
||||||
{
|
{
|
||||||
return `PEN_WHITE;
|
return `PEN_WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,j,Index;
|
local int i,j,Index;
|
||||||
local float Y;
|
local float Y;
|
||||||
|
|
||||||
if( Text=="" || !bVisible )
|
if( Text=="" || !bVisible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Need to figure out best fitting font.
|
// 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();
|
InitSize();
|
||||||
|
|
||||||
if( MaxHistory != 0 )
|
|
||||||
{
|
|
||||||
if( Lines.Length >= MaxHistory )
|
|
||||||
{
|
|
||||||
Index = InStr(Text, LineSplitter);
|
|
||||||
if( Index == INDEX_NONE )
|
|
||||||
Lines.Remove(0, 1);
|
|
||||||
else SetText(Mid(Text, Index+Len(LineSplitter)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.Font = InitFont;
|
if( MaxHistory != 0 )
|
||||||
|
{
|
||||||
|
if( Lines.Length >= MaxHistory )
|
||||||
|
{
|
||||||
|
Index = InStr(Text, LineSplitter);
|
||||||
|
if( Index == INDEX_NONE )
|
||||||
|
Lines.Remove(0, 1);
|
||||||
|
else SetText(Mid(Text, Index+Len(LineSplitter)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( bShowScrollbar )
|
Canvas.Font = InitFont;
|
||||||
{
|
|
||||||
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
|
if( bShowScrollbar )
|
||||||
i = ScrollBar.GetValue();
|
{
|
||||||
}
|
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
|
||||||
else i = 0;
|
i = ScrollBar.GetValue();
|
||||||
|
}
|
||||||
if( i<Lines.Length )
|
else i = 0;
|
||||||
{
|
|
||||||
Y = Lines[i].Y;
|
if( i<Lines.Length )
|
||||||
for( i=i; i<Lines.Length; ++i )
|
{
|
||||||
{
|
Y = Lines[i].Y;
|
||||||
if( Lines[i].Text.Length!=0 )
|
for( i=i; i<Lines.Length; ++i )
|
||||||
{
|
{
|
||||||
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
|
if( Lines[i].Text.Length!=0 )
|
||||||
break;
|
{
|
||||||
|
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
|
||||||
for( j=0; j<Lines[i].Text.Length; ++j )
|
break;
|
||||||
{
|
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawTextField(string S, int Index, float X, float Y, optional Color C, optional ETextFieldStyles TextStyle)
|
function DrawTextField(string S, int Index, float X, float Y, optional Color C, optional ETextFieldStyles TextStyle)
|
||||||
{
|
{
|
||||||
local float TempSize;
|
local float TempSize;
|
||||||
local int FadeAlpha;
|
local int FadeAlpha;
|
||||||
local Color MainColor;
|
local Color MainColor;
|
||||||
|
|
||||||
MainColor = C;
|
|
||||||
if( MainColor.A==0 )
|
|
||||||
MainColor = TextColor;
|
|
||||||
|
|
||||||
Canvas.DrawColor = GetColorFromStyle(MainColor, TextStyle);
|
|
||||||
|
|
||||||
if( bFadeInOut )
|
|
||||||
{
|
|
||||||
TempSize = `TimeSinceEx(GetPlayer(), FadeStartTime);
|
|
||||||
if ( TempSize > MessageDisplayTime )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( TempSize < MessageFadeInTime )
|
|
||||||
{
|
|
||||||
FadeAlpha = int((TempSize / MessageFadeInTime) * 255.0);
|
|
||||||
}
|
|
||||||
else if ( TempSize > MessageDisplayTime - MessageFadeOutTime )
|
|
||||||
{
|
|
||||||
FadeAlpha = int((1.0 - ((TempSize - (MessageDisplayTime - MessageFadeOutTime)) / MessageFadeOutTime)) * 255.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FadeAlpha = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
Canvas.DrawColor.A = FadeAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( bUseOutlineText )
|
MainColor = C;
|
||||||
{
|
if( MainColor.A==0 )
|
||||||
Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale);
|
MainColor = TextColor;
|
||||||
}
|
|
||||||
else
|
Canvas.DrawColor = GetColorFromStyle(MainColor, TextStyle);
|
||||||
{
|
|
||||||
Canvas.SetPos(X,Y);
|
if( bFadeInOut )
|
||||||
Canvas.DrawText(S,,InitFontScale,InitFontScale,TextFontInfo);
|
{
|
||||||
}
|
TempSize = `TimeSinceEx(GetPlayer(), FadeStartTime);
|
||||||
|
if ( TempSize > MessageDisplayTime )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( TempSize < MessageFadeInTime )
|
||||||
|
{
|
||||||
|
FadeAlpha = int((TempSize / MessageFadeInTime) * 255.0);
|
||||||
|
}
|
||||||
|
else if ( TempSize > MessageDisplayTime - MessageFadeOutTime )
|
||||||
|
{
|
||||||
|
FadeAlpha = int((1.0 - ((TempSize - (MessageDisplayTime - MessageFadeOutTime)) / MessageFadeOutTime)) * 255.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FadeAlpha = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.DrawColor.A = FadeAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bUseOutlineText )
|
||||||
|
{
|
||||||
|
Owner.CurrentStyle.DrawTextShadow(S,X,Y,OutlineSize,InitFontScale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.SetPos(X,Y);
|
||||||
|
Canvas.DrawText(S,,InitFontScale,InitFontScale,TextFontInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle)
|
function Color GetColorFromStyle(Color MainColor, ETextFieldStyles TextStyle)
|
||||||
{
|
{
|
||||||
local float ColorHUE,Value;
|
local float ColorHUE,Value;
|
||||||
local HSVColour HSV;
|
local HSVColour HSV;
|
||||||
|
|
||||||
if( TextStyle == TEXT_FIELD_HSV )
|
if( TextStyle == TEXT_FIELD_HSV )
|
||||||
{
|
{
|
||||||
ColorHUE = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 335);
|
ColorHUE = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 335);
|
||||||
|
|
||||||
HSV.H = ColorHUE;
|
HSV.H = ColorHUE;
|
||||||
HSV.S = 1.f;
|
HSV.S = 1.f;
|
||||||
HSV.V = 1.f;
|
HSV.V = 1.f;
|
||||||
HSV.A = MainColor.A / 255;
|
HSV.A = MainColor.A / 255;
|
||||||
|
|
||||||
return class'KFColorHelper'.static.LinearColorToColor(class'KFColorHelper'.static.HSVToRGB(HSV));
|
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);
|
Value = Abs(Sin(GetPlayer().WorldInfo.TimeSeconds * 0.9) * 1);
|
||||||
HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor));
|
HSV = class'KFColorHelper'.static.RGBToHSV(ColorToLinearColor(MainColor));
|
||||||
HSV.V = Value;
|
HSV.V = Value;
|
||||||
|
|
||||||
return class'KFColorHelper'.static.LinearColorToColor(class'KFColorHelper'.static.HSVToRGB(HSV));
|
return class'KFColorHelper'.static.LinearColorToColor(class'KFColorHelper'.static.HSVToRGB(HSV));
|
||||||
}
|
}
|
||||||
|
|
||||||
return MainColor;
|
return MainColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope.
|
return (bShowScrollbar ? Super.CaptureMouse() : false); // Nope.
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
if( bShowScrollbar )
|
if( bShowScrollbar )
|
||||||
ScrollBar.ScrollMouseWheel(bUp);
|
ScrollBar.ScrollMouseWheel(bUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetVisibility(bool Visible)
|
function SetVisibility(bool Visible)
|
||||||
{
|
{
|
||||||
Super.SetVisibility(Visible);
|
Super.SetVisibility(Visible);
|
||||||
|
|
||||||
if( ScrollBar != None )
|
if( ScrollBar != None )
|
||||||
{
|
{
|
||||||
ScrollBar.SetVisibility(Visible);
|
ScrollBar.SetVisibility(Visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bNoReset=false
|
bNoReset=false
|
||||||
LineSplitter="|"
|
LineSplitter="|"
|
||||||
FontScale=1
|
FontScale=1
|
||||||
MaxHistory=0
|
MaxHistory=0
|
||||||
OutlineSize=1
|
OutlineSize=1
|
||||||
Text="TextField"
|
Text="TextField"
|
||||||
TextColor=(R=255,G=255,B=255,A=255)
|
TextColor=(R=255,G=255,B=255,A=255)
|
||||||
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
||||||
bCanFocus=false
|
bCanFocus=false
|
||||||
bClickable=false
|
bClickable=false
|
||||||
bUseOutlineText=false
|
bUseOutlineText=false
|
||||||
}
|
}
|
@ -13,108 +13,108 @@ var transient float OldSize[2],InitOffset[2],InitFontScale;
|
|||||||
|
|
||||||
function InitSize()
|
function InitSize()
|
||||||
{
|
{
|
||||||
local float XL,YL,TS;
|
local float XL,YL,TS;
|
||||||
|
|
||||||
OldSize[0] = CompPos[2];
|
OldSize[0] = CompPos[2];
|
||||||
OldSize[1] = CompPos[3];
|
OldSize[1] = CompPos[3];
|
||||||
|
|
||||||
TS = Owner.CurrentStyle.GetFontScaler();
|
TS = Owner.CurrentStyle.GetFontScaler();
|
||||||
TS *= FontScale;
|
TS *= FontScale;
|
||||||
|
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
Canvas.Font = Owner.CurrentStyle.MainFont;
|
Canvas.Font = Owner.CurrentStyle.MainFont;
|
||||||
if( TextFontInfo.bClipText )
|
if( TextFontInfo.bClipText )
|
||||||
Canvas.TextSize(Text,XL,YL,TS,TS);
|
Canvas.TextSize(Text,XL,YL,TS,TS);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.SetPos(0,0);
|
Canvas.SetPos(0,0);
|
||||||
if( TS==1 )
|
if( TS==1 )
|
||||||
Canvas.StrLen(Text,XL,YL);
|
Canvas.StrLen(Text,XL,YL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.SetClip(CompPos[2]/TS,CompPos[3]); // Hacky, since StrLen has no TextSize support.
|
Canvas.SetClip(CompPos[2]/TS,CompPos[3]); // Hacky, since StrLen has no TextSize support.
|
||||||
Canvas.StrLen(Text,XL,YL);
|
Canvas.StrLen(Text,XL,YL);
|
||||||
XL*=TS;
|
XL*=TS;
|
||||||
YL*=TS;
|
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;
|
break;
|
||||||
|
|
||||||
TS -= 0.001;
|
TS -= 0.001;
|
||||||
}
|
}
|
||||||
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
||||||
InitFont = Canvas.Font;
|
InitFont = Canvas.Font;
|
||||||
InitFontScale = TS;
|
InitFontScale = TS;
|
||||||
|
|
||||||
switch( AlignX )
|
switch( AlignX )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
InitOffset[0] = 0;
|
InitOffset[0] = 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
InitOffset[0] = FMax((CompPos[2]-XL)*0.5,0.f);
|
InitOffset[0] = FMax((CompPos[2]-XL)*0.5,0.f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InitOffset[0] = CompPos[2]-(XL+1);
|
InitOffset[0] = CompPos[2]-(XL+1);
|
||||||
}
|
}
|
||||||
switch( AlignY )
|
switch( AlignY )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
InitOffset[1] = 0;
|
InitOffset[1] = 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
InitOffset[1] = FMax((CompPos[3]-YL)*0.5,0.f);
|
InitOffset[1] = FMax((CompPos[3]-YL)*0.5,0.f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InitOffset[1] = CompPos[3]-YL;
|
InitOffset[1] = CompPos[3]-YL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function SetText( string S )
|
function SetText( string S )
|
||||||
{
|
{
|
||||||
if( Text==S )
|
if( Text==S )
|
||||||
return;
|
return;
|
||||||
Text = S;
|
Text = S;
|
||||||
OldSize[0] = -1; // Force to refresh.
|
OldSize[0] = -1; // Force to refresh.
|
||||||
}
|
}
|
||||||
final function string GetText()
|
final function string GetText()
|
||||||
{
|
{
|
||||||
return Text;
|
return Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
if( Text=="" )
|
if( Text=="" )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Need to figure out best fitting font.
|
// 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();
|
InitSize();
|
||||||
|
|
||||||
Canvas.Font = InitFont;
|
Canvas.Font = InitFont;
|
||||||
Canvas.DrawColor = TextColor;
|
Canvas.DrawColor = TextColor;
|
||||||
if( bUseOutline )
|
if( bUseOutline )
|
||||||
{
|
{
|
||||||
Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale);
|
Owner.CurrentStyle.DrawTextShadow(Text,InitOffset[0],InitOffset[1],OutlineSize,InitFontScale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas.SetPos(InitOffset[0],InitOffset[1]);
|
Canvas.SetPos(InitOffset[0],InitOffset[1]);
|
||||||
Canvas.DrawText(Text,,InitFontScale,InitFontScale,TextFontInfo);
|
Canvas.DrawText(Text,,InitFontScale,InitFontScale,TextFontInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
Text="Label"
|
Text="Label"
|
||||||
TextColor=(R=255,G=255,B=255,A=255)
|
TextColor=(R=255,G=255,B=255,A=255)
|
||||||
TextFontInfo=(bClipText=false,bEnableShadow=true)
|
TextFontInfo=(bClipText=false,bEnableShadow=true)
|
||||||
FontScale=1.f
|
FontScale=1.f
|
||||||
OutlineSize=1
|
OutlineSize=1
|
||||||
bCanFocus=false
|
bCanFocus=false
|
||||||
}
|
}
|
@ -9,177 +9,177 @@ var transient int MaxIndex, RowsDropped;
|
|||||||
|
|
||||||
function SetText( string S )
|
function SetText( string S )
|
||||||
{
|
{
|
||||||
Super.SetText(S);
|
Super.SetText(S);
|
||||||
|
|
||||||
MaxIndex = 0;
|
MaxIndex = 0;
|
||||||
RowsCompleted.Length = 0;
|
RowsCompleted.Length = 0;
|
||||||
RowsDropped = 0;
|
RowsDropped = 0;
|
||||||
|
|
||||||
bScrollCompleted = false;
|
bScrollCompleted = false;
|
||||||
bTextDirty = true;
|
bTextDirty = true;
|
||||||
CharStartTime = GetPlayer().WorldInfo.TimeSeconds;
|
CharStartTime = GetPlayer().WorldInfo.TimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local int i,j,k,SLen,CurrentIndex;
|
local int i,j,k,SLen,CurrentIndex;
|
||||||
local float Y, DTime, XL, YL, MainY, MainX, CharTime;
|
local float Y, DTime, XL, YL, MainY, MainX, CharTime;
|
||||||
local string MainString;
|
local string MainString;
|
||||||
local Color MainTextColor;
|
local Color MainTextColor;
|
||||||
local Texture CurrentCursor;
|
local Texture CurrentCursor;
|
||||||
local ETextFieldStyles TextStyle;
|
local ETextFieldStyles TextStyle;
|
||||||
|
|
||||||
if( bScrollCompleted )
|
if( bScrollCompleted )
|
||||||
{
|
{
|
||||||
Super.DrawMenu();
|
Super.DrawMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Text=="" )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Need to figure out best fitting font.
|
if( Text=="" )
|
||||||
if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] )
|
return;
|
||||||
InitSize();
|
|
||||||
|
|
||||||
Canvas.Font = InitFont;
|
// Need to figure out best fitting font.
|
||||||
|
if( OldSize[0]!=CompPos[2] || OldSize[1]!=CompPos[3] )
|
||||||
|
InitSize();
|
||||||
|
|
||||||
if( bShowScrollbar )
|
Canvas.Font = InitFont;
|
||||||
{
|
|
||||||
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
|
|
||||||
i = ScrollBar.GetValue();
|
|
||||||
}
|
|
||||||
else i = 0;
|
|
||||||
|
|
||||||
if( ScrollBar != None )
|
|
||||||
{
|
|
||||||
if( bTextDirty )
|
|
||||||
{
|
|
||||||
ScrollBar.bDisabled = true;
|
|
||||||
RowsCompleted.Length = Lines.Length;
|
|
||||||
bTextDirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( RowsCompleted[Lines.Length-1] )
|
|
||||||
{
|
|
||||||
ScrollBar.AddValue(1);
|
|
||||||
ScrollBar.bDisabled = false;
|
|
||||||
bScrollCompleted = true;
|
|
||||||
|
|
||||||
//Temp fix! The last line in the string seems to be skipped
|
|
||||||
AddText(LineSplitter);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if( MaxIndex != 0 && RowsCompleted[MaxIndex] )
|
|
||||||
{
|
|
||||||
MaxIndex = 0;
|
|
||||||
ScrollBar.AddValue(1);
|
|
||||||
|
|
||||||
RowsDropped++;
|
|
||||||
|
|
||||||
i = ScrollBar.GetValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( RowsDropped > 0 )
|
|
||||||
{
|
|
||||||
for( i=0; i<=RowsDropped; ++i )
|
|
||||||
{
|
|
||||||
for( j=0; j<Lines[i].Text.Length; ++j )
|
|
||||||
{
|
|
||||||
for( k=0; k<=Len(Lines[i].Text[j].S); ++k )
|
|
||||||
{
|
|
||||||
CharTime += ScrollSpeed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DTime = `TimeSinceEx(GetPlayer(), CharStartTime);
|
|
||||||
if( i<Lines.Length )
|
|
||||||
{
|
|
||||||
CurrentCursor = Owner.DefaultPens[GetCursorStyle()];
|
|
||||||
Y = Lines[i].Y;
|
|
||||||
for( i=i; i<Lines.Length; ++i )
|
|
||||||
{
|
|
||||||
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
|
|
||||||
{
|
|
||||||
MaxIndex = i-1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Lines[i].Text.Length!=0 )
|
|
||||||
{
|
|
||||||
for( j=0; j<Lines[i].Text.Length; ++j )
|
|
||||||
{
|
|
||||||
MainTextColor = Lines[i].Text[j].C;
|
|
||||||
if( MainTextColor.A==0 )
|
|
||||||
MainTextColor = TextColor;
|
|
||||||
|
|
||||||
TextStyle = Lines[i].Text[j].TextType;
|
|
||||||
|
|
||||||
MainX = Lines[i].Text[j].X;
|
|
||||||
MainY = Lines[i].Y-Y;
|
|
||||||
MainString = Lines[i].Text[j].S;
|
|
||||||
SLen = Len(MainString);
|
|
||||||
|
|
||||||
CurrentIndex = 0;
|
if( bShowScrollbar )
|
||||||
for( k=0; k<=SLen; ++k )
|
{
|
||||||
{
|
Canvas.SetClip(CompPos[0]+(CompPos[2]-ScrollWidth),CompPos[1]+CompPos[3]);
|
||||||
CharTime += ScrollSpeed;
|
i = ScrollBar.GetValue();
|
||||||
|
}
|
||||||
Canvas.TextSize(Mid(MainString, 0, k), XL, YL, InitFontScale, InitFontScale);
|
else i = 0;
|
||||||
|
|
||||||
if ( CharTime > DTime )
|
if( ScrollBar != None )
|
||||||
{
|
{
|
||||||
if( CurrentIndex == k )
|
if( bTextDirty )
|
||||||
{
|
{
|
||||||
Canvas.SetDrawColor(255,255,255,255);
|
ScrollBar.bDisabled = true;
|
||||||
Canvas.SetPos(MainX+XL,MainY);
|
RowsCompleted.Length = Lines.Length;
|
||||||
Canvas.DrawTile(CurrentCursor, YL/2, YL, 0, 0, CurrentCursor.GetSurfaceWidth(), CurrentCursor.GetSurfaceHeight());
|
bTextDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
if( RowsCompleted[Lines.Length-1] )
|
||||||
}
|
{
|
||||||
|
ScrollBar.AddValue(1);
|
||||||
Canvas.DrawColor = GetColorFromStyle(MainTextColor, TextStyle);
|
ScrollBar.bDisabled = false;
|
||||||
Canvas.SetPos(MainX+XL,MainY);
|
bScrollCompleted = true;
|
||||||
Canvas.DrawText(Mid(MainString, k, 1),,InitFontScale,InitFontScale,TextFontInfo);
|
|
||||||
|
//Temp fix! The last line in the string seems to be skipped
|
||||||
CurrentIndex = k+1;
|
AddText(LineSplitter);
|
||||||
|
|
||||||
if( k >= SLen )
|
return;
|
||||||
{
|
}
|
||||||
RowsCompleted[i] = true;
|
else if( MaxIndex != 0 && RowsCompleted[MaxIndex] )
|
||||||
}
|
{
|
||||||
}
|
MaxIndex = 0;
|
||||||
}
|
ScrollBar.AddValue(1);
|
||||||
}
|
|
||||||
}
|
RowsDropped++;
|
||||||
}
|
|
||||||
|
i = ScrollBar.GetValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( RowsDropped > 0 )
|
||||||
|
{
|
||||||
|
for( i=0; i<=RowsDropped; ++i )
|
||||||
|
{
|
||||||
|
for( j=0; j<Lines[i].Text.Length; ++j )
|
||||||
|
{
|
||||||
|
for( k=0; k<=Len(Lines[i].Text[j].S); ++k )
|
||||||
|
{
|
||||||
|
CharTime += ScrollSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DTime = `TimeSinceEx(GetPlayer(), CharStartTime);
|
||||||
|
if( i<Lines.Length )
|
||||||
|
{
|
||||||
|
CurrentCursor = Owner.DefaultPens[GetCursorStyle()];
|
||||||
|
Y = Lines[i].Y;
|
||||||
|
for( i=i; i<Lines.Length; ++i )
|
||||||
|
{
|
||||||
|
if( (Lines[i].Y-Y+TextHeight)>=CompPos[3] )
|
||||||
|
{
|
||||||
|
MaxIndex = i-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Lines[i].Text.Length!=0 )
|
||||||
|
{
|
||||||
|
for( j=0; j<Lines[i].Text.Length; ++j )
|
||||||
|
{
|
||||||
|
MainTextColor = Lines[i].Text[j].C;
|
||||||
|
if( MainTextColor.A==0 )
|
||||||
|
MainTextColor = TextColor;
|
||||||
|
|
||||||
|
TextStyle = Lines[i].Text[j].TextType;
|
||||||
|
|
||||||
|
MainX = Lines[i].Text[j].X;
|
||||||
|
MainY = Lines[i].Y-Y;
|
||||||
|
MainString = Lines[i].Text[j].S;
|
||||||
|
SLen = Len(MainString);
|
||||||
|
|
||||||
|
CurrentIndex = 0;
|
||||||
|
for( k=0; k<=SLen; ++k )
|
||||||
|
{
|
||||||
|
CharTime += ScrollSpeed;
|
||||||
|
|
||||||
|
Canvas.TextSize(Mid(MainString, 0, k), XL, YL, InitFontScale, InitFontScale);
|
||||||
|
|
||||||
|
if ( CharTime > DTime )
|
||||||
|
{
|
||||||
|
if( CurrentIndex == k )
|
||||||
|
{
|
||||||
|
Canvas.SetDrawColor(255,255,255,255);
|
||||||
|
Canvas.SetPos(MainX+XL,MainY);
|
||||||
|
Canvas.DrawTile(CurrentCursor, YL/2, YL, 0, 0, CurrentCursor.GetSurfaceWidth(), CurrentCursor.GetSurfaceHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas.DrawColor = GetColorFromStyle(MainTextColor, TextStyle);
|
||||||
|
Canvas.SetPos(MainX+XL,MainY);
|
||||||
|
Canvas.DrawText(Mid(MainString, k, 1),,InitFontScale,InitFontScale,TextFontInfo);
|
||||||
|
|
||||||
|
CurrentIndex = k+1;
|
||||||
|
|
||||||
|
if( k >= SLen )
|
||||||
|
{
|
||||||
|
RowsCompleted[i] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool CaptureMouse()
|
function bool CaptureMouse()
|
||||||
{
|
{
|
||||||
return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse();
|
return (!bScrollCompleted && Super(KFGUI_MultiComponent).CaptureMouse()) || Super.CaptureMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
if( bScrollCompleted )
|
if( bScrollCompleted )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( ScrollBar != None )
|
if( ScrollBar != None )
|
||||||
ScrollBar.bDisabled = false;
|
ScrollBar.bDisabled = false;
|
||||||
|
|
||||||
bScrollCompleted = true;
|
bScrollCompleted = true;
|
||||||
|
|
||||||
//Temp fix! The last line in the string seems to be skipped
|
//Temp fix! The last line in the string seems to be skipped
|
||||||
AddText(LineSplitter);
|
AddText(LineSplitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ScrollSpeed=0.01
|
ScrollSpeed=0.01
|
||||||
}
|
}
|
@ -6,37 +6,37 @@ var byte CurrentAlpha;
|
|||||||
|
|
||||||
function InputMouseMoved()
|
function InputMouseMoved()
|
||||||
{
|
{
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
}
|
}
|
||||||
function MouseClick( bool bRight )
|
function MouseClick( bool bRight )
|
||||||
{
|
{
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
}
|
}
|
||||||
function MouseRelease( bool bRight )
|
function MouseRelease( bool bRight )
|
||||||
{
|
{
|
||||||
DropInputFocus();
|
DropInputFocus();
|
||||||
}
|
}
|
||||||
function ShowMenu()
|
function ShowMenu()
|
||||||
{
|
{
|
||||||
CurrentAlpha = 1;
|
CurrentAlpha = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
final function SetText( string S )
|
final function SetText( string S )
|
||||||
{
|
{
|
||||||
ParseStringIntoArray(S,Lines,"<SEPERATOR>",false);
|
ParseStringIntoArray(S,Lines,"<SEPERATOR>",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreDraw()
|
function PreDraw()
|
||||||
{
|
{
|
||||||
if( !bVisible )
|
if( !bVisible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Owner.CurrentStyle.RenderToolTip(Self);
|
Owner.CurrentStyle.RenderToolTip(Self);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
TextFontInfo=(bClipText=true,bEnableShadow=true)
|
||||||
bCanFocus=false
|
bCanFocus=false
|
||||||
bFocusedPostDrawItem=true
|
bFocusedPostDrawItem=true
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
class KFScoreBoard extends KFGUI_Page;
|
class KFScoreBoard extends KFGUI_Page;
|
||||||
|
|
||||||
var transient float PerkXPos, PlayerXPos, StateXPos, TimeXPos, HealXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos;
|
var transient float StatusXPos, PerkXPos, PlayerXPos, HealthXPos, TimeXPos, KillsXPos, AssistXPos, CashXPos, DeathXPos, PingXPos;
|
||||||
|
var transient float StatusWBox, PlayerWBox, PerkWBox, CashWBox, KillsWBox, AssistWBox, HealthWBox, PingWBox;
|
||||||
var transient float NextScoreboardRefresh;
|
var transient float NextScoreboardRefresh;
|
||||||
|
|
||||||
var int PlayerIndex;
|
var int PlayerIndex;
|
||||||
@ -17,269 +18,294 @@ var float PingBars,IdealPing,MaxPing;
|
|||||||
|
|
||||||
function InitMenu()
|
function InitMenu()
|
||||||
{
|
{
|
||||||
Super.InitMenu();
|
Super.InitMenu();
|
||||||
PlayersList = KFGUI_List(FindComponentID('PlayerList'));
|
PlayersList = KFGUI_List(FindComponentID('PlayerList'));
|
||||||
OwnerPC = KFPlayerController(GetPlayer());
|
OwnerPC = KFPlayerController(GetPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC)
|
static function CheckAvatar(KFPlayerReplicationInfo KFPRI, KFPlayerController PC)
|
||||||
{
|
{
|
||||||
local Texture2D Avatar;
|
local Texture2D Avatar;
|
||||||
|
|
||||||
if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar )
|
if( KFPRI.Avatar == None || KFPRI.Avatar == default.DefaultAvatar )
|
||||||
{
|
{
|
||||||
Avatar = FindAvatar(PC, KFPRI.UniqueId);
|
Avatar = FindAvatar(PC, KFPRI.UniqueId);
|
||||||
if( Avatar == None )
|
if( Avatar == None )
|
||||||
Avatar = default.DefaultAvatar;
|
Avatar = default.DefaultAvatar;
|
||||||
|
|
||||||
KFPRI.Avatar = Avatar;
|
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;
|
return true;
|
||||||
|
|
||||||
if( P1.GetTeamNum() < P2.GetTeamNum() )
|
if( P1.GetTeamNum() < P2.GetTeamNum() )
|
||||||
return false;
|
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 true;
|
||||||
|
|
||||||
return P1.Assists < P2.Assists;
|
return P1.Assists < P2.Assists;
|
||||||
}
|
}
|
||||||
|
|
||||||
return P1.Kills < P2.Kills;
|
return P1.Kills < P2.Kills;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawMenu()
|
function DrawMenu()
|
||||||
{
|
{
|
||||||
local string S;
|
local string S;
|
||||||
local PlayerController PC;
|
local PlayerController PC;
|
||||||
local KFPlayerReplicationInfo KFPRI;
|
local KFPlayerReplicationInfo KFPRI;
|
||||||
local PlayerReplicationInfo PRI;
|
local PlayerReplicationInfo PRI;
|
||||||
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, DefFontHeight, BoxW, BoxX;
|
local float XPos, YPos, YL, XL, FontScalar, XPosCenter, DefFontHeight, BoxW, BoxX;
|
||||||
local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width;
|
local int i, j, NumSpec, NumPlayer, NumAlivePlayer, Width;
|
||||||
|
|
||||||
PC = GetPlayer();
|
PC = GetPlayer();
|
||||||
if( KFGRI==None )
|
if( KFGRI==None )
|
||||||
{
|
{
|
||||||
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
|
KFGRI = KFGameReplicationInfo(PC.WorldInfo.GRI);
|
||||||
if( KFGRI==None )
|
if( KFGRI==None )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort player list.
|
|
||||||
if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds )
|
|
||||||
{
|
|
||||||
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1;
|
|
||||||
|
|
||||||
for( i=(KFGRI.PRIArray.Length-1); i>0; --i )
|
|
||||||
{
|
|
||||||
for( j=i-1; j>=0; --j )
|
|
||||||
{
|
|
||||||
if( !InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])) )
|
|
||||||
{
|
|
||||||
PRI = KFGRI.PRIArray[i];
|
|
||||||
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
|
|
||||||
KFGRI.PRIArray[j] = PRI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check players.
|
// Sort player list.
|
||||||
PlayerIndex = -1;
|
if( NextScoreboardRefresh < PC.WorldInfo.TimeSeconds )
|
||||||
NumPlayer = 0;
|
{
|
||||||
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
|
NextScoreboardRefresh = PC.WorldInfo.TimeSeconds + 0.1;
|
||||||
{
|
|
||||||
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
|
||||||
if( KFPRI==None )
|
|
||||||
continue;
|
|
||||||
if( KFPRI.bOnlySpectator )
|
|
||||||
{
|
|
||||||
++NumSpec;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
|
||||||
if( KFPRI!=None && !KFPRI.bOnlySpectator )
|
|
||||||
{
|
|
||||||
KFPRIArray[--j] = KFPRI;
|
|
||||||
if( KFPRI==PC.PlayerReplicationInfo )
|
|
||||||
PlayerIndex = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Header font info.
|
for( i=(KFGRI.PRIArray.Length-1); i>0; --i )
|
||||||
Canvas.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
{
|
||||||
YL = Owner.CurrentStyle.DefaultHeight;
|
for( j=i-1; j>=0; --j )
|
||||||
DefFontHeight = YL;
|
{
|
||||||
|
if( !InOrder(KFPlayerReplicationInfo(KFGRI.PRIArray[i]),KFPlayerReplicationInfo(KFGRI.PRIArray[j])) )
|
||||||
|
{
|
||||||
|
PRI = KFGRI.PRIArray[i];
|
||||||
|
KFGRI.PRIArray[i] = KFGRI.PRIArray[j];
|
||||||
|
KFGRI.PRIArray[j] = PRI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XPosCenter = (Canvas.ClipX * 0.5);
|
// Check players.
|
||||||
|
PlayerIndex = -1;
|
||||||
// Server Name
|
NumPlayer = 0;
|
||||||
|
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
|
||||||
XPos = XPosCenter;
|
{
|
||||||
YPos += DefFontHeight;
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
||||||
|
if( KFPRI==None )
|
||||||
S = KFGRI.ServerName;
|
continue;
|
||||||
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
if( KFPRI.bOnlySpectator )
|
||||||
|
{
|
||||||
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
++NumSpec;
|
||||||
BoxX = XPos - (BoxW * 0.5);
|
continue;
|
||||||
Canvas.SetDrawColor(10, 10, 10, 200);
|
}
|
||||||
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
if( KFPRI.PlayerHealth>0 && KFPRI.PlayerHealthPercent>0 && KFPRI.GetTeamNum()==0 )
|
||||||
Canvas.SetDrawColor(250, 0, 0, 255);
|
++NumAlivePlayer;
|
||||||
|
++NumPlayer;
|
||||||
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
}
|
||||||
|
|
||||||
// Deficulty | Wave | MapName
|
KFPRIArray.Length = NumPlayer;
|
||||||
|
j = KFPRIArray.Length;
|
||||||
|
for( i=(KFGRI.PRIArray.Length-1); i>=0; --i )
|
||||||
|
{
|
||||||
|
KFPRI = KFPlayerReplicationInfo(KFGRI.PRIArray[i]);
|
||||||
|
if( KFPRI!=None && !KFPRI.bOnlySpectator )
|
||||||
|
{
|
||||||
|
KFPRIArray[--j] = KFPRI;
|
||||||
|
if( KFPRI==PC.PlayerReplicationInfo )
|
||||||
|
PlayerIndex = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XPos = XPosCenter;
|
// Header font info.
|
||||||
YPos += DefFontHeight+Owner.HUDOwner.ScaledBorderSize;
|
Canvas.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
||||||
|
YL = Owner.CurrentStyle.DefaultHeight;
|
||||||
|
DefFontHeight = YL;
|
||||||
|
|
||||||
S = Class'KFCommon_LocalizedStrings'.Static.GetDifficultyString (KFGRI.GameDifficulty) $" | "$class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString@KFGRI.WaveNum $" | " $class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true));
|
XPosCenter = (Canvas.ClipX * 0.5);
|
||||||
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
|
||||||
|
|
||||||
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
|
||||||
BoxX = XPos - (BoxW * 0.5);
|
|
||||||
Canvas.SetDrawColor(10, 10, 10, 200);
|
|
||||||
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
|
||||||
Canvas.SetDrawColor(0, 250, 0, 255);
|
|
||||||
|
|
||||||
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
|
||||||
|
|
||||||
// Players | Spectators | Alive | Time
|
|
||||||
|
|
||||||
XPos = XPosCenter;
|
// Server Name
|
||||||
YPos += DefFontHeight+Owner.HUDOwner.ScaledBorderSize;
|
|
||||||
|
|
||||||
S = " Players : " $ NumPlayer $ " | Spectators : " $ NumSpec $ " | Alive : " $ NumAlivePlayer $ " | Elapsed Time : " $ Owner.CurrentStyle.GetTimeString(KFGRI.ElapsedTime) $ " ";
|
|
||||||
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
|
||||||
|
|
||||||
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
|
||||||
BoxX = XPos - (BoxW * 0.5);
|
|
||||||
Canvas.SetDrawColor(10, 10, 10, 200);
|
|
||||||
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
|
||||||
Canvas.SetDrawColor(250, 250, 0, 255);
|
|
||||||
|
|
||||||
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
|
||||||
|
|
||||||
Width = Canvas.ClipX * 0.625;
|
|
||||||
|
|
||||||
XPos = (Canvas.ClipX - Width) * 0.5;
|
XPos = XPosCenter;
|
||||||
YPos += DefFontHeight * 2.0;
|
YPos += DefFontHeight;
|
||||||
|
|
||||||
Canvas.SetDrawColor (10, 10, 10, 200);
|
|
||||||
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Width, DefFontHeight, 4);
|
|
||||||
|
|
||||||
Canvas.SetDrawColor(250, 250, 250, 255);
|
S = KFGRI.ServerName;
|
||||||
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
||||||
|
|
||||||
// Calc X offsets
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
||||||
PerkXPos = Width * 0.01;
|
BoxX = XPos - (BoxW * 0.5);
|
||||||
PlayerXPos = Width * 0.2;
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
||||||
KillsXPos = Width * 0.5;
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
||||||
AssistXPos = Width * 0.6;
|
Canvas.SetDrawColor(250, 0, 0, 255);
|
||||||
CashXPos = Width * 0.7;
|
|
||||||
StateXPos = Width * 0.8;
|
|
||||||
PingXPos = Width * 0.92;
|
|
||||||
|
|
||||||
// Header texts
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
||||||
Canvas.SetPos (XPos + PerkXPos, YPos);
|
|
||||||
Canvas.DrawText (class'KFGFxMenu_Inventory'.default.PerkFilterString, , FontScalar, FontScalar);
|
|
||||||
|
|
||||||
Canvas.SetPos (XPos + KillsXPos, YPos);
|
// Deficulty | Wave | MapName
|
||||||
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.KillsString, , FontScalar, FontScalar);
|
|
||||||
|
|
||||||
Canvas.SetPos (XPos + AssistXPos, YPos);
|
XPos = XPosCenter;
|
||||||
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, , FontScalar, FontScalar);
|
YPos += DefFontHeight+Owner.HUDOwner.ScaledBorderSize;
|
||||||
|
|
||||||
Canvas.SetPos (XPos + CashXPos, YPos);
|
S = Class'KFCommon_LocalizedStrings'.Static.GetDifficultyString (KFGRI.GameDifficulty) $" | "$class'KFGFxHUD_ScoreboardMapInfoContainer'.default.WaveString@KFGRI.WaveNum $" | " $class'KFCommon_LocalizedStrings'.static.GetFriendlyMapName(PC.WorldInfo.GetMapName(true));
|
||||||
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.DoshString, , FontScalar, FontScalar);
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
||||||
|
|
||||||
Canvas.SetPos (XPos + StateXPos, YPos);
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
||||||
Canvas.DrawText ("STATE", , FontScalar, FontScalar);
|
BoxX = XPos - (BoxW * 0.5);
|
||||||
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
||||||
Canvas.SetPos (XPos + PlayerXPos, YPos);
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
||||||
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, , FontScalar, FontScalar);
|
Canvas.SetDrawColor(0, 250, 0, 255);
|
||||||
|
|
||||||
Canvas.SetPos (XPos + PingXPos, YPos);
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
||||||
Canvas.DrawText (class'KFGFxHUD_ScoreboardWidget'.default.PingString, , FontScalar, FontScalar);
|
|
||||||
|
|
||||||
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
|
// Players | Spectators | Alive | Time
|
||||||
PlayersList.YPosition = (YPos + (YL + 4)) / InputPos[3];
|
|
||||||
PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15;
|
XPos = XPosCenter;
|
||||||
|
YPos += DefFontHeight+Owner.HUDOwner.ScaledBorderSize;
|
||||||
PlayersList.ChangeListSize(KFPRIArray.Length);
|
|
||||||
|
S = " Players : " $ NumPlayer $ " | Spectators : " $ NumSpec $ " | Alive : " $ NumAlivePlayer $ " | Elapsed Time : " $ Owner.CurrentStyle.GetTimeString(KFGRI.ElapsedTime) $ " ";
|
||||||
|
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
|
||||||
|
|
||||||
|
BoxW = XL + (Owner.HUDOwner.ScaledBorderSize*4);
|
||||||
|
BoxX = XPos - (BoxW * 0.5);
|
||||||
|
Canvas.SetDrawColor(10, 10, 10, 200);
|
||||||
|
Owner.CurrentStyle.DrawRectBox(BoxX, YPos, BoxW, DefFontHeight, 4);
|
||||||
|
Canvas.SetDrawColor(250, 250, 0, 255);
|
||||||
|
|
||||||
|
Owner.CurrentStyle.DrawTextShadow(S, BoxX + ((BoxW-XL) * 0.5f), YPos + ((DefFontHeight-YL) * 0.5f), 1, FontScalar);
|
||||||
|
|
||||||
|
Width = Canvas.ClipX * 0.625;
|
||||||
|
|
||||||
|
XPos = (Canvas.ClipX - Width) * 0.5;
|
||||||
|
YPos += DefFontHeight * 2.0;
|
||||||
|
|
||||||
|
Canvas.SetDrawColor (10, 10, 10, 200);
|
||||||
|
Owner.CurrentStyle.DrawRectBox(XPos, YPos, Width, DefFontHeight, 4);
|
||||||
|
|
||||||
|
Canvas.SetDrawColor(250, 250, 250, 255);
|
||||||
|
|
||||||
|
// Calc X offsets
|
||||||
|
StatusXPos = Width * 0.01;
|
||||||
|
PlayerXPos = Width * 0.20;
|
||||||
|
PerkXPos = Width * 0.40;
|
||||||
|
CashXPos = Width * 0.57;
|
||||||
|
KillsXPos = Width * 0.66;
|
||||||
|
AssistXPos = Width * 0.75;
|
||||||
|
HealthXPos = Width * 0.84;
|
||||||
|
PingXPos = Width * 0.93;
|
||||||
|
|
||||||
|
StatusWBox = PlayerXPos - StatusXPos;
|
||||||
|
PlayerWBox = PerkXPos - PlayerXPos;
|
||||||
|
PerkWBox = CashXPos - PerkXPos;
|
||||||
|
CashWBox = KillsXPos - CashXPos;
|
||||||
|
KillsWBox = AssistXPos - KillsXPos;
|
||||||
|
AssistWBox = HealthXPos - AssistXPos;
|
||||||
|
HealthWBox = PingXPos - HealthXPos;
|
||||||
|
PingWBox = Width - PingXPos;
|
||||||
|
|
||||||
|
// Header texts
|
||||||
|
DrawTextWLeft("STATUS", XPos + StatusXPos, YPos, FontScalar);
|
||||||
|
DrawTextWLeft(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, FontScalar);
|
||||||
|
DrawTextWLeft(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, FontScalar);
|
||||||
|
DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, FontScalar);
|
||||||
|
DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, FontScalar);
|
||||||
|
DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + CashXPos, YPos, CashWBox, FontScalar);
|
||||||
|
DrawTextWCenter("HEALTH", XPos + HealthXPos, YPos, HealthWBox, FontScalar);
|
||||||
|
DrawTextWCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, FontScalar);
|
||||||
|
|
||||||
|
PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2];
|
||||||
|
PlayersList.YPosition = (YPos + (YL + 4)) / InputPos[3];
|
||||||
|
PlayersList.YSize = (1.f - PlayersList.YPosition) - 0.15;
|
||||||
|
|
||||||
|
PlayersList.ChangeListSize(KFPRIArray.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawTextWCenter(string Str, float XPos, float YPos, float BoxWidth, float FontScalar)
|
||||||
|
{
|
||||||
|
local float TextWidth;
|
||||||
|
local float TextHeight;
|
||||||
|
|
||||||
|
Canvas.TextSize(Str, TextWidth, TextHeight, FontScalar, FontScalar);
|
||||||
|
|
||||||
|
Canvas.SetPos(XPos + (BoxWidth - TextWidth)/2 , YPos);
|
||||||
|
Canvas.DrawText(Str, , FontScalar, FontScalar);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawTextWLeft(string Str, float XPos, float YPos, float FontScalar)
|
||||||
|
{
|
||||||
|
Canvas.SetPos(XPos, YPos);
|
||||||
|
Canvas.DrawText(Str, , FontScalar, FontScalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 string S, StrValue;
|
||||||
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
|
local float FontScalar, TextYOffset, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
|
||||||
local KFPlayerReplicationInfo KFPRI;
|
local KFPlayerReplicationInfo KFPRI;
|
||||||
local byte Level, PrestigeLevel;
|
local byte Level, PrestigeLevel;
|
||||||
local bool bIsZED;
|
local bool bIsZED;
|
||||||
local int Ping;
|
local int Ping;
|
||||||
|
|
||||||
YOffset *= 1.05;
|
|
||||||
KFPRI = KFPRIArray[Index];
|
|
||||||
|
|
||||||
if( KFGRI.bVersusGame )
|
|
||||||
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
|
|
||||||
|
|
||||||
C.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
|
||||||
|
|
||||||
TextYOffset = YOffset + (Height * 0.5f) - (Owner.CurrentStyle.DefaultHeight * 0.5f);
|
|
||||||
if (PlayerIndex == Index)
|
|
||||||
C.SetDrawColor (51, 30, 101, 150);
|
|
||||||
else C.SetDrawColor (30, 30, 30, 150);
|
|
||||||
|
|
||||||
Owner.CurrentStyle.DrawRectBox(0.f, YOffset, Width, Height, 4);
|
|
||||||
|
|
||||||
C.SetDrawColor(250,250,250,255);
|
|
||||||
|
|
||||||
// Perk
|
YOffset *= 1.05;
|
||||||
if( bIsZED )
|
KFPRI = KFPRIArray[Index];
|
||||||
{
|
|
||||||
C.SetDrawColor(255,0,0,255);
|
if( KFGRI.bVersusGame )
|
||||||
C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f));
|
bIsZED = KFTeamInfo_Zeds(KFPRI.Team) != None;
|
||||||
C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF');
|
|
||||||
|
C.Font = Owner.CurrentStyle.PickFont(FontScalar);
|
||||||
S = "ZED";
|
|
||||||
C.SetPos (PerkXPos + Height, TextYOffset);
|
TextYOffset = YOffset + (Height * 0.5f) - (Owner.CurrentStyle.DefaultHeight * 0.5f);
|
||||||
C.DrawText (S, , FontScalar, FontScalar);
|
if (PlayerIndex == Index)
|
||||||
}
|
C.SetDrawColor (51, 30, 101, 150);
|
||||||
else
|
else C.SetDrawColor (30, 30, 30, 150);
|
||||||
{
|
|
||||||
if( KFPRI.CurrentPerkClass!=None )
|
Owner.CurrentStyle.DrawRectBox(0.f, YOffset, Width, Height, 4);
|
||||||
{
|
|
||||||
|
C.SetDrawColor(250,250,250,255);
|
||||||
|
|
||||||
|
// Status
|
||||||
|
if (KFPRI.bAdmin)
|
||||||
|
{
|
||||||
|
S = "Admin";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
S = "Player";
|
||||||
|
}
|
||||||
|
DrawTextWLeft(S, StatusXPos, TextYOffset, FontScalar);
|
||||||
|
|
||||||
|
// Perk
|
||||||
|
if( bIsZED )
|
||||||
|
{
|
||||||
|
C.SetDrawColor(255,0,0,255);
|
||||||
|
C.SetPos (PerkXPos, YOffset - ((Height-5) * 0.5f));
|
||||||
|
C.DrawRect (Height-5, Height-5, Texture2D'UI_Widgets.MenuBarWidget_SWF_IF');
|
||||||
|
|
||||||
|
S = "ZED";
|
||||||
|
DrawTextWLeft(S, PerkXPos + Height, TextYOffset, FontScalar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( KFPRI.CurrentPerkClass!=None )
|
||||||
|
{
|
||||||
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
|
PrestigeLevel = KFPRI.GetActivePerkPrestigeLevel();
|
||||||
Level = KFPRI.GetActivePerkLevel();
|
Level = KFPRI.GetActivePerkLevel();
|
||||||
|
|
||||||
PerkIconPosX = PerkXPos;
|
PerkIconPosX = PerkXPos;
|
||||||
PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2);
|
PerkIconPosY = YOffset + (Owner.HUDOwner.ScaledBorderSize * 2);
|
||||||
PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4);
|
PerkIconSize = Height-(Owner.HUDOwner.ScaledBorderSize * 4);
|
||||||
PrestigeIconScale = 0.6625f;
|
PrestigeIconScale = 0.6625f;
|
||||||
|
|
||||||
C.DrawColor = HUDOwner.WhiteColor;
|
C.DrawColor = HUDOwner.WhiteColor;
|
||||||
if (PrestigeLevel > 0)
|
if (PrestigeLevel > 0)
|
||||||
{
|
{
|
||||||
C.SetPos(PerkIconPosX, PerkIconPosY);
|
C.SetPos(PerkIconPosX, PerkIconPosY);
|
||||||
C.DrawTile(KFPRI.CurrentPerkClass.default.PrestigeIcons[PrestigeLevel - 1], PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PrestigeIcons[PrestigeLevel - 1], PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
||||||
|
|
||||||
C.SetPos(PerkIconPosX + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/2)), PerkIconPosY + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/1.75)));
|
C.SetPos(PerkIconPosX + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/2)), PerkIconPosY + ((PerkIconSize/2) - ((PerkIconSize*PrestigeIconScale)/1.75)));
|
||||||
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize * PrestigeIconScale, PerkIconSize * PrestigeIconScale, 0, 0, 256, 256);
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize * PrestigeIconScale, PerkIconSize * PrestigeIconScale, 0, 0, 256, 256);
|
||||||
}
|
}
|
||||||
@ -288,204 +314,195 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
|
|||||||
C.SetPos(PerkIconPosX, PerkIconPosY);
|
C.SetPos(PerkIconPosX, PerkIconPosY);
|
||||||
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
C.DrawTile(KFPRI.CurrentPerkClass.default.PerkIcon, PerkIconSize, PerkIconSize, 0, 0, 256, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
C.SetDrawColor(250,250,250,255);
|
C.SetDrawColor(250,250,250,255);
|
||||||
C.SetPos(PerkIconPosX + PerkIconSize + (Owner.HUDOwner.ScaledBorderSize*2), TextYOffset);
|
S = Level@KFPRI.CurrentPerkClass.default.PerkName;
|
||||||
C.DrawText(Level@KFPRI.CurrentPerkClass.default.PerkName, , FontScalar, FontScalar);
|
DrawTextWLeft(S, PerkIconPosX + PerkIconSize + (Owner.HUDOwner.ScaledBorderSize*2), TextYOffset, FontScalar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C.SetDrawColor(250,250,250,255);
|
C.SetDrawColor(250,250,250,255);
|
||||||
S = "No Perk";
|
S = "No Perk";
|
||||||
C.SetPos (PerkXPos + Height, TextYOffset);
|
DrawTextWLeft(S, PerkXPos + Height, TextYOffset, FontScalar);
|
||||||
C.DrawText (S, , FontScalar, FontScalar);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Avatar
|
|
||||||
if( KFPRI.Avatar != None )
|
|
||||||
{
|
|
||||||
if( KFPRI.Avatar == default.DefaultAvatar )
|
|
||||||
CheckAvatar(KFPRI, OwnerPC);
|
|
||||||
|
|
||||||
C.SetDrawColor(255,255,255,255);
|
|
||||||
C.SetPos(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f));
|
|
||||||
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 )
|
|
||||||
CheckAvatar(KFPRI, OwnerPC);
|
|
||||||
|
|
||||||
// Player
|
// Avatar
|
||||||
C.SetPos (PlayerXPos, TextYOffset);
|
if( KFPRI.Avatar != None )
|
||||||
|
{
|
||||||
if( Len(KFPRI.PlayerName) > 25 )
|
if( KFPRI.Avatar == default.DefaultAvatar )
|
||||||
S = Left(KFPRI.PlayerName, 25);
|
CheckAvatar(KFPRI, OwnerPC);
|
||||||
else S = KFPRI.PlayerName;
|
|
||||||
C.DrawText (S, , FontScalar, FontScalar);
|
|
||||||
|
|
||||||
C.SetDrawColor(255,255,255,255);
|
|
||||||
|
|
||||||
// Kill
|
C.SetDrawColor(255,255,255,255);
|
||||||
C.SetPos (KillsXPos, TextYOffset);
|
C.SetPos(PlayerXPos - (Height * 1.075), YOffset + (Height * 0.5f) - ((Height - 6) * 0.5f));
|
||||||
C.DrawText (string (KFPRI.Kills), , FontScalar, FontScalar);
|
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 )
|
||||||
|
CheckAvatar(KFPRI, OwnerPC);
|
||||||
|
|
||||||
// Assist
|
// Player
|
||||||
C.SetPos (AssistXPos, TextYOffset);
|
if( Len(KFPRI.PlayerName) > 25 )
|
||||||
C.DrawText (string (KFPRI.Assists), , FontScalar, FontScalar);
|
S = Left(KFPRI.PlayerName, 25);
|
||||||
|
else S = KFPRI.PlayerName;
|
||||||
|
DrawTextWLeft(S, PlayerXPos, TextYOffset, FontScalar);
|
||||||
|
|
||||||
// Cash
|
C.SetDrawColor(255,255,255,255);
|
||||||
C.SetPos (CashXPos, TextYOffset);
|
|
||||||
if( bIsZED )
|
|
||||||
{
|
|
||||||
C.SetDrawColor(250, 0, 0, 255);
|
|
||||||
StrValue = "Brains!";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
C.SetDrawColor(250, 250, 100, 255);
|
|
||||||
StrValue = GetNiceSize(int(KFPRI.Score));
|
|
||||||
}
|
|
||||||
C.DrawText (StrValue, , FontScalar, FontScalar);
|
|
||||||
|
|
||||||
C.SetDrawColor(255,255,255,255);
|
|
||||||
|
|
||||||
// State
|
// Kill
|
||||||
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
|
DrawTextWCenter(string (KFPRI.Kills), KillsXPos, TextYOffset, KillsWBox, FontScalar);
|
||||||
{
|
|
||||||
C.SetDrawColor(250,0,0,255);
|
|
||||||
S = "LOBBY";
|
|
||||||
}
|
|
||||||
else if( !KFGRI.bMatchHasBegun )
|
|
||||||
{
|
|
||||||
C.SetDrawColor(250,0,0,255);
|
|
||||||
S = KFPRI.bReadyToPlay ? "Ready" : "Not Ready";
|
|
||||||
}
|
|
||||||
else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None )
|
|
||||||
{
|
|
||||||
C.SetDrawColor(250,0,0,255);
|
|
||||||
S = "Unknown";
|
|
||||||
}
|
|
||||||
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
|
|
||||||
{
|
|
||||||
C.SetDrawColor(250,0,0,255);
|
|
||||||
S = (KFPRI.bOnlySpectator) ? "Spectator" : "DEAD";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.8)
|
|
||||||
C.SetDrawColor(0,250,0,255);
|
|
||||||
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.4)
|
|
||||||
C.SetDrawColor(250,250,0,255);
|
|
||||||
else C.SetDrawColor(250,100,100,255);
|
|
||||||
|
|
||||||
S = string (KFPRI.PlayerHealth) @"HP";
|
|
||||||
}
|
|
||||||
|
|
||||||
C.SetPos (StateXPos, TextYOffset);
|
// Assist
|
||||||
C.DrawText (S, , FontScalar, FontScalar);
|
DrawTextWCenter(string (KFPRI.Assists), AssistXPos, TextYOffset, AssistWBox, FontScalar);
|
||||||
|
|
||||||
C.SetDrawColor(250,250,250,255);
|
|
||||||
|
|
||||||
// Ping
|
// Cash
|
||||||
if (KFPRI.bBot)
|
if( bIsZED )
|
||||||
S = "-";
|
{
|
||||||
else
|
C.SetDrawColor(250, 0, 0, 255);
|
||||||
{
|
StrValue = "Brains!";
|
||||||
Ping = int(KFPRI.Ping * `PING_SCALE);
|
}
|
||||||
|
else
|
||||||
if (Ping <= 100)
|
{
|
||||||
C.SetDrawColor(0,250,0,255);
|
C.SetDrawColor(250, 250, 100, 255);
|
||||||
else if (Ping <= 200)
|
StrValue = GetNiceSize(int(KFPRI.Score));
|
||||||
C.SetDrawColor(250,250,0,255);
|
}
|
||||||
else C.SetDrawColor(250,100,100,255);
|
DrawTextWCenter(StrValue, CashXPos, TextYOffset, CashWBox, FontScalar);
|
||||||
|
|
||||||
S = string(Ping);
|
C.SetDrawColor(255,255,255,255);
|
||||||
}
|
|
||||||
|
// Health
|
||||||
C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar);
|
if( !KFPRI.bReadyToPlay && KFGRI.bMatchHasBegun )
|
||||||
|
{
|
||||||
C.SetPos(PingXPos, TextYOffset);
|
C.SetDrawColor(250,0,0,255);
|
||||||
C.DrawText(S,, FontScalar, FontScalar);
|
S = "LOBBY";
|
||||||
|
}
|
||||||
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));
|
else if( !KFGRI.bMatchHasBegun )
|
||||||
|
{
|
||||||
|
C.SetDrawColor(250,0,0,255);
|
||||||
|
S = KFPRI.bReadyToPlay ? "Ready" : "Not Ready";
|
||||||
|
}
|
||||||
|
else if( bIsZED && KFTeamInfo_Zeds(GetPlayer().PlayerReplicationInfo.Team) == None )
|
||||||
|
{
|
||||||
|
C.SetDrawColor(250,0,0,255);
|
||||||
|
S = "Unknown";
|
||||||
|
}
|
||||||
|
else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0)
|
||||||
|
{
|
||||||
|
C.SetDrawColor(250,0,0,255);
|
||||||
|
S = (KFPRI.bOnlySpectator) ? "Spectator" : "DEAD";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.8)
|
||||||
|
C.SetDrawColor(0,250,0,255);
|
||||||
|
else if (ByteToFloat(KFPRI.PlayerHealthPercent) >= 0.4)
|
||||||
|
C.SetDrawColor(250,250,0,255);
|
||||||
|
else C.SetDrawColor(250,100,100,255);
|
||||||
|
|
||||||
|
S = string (KFPRI.PlayerHealth) @"HP";
|
||||||
|
}
|
||||||
|
DrawTextWCenter(S, HealthXPos, TextYOffset, HealthWBox, FontScalar);
|
||||||
|
|
||||||
|
C.SetDrawColor(250,250,250,255);
|
||||||
|
|
||||||
|
// Ping
|
||||||
|
if (KFPRI.bBot)
|
||||||
|
S = "-";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ping = int(KFPRI.Ping * `PING_SCALE);
|
||||||
|
|
||||||
|
if (Ping <= 100)
|
||||||
|
C.SetDrawColor(0,250,0,255);
|
||||||
|
else if (Ping <= 200)
|
||||||
|
C.SetDrawColor(250,250,0,255);
|
||||||
|
else C.SetDrawColor(250,100,100,255);
|
||||||
|
|
||||||
|
S = string(Ping);
|
||||||
|
}
|
||||||
|
|
||||||
|
C.TextSize(MaxPing, XL, YL, FontScalar, FontScalar);
|
||||||
|
|
||||||
|
DrawTextWLeft(S, PingXPos, TextYOffset, FontScalar);
|
||||||
|
|
||||||
|
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 float PingMul, BarW, BarH, BaseH, XPos, YPos;
|
||||||
local byte i;
|
local byte i;
|
||||||
|
|
||||||
PingMul = 1.f - FClamp(FMax(Ping - IdealPing, 1.f) / MaxPing, 0.f, 1.f);
|
|
||||||
BarW = W / PingBars;
|
|
||||||
BaseH = H / PingBars;
|
|
||||||
|
|
||||||
PingColor.R = (1.f - PingMul) * 255;
|
PingMul = 1.f - FClamp(FMax(Ping - IdealPing, 1.f) / MaxPing, 0.f, 1.f);
|
||||||
PingColor.G = PingMul * 255;
|
BarW = W / PingBars;
|
||||||
|
BaseH = H / PingBars;
|
||||||
|
|
||||||
for(i=1; i<PingBars; i++)
|
PingColor.R = (1.f - PingMul) * 255;
|
||||||
{
|
PingColor.G = PingMul * 255;
|
||||||
BarH = BaseH * i;
|
|
||||||
XPos = XOffset + ((i - 1) * BarW);
|
|
||||||
YPos = YOffset + (H - BarH);
|
|
||||||
|
|
||||||
C.SetPos(XPos,YPos);
|
for(i=1; i<PingBars; i++)
|
||||||
C.SetDrawColor(20, 20, 20, 255);
|
{
|
||||||
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
BarH = BaseH * i;
|
||||||
|
XPos = XOffset + ((i - 1) * BarW);
|
||||||
|
YPos = YOffset + (H - BarH);
|
||||||
|
|
||||||
if( PingMul >= (i / PingBars) )
|
C.SetPos(XPos,YPos);
|
||||||
{
|
C.SetDrawColor(20, 20, 20, 255);
|
||||||
C.SetPos(XPos,YPos);
|
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
||||||
C.DrawColor = PingColor;
|
|
||||||
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
|
||||||
}
|
|
||||||
|
|
||||||
C.SetDrawColor(80, 80, 80, 255);
|
if( PingMul >= (i / PingBars) )
|
||||||
Owner.CurrentStyle.DrawBoxHollow(XPos,YPos,BarW,BarH,1);
|
{
|
||||||
}
|
C.SetPos(XPos,YPos);
|
||||||
|
C.DrawColor = PingColor;
|
||||||
|
Owner.CurrentStyle.DrawWhiteBox(BarW,BarH);
|
||||||
|
}
|
||||||
|
|
||||||
|
C.SetDrawColor(80, 80, 80, 255);
|
||||||
|
Owner.CurrentStyle.DrawBoxHollow(XPos,YPos,BarW,BarH,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID )
|
static final function Texture2D FindAvatar( KFPlayerController PC, UniqueNetId ClientID )
|
||||||
{
|
{
|
||||||
local string S;
|
local string S;
|
||||||
|
|
||||||
S = PC.GetSteamAvatar(ClientID);
|
S = PC.GetSteamAvatar(ClientID);
|
||||||
if( S=="" )
|
if( S=="" )
|
||||||
return None;
|
return None;
|
||||||
return Texture2D(PC.FindObject(S,class'Texture2D'));
|
return Texture2D(PC.FindObject(S,class'Texture2D'));
|
||||||
}
|
}
|
||||||
|
|
||||||
final static function string GetNiceSize(int Num)
|
final static function string GetNiceSize(int Num)
|
||||||
{
|
{
|
||||||
if( Num < 1000 ) return string(Num);
|
if( Num < 1000 ) return string(Num);
|
||||||
else if( Num < 1000000 ) return (Num / 1000) $ "K";
|
else if( Num < 1000000 ) return (Num / 1000) $ "K";
|
||||||
else if( Num < 1000000000 ) return (Num / 1000000) $ "M";
|
else if( Num < 1000000000 ) return (Num / 1000000) $ "M";
|
||||||
|
|
||||||
return (Num / 1000000000) $ "B";
|
return (Num / 1000000000) $ "B";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollMouseWheel( bool bUp )
|
function ScrollMouseWheel( bool bUp )
|
||||||
{
|
{
|
||||||
PlayersList.ScrollMouseWheel(bUp);
|
PlayersList.ScrollMouseWheel(bUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
bEnableInputs=true
|
bEnableInputs=true
|
||||||
|
|
||||||
PingColor=(R=255,G=255,B=60,A=255)
|
PingColor=(R=255,G=255,B=60,A=255)
|
||||||
IdealPing=50.0
|
IdealPing=50.0
|
||||||
MaxPing=200.0
|
MaxPing=200.0
|
||||||
PingBars=5.0
|
PingBars=5.0
|
||||||
|
|
||||||
Begin Object Class=KFGUI_List Name=PlayerList
|
Begin Object Class=KFGUI_List Name=PlayerList
|
||||||
XSize=0.625
|
XSize=0.625
|
||||||
OnDrawItem=DrawPlayerEntry
|
OnDrawItem=DrawPlayerEntry
|
||||||
ID="PlayerList"
|
ID="PlayerList"
|
||||||
bClickable=false
|
bClickable=false
|
||||||
ListItemsPerPage=16
|
ListItemsPerPage=16
|
||||||
End Object
|
End Object
|
||||||
Components.Add(PlayerList)
|
Components.Add(PlayerList)
|
||||||
|
|
||||||
DefaultAvatar=Texture2D'UI_HUD.ScoreBoard_Standard_SWF_I26'
|
DefaultAvatar=Texture2D'UI_HUD.ScoreBoard_Standard_SWF_I26'
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
class ScoreboardExtHUD extends KFGFxHudWrapper
|
class ScoreboardExtHUD extends KFGFxHudWrapper
|
||||||
config(ScoreboardExtMut);
|
config(ScoreboardExtMut);
|
||||||
|
|
||||||
const HUDBorderSize = 3;
|
const HUDBorderSize = 3;
|
||||||
|
|
||||||
@ -16,99 +16,99 @@ var transient GUIStyleBase GUIStyle;
|
|||||||
|
|
||||||
simulated function PostBeginPlay()
|
simulated function PostBeginPlay()
|
||||||
{
|
{
|
||||||
Super.PostBeginPlay();
|
Super.PostBeginPlay();
|
||||||
|
|
||||||
PlayerOwner.PlayerInput.OnReceivedNativeInputKey = NotifyInputKey;
|
PlayerOwner.PlayerInput.OnReceivedNativeInputKey = NotifyInputKey;
|
||||||
PlayerOwner.PlayerInput.OnReceivedNativeInputAxis = NotifyInputAxis;
|
PlayerOwner.PlayerInput.OnReceivedNativeInputAxis = NotifyInputAxis;
|
||||||
PlayerOwner.PlayerInput.OnReceivedNativeInputChar = NotifyInputChar;
|
PlayerOwner.PlayerInput.OnReceivedNativeInputChar = NotifyInputChar;
|
||||||
|
|
||||||
RemoveMovies();
|
RemoveMovies();
|
||||||
CreateHUDMovie();
|
CreateHUDMovie();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostRender()
|
function PostRender()
|
||||||
{
|
{
|
||||||
if( KFGRI == None )
|
if( KFGRI == None )
|
||||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
||||||
|
|
||||||
if( GUIController!=None && PlayerOwner.PlayerInput==None )
|
if( GUIController!=None && PlayerOwner.PlayerInput==None )
|
||||||
GUIController.NotifyLevelChange();
|
GUIController.NotifyLevelChange();
|
||||||
|
|
||||||
if( GUIController==None || GUIController.bIsInvalid )
|
if( GUIController==None || GUIController.bIsInvalid )
|
||||||
{
|
{
|
||||||
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
|
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
|
||||||
if( GUIController!=None )
|
if( GUIController!=None )
|
||||||
{
|
{
|
||||||
GUIStyle = GUIController.CurrentStyle;
|
GUIStyle = GUIController.CurrentStyle;
|
||||||
GUIStyle.HUDOwner = self;
|
GUIStyle.HUDOwner = self;
|
||||||
LaunchHUDMenus();
|
LaunchHUDMenus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GUIStyle.Canvas = Canvas;
|
GUIStyle.Canvas = Canvas;
|
||||||
GUIStyle.PickDefaultFontSize(Canvas.ClipY);
|
GUIStyle.PickDefaultFontSize(Canvas.ClipY);
|
||||||
|
|
||||||
if( !GUIController.bIsInMenuState )
|
if( !GUIController.bIsInMenuState )
|
||||||
GUIController.HandleDrawMenu();
|
GUIController.HandleDrawMenu();
|
||||||
|
|
||||||
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
|
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
|
||||||
|
|
||||||
Super.PostRender();
|
Super.PostRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
function LaunchHUDMenus()
|
function LaunchHUDMenus()
|
||||||
{
|
{
|
||||||
Scoreboard = KFScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass));
|
Scoreboard = KFScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass));
|
||||||
Scoreboard.SetVisibility(false);
|
Scoreboard.SetVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
local int i;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float DeltaTime, optional bool bGamepad)
|
function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float DeltaTime, optional bool bGamepad)
|
||||||
{
|
{
|
||||||
local int i;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool NotifyInputChar(int ControllerId, string Unicode)
|
function bool NotifyInputChar(int ControllerId, string Unicode)
|
||||||
{
|
{
|
||||||
local int i;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec function SetShowScores(bool bNewValue)
|
exec function SetShowScores(bool bNewValue)
|
||||||
{
|
{
|
||||||
if (Scoreboard != None)
|
if (Scoreboard != None)
|
||||||
Scoreboard.SetVisibility(bNewValue);
|
Scoreboard.SetVisibility(bNewValue);
|
||||||
else Super.SetShowScores(bNewValue);
|
else Super.SetShowScores(bNewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
ScoreboardClass=class'KFScoreBoard'
|
ScoreboardClass=class'KFScoreBoard'
|
||||||
RepObject=ObjectReferencer'KFScoreboardExt_Assets.ObjectRef.MainObj_List'
|
RepObject=ObjectReferencer'KFScoreboardExt_Assets.ObjectRef.MainObj_List'
|
||||||
}
|
}
|
@ -2,8 +2,8 @@ class ScoreboardExtMut extends KFMutator;
|
|||||||
|
|
||||||
function PostBeginPlay()
|
function PostBeginPlay()
|
||||||
{
|
{
|
||||||
Super.PostBeginPlay();
|
Super.PostBeginPlay();
|
||||||
WorldInfo.Game.HUDType = class'ScoreboardExtHUD';
|
WorldInfo.Game.HUDType = class'ScoreboardExtHUD';
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
|
Loading…
x
Reference in New Issue
Block a user