242 lines
		
	
	
	
		
			11 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
			
		
		
	
	
			242 lines
		
	
	
	
		
			11 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
| extends Node
 | |
| 
 | |
| var galleryPath = OS.get_user_data_dir() + "/gallery.json";
 | |
| 
 | |
| var galleryObject = {}
 | |
| 
 | |
| func _ready():
 | |
| 	Init();
 | |
| 
 | |
| func Init():
 | |
| 	var fileObj = File.new();
 | |
| 	
 | |
| 	if not (fileObj.file_exists(galleryPath)):
 | |
| 		CreateGallery();
 | |
| 	else :
 | |
| 		fileObj.open(galleryPath, File.READ);
 | |
| 		var content = fileObj.get_as_text();
 | |
| 		Deserialize(content);
 | |
| 	
 | |
| 	fileObj.close();
 | |
| 
 | |
| func CreateGallery():
 | |
| 	galleryObject = {
 | |
| 		"musics":["Menu", ], 
 | |
| 		"backgrounds":[], 
 | |
| 		"images":[]
 | |
| 	}
 | |
| 	SaveToFile();
 | |
| 
 | |
| func Deserialize(fileContent):
 | |
| 	galleryObject = str2var(fileContent);
 | |
| 
 | |
| func SaveToFile():
 | |
| 	var fileObj = File.new()
 | |
| 	fileObj.open(galleryPath, File.WRITE)
 | |
| 	var content = var2str(galleryObject);
 | |
| 	fileObj.store_string(content)
 | |
| 	fileObj.close()
 | |
| 
 | |
| func AddMusic(content):
 | |
| 	content = str(content);
 | |
| 	if content == "99":
 | |
| 		return ;
 | |
| 	
 | |
| 	var key = "";
 | |
| 	for i in GetMusicSettings():
 | |
| 		if str(content, ".ogg") in i.path:
 | |
| 			key = i.name
 | |
| 			break;
 | |
| 	
 | |
| 	if not key in galleryObject["musics"]:
 | |
| 		galleryObject["musics"].push_back(key);
 | |
| 		SaveToFile();
 | |
| 		
 | |
| 		CheckForGreatCollector();
 | |
| 
 | |
| func AddBackground(content):
 | |
| 	if not content in galleryObject["backgrounds"]:
 | |
| 		galleryObject["backgrounds"].push_back(content);
 | |
| 		SaveToFile();
 | |
| 		
 | |
| 		CheckForGreatCollector();
 | |
| 
 | |
| func AddImage(content):
 | |
| 	if not content in galleryObject["images"]:
 | |
| 		galleryObject["images"].push_back(content);
 | |
| 		SaveToFile();
 | |
| 		
 | |
| 		CheckForGreatCollector();
 | |
| 
 | |
| func HaveMusic(content)->bool:
 | |
| 
 | |
| 	return content in galleryObject["musics"];
 | |
| 
 | |
| func HaveBackground(content)->bool:
 | |
| 
 | |
| 	return content in galleryObject["backgrounds"];
 | |
| 
 | |
| func HaveImage(content)->bool:
 | |
| 
 | |
| 	return content in galleryObject["images"];
 | |
| 
 | |
| func GetMusicSettings():
 | |
| 	var music = [
 | |
| 		{"name":"Menu", "path":"res://resources/audio/bgm/1.ogg"}, 
 | |
| 		{"name":"First", "path":"res://resources/audio/bgm/2.ogg"}, 
 | |
| 		{"name":"Restaurant", "path":"res://resources/audio/bgm/3.ogg"}, 
 | |
| 		{"name":"Dating", "path":"res://resources/audio/bgm/4.ogg"}, 
 | |
| 		{"name":"Funny Scene", "path":"res://resources/audio/bgm/5.ogg"}, 
 | |
| 		{"name":"Murderer Theme", "path":"res://resources/audio/bgm/6.ogg"}, 
 | |
| 		{"name":"Romantic Scene", "path":"res://resources/audio/bgm/8.ogg"}, 
 | |
| 		{"name":"Intimate Scene", "path":"res://resources/audio/bgm/9.ogg"}, 
 | |
| 		{"name":"Worried Theme", "path":"res://resources/audio/bgm/10.ogg"}, 
 | |
| 		{"name":"Ending", "path":"res://resources/audio/FuckGallery/12.ogg"}, 
 | |
| 		{"name":"You Died", "path":"res://resources/audio/bgm/13.ogg"}, 
 | |
| 		{"name":"Do Not Worry", "path":"res://resources/audio/FuckGallery/14.ogg"}, 
 | |
| 		{"name":"Think", "path":"res://resources/audio/bgm/15.ogg"}, 
 | |
| 		{"name":"Strange Girl", "path":"res://resources/audio/bgm/16.ogg"}, 
 | |
| 		{"name":"Silent Ambient", "path":"res://resources/audio/FuckGallery/17.ogg"}, 
 | |
| 		{"name":"Dark Ambient", "path":"res://resources/audio/FuckGallery/18.ogg"}, 
 | |
| 		{"name":"Sadness", "path":"res://resources/audio/FuckGallery/19.ogg"}, 
 | |
| 		{"name":"Searching", "path":"res://resources/audio/FuckGallery/20.ogg"}, 
 | |
| 		{"name":"Agatha Theme", "path":"res://resources/audio/FuckGallery/21.ogg"}, 
 | |
| 		{"name":"Dana Theme", "path":"res://resources/audio/FuckGallery/22.ogg"}, 
 | |
| 		{"name":"Linda Theme", "path":"res://resources/audio/FuckGallery/23.ogg"}, 
 | |
| 		{"name":"Hugh Theme", "path":"res://resources/audio/bgm/24.ogg"}, 
 | |
| 		{"name":"Train One", "path":"res://resources/audio/bgm/25.ogg"}, 
 | |
| 		{"name":"Fight Scene", "path":"res://resources/audio/FuckGallery/26.ogg"}, 
 | |
| 		{"name":"Fight Track", "path":"res://resources/audio/bgm/27.ogg"}, 
 | |
| 		{"name":"BigCity", "path":"res://resources/audio/bgm/BigCity.ogg"}, 
 | |
| 
 | |
| 
 | |
| 		{"name":"Triptych", "path":"res://resources/audio/bgm/29.ogg"}, 
 | |
| 	]
 | |
| 	var easterEgg = HaveMusic("Survive");
 | |
| 	if easterEgg:
 | |
| 		music.insert(25, {"name":"Survive", "path":"res://resources/audio/bgm/Survive.ogg"});
 | |
| 		music.insert(26, {"name":"Survive (Eng)", "path":"res://resources/audio/bgm/Survive (Eng).ogg"});
 | |
| 	return music;
 | |
| 
 | |
| func GetBackgroundsSettings():
 | |
| 	var bg = [
 | |
| 		{"name":"Scene_alt1", "path":"res://resources/graphics/Gallery/Backgrounds/Scene_alt1.webp"}, 
 | |
| 		{"name":"Scene2", "path":"res://resources/graphics/Gallery/Backgrounds/Scene2.webp"}, 
 | |
| 		{"name":"Scene2_1", "path":"res://resources/graphics/Gallery/Backgrounds/Scene2_1.webp"}, 
 | |
| 		{"name":"Scene2_2", "path":"res://resources/graphics/Gallery/Backgrounds/Scene2_2.webp"}, 
 | |
| 		{"name":"Scene4", "path":"res://resources/graphics/Gallery/Backgrounds/Scene4.webp"}, 
 | |
| 		{"name":"Scene6", "path":"res://resources/graphics/Gallery/Backgrounds/Scene6.webp"}, 
 | |
| 		{"name":"Scene7", "path":"res://resources/graphics/Gallery/Backgrounds/Scene7.webp"}, 
 | |
| 		{"name":"Scene8", "path":"res://resources/graphics/Gallery/Backgrounds/Scene8.webp"}, 
 | |
| 		{"name":"Scene9", "path":"res://resources/graphics/Gallery/Backgrounds/Scene9.webp"}, 
 | |
| 		{"name":"Scene12", "path":"res://resources/graphics/Gallery/Backgrounds/Scene12.webp"}, 
 | |
| 		{"name":"Kamin", "path":"res://resources/graphics/Gallery/Backgrounds/Kamin.webp"}, 
 | |
| 		{"name":"Podval", "path":"res://resources/graphics/Gallery/Backgrounds/Podval.webp"}, 
 | |
| 		{"name":"Garaj", "path":"res://resources/graphics/Gallery/Backgrounds/Garaj.webp"}, 
 | |
| 		{"name":"Vtoroi_etaj", "path":"res://resources/graphics/Gallery/Backgrounds/Vtoroi_etaj.webp"}, 
 | |
| 		{"name":"Tretii_etaj", "path":"res://resources/graphics/Gallery/Backgrounds/Tretii_etaj.webp"}, 
 | |
| 		{"name":"DomikVnutri", "path":"res://resources/graphics/Gallery/Backgrounds/DomikVnutri.webp"}, 
 | |
| 		{"name":"Pristan", "path":"res://resources/graphics/Gallery/Backgrounds/Pristan.webp"}, 
 | |
| 		{"name":"Room_Agatha", "path":"res://resources/graphics/Gallery/Backgrounds/Room_Agatha.webp"}, 
 | |
| 		{"name":"Room_Dana", "path":"res://resources/graphics/Gallery/Backgrounds/Room_Dana.webp"}, 
 | |
| 		{"name":"Room_Emiliya", "path":"res://resources/graphics/Gallery/Backgrounds/Room_Emiliya.webp"}, 
 | |
| 		{"name":"Room_Linda", "path":"res://resources/graphics/Gallery/Backgrounds/Room_Linda.webp"}, 
 | |
| 		{"name":"Blood_floor", "path":"res://resources/graphics/Gallery/Backgrounds/Blood_floor.webp"}, 
 | |
| 		{"name":"Mayak", "path":"res://resources/graphics/Gallery/Backgrounds/Mayak.webp"}, 
 | |
| 		{"name":"Mayak_Back", "path":"res://resources/graphics/Gallery/Backgrounds/Mayak_Back.webp"}, 
 | |
| 		{"name":"Panorama", "path":"res://resources/graphics/Gallery/Backgrounds/Panorama.webp"}, 
 | |
| 		{"name":"PoliceStation", "path":"res://resources/graphics/Gallery/Backgrounds/PoliceStation.webp"}, 
 | |
| 		{"name":"Room_Martin", "path":"res://resources/graphics/Gallery/Backgrounds/Room_Martin.webp"}, 
 | |
| 		{"name":"Sarai", "path":"res://resources/graphics/Gallery/Backgrounds/Sarai.webp"}, 
 | |
| 		{"name":"Stol", "path":"res://resources/graphics/Gallery/Backgrounds/Stol.webp"}, 
 | |
| 		{"name":"Train_video", "path":"res://resources/graphics/Gallery/Backgrounds/Train_video.webp"}, 
 | |
| 		{"name":"ChapterSelector", "path":"res://resources/graphics/Gallery/Backgrounds/ChapterSelector.webp"}, 
 | |
| 		{"name":"Hospital", "path":"", "multiB":["Hospital_Pink", "Hospital_Blue", "Hospital_Green", "Hospital_Purple", "Hospital_Orange", "Hospital_Black", "Hospital_Loser"]}, 
 | |
| 	]
 | |
