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

$RG_TEMPLATE::Description    = "Roaming Gamer - T2DProject Template #1";
$RG_TEMPLATE::Version        = 3;
$RG_TEMPLATE::LastUpdate     = "23 APR 2009";

package RG_TEMPLATE_Package {
   function rgVersions()
    {
      Parent::rgVersions();
      echo( $RG_TEMPLATE::Description @ ":" SPC $RG_TEMPLATE::Version SPC "Last updated:" SPC $RG_TEMPLATE::LastUpdate );      
   }
};

if(!isObject($RNDGen))
{
      $RNDGen = new RNDGenerator();
      $RNDGen.setRandomSeed();
}
   
exec("~/TSTK/main.cs");

activatePackage(RG_TEMPLATE_Package);


// returns full name for data file (for level) - we will parse it for specific level data
function getDatafileName(%name)
{
   if (%name !$= "")   
   {
      %prefix = "game/data/levelxml/";
      return %prefix @ %name;  
   }
   else
   return "";
}


function loadProject2()
{
   exec("~/gui/deleteProfile.gui");
   exec("~/gui/gui_pause.gui");
   
   //exec("~/gui/HUD.gui");
   exec("~/gui/CombatHUD.gui");
   exec("~/gui/Combat.gui");
   exec("~/gui/black.gui");
   exec("~/gui/UnitsSlider.gui");
   
   exec("~/gui/gamemenu.gui");
   exec("~/gui/FirstStart.gui");
   exec("~/gui/editProfile.gui");
   exec("~/gui/StringEdit.gui");
   exec("~/gui/Records.gui");
   exec("~/gui/WorldMapUI.gui");

   
   
   exec("~/gameScripts/EditProfiles.cs");
   exec("~/gameScripts/Records.cs");
   
   
   
   exec("~/gameScripts/FlagsControl.cs");
   FlagsControl::Create();
   
   exec("~/gameScripts/VictoryAndDefeat.cs");
   VictoryAndDefeat::Create();
   
   
      
   exec("~/gameScripts/RegionsManager.cs");
   //$RegionsManager.Init();
      
         
   exec("~/gameScripts/PlayerManager.cs");
   //$PlayerManager.Init();
      
      
   exec("~/gameScripts/PlayersManager.cs");
   //$PlayersManager.Init();
      
      
   exec("~/gameScripts/GameLevel.cs");
   exec("~/gameScripts/WorldMap.cs");
   exec("~/gameScripts/CutScene.cs");
  
   exec("~/gameScripts/AIGeneral.cs");
   exec("~/gameScripts/AI1.cs");
   exec("~/gameScripts/AI2.cs");
   exec("~/gameScripts/AI3.cs");
   exec("~/gameScripts/AI4.cs");
   exec("~/gameScripts/AI5.cs");
   exec("~/gameScripts/AI6.cs");
   exec("~/gameScripts/AI7.cs");
   exec("~/gameScripts/AI8.cs");
   exec("~/gameScripts/AI9.cs");
   exec("~/gameScripts/AI10.cs");
   exec("~/gameScripts/AI11.cs");
   exec("~/gameScripts/AI12.cs");
   
   
   exec("~/gameScripts/AI50.cs");
   exec("~/gameScripts/AI51.cs");
   
   exec("~/gameScripts/MenuControl.cs");

   exec("~/gameScripts/ClubsManager.cs");
   //$ClubsManager.Init("Clubs.xml");
   
   exec("~/gameScripts/CombatUnit.cs");
   exec("~/gameScripts/RegionUnit.cs");
   
   
   exec("~/gameScripts/UnitsManager.cs");
   
   exec("~/gameScripts/HUDManager.cs");
   exec("~/gameScripts/PanelManager.cs");
   
   exec("~/gameScripts/ShowList.cs");
   exec("~/gameScripts/DialogsManager.cs");
   //$UnitsManager.Init("Units.xml");
   
   exec("~/gameScripts/TutorialManager.cs");
   
   exec("~/gameScripts/BuildingsManager.cs");
   //$BuildingsManager.Init("Buildings.xml");
   
   exec("~/gameScripts/SuperPowerAnimation.cs");
   exec("~/gameScripts/SuperPower.cs");
      
      
   exec("~/gameScripts/Sounds.cs");
   exec("~/gameScripts/Trophy.cs");
   exec("~/gameScripts/Cities.cs");
   Cities::Create();
   exec("~/gameScripts/Bonuses.cs");
   exec("~/gameScripts/LoadSave.cs");
   
   exec("~/gameScripts/Events.cs");
   
   exec("~/gameScripts/StoryManager.cs");
   //$StoryManager.Init();
   exec("~/gameScripts/MusicControl.cs");
   exec("~/gameScripts/BattleXml.cs");
   exec("~/gameScripts/BattleStorage.cs");
   exec("~/gameScripts/BattleScene.cs");
   //exec("~/gameScripts/BattleControl.cs");
   exec("~/gameScripts/Statistic.cs");

   exec("~/gameScripts/NewGameManager.cs");
   //$GameManager.Init("GamePrm.xml");
   
   exec("~/gameScripts/CombatLevel.cs");
   //$curCombatLevel.Init();
   exec("~/gameScripts/DataControls.cs");
   

   
   exec("~/gameScripts/Store.cs");
   Store::Create();
   exec("~/gameScripts/Skirmish.cs");
   Skirmish::Create();

   exec("~/gameScripts/ImageFontManager.cs");
   
   exec("~/gameScripts/Effects.cs");
   exec("~/gameScripts/BattleCounter.cs");
   exec("~/gameScripts/BattleAnimation.cs");
   exec("~/gameScripts/BattleNewControl.cs");
   
   exec("~/gameScripts/DrawTrophy.cs");



   // Exec game scripts.

 
   // 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) );
/*
   if (isObject($splashScreen))
   {
      $splashScreen.deinit();
      $splashScreen.delete();
   }*/
   
   //exec("./behaviors/MouseDrag.cs");
   //exec("./behaviors/MouseControl.cs");
   //exec("./behaviors/UserControl.cs");
   //exec("./behaviors/ControllersManager.cs");
   
   exec("./gameScripts/music.cs");
   
   
   
   
   $ClubsManager.Init("Clubs.xml");
   $UnitsManager.Init("Units1.xml");
   
   
   $HUDManager.Init("HUD.xml");
   
   $BuildingsManager.Init("Buildings.xml");
   $SuperPower.Init("SuperPower.xml");
   
   $StoryManager.Init();   
   ManagersInit();
   
     
   
   
   
   $ImageFontManager.Init("ImageFonts.xml");
   
   $PanelManager.Init("PanelInfo.xml");
   $DialogsManager.Init("Dialogs.xml");
   
   // General XML load:
   $Sounds.LoadFromFile("Sounds.xml");
   $Trophies.InitFromFile("Trophy.xml");
   $Events.LoadFromFile("Events.xml");
   
   $DrawTrophy.InitFromXML("TrophyView.xml");
   
   $TutorialManager.InitInteractive("InteractiveTutorial.xml");
   
   // Create:
   MouseStatesInit();
   
   // Music:
   play_music(snd_mainmenu);
}

