mirror of
				https://github.com/ErikasKontenis/SabrehavenServer.git
				synced 2025-10-30 19:56:22 +01:00 
			
		
		
		
	commit client
This commit is contained in:
		
							
								
								
									
										58
									
								
								SabrehavenOTClient/modules/client_styles/styles.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								SabrehavenOTClient/modules/client_styles/styles.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| function init() | ||||
|   local files | ||||
|   local loaded_files = {} | ||||
|   local layout = g_resources:getLayout() | ||||
|    | ||||
|   local style_files = {} | ||||
|   if layout:len() > 0 then | ||||
|     loaded_files = {} | ||||
|     files = g_resources.listDirectoryFiles('/layouts/' .. layout .. '/styles') | ||||
|     for _,file in pairs(files) do | ||||
|       if g_resources.isFileType(file, 'otui') then | ||||
|         table.insert(style_files, file) | ||||
|         loaded_files[file] = true | ||||
|       end | ||||
|     end   | ||||
|   end | ||||
|    | ||||
|   files = g_resources.listDirectoryFiles('/data/styles') | ||||
|   for _,file in pairs(files) do | ||||
|     if g_resources.isFileType(file, 'otui') and not loaded_files[file] then | ||||
|         table.insert(style_files, file) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   table.sort(style_files) | ||||
|   for _,file in pairs(style_files) do | ||||
|     if g_resources.isFileType(file, 'otui') then | ||||
|       g_ui.importStyle('/styles/' .. file) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   if layout:len() > 0 then | ||||
|     files = g_resources.listDirectoryFiles('/layouts/' .. layout .. '/fonts') | ||||
|     loaded_files = {} | ||||
|     for _,file in pairs(files) do | ||||
|       if g_resources.isFileType(file, 'otfont') then | ||||
|         g_fonts.importFont('/layouts/' .. layout .. '/fonts/' .. file) | ||||
|         loaded_files[file] = true | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   files = g_resources.listDirectoryFiles('/data/fonts') | ||||
|   for _,file in pairs(files) do | ||||
|     if g_resources.isFileType(file, 'otfont') and not loaded_files[file] then | ||||
|       g_fonts.importFont('/data/fonts/' .. file) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   g_mouse.loadCursors('/data/cursors/cursors') | ||||
|   if layout:len() > 0 and g_resources.directoryExists('/layouts/' .. layout .. '/cursors/cursors') then | ||||
|     g_mouse.loadCursors('/layouts/' .. layout .. '/cursors/cursors')     | ||||
|   end | ||||
| end | ||||
|  | ||||
| function terminate() | ||||
| end | ||||
|  | ||||
							
								
								
									
										9
									
								
								SabrehavenOTClient/modules/client_styles/styles.otmod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								SabrehavenOTClient/modules/client_styles/styles.otmod
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| Module | ||||
|   name: client_styles | ||||
|   description: Load client fonts and styles | ||||
|   author: edubart | ||||
|   website: https://github.com/edubart/otclient | ||||
|   scripts: [ styles ] | ||||
|   sandboxed: true | ||||
|   @onLoad: init() | ||||
|   @onUnload: terminate() | ||||
		Reference in New Issue
	
	Block a user
	 ErikasKontenis
					ErikasKontenis