| 	return bg;
 | |
| 
 | |
| func GetImagesSettings():
 | |
| 	var im = [
 | |
| 		{"name":"Black_Death_1", "path":"res://resources/graphics/Gallery/Images/Black_Death_1.webp"}, 
 | |
| 		{"name":"Death_fall", "path":"res://resources/graphics/Gallery/Images/Death_fall.webp"}, 
 | |
| 		{"name":"Death_knife", "path":"res://resources/graphics/Gallery/Images/Death_knife.webp"}, 
 | |
| 		{"name":"Green_Death_1", "path":"res://resources/graphics/Gallery/Images/Green_Death_1.webp"}, 
 | |
| 		{"name":"Purple_Death_1", "path":"res://resources/graphics/Gallery/Images/Purple_Death_1.webp"}, 
 | |
| 		{"name":"Roman_black", "path":"res://resources/graphics/Gallery/Images/Roman_black.webp"}, 
 | |
| 		{"name":"Roman_blue", "path":"res://resources/graphics/Gallery/Images/Roman_blue.webp"}, 
 | |
| 		{"name":"Roman_green", "path":"res://resources/graphics/Gallery/Images/Roman_green.webp"}, 
 | |
| 		{"name":"Roman_pink", "path":"res://resources/graphics/Gallery/Images/Roman_pink.webp"}, 
 | |
| 		{"name":"Roman_violet", "path":"res://resources/graphics/Gallery/Images/Roman_violet.webp"}, 
 | |
| 		{"name":"Roman_Orange", "path":"res://resources/graphics/Gallery/Images/Roman_Orange.webp"}, 
 | |
| 		{"name":"Emiliya_sex", "path":"res://resources/graphics/Gallery/Images/Emiliya_sex.webp"}, 
 | |
| 		{"name":"Agatha_sex", "path":"res://resources/graphics/Gallery/Images/Agatha_sex.webp"}, 
 | |
| 		{"name":"Amanda_sex", "path":"res://resources/graphics/Gallery/Images/Amanda_sex.webp"}, 
 | |
| 		{"name":"Amanda_Suicide", "path":"res://resources/graphics/Gallery/Images/Amanda_Suicide.webp"}, 
 | |
| 		{"name":"Linda_sex", "path":"res://resources/graphics/Gallery/Images/Linda_sex.webp"}, 
 | |
| 		{"name":"Dana_sex", "path":"res://resources/graphics/Gallery/Images/Dana_sex.webp"}, 
 | |
| 		{"name":"Renata_sex", "path":"res://resources/graphics/Gallery/Images/Renata_sex.webp"}, 
 | |
| 		{"name":"Emiliya_Go_Away", "path":"res://resources/graphics/Gallery/Images/Emiliya_Go_Away.webp"}, 
 | |
| 		{"name":"Final_Amanda", "path":"res://resources/graphics/Gallery/Images/Final_Amanda.webp"}, 
 | |
| 		{"name":"Final_Emiliya", "path":"res://resources/graphics/Gallery/Images/Final_Emiliya.webp"}, 
 | |
| 		{"name":"Death_shot_epilogue", "path":"res://resources/graphics/Gallery/Images/Death_shot_epilogue.webp"}, 
 | |
| 		{"name":"Death_shot_girl", "path":"", "multi":["Death_shot_girl_blue", "Death_shot_girl_pink"]}, 
 | |
| 		{"name":"Pistol", "path":"res://resources/graphics/Gallery/Images/Pistol.webp"}, 
 | |
| 		{"name":"Vzriv2", "path":"", "multi":["Vzriv2_Gray", "Vzriv2_White", "Vzriv2_Red", "Vzriv2_Blue_M", ]}, 
 | |
| 		{"name":"Death_Stairs", "path":"res://resources/graphics/Gallery/Images/Death_Stairs.webp"}, 
 | |
| 		{"name":"Death_Poison", "path":"", "multi":["Death_Poison_Green", "Death_Poison_Black", "Death_Poison_Hugh", "Death_Poison_Purple"]}, 
 | |
| 		{"name":"Death_Boy_Electricity", "path":"res://resources/graphics/Gallery/Images/Death_Boy_Electricity.webp"}, 
 | |
| 		{"name":"WoundedDead", "path":"", "multi":["WoundedDead_Red", "WoundedDead_White", "WoundedDead_Blue", "WoundedDead_Gray"]}, 
 | |
| 		{"name":"Car", "path":"res://resources/graphics/Gallery/Images/Car.webp"}, 
 | |
| 		{"name":"Death_Car", "path":"res://resources/graphics/Gallery/Images/Death_Car.webp"}, 
 | |
| 		{"name":"Amanda_before_sex", "path":"res://resources/graphics/Gallery/Images/Amanda_before_sex.webp"}, 
 | |
| 		{"name":"Death_shot", "path":"res://resources/graphics/Gallery/Images/Death_shot.webp"}, 
 | |
| 		{"name":"Kofta", "path":"res://resources/graphics/Gallery/Images/Kofta.webp"}, 
 | |
| 		{"name":"Death_Electro", "path":"res://resources/graphics/Gallery/Images/Death_Electro.webp"}, 
 | |
| 	]
 | |