$IsNoFirst_TempMouseDragInit = false;
function ManagersInit() {
   if ($IsNoFirst_TempMouseDragInit) {
      //TempMouseDragInit();
   } else {
      $IsNoFirst_TempMouseDragInit = true;
   }
   // 
   $RegionsManager.Init();
   $PlayerManager.Init();
   $PlayersManager.Init();
   $GameManager.Init("GamePrm.xml");
   if (isObject($splashScreen))
   {
      $splashScreen.deinit();
      $splashScreen.delete();
   }
   
   //$ControllersManager.Create();
   
   /*
   //if(isObject($Cursor))
      $Cursor.Init("Cursor.xml");
   
   //$Cursor.setCursor(Void);
   $Cursor.setCursor(Default);*/
}

function PredStartInit() {
}


function loadProject()
{
   
   //Canvas.ForcedShowCursor();
   // Load up the in game gui.
   
   exec("~/gui/mainScreen.gui");   

   exec("./gameScripts/game.cs");   
   exec("./gameScripts/xml.cs");
   
   exec("~/gui/TestVideo.gui");
   
      
   exec("./gameScripts/ObjectActions.cs");

   exec("./gameScripts/Cursor.cs");
   if(isObject($Cursor))
      $Cursor.Init("Cursor.xml");
   
   //$Cursor.setCursor(Void);
   $Cursor.setCursor(Void, true);
   Canvas.ForcedHideCursor();
   
   exec("./gameScripts/global.cs");
   $ProgressCounter1 = 0;
   $ProgressCounter = 171;
   //sceneWindow2D.loadLevel("game/data/levels/loadscreen.t2d", true);   


      new ActionMap(moveMap);   
   moveMap.push();
   
   $enableDirectInput = true;
      activateDirectInput();
      enableJoystick();

 
   Canvas.setContent(mainScreenGui);
   
   
   $managedDatablockSet1 = new SimSet() {
   canSaveDynamicFields = "1";
      setType = "Datablocks";
      new t2dImageMapDatablock(LoadSCRBar) {
         unloadBitmap = "1";
      imageName = "~/data/images/LoadingBar/bar";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
   };
   new t2dImageMapDatablock(LoadSCRBG) {
      unloadBitmap = "1";
      imageName = "~/data/images/LoadingBar/bg";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
   };
   new t2dImageMapDatablock(LoadSCRFrame) {
      unloadBitmap = "1";
      imageName = "~/data/images/LoadingBar/frame";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
   };
   
   new t2dImageMapDatablock(whiteImage) {
      unloadBitmap = "1";
            imageName = "~/data/images/white";
            imageMode = "FULL";
            frameCount = "-1";
            filterMode = "SMOOTH";
            filterPad = "1";
            preferPerf = "1";
            cellRowOrder = "1";
            cellOffsetX = "0";
            cellOffsetY = "0";
            cellStrideX = "0";
            cellStrideY = "0";
            cellCountX = "-1";
            cellCountY = "-1";
            cellWidth = "0";
            cellHeight = "0";
            preload = "1";
            allowUnload = "0";
         };
   };
   
new t2dSceneGraph(fxSceneGraph) {
   canSaveDynamicFields = "1";
   UseLayerSorting = "1";
   layerSortMode0 = "Normal";
   layerSortMode1 = "Normal";
   layerSortMode2 = "Normal";
   layerSortMode3 = "Normal";
   layerSortMode4 = "Normal";
   layerSortMode5 = "Normal";
   layerSortMode6 = "Normal";
   layerSortMode7 = "Normal";
   layerSortMode8 = "Normal";
   layerSortMode9 = "Normal";
   layerSortMode10 = "Normal";
   layerSortMode11 = "Normal";
   layerSortMode12 = "Normal";
   layerSortMode13 = "Normal";
   layerSortMode14 = "Normal";
   layerSortMode15 = "Normal";
   layerSortMode16 = "Normal";
   layerSortMode17 = "Normal";
   layerSortMode18 = "Normal";
   layerSortMode19 = "Normal";
   layerSortMode20 = "Normal";
   layerSortMode21 = "Normal";
   layerSortMode22 = "Normal";
   layerSortMode23 = "Normal";
   layerSortMode24 = "Normal";
   layerSortMode25 = "Normal";
   layerSortMode26 = "Normal";
   layerSortMode27 = "Normal";
   layerSortMode28 = "Normal";
   layerSortMode29 = "Normal";
   layerSortMode30 = "Normal";
   layerSortMode31 = "Normal";
   DebugRendering = "0";
      cameraPosition = "50.0 37.5";
      cameraSize = "100 75";

   new t2dStaticSprite(LoadSCRBGObj) {
      imageMap = "LoadSCRBG";
      frame = "0";
      canSaveDynamicFields = "1";
      Visible = "0";
      Position = "50.000 37.500";
      size = "100.000 75.000";
      Layer = "7";
         mountID = "2";
      _behavior0 = "ObjectActions";
   };
   new t2dStaticSprite(LoadSCRBarObj) {
      imageMap = "LoadSCRBar";
      frame = "0";
      canSaveDynamicFields = "1";
      Visible = "0";
      Position = "3.271 63.965";
      size = "64.941 4.883";
      Layer = "6";
         EndPosX = "49.951";
         mountID = "3";
         StartPosX = "3.271";
      _behavior0 = "ObjectActions";
   };
   new t2dStaticSprite(LoadSCRFrameObj) {
      imageMap = "LoadSCRFrame";
      frame = "0";
      canSaveDynamicFields = "1";
      Visible = "0";
      Position = "41.602 63.965";
      size = "83.203 5.664";
         mountID = "4";
      _behavior0 = "ObjectActions";
      Layer = "5";
   };
   new t2dStaticSprite(ScreenShotTexture) {
      imageMap = "whiteImage";
      frame = "0";
      canSaveDynamicFields = "1";
      internalName = "YYYYY";
      Visible = "0";
      size = "100.000 75.000";
      FlipY = "1";
         mountID = "5";
   };
};

   sceneFXWindow.setSceneGraph(fxSceneGraph);
   sceneFXWindow.setCurrentCameraPosition("50 37.5", "100 75");
   
   
   exec("~/gui/mainmenu.gui");
   exec("./gameScripts/StringManager.cs");
   
   $StringManager.Init("Strings.xml");
   
   versionButton.text = $StringManager.GetString("version");
   
   FaderVisible(true);
   
   
   
   sceneFXWindow.addGuiControl(mainMenuDlg);
   
   LoadLoadingImages();
   startGame();
      
      
 
}

