KF2-Server-Extension/ServerExt/Classes/UIP_MiniGame.uc

44 lines
1002 B
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class UIP_MiniGame extends KFGUI_MultiComponent;
var MX_MiniGameBase ActiveGame;
var transient float LastUpdateTime;
var WorldInfo Level;
function ShowMenu()
{
Super.ShowMenu();
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
Level = GetPlayer().WorldInfo;
LastUpdateTime = Level.RealTimeSeconds;
2020-11-28 20:12:58 +00:00
if (ActiveGame==None)
2017-10-20 02:00:49 +00:00
{
ActiveGame = new (GetPlayer()) class'MX_PongGame';
ActiveGame.Init();
ActiveGame.SetFXTrack(ExtPlayerController(GetPlayer()).BonusFX);
ActiveGame.StartGame();
}
}
function DrawMenu()
{
// Update input.
ActiveGame.SetMouse(Owner.MousePosition.X-CompPos[0],Owner.MousePosition.Y-CompPos[1]);
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
// Handle tick.
ActiveGame.Tick(FMin(Level.RealTimeSeconds-LastUpdateTime,0.05));
LastUpdateTime = Level.RealTimeSeconds;
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
// Draw background.
Canvas.SetPos(0,0);
Canvas.SetDrawColor(0,0,0,255);
Canvas.DrawTile(Canvas.DefaultTexture,CompPos[2],CompPos[3],0,0,1,1);
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
// Draw minigame
ActiveGame.Canvas = Canvas;
ActiveGame.Render(0,0,CompPos[2],CompPos[3]);
ActiveGame.Canvas = None;
}
defaultproperties
{
}