| 	return im;
 | |
| 
 | |
| func GetDlcsSettings()->Array:
 | |
| 	var dlcs = [
 | |
| 		{"name":"AgathaDLC", "path":"res://resources/graphics/Gallery/DLC/AgathaDLC.webp"}, 
 | |
| 		{"name":"AmandaDLC", "path":"res://resources/graphics/Gallery/DLC/AmandaDLC.webp"}, 
 | |
| 		{"name":"DanaDLC", "path":"res://resources/graphics/Gallery/DLC/DanaDLC.webp"}, 
 | |
| 		{"name":"EmiliyaDLC", "path":"res://resources/graphics/Gallery/DLC/EmiliyaDLC.webp"}, 
 | |
| 		{"name":"LindaDLC", "path":"res://resources/graphics/Gallery/DLC/LindaDLC.webp"}, 
 | |
| 		{"name":"RenataDLC", "path":"res://resources/graphics/Gallery/DLC/RenataDLC.webp"}, 
 | |
| 	]
 | |
| 	
 | |
| 	return dlcs;
 | |
| 
 | |
| 
 | |
| 
 | |
| var musicGC = [];
 | |
| var backgroundsGC = [];
 | |
| var imagesGC = [];
 | |
| 
 | |
| func CheckForGreatCollector():
 | |
| 	
 | |
| 	if musicGC.size() == 0:
 | |
| 		var temp = GetMusicSettings();
 | |
| 		for i in temp:
 | |
| 			musicGC.push_back(i["name"]);
 | |
| 		
 | |
| 		temp = GetBackgroundsSettings();
 | |
| 		for i in temp:
 | |
| 			backgroundsGC.push_back(i["name"]);
 | |
| 		
 | |
| 		temp = GetImagesSettings();
 | |
| 		for i in temp:
 | |
| 			imagesGC.push_back(i["name"]);
 | |
| 	
 | |
| 	
 | |
| 	for i in musicGC:
 | |
| 		if not HaveMusic(i):
 | |
| 			return ;
 | |
| 	for i in backgroundsGC:
 | |
| 		if not HaveBackground(i):
 | |
| 			return ;
 | |
| 	for i in imagesGC:
 | |
| 		if not HaveImage(i):
 | |
| 			return ;
 | |
| 	
 | |
| 	# Steam.set_achievement("Great_Collector");
 |