mirror of
				https://github.com/tonytins/dressupzack
				synced 2025-10-31 14:34:42 -04:00 
			
		
		
		
	Compare commits
	
		
			2 commits
		
	
	
		
			0d280d61e0
			...
			b88e55eb52
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b88e55eb52 | ||
|  | fce9a95c0e | 
					 1 changed files with 50 additions and 13 deletions
				
			
		|  | @ -9,7 +9,24 @@ onready var shirts_grid = $Shirts/ShirtsScroll/ShirtsGrid | ||||||
| onready var undies_grid = $Underwear/UndiesScroll/UndiesGrid | onready var undies_grid = $Underwear/UndiesScroll/UndiesGrid | ||||||
| onready var accs_grid = $Accessoires/AccsScroll/AccsGrid | onready var accs_grid = $Accessoires/AccsScroll/AccsGrid | ||||||
| 
 | 
 | ||||||
| func get_dlc(dlc_pack, scenes: Array): | func list_files_in_directory(path): | ||||||
|  | 	var files = [] | ||||||
|  | 	var dir = Directory.new() | ||||||
|  | 	dir.open(path) | ||||||
|  | 	dir.list_dir_begin() | ||||||
|  | 
 | ||||||
|  | 	while true: | ||||||
|  | 		var file = dir.get_next() | ||||||
|  | 		if file == "": | ||||||
|  | 			break | ||||||
|  | 		elif not file.begins_with("."): | ||||||
|  | 			files.append(file) | ||||||
|  | 
 | ||||||
|  | 	dir.list_dir_end() | ||||||
|  | 
 | ||||||
|  | 	return files | ||||||
|  | 
 | ||||||
|  | func check_for_dlc(dlc_pack): | ||||||
| 	var usr_dir = "user://dlc/" | 	var usr_dir = "user://dlc/" | ||||||
| 	var dlc_path = usr_dir + dlc_pack | 	var dlc_path = usr_dir + dlc_pack | ||||||
| 	var load_pck = ProjectSettings.load_resource_pack(dlc_path, false) | 	var load_pck = ProjectSettings.load_resource_pack(dlc_path, false) | ||||||
|  | @ -17,24 +34,44 @@ func get_dlc(dlc_pack, scenes: Array): | ||||||
| 	 | 	 | ||||||
| 	# Check if the DLC is actually there | 	# Check if the DLC is actually there | ||||||
| 	if load_pck == true: | 	if load_pck == true: | ||||||
| 		# Load the DLC | 		 | ||||||
|  | 		# Loads the DLC | ||||||
| 		ProjectSettings.load_resource_pack(dlc_path, false) | 		ProjectSettings.load_resource_pack(dlc_path, false) | ||||||
| 		 | 		 | ||||||
| 		# Initialize and add nodes from each tab  | 		var dir = Directory.new() | ||||||
| 		for scene in scenes: | 		dir.list_dir_begin() | ||||||
| 			var dlc_scene = "res://scenes/dlc/" + scene | 		 | ||||||
| 			var init = load(dlc_scene).instance() | 		# Lists the files in each of their respective directories | ||||||
| 			 | 		var shirts_dir = "res://scenes/dlc/shirts/" | ||||||
| 			if "shirts" in scene: | 		var pants_dir = "res://scenes/dlc/pants/" | ||||||
|  | 		var undies_dir = "res://scenes/dlc/undies/" | ||||||
|  | 		var dlc_shirts = list_files_in_directory(shirts_dir) | ||||||
|  | 		var dlc_pants = list_files_in_directory(pants_dir) | ||||||
|  | 		var dlc_undies = list_files_in_directory(undies_dir) | ||||||
|  | 		 | ||||||
|  | 		# Make sure each file actually exist, instance them | ||||||
|  | 		# and add them to their respective tabs | ||||||
|  | 		for shirt in dlc_shirts: | ||||||
|  | 			if dir.file_exists(shirts_dir + shirt): | ||||||
|  | 				var init = load(shirts_dir + shirt).instance() | ||||||
| 				shirts_grid.add_child(init) | 				shirts_grid.add_child(init) | ||||||
| 				print_debug("Initialized: " + dlc_scene) | 				print_debug("Initialized: " + shirts_dir + shirt) | ||||||
| 				 | 				 | ||||||
| 			if "pants" in scene: | 		for pants in dlc_pants: | ||||||
| 				pants_grid.add_child(init) | 			if dir.file_exists(pants_dir + pants): | ||||||
| 				print_debug("Initialized: " + dlc_scene) | 				var init = load(pants_dir + pants).instance() | ||||||
|  | 				shirts_grid.add_child(init) | ||||||
|  | 				print_debug("Initialized: " + pants_dir + pants) | ||||||
|  | 	 | ||||||
|  | 		for undies in dlc_undies: | ||||||
|  | 			if dir.file_exists(undies_dir + undies): | ||||||
|  | 				var init = load(undies_dir + undies).instance() | ||||||
|  | 				shirts_grid.add_child(init) | ||||||
|  | 				print_debug("Initialized: " + undies_dir + undies) | ||||||
| 
 | 
 | ||||||
| func _ready(): | func _ready(): | ||||||
| 	get_dlc("testdlc.pck", ["shirts/TestShirts.tscn"]) | #	check_for_dlc("testdlc.pck") | ||||||
|  | 	pass | ||||||
| 			 | 			 | ||||||
| func _on_removeAccessory_pressed(): | func _on_removeAccessory_pressed(): | ||||||
| 	character.accessory = blank_top | 	character.accessory = blank_top | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue