263 lines
5.7 KiB
GDScript
263 lines
5.7 KiB
GDScript
extends Node
|
|
|
|
var configManagerInstance;
|
|
var config;
|
|
|
|
var MainOpenCount = 0;
|
|
|
|
func _ready():
|
|
var configManager = load("res://scripts/ConfigManager.gd");
|
|
configManagerInstance = configManager.new();
|
|
config = configManagerInstance.Init();
|
|
|
|
|
|
|
|
func CheckCurrentLanguage():
|
|
TranslationServer.set_locale(config.Language);
|
|
|
|
func CheckVideoSettings():
|
|
CheckWindowState();
|
|
CheckLowProcessor();
|
|
|
|
func CheckWindowState():
|
|
var state = SettingsSingleton.GetCurrectWindowState();
|
|
if state == 0:
|
|
if OS.is_window_fullscreen():
|
|
OS.set_window_fullscreen(false);
|
|
if OS.get_borderless_window():
|
|
OS.set_borderless_window(false);
|
|
CheckWindowResolution();
|
|
elif state == 1:
|
|
if OS.is_window_fullscreen():
|
|
OS.set_window_fullscreen(false);
|
|
OS.set_borderless_window(true);
|
|
CheckWindowResolution();
|
|
elif state == 2:
|
|
OS.set_window_fullscreen(true);
|
|
else :
|
|
return
|
|
|
|
func CheckWindowResolution():
|
|
var resolution = SettingsSingleton.GetCurrectScreenResolution()
|
|
var width = 0;
|
|
var height = 0;
|
|
if resolution != "-":
|
|
var value = resolution.split("x", false, 1);
|
|
width = int(value[0]);
|
|
height = int(value[1]);
|
|
else :
|
|
var window = OS.get_real_window_size()
|
|
width = window.x;
|
|
height = window.y;
|
|
OS.set_window_size(Vector2(width, height));
|
|
|
|
var screen_size = OS.get_screen_size();
|
|
var window_size = OS.get_window_size();
|
|
OS.set_window_position(screen_size * 0.5 - window_size * 0.5)
|
|
|
|
func CheckLowProcessor():
|
|
var value = SettingsSingleton.GetCurrectLowProcessor();
|
|
OS.set_low_processor_usage_mode(value);
|
|
|
|
func CheckAudioSettings():
|
|
var audioSettings = [
|
|
{"value":SettingsSingleton.GetGeneralVolumeLevel(), "bus":"Master"},
|
|
{"value":SettingsSingleton.GetMusicVolumeLevel(), "bus":"BGM"},
|
|
{"value":SettingsSingleton.GetEffectsVolumeLevel(), "bus":"SFX"},
|
|
{"value":SettingsSingleton.GetDialogueVolumeLevel(), "bus":"Dialogue"},
|
|
]
|
|
for i in audioSettings:
|
|
CheckAudioVolume(i["value"], i["bus"]);
|
|
|
|
func CheckAudioVolume(value, bus):
|
|
value = float(value);
|
|
var busIndex = AudioServer.get_bus_index(bus);
|
|
if value <= 0:
|
|
AudioServer.set_bus_mute(busIndex, true);
|
|
else :
|
|
if AudioServer.is_bus_mute(busIndex):
|
|
AudioServer.set_bus_mute(busIndex, false);
|
|
var dbValue:float = linear2db(value / 100);
|
|
AudioServer.set_bus_volume_db(busIndex, dbValue);
|
|
|
|
var hasDLC:bool = false;
|
|
# const ExecutableFilename:String = "OneEleven.exe";
|
|
func CheckDLC():
|
|
# var filepath = OS.get_executable_path().replace(ExecutableFilename, "OneElevenDLC18+.pck");
|
|
# hasDLC = ProjectSettings.load_resource_pack(filepath);
|
|
hasDLC = true;
|
|
|
|
func GetDLC()->bool:
|
|
return hasDLC;
|
|
|
|
|
|
func GetUseDlc()->bool:
|
|
return hasDLC and config.UseDlc;
|
|
|
|
func SetUseDlc(value:bool):
|
|
config.UseDlc = value;
|
|
|
|
|
|
func GetCurrentLanguage()->String:
|
|
return config.Language;
|
|
|
|
func SetCurrentLanguage(locale):
|
|
TranslationServer.set_locale(locale);
|
|
config.Language = locale;
|
|
|
|
func GetVoiceoverLanguage()->String:
|
|
return config.VoiceLanguage;
|
|
|
|
func SetVoiceoverLanguage(locale):
|
|
config.VoiceLanguage = locale;
|
|
|
|
func GetCurrectWindowState():
|
|
return config.WindowState;
|
|
|
|
func SetCurrectWindowState(value):
|
|
config.WindowState = value;
|
|
|
|
func GetCurrectScreenResolution():
|
|
return config.ScreenResolution;
|
|
|
|
func GetCurrectScreenResolutionVector2()->Vector2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Vector2(1920, 1080)
|
|
|
|
func SetCurrectScreenResolution(value):
|
|
config.ScreenResolution = value;
|
|
|
|
func GetCurrectLowProcessor()->bool:
|
|
return config.LowProcessor;
|
|
|
|
func SetCurrectLowProcessor(value):
|
|
config.LowProcessor = value;
|
|
|
|
func GetAsyncBackgroundLoading()->bool:
|
|
return config.AsyncBackgroundLoading;
|
|
|
|
func SetAsyncBackgroundLoading(value:bool):
|
|
config.AsyncBackgroundLoading = value;
|
|
|
|
func GetGeneralVolumeLevel()->int:
|
|
return config.GeneralVolume;
|
|
|
|
func SetGeneralVolumeLevel(value):
|
|
config.GeneralVolume = value;
|
|
|
|
func GetMusicVolumeLevel()->int:
|
|
return config.MusicVolume;
|
|
|
|
func SetMusicVolumeLevel(value):
|
|
config.MusicVolume = value;
|
|
|
|
func GetDialogueVolumeLevel()->int:
|
|
return config.DialogueVolume;
|
|
|
|
func SetDialogueVolumeLevel(value):
|
|
config.DialogueVolume = value;
|
|
|
|
func GetEffectsVolumeLevel()->int:
|
|
return config.EffectsVolume;
|
|
|
|
func SetEffectsVolumeLevel(value):
|
|
config.EffectsVolume = value;
|
|
|
|
|
|
func SetAutoRead(value):
|
|
config.AutoRead = value;
|
|
|
|
func GetAutoRead()->bool:
|
|
return config.AutoRead;
|
|
|
|
func SetSkipSeen(value):
|
|
config.SkipSeen = value;
|
|
|
|
func GetSkipSeen()->bool:
|
|
return config.SkipSeen;
|
|
|
|
func SetTextSpeed(value):
|
|
config.TextSpeed = value;
|
|
|
|
func GetTextSpeed()->int:
|
|
return config.TextSpeed;
|
|
|
|
func SetDeafaultTheme(value):
|
|
config.DefaultTheme = value
|
|
|
|
func GetDefaultTheme()->bool:
|
|
return config.DefaultTheme
|
|
|
|
func SetBackgroundColor(color:int):
|
|
config.BackgroundColor = color;
|
|
|
|
func GetBackgroundColor()->int:
|
|
return config.BackgroundColor;
|
|
|
|
func SetTextColor(color:int):
|
|
config.TextColor = color;
|
|
|
|
func GetTextColor()->int:
|
|
return config.TextColor;
|
|
|
|
|
|
func SetTwitchEnabled(value):
|
|
config.TwitchEnabled = value;
|
|
|
|
func GetTwitchEnabled()->bool:
|
|
return config.TwitchEnabled;
|
|
|
|
func SetTwitchChannel(value):
|
|
config.TwitchChannel = value;
|
|
|
|
func GetTwitchChannel()->String:
|
|
return config.TwitchChannel;
|
|
|
|
func SetTwitchTimer(value):
|
|
config.TwitchTimer = value;
|
|
|
|
func GetTwitchTimer()->int:
|
|
return config.TwitchTimer;
|
|
|
|
|
|
|
|
func SaveSettings():
|
|
configManagerInstance.SaveConfig();
|
|
|
|
|
|
|
|
var timeline = "Timeline_1";
|
|
func GetTimeline():
|
|
return timeline;
|
|
|
|
func SetTimeline(value):
|
|
timeline = value;
|
|
|
|
var haveSaves:bool = false;
|
|
func GetHaveSave()->bool:
|
|
return haveSaves;
|
|
|
|
func SetHaveSave(value):
|
|
haveSaves = bool(value);
|
|
|
|
var isFirstStartup;
|
|
|
|
func SetFirstStartup(value):
|
|
isFirstStartup = value;
|
|
|
|
func GetFirstStartup():
|
|
return isFirstStartup;
|
|
|
|
func GetExplanation()->bool:
|
|
return config.Explanation;
|
|
|
|
func SetExplanation(value:bool):
|
|
config.Explanation = value;
|
|
SaveSettings()
|