home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 January / Gamestar_69_2005-01_dvd.iso / Dema / theprojectv1-0.exe / FCData / Scripts.pak / Scripts / UIScreens / UISystem.lua < prev    next >
Encoding:
Text File  |  2004-09-07  |  2.9 KB  |  102 lines

  1. --------------------------------------------------------------------------------
  2. -- System Initialization
  3. --------------------------------------------------------------------------------
  4. function UI:OnInit()
  5.  
  6.     -- get the list of videofiles
  7.     --local szScriptFolder = "Scripts/UIScreens/";
  8.  
  9.     ----------------------
  10.     -- Load Configuration
  11.     ----------------------
  12.     --Script:LoadScript(szScriptFolder.."UISystemCfg.lua", 1);                -- Load Configuration File
  13.  
  14.     -- Load the skin
  15.     --Script:LoadScript(UI.szSkinPath, 1);
  16.  
  17.     -- Set background and mouse cursor
  18.     UI:SetMouseCursor(System:LoadImage(UI.szMouseCursor));
  19.     UI:SetMouseCursorSize(24, 24);
  20.  
  21.     ----------------------
  22.     -- Load Screen Scripts
  23.     ----------------------
  24.  
  25.     -- Load Common Generic Screens
  26.     --Script:LoadScript(szScriptFolder..szLuaFile, 1);                -- Back Borders
  27.     UI:ActivateScreen(szScreen);
  28. end
  29.  
  30. --------------------------------------------------------------------------------
  31. -- System Deinitialization
  32. --------------------------------------------------------------------------------
  33. function UI:OnRelease()
  34. end
  35.  
  36. --------------------------------------------------------------------------------
  37. -- System Idle
  38. --------------------------------------------------------------------------------
  39. function UI:OnIdle(fIdleTime)
  40. end
  41.  
  42. --------------------------------------------------------------------------------
  43. -- System Switch (e.g. user pressed ESC to switch between game and menu)
  44. --------------------------------------------------------------------------------
  45. -- /param bSwitchOn 1=on, 0=off
  46. function UI:OnSwitch( bSwitchOn )
  47.  
  48. --    System:Log("UI:OnSwitch");        -- debugging
  49.  
  50.     System:ShowConsole(0);
  51.  
  52.     if (bSwitchOn) then
  53.         UI:ActivateScreen(szScreen);
  54.  
  55.         if (ClientStuff and _localplayer and ClientStuff.OnMenuEnter) then
  56.             ClientStuff:OnMenuEnter();
  57.         end
  58.     else
  59.         UI:DeactivateAllScreens();
  60.     end
  61. end
  62.  
  63.  
  64.  
  65. -----------------------------------------------------------------------------
  66. -- Can we render the game in the background ?
  67. ------------------------------------------------------------------------------
  68. function UI:CanRenderGame()
  69.     if (not ClientStuff) then
  70.         return nil;
  71.     end
  72.  
  73.     if (Game:IsInMenu()) then
  74.         if (ClientStuff.GetInGameMenuVideoOn) then
  75.             if (ClientStuff:GetInGameMenuVideoOn() ~= 0) then
  76.                 return nil;
  77.             end
  78.         end
  79.     end
  80.  
  81.     return 1;
  82. end
  83.  
  84. --------------------------------------------------------------------------------
  85. -- System Can Switch ? (e.g. user pressed ESC to switch between game and menu)
  86. --------------------------------------------------------------------------------
  87. -- /param bSwitchOn 1=on, 0=off
  88. function UI:CanSwitch( bSwitchOn )
  89.     if (bSwitchOn) then
  90.         if ((UI.bCanSwitchOn and UI.bCanSwitchOn ~= 0) or (not UI.bCanSwitchOn)) then
  91.             return 1;
  92.         end
  93.  
  94.         return nil;
  95.     else
  96.         if (UI.bCanSwitchOff and UI.bCanSwitchOff == 0) then
  97.             return nil;
  98.         end
  99.  
  100.         return 1;
  101.     end
  102. end