2017-10-20 02:00:49 +00:00
|
|
|
Class KFGUI_MultiComponent extends KFGUI_Base;
|
|
|
|
|
|
|
|
var() export editinline array<KFGUI_Base> Components;
|
|
|
|
|
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Components[i].Owner = Owner;
|
|
|
|
Components[i].ParentComponent = Self;
|
|
|
|
Components[i].InitMenu();
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function ShowMenu()
|
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].ShowMenu();
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function PreDraw()
|
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
local byte j;
|
|
|
|
|
|
|
|
ComputeCoords();
|
|
|
|
Canvas.SetDrawColor(255,255,255);
|
|
|
|
Canvas.SetOrigin(CompPos[0],CompPos[1]);
|
|
|
|
Canvas.SetClip(CompPos[0]+CompPos[2],CompPos[1]+CompPos[3]);
|
|
|
|
DrawMenu();
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Components[i].Canvas = Canvas;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (j=0; j<4; ++j)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].InputPos[j] = CompPos[j];
|
|
|
|
Components[i].PreDraw();
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function MenuTick(float DeltaTime)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
|
|
|
Super.MenuTick(DeltaTime);
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].MenuTick(DeltaTime);
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function AddComponent(KFGUI_Base C)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Components[Components.Length] = C;
|
|
|
|
C.Owner = Owner;
|
|
|
|
C.ParentComponent = Self;
|
|
|
|
C.InitMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
function CloseMenu()
|
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].CloseMenu();
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function bool CaptureMouse()
|
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
|
|
|
if (Components[i].CaptureMouse())
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
MouseArea = Components[i];
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
MouseArea = None;
|
|
|
|
return Super.CaptureMouse(); // check with frame itself.
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function KFGUI_Base FindComponentID(name InID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
local KFGUI_Base Result;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (ID==InID)
|
2017-10-20 02:00:49 +00:00
|
|
|
Result = Self;
|
|
|
|
else
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length && Result==None; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Result = Components[i].FindComponentID(InID);
|
|
|
|
}
|
|
|
|
return Result;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function FindAllComponentID(name InID, out array<KFGUI_Base> Res)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (ID==InID)
|
2017-10-20 02:00:49 +00:00
|
|
|
Res[Res.Length] = Self;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].FindAllComponentID(InID,Res);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function RemoveComponent(KFGUI_Base B)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
|
|
|
if (Components[i]==B)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Components.Remove(i,1);
|
|
|
|
B.CloseMenu();
|
|
|
|
return;
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].RemoveComponent(B);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function NotifyLevelChange()
|
|
|
|
{
|
|
|
|
local int i;
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<Components.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
Components[i].NotifyLevelChange();
|
|
|
|
}
|