//---------------------------------------------------------------------------------------------
// Torque Game Builder
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------
// initializeProject
// Perform game initialization here.
//---------------------------------------------------------------------------------------------
function initializeProject()
{
   //this sets the title of the game in the windows menu bar
   $canvasTitle = "Country Harvest"; 
   SetCanvasTitle($canvasTitle);
   
   //load the settings.cs and toggle to fullscreen
   exec("./gameScripts/settings.cs");
   
   // Load up the in game gui.
   exec("~/gui/mainScreen.gui");   
   
   //load splash screens and main menu
   exec("~/gui/tgbSplash.gui");
   exec("~/gui/jumboSplash.gui");
   exec("~/gui/portalSplash.gui");
   exec("~/gui/mainMenu.gui");
   exec("~/gui/mainLoading.gui");
   exec("~/gui/loadFarm.gui");
   exec("~/gui/pauseGui.gui");
   exec("~/gui/creditsGui.gui");
   
   //load custom cursors
   exec("./gameScripts/customCursors.cs");
   
   //profile gui's
   exec("~/gui/chooseChar.gui");
   exec("~/gui/chooseName.gui");
   exec("~/gui/chooseProfile.gui");
   exec("~/gui/profileOverwrite.gui");
   exec("~/gui/chooseProfileLoad.gui");
   
   //load HUD gui
   exec("~/gui/HUD.gui");
   exec("~/gui/mapHUD.gui");
   
   //load other various gui's
   exec("~/gui/xpRemain.gui");
   exec("~/gui/gameMenu.gui");
   exec("~/gui/achieve.gui");
   exec("~/gui/achieved.gui");
   exec("~/gui/achvFailed.gui");
   exec("~/gui/propConfirm.gui");
   exec("~/gui/exitGameConfirm.gui");
   exec("~/gui/settingsGui.gui");
   
   //load story gui's
   exec("~/gui/tutValleyStart00.gui");
   exec("~/gui/tutValleyStart01.gui");
   exec("~/gui/tutValleyStart02.gui");
   exec("~/gui/tutValleyStart03.gui");
   exec("~/gui/tutValleyStart04.gui");
   exec("~/gui/tutValleyStart05.gui");
   exec("~/gui/tutValleyStart06.gui");
   exec("~/gui/tutValleyEnd00.gui");
   exec("~/gui/tutValleyEnd01.gui");
   exec("~/gui/tutValleyEnd02.gui");
   exec("~/gui/localCompleteCoin.gui");
   exec("~/gui/localCompleteDecor.gui");
   exec("~/gui/localCompleteDTruck.gui");
   exec("~/gui/localNext.gui");
   
   //load first tutorial gui's
   exec("~/gui/tutStart.gui");
   exec("~/gui/tutCrops00.gui");
   exec("~/gui/tutNav00.gui");
   exec("~/gui/tutPlough00.gui");
   exec("~/gui/tutPlough01.gui");
   exec("~/gui/tutPlant00.gui");
   exec("~/gui/tutPlant01.gui");
   exec("~/gui/tutPlant02.gui");
   exec("~/gui/tutPlant03.gui");
   exec("~/gui/tutHarvest00.gui");
   exec("~/gui/tutHarvest01.gui");
   exec("~/gui/tutComplete00.gui");
   
   //load storage tutorial gui's
   exec("~/gui/tutStorage00.gui");
   exec("~/gui/tutStorage01.gui");
   exec("~/gui/tutStorage02.gui");
   exec("~/gui/tutStorage03.gui");
   exec("~/gui/tutStorage05.gui");
   
   //load the employee tutorial gui's
   exec("~/gui/tutEmployee00.gui");
   exec("~/gui/tutEmployee01.gui");
   exec("~/gui/tutEmployee02.gui");
   exec("~/gui/tutEmployee03.gui");
   
   //load the decor tutorial gui's
   exec("~/gui/tutDecor00.gui");
   exec("~/gui/tutDecor01.gui");
   exec("~/gui/tutDecor02.gui");
   exec("~/gui/tutDecor03.gui");
   exec("~/gui/tutDecor04.gui");
   
   //load the silo build tutorial gui's
   exec("~/gui/tutSilo00.gui");
   exec("~/gui/tutSilo01.gui");
   exec("~/gui/tutSilo02.gui");
   exec("~/gui/tutSilo03.gui");
   exec("~/gui/tutSilo04.gui");
   
   //other tutorials
   exec("~/gui/tutCrow00.gui");
   exec("~/gui/tutCrow01.gui");
   exec("~/gui/tutAchieve00.gui");
   exec("~/gui/tutViewStorage00.gui");
   exec("~/gui/tutEndConfirm.gui");
   exec("~/gui/d3dIssue.gui");
   
   //mill tutorial gui's
   exec("~/gui/tutMill00.gui");
   exec("~/gui/tutMill01.gui");
   exec("~/gui/tutMill02.gui");
   exec("~/gui/tutMill03.gui");
   exec("~/gui/tutMill04.gui");
   exec("~/gui/tutMill05.gui");
   exec("~/gui/tutMill06.gui");
   exec("~/gui/tutMill07.gui");
   exec("~/gui/tutMill08.gui");
   exec("~/gui/tutMill09.gui");
   
   //level up gui's
   exec("~/gui/lvl2.gui");
   exec("~/gui/lvl3.gui");
   exec("~/gui/lvl4.gui");
   exec("~/gui/lvl5.gui");
   exec("~/gui/lvl6.gui");
   exec("~/gui/lvl7.gui");
   exec("~/gui/lvl8.gui");
   exec("~/gui/lvl9.gui");
   exec("~/gui/lvl10.gui");
   exec("~/gui/lvl11.gui");
   exec("~/gui/lvl12.gui");
   exec("~/gui/lvl13.gui");
   exec("~/gui/lvl14.gui");
   exec("~/gui/lvl15.gui");
   
   //load selection gui's
   exec("~/gui/charSelect.gui");
   
   //load hover gui's
   exec("~/gui/upgrdHoverMill.gui");
   exec("~/gui/sellHoverMill.gui");
   exec("~/gui/convertHoverMill.gui");
   exec("~/gui/upgrdHoverSilo.gui");
   exec("~/gui/hoverCrop.gui");
   exec("~/gui/hoverCropWilted.gui");
   exec("~/gui/hoverUnploughed.gui");
   exec("~/gui/hoverPloughed.gui");
   exec("~/gui/upgrdHoverDTruck.gui");
   exec("~/gui/upgrdHoverBay.gui");
   
   //load market gui's
   exec("~/gui/market.gui");
   exec("~/gui/seeds.gui");
   exec("~/gui/paths.gui");
   exec("~/gui/buildings.gui");
   exec("~/gui/employees.gui");
   exec("~/gui/property.gui");
   exec("~/gui/decor.gui");
   
   //load Storage gui's
   exec("~/gui/storage.gui");
   exec("~/gui/storageCrops.gui");
   exec("~/gui/storageProducts.gui");

   //load the cheats script
   exec("./gameScripts/cheats.cs");

   //Exec game scripts.
   exec("./gameScripts/game.cs");
   exec("./gameScripts/profiles.cs");
   exec("./gameScripts/plot.cs");
   exec("./gameScripts/highlight.cs");
   exec("./gameScripts/inGameHUD.cs");
   exec("./gameScripts/selectChars.cs");
   exec("./gameScripts/camera.cs");
   exec("./gameScripts/gameObjects.cs");
   exec("./gameScripts/loadBay.cs");
   exec("./gameScripts/mainChar.cs");
   exec("./gameScripts/employee1.cs");
   exec("./gameScripts/employee2.cs");
   exec("./gameScripts/employee3.cs");
   exec("./gameScripts/crow.cs");
   exec("./gameScripts/xp.cs");
   exec("./gameScripts/money.cs");
   exec("./gameScripts/pickPaths.cs");
   exec("./gameScripts/pickBuildings.cs");
   exec("./gameScripts/pickCrops.cs");
   exec("./gameScripts/pickDecor.cs");
   exec("./gameScripts/storage.cs");
   exec("./gameScripts/dTruck.cs");
   exec("./gameScripts/pickPropExp.cs");
   exec("./gameScripts/charUpgrades.cs");
   exec("./gameScripts/achievements.cs");
   exec("./gameScripts/story.cs");
   exec("./gameScripts/menuBtnAudio.cs");
   
   //for loading datablocks, doesn't load when executed, only when specific function called
   exec("./gameScripts/customDatablocks.cs");
   //exec("./gameScripts/audio.cs");  //audio is loaded through the customDatablocks script, hence why it is not loaded here
   
   //specific buildings
   exec("./gameScripts/toolshed_house.cs");
   exec("./gameScripts/mills.cs");
   exec("./gameScripts/silos.cs");
   
   //tutorial scripts
   exec("./gameScripts/tutorial.cs");

   exec("./gameScripts/various.cs");
   exec("./gameScripts/functions.cs");
   exec("./gameScripts/save_load.cs");
   
   //config file
   exec("./config.cs");
   
   // This is where the game starts. Right now, we are just starting the first level. You will
   // want to expand this to load up a splash screen followed by a main menu depending on the
   // specific needs of your game. Most likely, a menu button will start the actual game, which
   // is where startGame should be called from.
   //startGame( expandFilename($Game::DefaultScene) );
   
   Canvas.setContent(mainScreenGui);
   //fullscreen preferences must be determined, fullscreen prefs found in config.cs
   if($startFullscreen)
   {
      fullScreenChange();
      initialSplash();
   }else
   {
      %desktopBit = getWord(getDesktopResolution(), 2);
      %resX = getWord($windowRes, 0);
      %resY = getWord($windowRes, 1);
      setScreenMode(%resX, %resY, %desktopBit, false);
      
      fullscreenCheckImg.setBitmap("game/data/images/GUI/settings/checkBox_i.png");
      initialSplash();
   }
}

//---------------------------------------------------------------------------------------------
// shutdownProject
// Clean up your game objects here.
//---------------------------------------------------------------------------------------------
function shutdownProject()
{
   endGame();
}

//---------------------------------------------------------------------------------------------
// setupKeybinds
// Bind keys to actions here..
//---------------------------------------------------------------------------------------------
function setupKeybinds()
{
   new ActionMap(moveMap);
   //moveMap.bind("keyboard", "a", "doAction", "Action Description");
}
