Advertisement
Daemonion

LURK ui_mm_main.xml p1

Apr 13th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. function main_menu:InitControls()
  2.     local xml = CScriptXmlInit()
  3.         xml:ParseFile("ui_mm_main.xml")    
  4.  
  5.     local flist = getFS():file_list_open_ex("$game_saves$",bit_or(bit_or(FS.FS_ListFiles,FS.FS_RootOnly), FS.FS_ClampExt) , "*.sav")
  6.     local f_cnt = flist:Size()
  7.     local con = get_console()
  8.     local y,m,d,h,min,sec,ms = nil,nil,nil,nil,nil,nil,nil
  9.    
  10.     flist:Sort(5)
  11.    
  12.     if f_cnt > 0 then
  13.         local file = flist:GetAt(0)
  14.         local sg = CSavedGameWrapper(file:NameFull())
  15.        
  16.         y,m,d,h,min,sec,ms = sg:game_time():get()
  17.        
  18.         -- little fixin's from OGSE to display data in main menu console; we could add other things /daemonion
  19.         local level_name = sg:level_name()
  20.     end
  21.    
  22.     -- picks proper texture from ui_mm_main based first on the level, then on the time of day (day or night only)
  23.     if level and level.present() then
  24.          local htime = level.get_time_hours()
  25.          if htime <= 5 or htime >= 20 then
  26.             -- night level menu
  27.             xml:InitStatic("mm_night_"..level.name(), self)
  28.          else
  29.             -- day level menu
  30.             xml:InitStatic("mm_day_"..level.name(), self)
  31.         end
  32.     end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement