Implement 40250 classic client port
This commit is contained in:
@@ -45,6 +45,15 @@ var camera_mode := 1 # 0 近, 1 远
|
||||
var fog_level := 1 # 0 浓, 1 中, 2 淡
|
||||
var tiling_mode := 1 # 0 CPU, 1 GPU(占位)
|
||||
|
||||
static func config_path() -> String:
|
||||
var override_dir := OS.get_environment("MT_CONFIG_DIR")
|
||||
if override_dir != "":
|
||||
return override_dir.path_join("system_option.cfg")
|
||||
# Godot headless 在受限执行环境里可能无法写 user://;测试配置放在系统
|
||||
# 临时目录,正常图形客户端仍使用 user://。
|
||||
return OS.get_temp_dir().path_join("mtgodot_system_option.cfg") \
|
||||
if DisplayServer.get_name() == "headless" else CFG_PATH
|
||||
|
||||
func setup(ui_manager: CanvasLayer, assets: String, audio_node: Node = null,
|
||||
cam_getter := Callable(), env_getter := Callable()) -> void:
|
||||
ui = ui_manager
|
||||
@@ -228,7 +237,7 @@ func _apply_fog() -> void:
|
||||
# --- persistence (= systemSetting 配置文件) --------------------------
|
||||
|
||||
func _load_cfg() -> void:
|
||||
if _cfg.load(CFG_PATH) != OK:
|
||||
if _cfg.load(config_path()) != OK:
|
||||
return
|
||||
music_volume = float(_cfg.get_value("audio", "music_volume", music_volume))
|
||||
sound_volume = float(_cfg.get_value("audio", "sound_volume", sound_volume))
|
||||
@@ -242,4 +251,6 @@ func _save() -> void:
|
||||
_cfg.set_value("video", "camera_mode", camera_mode)
|
||||
_cfg.set_value("video", "fog_level", fog_level)
|
||||
_cfg.set_value("video", "tiling_mode", tiling_mode)
|
||||
_cfg.save(CFG_PATH)
|
||||
var err := _cfg.save(config_path())
|
||||
if err != OK:
|
||||
push_warning("SystemOptionUI: save failed (%s): %s" % [err, config_path()])
|
||||
|
||||
Reference in New Issue
Block a user