Initial Android commit
This commit is contained in:
commit
1e2b80c13d
8521 changed files with 231475 additions and 0 deletions
242
scripts/Singletons/GallerySingleton.gd
Normal file
242
scripts/Singletons/GallerySingleton.gd
Normal file
|
@ -0,0 +1,242 @@
|
|||
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");
|
31
scripts/Singletons/InvestigationSingleton.gd
Normal file
31
scripts/Singletons/InvestigationSingleton.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends Node
|
||||
|
||||
var blackClues = [];
|
||||
var greenClues = [];
|
||||
var purpleClues = [];
|
||||
|
||||
func GetBlackClues():
|
||||
return blackClues;
|
||||
|
||||
func AddBlackClues(code):
|
||||
if not code in blackClues:
|
||||
blackClues.push_back(code);
|
||||
|
||||
func GetGreenClues():
|
||||
return greenClues;
|
||||
|
||||
func AddGreenClues(code):
|
||||
if not code in greenClues:
|
||||
greenClues.push_back(code);
|
||||
|
||||
func GetPurpleClues():
|
||||
return purpleClues;
|
||||
|
||||
func AddPurpleClues(code):
|
||||
if not code in purpleClues:
|
||||
purpleClues.push_back(code);
|
||||
|
||||
func ClearCluesArray():
|
||||
blackClues.clear();
|
||||
greenClues.clear();
|
||||
purpleClues.clear();
|
343
scripts/Singletons/ProgressAchievementsSingleton.gd
Normal file
343
scripts/Singletons/ProgressAchievementsSingleton.gd
Normal file
|
@ -0,0 +1,343 @@
|
|||
extends Node
|
||||
|
||||
var achievePath = OS.get_user_data_dir() + "/achievements.json";
|
||||
|
||||
var achieveObject = {}
|
||||
|
||||
func _ready():
|
||||
Init();
|
||||
MakeSureArraysExist();
|
||||
|
||||
func Init():
|
||||
var fileObj = File.new();
|
||||
|
||||
if not (fileObj.file_exists(achievePath)):
|
||||
CreateAchieve();
|
||||
else :
|
||||
fileObj.open(achievePath, File.READ);
|
||||
var content = fileObj.get_as_text();
|
||||
Deserialize(content);
|
||||
|
||||
fileObj.close();
|
||||
|
||||
func MakeSureArraysExist():
|
||||
var keys = ["cats", "minigame", "seenCharacters", "profileTexts", "deathAchievements", "sexAchievements", "killerAchievement", "yellowDeathAchievement", "numberDeathAchievement", ]
|
||||
var shouldUpdate = false;
|
||||
for i in keys:
|
||||
if not achieveObject.has(i):
|
||||
achieveObject[i] = [];
|
||||
shouldUpdate = true;
|
||||
|
||||
if shouldUpdate:
|
||||
SaveToFile();
|
||||
|
||||
|
||||
func CreateAchieve():
|
||||
achieveObject = {
|
||||
"cats":[],
|
||||
"minigame":[],
|
||||
"seenCharacters":[],
|
||||
"profileTexts":[],
|
||||
"deathAchievements":[],
|
||||
"sexAchievements":[],
|
||||
"killerAchievement":[],
|
||||
"yellowDeathAchievement":[],
|
||||
"numberDeathAchievement":[],
|
||||
}
|
||||
SaveToFile();
|
||||
|
||||
func Deserialize(fileContent):
|
||||
achieveObject = str2var(fileContent);
|
||||
|
||||
func SaveToFile():
|
||||
var fileObj = File.new()
|
||||
fileObj.open(achievePath, File.WRITE)
|
||||
var content = var2str(achieveObject);
|
||||
fileObj.store_string(content);
|
||||
fileObj.close();
|
||||
|
||||
func AddCat(catNumber:int)->int:
|
||||
if not catNumber in achieveObject["cats"]:
|
||||
achieveObject["cats"].push_back(catNumber);
|
||||
SaveToFile();
|
||||
return achieveObject["cats"].size();
|
||||
|
||||
return - 1;
|
||||
|
||||
func GetMinigameClues():
|
||||
return achieveObject["minigame"];
|
||||
|
||||
func AddMinigameClue(clue:String)->int:
|
||||
if not clue in achieveObject["minigame"]:
|
||||
achieveObject["minigame"].push_back(clue);
|
||||
SaveToFile();
|
||||
return achieveObject["minigame"].size();
|
||||
|
||||
return - 1;
|
||||
|
||||
|
||||
func SetMinigameVariables():
|
||||
isWindowPressed = Dialogic.get_variable("WindowPressed") == "1";
|
||||
isCasketPressed = Dialogic.get_variable("CasketPressed") == "1";
|
||||
isDrawerPressed = Dialogic.get_variable("DrawerPressed") == "1";
|
||||
isBarrelPressed = Dialogic.get_variable("BarrelPressed") == "1";
|
||||
isClosedTrapdoorPressed = Dialogic.get_variable("ClosedTrapdoorPressed") == "1";
|
||||
|
||||
var isWindowPressed:bool = false;
|
||||
func WindowPressed():
|
||||
isWindowPressed = true;
|
||||
Dialogic.set_variable("WindowPressed", "1");
|
||||
|
||||
func IsWindowPressed()->bool:
|
||||
return isWindowPressed;
|
||||
|
||||
var isCasketPressed:bool = false;
|
||||
func CasketPressed():
|
||||
isCasketPressed = true;
|
||||
Dialogic.set_variable("CasketPressed", "1");
|
||||
|
||||
func IsCasketPressed()->bool:
|
||||
return isCasketPressed;
|
||||
|
||||
var isDrawerPressed:bool = false;
|
||||
func DrawerPressed():
|
||||
isDrawerPressed = true;
|
||||
Dialogic.set_variable("DrawerPressed", "1");
|
||||
|
||||
func IsDrawerPressed()->bool:
|
||||
return isDrawerPressed;
|
||||
|
||||
var isBarrelPressed:bool = false;
|
||||
func BarrelPressed():
|
||||
isBarrelPressed = true;
|
||||
Dialogic.set_variable("BarrelPressed", "1");
|
||||
|
||||
func IsBarrelPressed()->bool:
|
||||
return isBarrelPressed;
|
||||
|
||||
var isClosedTrapdoorPressed:bool = false;
|
||||
func ClosedTrapdoorPressed():
|
||||
isClosedTrapdoorPressed = true;
|
||||
Dialogic.set_variable("ClosedTrapdoorPressed", "1");
|
||||
|
||||
func IsClosedTrapdoorPressed()->bool:
|
||||
return isClosedTrapdoorPressed;
|
||||
|
||||
|
||||
func AddSeenCharacter(character:String):
|
||||
if not character in achieveObject["seenCharacters"]:
|
||||
achieveObject["seenCharacters"].push_back(character);
|
||||
SaveToFile();
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func AddProfileText(stringText:String):
|
||||
if not stringText in achieveObject["profileTexts"]:
|
||||
achieveObject["profileTexts"].push_back(stringText);
|
||||
SaveToFile();
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func GetSeenCharacters():
|
||||
return achieveObject["seenCharacters"]
|
||||
|
||||
func IsInSeenCharacters(name:String)->bool:
|
||||
return name in achieveObject["seenCharacters"];
|
||||
|
||||
func GetProfileText():
|
||||
return achieveObject["profileTexts"]
|
||||
|
||||
|
||||
var allDeathAch = [
|
||||
"Fall",
|
||||
"Knife",
|
||||
"Electrocute",
|
||||
"Explosion",
|
||||
"Poison",
|
||||
"Stairs",
|
||||
"Pillow",
|
||||
"Drowned",
|
||||
"Shot_boy",
|
||||
"Shot_girl",
|
||||
]
|
||||
|
||||
|
||||
func AddDeathAchievement(achName):
|
||||
# Steam.set_achievement(achName);
|
||||
|
||||
if not achName in achieveObject["deathAchievements"]:
|
||||
achieveObject["deathAchievements"].push_back(achName);
|
||||
SaveToFile();
|
||||
|
||||
|
||||
for i in allDeathAch:
|
||||
if not i in achieveObject["deathAchievements"]:
|
||||
return ;
|
||||
|
||||
# Steam.set_achievement("Immortal");
|
||||
|
||||
var allSexAch = [
|
||||
"Orange_S",
|
||||
"Green_S",
|
||||
"Pink_S",
|
||||
"Blue_S",
|
||||
"Black_S",
|
||||
"Purple_S",
|
||||
]
|
||||
|
||||
|
||||
func AddSexAchievement(achName):
|
||||
# Steam.set_achievement(achName);
|
||||
|
||||
if not achName in achieveObject["sexAchievements"]:
|
||||
achieveObject["sexAchievements"].push_back(achName);
|
||||
SaveToFile();
|
||||
|
||||
|
||||
for i in allSexAch:
|
||||
if not i in achieveObject["sexAchievements"]:
|
||||
return ;
|
||||
|
||||
# Steam.set_achievement("Don_Juan");
|
||||
|
||||
func AddKillersAchievement(killer):
|
||||
if not killer in achieveObject["killerAchievement"]:
|
||||
achieveObject["killerAchievement"].push_back(killer);
|
||||
SaveToFile();
|
||||
|
||||
var killers = ["Blue", "Pink"];
|
||||
for i in killers:
|
||||
if not i in achieveObject["killerAchievement"]:
|
||||
return ;
|
||||
|
||||
# Steam.set_achievement("Two_killer");
|
||||
|
||||
func AddYellowDeathAchievement(achName):
|
||||
if not achName in achieveObject["yellowDeathAchievement"]:
|
||||
achieveObject["yellowDeathAchievement"].push_back(achName);
|
||||
SaveToFile();
|
||||
|
||||
var deaths = ["Electricity", "Fire"];
|
||||
for i in deaths:
|
||||
if not i in achieveObject["yellowDeathAchievement"]:
|
||||
return ;
|
||||
|
||||
# Steam.set_achievement("Boss_death");
|
||||
|
||||
func AddNumberDeathAchievement(death, boy):
|
||||
var achName = str(death, boy);
|
||||
if not achName in achieveObject["numberDeathAchievement"]:
|
||||
achieveObject["numberDeathAchievement"].push_back(achName);
|
||||
SaveToFile();
|
||||
|
||||
var deaths = CreateNumberDeathCheck();
|
||||
for i in deaths:
|
||||
if not i in achieveObject["numberDeathAchievement"]:
|
||||
return ;
|
||||
|
||||
# Steam.set_achievement("Definitely_not_me");
|
||||
|
||||
var numberDeathCheck = [];
|
||||
func CreateNumberDeathCheck()->Array:
|
||||
if numberDeathCheck.size() != 0:
|
||||
return numberDeathCheck;
|
||||
|
||||
var numberDeath = ["3_Death_Electricity", "4_Death_Fire"];
|
||||
var deathBoys = ["Red", "Yellow", "White", "Blue_M", "Gray"];
|
||||
for i in numberDeath:
|
||||
for j in deathBoys:
|
||||
numberDeathCheck.push_back(str(i, j));
|
||||
|
||||
return numberDeathCheck;
|
||||
|
||||
|
||||
|
||||
var slotLocation = [
|
||||
Vector2(1478, 620),
|
||||
Vector2(2004, 700),
|
||||
Vector2(2504, 712),
|
||||
Vector2(1920, 961),
|
||||
Vector2(2440, 1008),
|
||||
Vector2(1256, 1248),
|
||||
Vector2(1876, 1308),
|
||||
Vector2(2454, 1322),
|
||||
Vector2(1036, 1704),
|
||||
Vector2(1676, 1672),
|
||||
Vector2(2328, 1728),
|
||||
]
|
||||
|
||||
var variables = [
|
||||
{"variable":"Garage", "slot":10},
|
||||
{"variable":"Office", "slot":11},
|
||||
{"variable":"Kamin", "slot":8},
|
||||
{"variable":"Room", "slot":3},
|
||||
{"variable":"Smoking", "slot":2},
|
||||
{"variable":"Kitchen", "slot":1},
|
||||
{"variable":"Stairs", "slot":5},
|
||||
{"variable":"Lighthouse", "slot":7},
|
||||
{"variable":"Cliff", "slot":4},
|
||||
{"variable":"Parking", "slot":9},
|
||||
{"variable":"Pristan", "slot":4},
|
||||
{"variable":"Podval", "slot":6},
|
||||
{"variable":"Prichal", "slot":3},
|
||||
{"variable":"Restaurant", "slot":8},
|
||||
{"variable":"Tropa", "slot":9},
|
||||
];
|
||||
|
||||
var cachedEpilog:Array = [];
|
||||
|
||||
func CreateEpilogMinigameImages()->Array:
|
||||
if cachedEpilog.size() != 0:
|
||||
return cachedEpilog;
|
||||
|
||||
|
||||
var available = {};
|
||||
for i in range(1, 12):
|
||||
available[i] = 0;
|
||||
|
||||
|
||||
for i in variables:
|
||||
if Dialogic.get_variable(i["variable"]) == "1":
|
||||
cachedEpilog.push_back({"name":i["variable"], "status":true, "slot":i["slot"]});
|
||||
available[i["slot"]] += 1;
|
||||
|
||||
|
||||
|
||||
for i in available:
|
||||
if available[i] == 1:
|
||||
continue;
|
||||
|
||||
if available[i] == 2:
|
||||
|
||||
var firstAvailableSlot = FirstAvailableSlot(available);
|
||||
available[firstAvailableSlot] = 1;
|
||||
available[i] = 1;
|
||||
|
||||
|
||||
for j in cachedEpilog:
|
||||
if j["slot"] == i:
|
||||
j["slot"] = firstAvailableSlot;
|
||||
j["location"] = slotLocation[firstAvailableSlot - 1];
|
||||
break
|
||||
|
||||
for i in available:
|
||||
if available[i] == 1:
|
||||
continue;
|
||||
|
||||
|
||||
if available[i] == 0:
|
||||
for j in variables:
|
||||
if j["slot"] == i:
|
||||
cachedEpilog.push_back({"name":j["variable"], "status":false, "slot":j["slot"]});
|
||||
break
|
||||
|
||||
return cachedEpilog;
|
||||
|
||||
func FirstAvailableSlot(dict:Dictionary)->int:
|
||||
for i in dict:
|
||||
var value = dict[i];
|
||||
if value == 0:
|
||||
return i;
|
||||
return 1;
|
125
scripts/Singletons/SceneLoader.gd
Normal file
125
scripts/Singletons/SceneLoader.gd
Normal file
|
@ -0,0 +1,125 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extends Node
|
||||
|
||||
var thread
|
||||
var scene_queue = {}
|
||||
var file = File.new()
|
||||
var cache = {}
|
||||
var awaiters = []
|
||||
|
||||
signal on_progress
|
||||
signal on_scene_loaded
|
||||
|
||||
var running;
|
||||
|
||||
func _ready():
|
||||
running = true;
|
||||
thread = Thread.new()
|
||||
thread.start(self, "_thread_runner", null)
|
||||
|
||||
func _thread_runner(o):
|
||||
while running:
|
||||
OS.delay_msec(5)
|
||||
|
||||
if scene_queue.size() > 0:
|
||||
for i in scene_queue:
|
||||
var err = scene_queue[i].loader.poll()
|
||||
call_deferred("emit_signal", "on_progress", scene_queue[i].path, scene_queue[i].loader.get_stage_count(), scene_queue[i].loader.get_stage())
|
||||
|
||||
if err == ERR_FILE_EOF:
|
||||
scene_queue[i].loader = scene_queue[i].loader.get_resource()
|
||||
scene_queue[i].instance = scene_queue[i].loader.instance()
|
||||
cache[scene_queue[i].path] = scene_queue[i]
|
||||
call_deferred("emit_signal", "on_scene_loaded", scene_queue[i])
|
||||
scene_queue.erase(scene_queue[i].path)
|
||||
elif err != OK:
|
||||
print("Failed to load: " + scene_queue[i].path)
|
||||
scene_queue.erase(scene_queue[i].path)
|
||||
|
||||
for awaiter in awaiters:
|
||||
if cache.has(awaiter.path):
|
||||
if awaiter.path == cache[awaiter.path].path:
|
||||
awaiter.loader = cache[awaiter.path].loader
|
||||
awaiter.instance = cache[awaiter.path].instance.duplicate()
|
||||
call_deferred("emit_signal", "on_scene_loaded", awaiter)
|
||||
awaiters.remove(awaiters.find(awaiter))
|
||||
|
||||
func load_scene(path, props = null):
|
||||
if not file.file_exists(path):
|
||||
print("File does not exist: " + path)
|
||||
return
|
||||
|
||||
if cache.has(path):
|
||||
call_deferred("emit_signal", "on_scene_loaded", {path = path, loader = cache[path].loader, instance = cache[path].loader.instance(), props = props})
|
||||
return
|
||||
|
||||
if not scene_queue.has(path):
|
||||
scene_queue[path] = {path = path, loader = ResourceLoader.load_interactive(path), instance = null, props = props}
|
||||
else :
|
||||
awaiters.push_back({path = path, loader = null, instance = null, props = props})
|
||||
|
||||
func is_loading_scene(path):
|
||||
return scene_queue.has(path)
|
||||
|
||||
func clear_cache():
|
||||
for item in cache:
|
||||
item.instance.queue_free()
|
||||
cache = {}
|
||||
|
||||
func pop_cache():
|
||||
if cache.size() > 5:
|
||||
var lastKey = cache.keys()[0];
|
||||
cache[lastKey].instance.queue_free()
|
||||
cache.erase(lastKey);
|
||||
|
||||
func getSceneByPath(scenePath:String)->Node:
|
||||
for i in cache.keys():
|
||||
var item = cache[i];
|
||||
if item.path == scenePath:
|
||||
return item.instance;
|
||||
return null;
|
||||
|
||||
func free_scene_cache(sceneName:String):
|
||||
|
||||
sceneName = sceneName + ".tscn";
|
||||
for i in cache.keys():
|
||||
if sceneName in i:
|
||||
cache[i].instance.queue_free()
|
||||
cache.erase(i);
|
||||
|
||||
func get_cache_size()->int:
|
||||
return cache.size();
|
||||
|
||||
func stop_scene_loader():
|
||||
running = false;
|
||||
if thread != null:
|
||||
thread.wait_to_finish();
|
Loading…
Add table
Add a link
Reference in a new issue