function LoadLoadingImages(%value)
{
   
   %image = new t2dImageMapDatablock(LoadSCRBG1) {
      imageName = "~/data/images/LoadingBar/bg1";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRBG2) {
      imageName = "~/data/images/LoadingBar/bg2";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRBG3) {
      imageName = "~/data/images/LoadingBar/bg3";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRBG4) {
      imageName = "~/data/images/LoadingBar/bg4";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRFrame1) {
      imageName = "~/data/images/LoadingBar/frame1";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRFrame2) {
      imageName = "~/data/images/LoadingBar/frame2";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRFrame3) {
      imageName = "~/data/images/LoadingBar/frame3";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      unloadBitmap = "1";
   };
   $managedDatablockSet1.add(%image);
   
   %image = new t2dImageMapDatablock(LoadSCRFrame4) {
      imageName = "~/data/images/LoadingBar/frame4";
      imageMode = "FULL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
   };
   $managedDatablockSet1.add(%image);
}

function FaderVisible(%value)
{
   LoadSCRBGObj.Visible = %value;
   LoadSCRBarObj.Visible = %value;
   LoadSCRFrameObj.Visible = %value;
   
   $LoadingActive = %value;
   checkSceneMouseActive(%value);
}

$FaderTime1 = 300;
$FaderTime2 = 300;

