From 99cee7f32a1e69c72fa4ff48d0cf9ffbc15bfc3d Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 2 Sep 2019 16:13:24 -0500 Subject: [PATCH] Caught the main modules up to new module script file paradigm Have initServer only get called when a server is actually started for the first time Added utility method callGamemodeFunction to streamline exec'ing of gamemode function calls Added onClientConnect gamemode function, called when the client establishes the connection Added onInitialControlSet gamemode function, called when the client actively gains control in the game, to allow gamemodes to special override GUI settings or input commands Cleaned up init'ng of the engine so stock UI module isn't required to trip configuration of the canvas Added fallback so if nothing set the main content control for the UI after boot, we attempt to set the defined mainMenuGUI, on the chance nothing explicitly sets it on load --- Templates/BaseGame/game/core/Core.cs | 1 - .../core/clientServer/Core_ClientServer.cs | 10 +- .../clientServer/Core_ClientServer.module | 4 +- .../scripts/client/connectionToServer.cs | 3 + .../scripts/server/connectionToClient.cs | 30 +- .../scripts/server/levelDownload.cs | 28 +- .../clientServer/scripts/server/levelLoad.cs | 84 +---- .../clientServer/scripts/server/server.cs | 9 +- .../game/core/rendering/Core_Rendering.cs | 29 ++ .../game/core/utility/Core_Utility.cs | 1 + .../game/core/utility/scripts/scene.cs | 36 ++ .../game/data/ExampleModule/ExampleModule.cs | 2 +- .../scripts/ExampleGamemodeScript.cs | 36 +- Templates/BaseGame/game/data/Kork/Kork.cs | 13 +- .../BaseGame/game/data/SpaceOrc/SpaceOrc.cs | 13 +- .../data/StaticShapeTest/StaticShapeTest.cs | 13 +- Templates/BaseGame/game/data/gameUI/gameUI.cs | 30 +- Templates/BaseGame/game/data/ui/UI.cs | 13 +- Templates/BaseGame/game/data/ui/UI.module | 4 +- Templates/BaseGame/game/main.cs.in | 37 +- Templates/BaseGame/game/tools/settings.xml | 348 +++++++++--------- 21 files changed, 358 insertions(+), 386 deletions(-) diff --git a/Templates/BaseGame/game/core/Core.cs b/Templates/BaseGame/game/core/Core.cs index ae744e7a0..f55128a46 100644 --- a/Templates/BaseGame/game/core/Core.cs +++ b/Templates/BaseGame/game/core/Core.cs @@ -1,7 +1,6 @@ function CoreModule::onCreate(%this) { - // ---------------------------------------------------------------------------- // Initialize core sub system functionality such as audio, the Canvas, PostFX, // rendermanager, light managers, etc. diff --git a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs index 1866adc12..1fab8f8c9 100644 --- a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs +++ b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs @@ -12,17 +12,17 @@ // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is // connected to it via createAndConnectToLocalServer(). -function Core_ClientServer::create( %this ) +function Core_ClientServer::onCreate( %this ) { echo("\n--------- Initializing Directory: scripts ---------"); exec( "./scripts/client/client.cs" ); exec( "./scripts/server/server.cs" ); $Game::MainScene = getScene(0); - - initServer(); - %dbList = new ArrayObject(DatablockFilesList); + new ArrayObject(DatablockFilesList); + + $Game::firstTimeServerRun = true; // Start up in either client, or dedicated server mode if ($Server::Dedicated) @@ -35,7 +35,7 @@ function Core_ClientServer::create( %this ) } } -function Core_ClientServer::destroy( %this ) +function Core_ClientServer::onDestroy( %this ) { // Ensure that we are disconnected and/or the server is destroyed. // This prevents crashes due to the SceneGraph being deleted before diff --git a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.module b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.module index ac86bbcd5..76b956a88 100644 --- a/Templates/BaseGame/game/core/clientServer/Core_ClientServer.module +++ b/Templates/BaseGame/game/core/clientServer/Core_ClientServer.module @@ -3,7 +3,7 @@ VersionId="1" Description="Default module for the game." ScriptFile="Core_ClientServer.cs" - CreateFunction="create" - DestroyFunction="destroy" + CreateFunction="onCreate" + DestroyFunction="onDestroy" Group="Core"> \ No newline at end of file diff --git a/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs b/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs index 5f9ed8163..68d58231c 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs @@ -50,6 +50,9 @@ function GameConnection::initialControlSet(%this) if (isObject(%playGUIName) && Canvas.getContent() != %playGUIName.getId()) Canvas.setContent(%playGUIName); + + //We allow the gamemodes to step in and override the canvas setting, or do any special input overrides here + %hasGameMode = callGamemodeFunction("onInitialControlSet"); } } diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs index 1f6ef8598..a87a250cf 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs @@ -81,6 +81,8 @@ function GameConnection::onConnect( %this, %clientData ) %this.connectData = %clientData; + callGamemodeFunction("onClientConnect", %this); + $Server::PlayerCount++; } @@ -151,33 +153,7 @@ function GameConnection::onDrop(%client, %reason) if($missionRunning) { - %hasGameMode = 0; - for(%i=0; %i < %activeSceneCount; %i++) - { - if(getScene(%i).gameModeName !$= "") - { - //if the scene defines a game mode, go ahead and envoke it here - if(isMethod(getScene(%i).gameModeName, "onClientLeaveGame")) - { - eval(getScene(%i).gameModeName @ "::onClientLeaveGame(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } - - //if none of our scenes have gamemodes, we need to kick off a default - if(%hasGameMode == 0) - { - %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); - if(%defaultModeName !$= "") - { - if(isMethod(%defaultModeName, "onClientLeaveGame")) - { - eval(%defaultModeName @ "::onClientLeaveGame(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } + %hasGameMode = callGamemodeFunction("onClientLeaveGame", %client); } removeFromServerGuidList( %client.guid ); diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs index fac9b4530..6ddeb646b 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs @@ -150,33 +150,7 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) %activeSceneCount = getSceneCount(); - %hasGameMode = 0; - for(%i=0; %i < %activeSceneCount; %i++) - { - if(getScene(%i).gameModeName !$= "") - { - //if the scene defines a game mode, go ahead and envoke it here - if(isMethod(getScene(%i).gameModeName, "onClientEnterGame")) - { - eval(getScene(%i).gameModeName @ "::onClientEnterGame(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } - - //if none of our scenes have gamemodes, we need to kick off a default - if(%hasGameMode == 0) - { - %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); - if(%defaultModeName !$= "") - { - if(isMethod(%defaultModeName, "onClientEnterGame")) - { - eval(%defaultModeName @ "::onClientEnterGame(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } + %hasGameMode = callGamemodeFunction("onClientEnterGame", %client); //if that also failed, just spawn a camera if(%hasGameMode == 0) diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs index ab25001ea..db889bdde 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs @@ -137,33 +137,7 @@ function loadMissionStage2() // Go ahead and launch the game %activeSceneCount = getSceneCount(); - %hasGameMode = 0; - for(%i=0; %i < %activeSceneCount; %i++) - { - if(getScene(%i).gameModeName !$= "") - { - //if the scene defines a game mode, go ahead and envoke it here - if(isMethod(getScene(%i).gameModeName, "onMissionStart")) - { - eval(getScene(%i).gameModeName @ "::onMissionStart();" ); - %hasGameMode = 1; - } - } - } - - //if none of our scenes have gamemodes, we need to kick off a default - if(%hasGameMode == 0) - { - %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); - if(%defaultModeName !$= "") - { - if(isMethod(%defaultModeName, "onMissionStart")) - { - eval(%defaultModeName @ "::onMissionStart();" ); - %hasGameMode = 1; - } - } - } + %hasGameMode = callGamemodeFunction("onMissionStart"); } function endMission() @@ -176,33 +150,7 @@ function endMission() // Inform the game code we're done. %activeSceneCount = getSceneCount(); - %hasGameMode = 0; - for(%i=0; %i < %activeSceneCount; %i++) - { - if(getScene(%i).gameModeName !$= "") - { - //if the scene defines a game mode, go ahead and envoke it here - if(isMethod(getScene(%i).gameModeName, "onMissionEnded")) - { - eval(getScene(%i).gameModeName @ "::onMissionEnded();" ); - %hasGameMode = 1; - } - } - } - - //if none of our scenes have gamemodes, we need to kick off a default - if(%hasGameMode == 0) - { - %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); - if(%defaultModeName !$= "") - { - if(isMethod(%defaultModeName, "onMissionEnded")) - { - eval(%defaultModeName @ "::onMissionEnded();" ); - %hasGameMode = 1; - } - } - } + %hasGameMode = callGamemodeFunction("onMissionEnded"); // Inform the clients for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) { @@ -235,31 +183,5 @@ function resetMission() // Inform the game code we're resetting. %activeSceneCount = getSceneCount(); - %hasGameMode = 0; - for(%i=0; %i < %activeSceneCount; %i++) - { - if(getScene(%i).gameModeName !$= "") - { - //if the scene defines a game mode, go ahead and envoke it here - if(isMethod(getScene(%i).gameModeName, "onMissionReset")) - { - eval(getScene(%i).gameModeName @ "::onMissionReset(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } - - //if none of our scenes have gamemodes, we need to kick off a default - if(%hasGameMode == 0) - { - %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); - if(%defaultModeName !$= "") - { - if(isMethod(%defaultModeName, "onMissionReset")) - { - eval(%defaultModeName @ "::onMissionReset(" @ %client @ ");" ); - %hasGameMode = 1; - } - } - } + %hasGameMode = callGamemodeFunction("onMissionReset", %client); } \ No newline at end of file diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs index 7e938042a..702c93b62 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs @@ -126,6 +126,11 @@ function createAndConnectToLocalServer( %serverType, %level ) /// Specify the level to load on the server function createServer(%serverType, %level) { + if($Game::firstTimeServerRun == true) + { + initServer(); + $Game::firstTimeServerRun = false; + } // Increase the server session number. This is used to make sure we're // working with the server session we think we are. $Server::Session++; @@ -197,12 +202,8 @@ function onServerCreated() physicsStartSimulation("server"); - %cnt = DatablockFilesList.count(); - loadDatablockFiles( DatablockFilesList, true ); - %cnt = DatablockFilesList.count(); - // Keep track of when the game started $Game::StartTime = $Sim::Time; diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.cs b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs index 07e9bcc02..21624a3f1 100644 --- a/Templates/BaseGame/game/core/rendering/Core_Rendering.cs +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs @@ -20,4 +20,33 @@ function Core_Rendering::onCreate(%this) function Core_Rendering::onDestroy(%this) { +} + +function Core_Rendering::initClient(%this) +{ + // Start rendering and stuff. + initRenderManager(); + initLightingSystems("Advanced Lighting"); + + //load prefs + %prefPath = getPrefpath(); + if ( isFile( %prefPath @ "/clientPrefs.cs" ) ) + exec( %prefPath @ "/clientPrefs.cs" ); + else + exec("data/defaults.cs"); + + configureCanvas(); + + //Autodetect settings if it's our first time + if($pref::Video::autoDetect) + GraphicsMenu.Autodetect(); + + postFXInit(); + + closeSplashWindow(); + + // As we know at this point that the initial load is complete, + // we can hide any splash screen we have, and show the canvas. + // This keeps things looking nice, instead of having a blank window + Canvas.showWindow(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.cs b/Templates/BaseGame/game/core/utility/Core_Utility.cs index bfc09a85b..7d91af49d 100644 --- a/Templates/BaseGame/game/core/utility/Core_Utility.cs +++ b/Templates/BaseGame/game/core/utility/Core_Utility.cs @@ -7,6 +7,7 @@ function Core_Utility::onCreate(%this) exec("./scripts/gameObjectManagement.cs"); exec("./scripts/persistanceManagement.cs"); exec("./scripts/module.cs"); + exec("./scripts/scene.cs"); } function Core_Utility::onDestroy(%this) diff --git a/Templates/BaseGame/game/core/utility/scripts/scene.cs b/Templates/BaseGame/game/core/utility/scripts/scene.cs index e69de29bb..da9008f0a 100644 --- a/Templates/BaseGame/game/core/utility/scripts/scene.cs +++ b/Templates/BaseGame/game/core/utility/scripts/scene.cs @@ -0,0 +1,36 @@ +function callGamemodeFunction(%gameModeFuncName, %data) +{ + if(%data !$= "") + %data = "\""@%data@"\""; + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, %gameModeFuncName)) + { + + eval(getScene(%i).gameModeName @ "::"@%gameModeFuncName@"("@%data@");" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, %gameModeFuncName)) + { + eval(%defaultModeName @ "::"@%gameModeFuncName@"("@%data@");" ); + %hasGameMode = 1; + } + } + } + + return %hasGameMode; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ExampleModule/ExampleModule.cs b/Templates/BaseGame/game/data/ExampleModule/ExampleModule.cs index 7fb1b1850..1739659df 100644 --- a/Templates/BaseGame/game/data/ExampleModule/ExampleModule.cs +++ b/Templates/BaseGame/game/data/ExampleModule/ExampleModule.cs @@ -31,7 +31,7 @@ function ExampleModule::onDestroy(%this) //Are called during the startup, shut down, and resetting of any and all active gamemodes, as informed by the loaded scenes //when the game server is processed. //These callbacks are activated in core/clientServer/scripts/server/levelLoad.cs -function FPSGameplay::initServer(%this) +function ExampleModule::initServer(%this) { //This script contains our ExampleGameMode logic exec("./scripts/ExampleGamemodeScript.cs"); diff --git a/Templates/BaseGame/game/data/ExampleModule/scripts/ExampleGamemodeScript.cs b/Templates/BaseGame/game/data/ExampleModule/scripts/ExampleGamemodeScript.cs index 6689eb01f..f79ce355e 100644 --- a/Templates/BaseGame/game/data/ExampleModule/scripts/ExampleGamemodeScript.cs +++ b/Templates/BaseGame/game/data/ExampleModule/scripts/ExampleGamemodeScript.cs @@ -82,14 +82,10 @@ function ExampleGameMode::onGameDurationEnd() ExampleGameMode::onMissionEnded(); } -//This is called when a client enters the game server. It's used to spawn a player object -//set up any client-specific properties such as saved configs, values, their name, etc -//These callbacks are activated in core/clientServer/scripts/server/levelDownload.cs -function ExampleGameMode::onClientEnterGame(%client) +//This is called to actually spawn a control object for the player to utilize +//A player character, spectator camera, etc. +function ExampleGameMode::spawnControlObject(%client) { - //Set the player name based on the client's connection data - %client.setPlayerName(%client.connectData); - //In this example, we just spawn a camera if (!isObject(%client.camera)) { @@ -116,6 +112,25 @@ function ExampleGameMode::onClientEnterGame(%client) } } +//This is called when the client has initially established a connection to the game server +//It's used for setting up anything ahead of time for the client, such as loading in client-passed +//config stuffs, saved data or the like that should be handled BEFORE the client has actually entered +//the game itself +function ExampleGameMode::onClientConnect(%client) +{ +} + +//This is called when a client enters the game server. It's used to spawn a player object +//set up any client-specific properties such as saved configs, values, their name, etc +//These callbacks are activated in core/clientServer/scripts/server/levelDownload.cs +function ExampleGameMode::onClientEnterGame(%client) +{ + //Set the player name based on the client's connection data + %client.setPlayerName(%client.connectData); + + ExampleGameMode::spawnControlObject(%client); +} + //This is called when the player leaves the game server. It's used to clean up anything that //was spawned or setup for the client when it connected, in onClientEnterGame //These callbacks are activated in core/clientServer/scripts/server/levelDownload.cs @@ -124,5 +139,12 @@ function ExampleGameMode::onClientLeaveGame(%client) // Cleanup the camera if (isObject(%client.camera)) %client.camera.delete(); +} +//This is called when the player has connected and finaly setup is done and control is handed +//over to the client. It allows a point to special-case setting the client's canvas content +//(Such as a gamemode-specific GUI) or setting up gamemode-specific keybinds/control schemes +function ExampleGameMode::onInitialControlSet() +{ + } \ No newline at end of file diff --git a/Templates/BaseGame/game/data/Kork/Kork.cs b/Templates/BaseGame/game/data/Kork/Kork.cs index 10a60f95b..2e921446a 100644 --- a/Templates/BaseGame/game/data/Kork/Kork.cs +++ b/Templates/BaseGame/game/data/Kork/Kork.cs @@ -1,10 +1,19 @@ function Kork::onCreate(%this) { - } function Kork::onDestroy(%this) { - } +function Kork::initServer(%this){} + +function Kork::onCreateGameServer(%this){} + +function Kork::onDestroyGameServer(%this){} + +function Kork::initClient(%this){} + +function Kork::onCreateClientConnection(%this){} + +function Kork::onDestroyClientConnection(%this){} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs index 41ebb96aa..677da37e0 100644 --- a/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs +++ b/Templates/BaseGame/game/data/SpaceOrc/SpaceOrc.cs @@ -1,10 +1,19 @@ function SpaceOrc::onCreate(%this) { - } function SpaceOrc::onDestroy(%this) { - } +function SpaceOrc::initServer(%this){} + +function SpaceOrc::onCreateGameServer(%this){} + +function SpaceOrc::onDestroyGameServer(%this){} + +function SpaceOrc::initClient(%this){} + +function SpaceOrc::onCreateClientConnection(%this){} + +function SpaceOrc::onDestroyClientConnection(%this){} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/StaticShapeTest/StaticShapeTest.cs b/Templates/BaseGame/game/data/StaticShapeTest/StaticShapeTest.cs index 5a8376011..43e335106 100644 --- a/Templates/BaseGame/game/data/StaticShapeTest/StaticShapeTest.cs +++ b/Templates/BaseGame/game/data/StaticShapeTest/StaticShapeTest.cs @@ -1,10 +1,19 @@ function StaticShapeTest::onCreate(%this) { - } function StaticShapeTest::onDestroy(%this) { - } +function StaticShapeTest::initServer(%this){} + +function StaticShapeTest::onCreateGameServer(%this){} + +function StaticShapeTest::onDestroyGameServer(%this){} + +function StaticShapeTest::initClient(%this){} + +function StaticShapeTest::onCreateClientConnection(%this){} + +function StaticShapeTest::onDestroyClientConnection(%this){} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/gameUI/gameUI.cs b/Templates/BaseGame/game/data/gameUI/gameUI.cs index e52cb6890..fb3353497 100644 --- a/Templates/BaseGame/game/data/gameUI/gameUI.cs +++ b/Templates/BaseGame/game/data/gameUI/gameUI.cs @@ -1,14 +1,24 @@ -function gameUI::create( %this ) +function gameUI::onCreate(%this) { - if (!$Server::Dedicated) - { - //guis - exec("./GUIs/playGui.gui"); - exec("./GUIs/playGui.cs"); - } } -function gameUI::destroy( %this ) +function gameUI::onDestroy(%this) { - -} \ No newline at end of file +} + +function gameUI::initServer(%this){} + +function gameUI::onCreateGameServer(%this){} + +function gameUI::onDestroyGameServer(%this){} + +function gameUI::initClient(%this) +{ + //guis + exec("./GUIs/playGui.gui"); + exec("./GUIs/playGui.cs"); +} + +function gameUI::onCreateClientConnection(%this){} + +function gameUI::onDestroyClientConnection(%this){} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/UI.cs b/Templates/BaseGame/game/data/ui/UI.cs index 38de0958e..8df07adaa 100644 --- a/Templates/BaseGame/game/data/ui/UI.cs +++ b/Templates/BaseGame/game/data/ui/UI.cs @@ -12,24 +12,19 @@ // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is // connected to it via createAndConnectToLocalServer(). -function UI::create( %this ) +function UI::onCreate( %this ) { - if ($Server::Dedicated) - return; - - // Use our prefs to configure our Canvas/Window - configureCanvas(); } -function UI::destroy( %this ) +function UI::onDestroy( %this ) { } function UI::initServer(%this){} -function UI::onCreateServer(%this){} +function UI::onCreateGameServer(%this){} -function UI::onDestroyServer(%this){} +function UI::onDestroyGameServer(%this){} function UI::initClient(%this) { diff --git a/Templates/BaseGame/game/data/ui/UI.module b/Templates/BaseGame/game/data/ui/UI.module index e22117d39..c2e38d7b9 100644 --- a/Templates/BaseGame/game/data/ui/UI.module +++ b/Templates/BaseGame/game/data/ui/UI.module @@ -3,7 +3,7 @@ VersionId="1" Description="Module that implements the menus for the game." ScriptFile="UI.cs" - CreateFunction="create" - DestroyFunction="destroy" + CreateFunction="onCreate" + DestroyFunction="onDestroy" Group="Game"> \ No newline at end of file diff --git a/Templates/BaseGame/game/main.cs.in b/Templates/BaseGame/game/main.cs.in index 131eb9f48..af77ff4f8 100644 --- a/Templates/BaseGame/game/main.cs.in +++ b/Templates/BaseGame/game/main.cs.in @@ -28,37 +28,14 @@ ModuleDatabase.LoadGroup( "Game" ); //Finally, initialize the client/server structure ModuleDatabase.LoadExplicit( "Core_ClientServer" ); -if( !$isDedicated ) +//If nothing else set a main menu, try to do so now +if(!isObject(Canvas.getContent())) { - // Start rendering and stuff. - initRenderManager(); - initLightingSystems("Advanced Lighting"); - - //load prefs - %prefPath = getPrefpath(); - if ( isFile( %prefPath @ "/clientPrefs.cs" ) ) - exec( %prefPath @ "/clientPrefs.cs" ); - else - exec("data/defaults.cs"); - - configureCanvas(); - - //Autodetect settings if it's our first time - if($pref::Video::autoDetect) - GraphicsMenu.Autodetect(); - - postFXInit(); - - closeSplashWindow(); - - // As we know at this point that the initial load is complete, - // we can hide any splash screen we have, and show the canvas. - // This keeps things looking nice, instead of having a blank window - Canvas.showWindow(); -} -else -{ - closeSplashWindow(); + %mainMenuGUI = ProjectSettings.value("UI/mainMenuName"); + if (isObject( %mainMenuGUI )) + Canvas.setContent( %mainMenuGUI ); } +closeSplashWindow(); + echo("Engine initialized..."); \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 84d4b1bc6..edd7c47e4 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,5 +1,179 @@ + + 240 240 240 255 + 100 98 96 255 + 96 94 92 255 + 50 49 48 255 + 59 58 57 255 + 50 49 48 255 + 234 232 230 255 + 32 31 30 255 + 236 234 232 255 + 59 58 57 255 + 43 43 43 255 + 178 175 172 255 + 50 49 48 255 + 17 16 15 255 + 72 70 68 255 + 72 70 68 255 + 255 255 255 255 + 37 36 35 255 + + + 100 + 0 + 15 + 0.8 + 0.8 + 1 + 0 + + 0 + 255 255 255 20 + 500 + 0 + 0 + 10 10 10 + + + + 40 + 50 + 6 + 0 + 1 + AssetWork_Debug.exe + screenCenter + WorldEditorInspectorPlugin + + 255 255 255 100 + 102 102 102 100 + 0 + 1 + 51 51 51 100 + + + http://www.garagegames.com/products/torque-3d/documentation/user + http://www.garagegames.com/products/torque-3d/forums + ../../../Documentation/Official Documentation.html + ../../../Documentation/Torque 3D - Script Manual.chm + + + 100 100 100 255 + 0 255 0 255 + 0 0 255 255 + 255 255 0 255 + 255 255 0 255 + 255 0 0 255 + 255 255 255 255 + + + 255 255 255 255 + 180 180 180 255 + 48 48 48 255 + 215 215 215 255 + 50 50 50 255 + + + 20 + 255 + 0 + 1 + 8 + + + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 1 + 0 + 1 + 100 + 2 + + + tools/worldEditor/images/LockedHandle + tools/worldEditor/images/SelectHandle + tools/worldEditor/images/DefaultHandle + + + + tools/gui + 1024 768 + + 1 + 1 + + + ../../../Documentation/Official Documentation.html + ../../../Documentation/Torque 3D - Script Manual.chm + http://www.garagegames.com/products/torque-3d/documentation/user + + + 1 + 1 + 1 + 1 + 1 + 2 + 0 + 8 + + + 0 + + + 0 + 0 + 0 + + + Categorized + + + + lowerHeight + + 0 + 1 + 100 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 1 + 50 + 0.1 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 10 + 90 + + + 40 40 + 40 40 + ellipse + 1 + 1 + + + + 0 0 1 + 10 + 255 255 255 255 + 0 255 0 255 + 5 + 255 0 0 255 + + + Grid_512_Orange + + + AIPlayer + data/FPSGameplay/levels @@ -11,178 +185,4 @@ - - 15 - 0.8 - 0 - 0 - 0.8 - 1 - 100 - - 255 255 255 20 - 0 - 500 - 0 - 10 10 10 - 0 - - - - lowerHeight - - 1 - ellipse - 40 40 - 1 - 40 40 - - - 1 - 10 - 0 - 90 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 0.1 - 1 - 50 - 100 - - - - 6 - 1 - 40 - screenCenter - AssetWork_Debug.exe - 0 - 50 - WorldEditorInspectorPlugin - - ../../../Documentation/Torque 3D - Script Manual.chm - http://www.garagegames.com/products/torque-3d/forums - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/documentation/user - - - 255 0 0 255 - 100 100 100 255 - 255 255 0 255 - 255 255 0 255 - 255 255 255 255 - 0 255 0 255 - 0 0 255 255 - - - 1 - 1 - 1 - 1 - 1 - - - 255 255 255 100 - 1 - 102 102 102 100 - 51 51 51 100 - 0 - - - 100 - 1 - 0 - 0 - 2 - 0 - 1 - - - 50 50 50 255 - 180 180 180 255 - 215 215 215 255 - 255 255 255 255 - 48 48 48 255 - - - tools/worldEditor/images/DefaultHandle - tools/worldEditor/images/SelectHandle - tools/worldEditor/images/LockedHandle - - - 20 - 8 - 1 - 0 - 255 - - - - 1024 768 - tools/gui - - 0 - 1 - 1 - 1 - 1 - 8 - 2 - 1 - - - 1 - 1 - - - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html - - - 0 - - - 0 - 0 - 0 - - - Categorized - - - - 0 0 1 - 10 - 0 255 0 255 - 255 0 0 255 - 255 255 255 255 - 5 - - - 43 43 43 255 - 255 255 255 255 - 240 240 240 255 - 72 70 68 255 - 59 58 57 255 - 234 232 230 255 - 37 36 35 255 - 50 49 48 255 - 50 49 48 255 - 100 98 96 255 - 32 31 30 255 - 96 94 92 255 - 17 16 15 255 - 178 175 172 255 - 72 70 68 255 - 236 234 232 255 - 50 49 48 255 - 59 58 57 255 - - - Grid_512_Orange - - - AIPlayer -