Initial commit
This commit is contained in:
72
Torque/SDK/example/starter.racing/client/scripts/playGui.cs
Normal file
72
Torque/SDK/example/starter.racing/client/scripts/playGui.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PlayGui is the main TSControl through which the game is viewed.
|
||||
// The PlayGui also contains the hud controls.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function PlayGui::onWake(%this)
|
||||
{
|
||||
// Turn off any shell sounds...
|
||||
// alxStop( ... );
|
||||
|
||||
$enableDirectInput = "1";
|
||||
activateDirectInput();
|
||||
|
||||
// Message hud dialog
|
||||
Canvas.pushDialog( MainChatHud );
|
||||
chatHud.attach(HudMessageVector);
|
||||
|
||||
// just update the action map here
|
||||
moveMap.push();
|
||||
|
||||
// hack city - these controls are floating around and need to be clamped
|
||||
schedule(0, 0, "refreshCenterTextCtrl");
|
||||
schedule(0, 0, "refreshBottomTextCtrl");
|
||||
}
|
||||
|
||||
function PlayGui::onSleep(%this)
|
||||
{
|
||||
Canvas.popDialog( MainChatHud );
|
||||
|
||||
// pop the keymaps
|
||||
moveMap.pop();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
function PlayGui::updateLapCounter(%this)
|
||||
{
|
||||
LapCounter.setText("Lap" SPC %this.lap SPC "/" SPC %this.maxLaps);
|
||||
}
|
||||
|
||||
function clientCmdSetMaxLaps(%laps)
|
||||
{
|
||||
// Reset the current lap to 1 and set the max laps.
|
||||
PlayGui.lap = 1;
|
||||
PlayGui.maxLaps = %laps;
|
||||
PlayGui.updateLapCounter();
|
||||
}
|
||||
|
||||
function clientCmdIncreaseLapCounter()
|
||||
{
|
||||
// Increase the lap.
|
||||
PlayGui.lap++;
|
||||
PlayGui.updateLapCounter();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function refreshBottomTextCtrl()
|
||||
{
|
||||
BottomPrintText.position = "0 0";
|
||||
}
|
||||
|
||||
function refreshCenterTextCtrl()
|
||||
{
|
||||
CenterPrintText.position = "0 0";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user