function checkSceneMouseActive(%value)
{
   sceneWindow2D.useWindowMouseEvents = !%value;
   sceneWindow2D.useObjectMouseEvents = !%value;
}

$LoadingActive = 1;
function FaderBlendingIn(%Command)
{
   FadeOutAllMusic();
   $LoadingActive = 1;
   checkSceneMouseActive(1);
   $Cursor.SetCursor(Default);
   Canvas.ForcedHideCursor();
   Canvas.HideCursor();

   %LoadingScreen = $RNDGen.getRandom(0, 4);
   switch(%LoadingScreen)
   {
      case 0:
         LoadSCRBGObj.SetImageMap(LoadSCRBG, 0);
         LoadSCRFrameObj.SetImageMap(LoadSCRFrame, 0);
      case 1:
         LoadSCRBGObj.SetImageMap(LoadSCRBG1, 0);
         LoadSCRFrameObj.SetImageMap(LoadSCRFrame1, 0);
      case 2:
         LoadSCRBGObj.SetImageMap(LoadSCRBG2, 0);
         LoadSCRFrameObj.SetImageMap(LoadSCRFrame2, 0);
      case 3:
         LoadSCRBGObj.SetImageMap(LoadSCRBG3, 0);
         LoadSCRFrameObj.SetImageMap(LoadSCRFrame3, 0);
      case 4:
         LoadSCRBGObj.SetImageMap(LoadSCRBG4, 0);
         LoadSCRFrameObj.SetImageMap(LoadSCRFrame4, 0);
   }
   
   LoadSCRBarObj.SetPositionX(LoadSCRBarObj.StartPosX);
   
   %StartColor = "0 0 0 0";
   %EndColor = "0 0 0 1";
    
    $FaderBlendingCMD = %Command;
   %TmpCommand = "FaderBlendingIn2();";           
   ObjectBlending2(LoadSCRBGObj, %StartColor, %EndColor, $FaderTime1, %TmpCommand);
   //ObjectBlending2(LoadSCRBarObj, %StartColor, %EndColor, $FaderTime1, "");
   //ObjectBlending2(LoadSCRFrameObj, %StartColor, %EndColor, $FaderTime1, "");
}

function FaderBlendingIn2()
{
   
   %StartColor = "0 0 0 1";
   %EndColor = "1 1 1 1";
   ObjectBlending2(LoadSCRBGObj, %StartColor, %EndColor, $FaderTime2, "EvalFaderBlendingCMD();");
   ObjectBlending2(LoadSCRBarObj, %StartColor, %EndColor, $FaderTime2, "");
   ObjectBlending2(LoadSCRFrameObj, %StartColor, %EndColor, $FaderTime2, "");
}

function EvalFaderBlendingCMD()
{
   if($FaderStarted == 1)
   {
      schedule(100, 0, "EvalFaderBlendingCMD");
      return;
   }
   %tmpCMD = $FaderBlendingCMD;
   $FaderBlendingCMD = "";
   schedule(0, 0, "eval", %tmpCMD);
   //EvalFaderBlendingCMD(%tmpCMD);
}

function FaderBlendingOut(%Command)
{
   sceneFXWindow.removeGuiControl(mainMenuDlg);
   
   %StartColor = "1 1 1 1";
   %EndColor = "0 0 0 1";
   
   //$Cursor.setCursor(Void, true);
   $FaderBlendingCMD = %Command;
   %TmpCommand = "FaderBlendingOut2();";
   ObjectBlending2(LoadSCRBGObj, %StartColor, %EndColor, $FaderTime2, %TmpCommand);
   ObjectBlending2(LoadSCRBarObj, %StartColor, %EndColor, $FaderTime2, "");
   ObjectBlending2(LoadSCRFrameObj, %StartColor, %EndColor, $FaderTime2, "");
   //
   FadeInMusic();
}

function FaderBlendingOut2()
{
   Effect1.stopEffect();
Effect2.stopEffect();
Effect3.stopEffect();
Effect4.stopEffect();
Effect5.stopEffect();
Effect6.stopEffect();
Effect7.stopEffect();

    LoadSCRBarObj.Visible = 0;
   LoadSCRFrameObj.Visible = 0;
   %StartColor = "0 0 0 1";
   %EndColor = "0 0 0 0";
   %TmpCommand = "FaderVisible(false);Canvas.ForcedShowCursor();Canvas.ShowCursor();EvalFaderBlendingCMD();$LoadingActive=0;checkSceneMouseActive(0);";
   ObjectBlending2(LoadSCRBGObj, %StartColor, %EndColor, $FaderTime1, %TmpCommand);
   //ObjectBlending2(LoadSCRBarObj, %StartColor, %EndColor, $FaderTime1, %Command2);
   //ObjectBlending2(LoadSCRFrameObj, %StartColor, %EndColor, $FaderTime1, "");
}

//---------------------------------------------------------------------------------------------
// initializeProject
// Perform game initialization here.
//---------------------------------------------------------------------------------------------
function initializeProject()
{
   $splash = 1;
   //exec ("./gameScripts/music.cs");
   
   if($splash)
   {
      exec("~/gui/splash.gui");               
      exec("./gameScripts/splash.cs");  
   }

   $defaultScene = "game/data/levels/mainmenu.t2d";
   //Canvas.ForcedHideCursor();
   
  
   if(!$splash)
      loadProject();
   else
      $splashScreen.loadSplash();
}

//---------------------------------------------------------------------------------------------
// shutdownProject
// Clean up your game objects here.
//---------------------------------------------------------------------------------------------

function shutdownProject()
{

   StopSheduleList();
   if(isObject($SheduleList))
      $SheduleList.delete();
      
  
   if(isObject($Cursor))
     {
         $Cursor.Destroy();
         $Cursor.delete();
     }
     
     
   endGame();
}

//---------------------------------------------------------------------------------------------
// setupKeybinds
// Bind keys to actions here..
//---------------------------------------------------------------------------------------------
function setupKeybinds()
{
   new ActionMap(moveMap);

}

