Polish interface artwork and controller behavior
This commit is contained in:
parent
c6b897718c
commit
f8e02e3844
41 changed files with 1119 additions and 171 deletions
|
|
@ -15,6 +15,9 @@ const DEFAULT_WORLD_PIXEL_SIZE: int = 3
|
|||
const MIN_UI_PIXEL_SIZE: int = 1
|
||||
const MAX_UI_PIXEL_SIZE: int = 5
|
||||
const DEFAULT_UI_PIXEL_SIZE: int = 3
|
||||
const DEFAULT_CHAT_DOCK_RIGHT: bool = false
|
||||
const DEFAULT_CHAT_MOBILE_MODE: bool = false
|
||||
const DEFAULT_PAINT_DOCK_RIGHT: bool = true
|
||||
const MAX_CHAT_DRAFT_CHARACTERS: int = 256
|
||||
const COMPACT_DISPLAY_HEIGHT: int = 560
|
||||
const WORLD_DESKTOP_GRID_HEIGHTS: Array[int] = [0, 540, 360, 216, 96]
|
||||
|
|
@ -32,9 +35,10 @@ const UI_COMPACT_RENDER_HEIGHTS: Array[int] = [0, 408, 336, 264, 192]
|
|||
@export var on_screen_keyboard_enabled: bool = false
|
||||
@export var chat_draft: String = ""
|
||||
@export var chat_collapsed: bool = false
|
||||
@export var chat_dock_right: bool = false
|
||||
@export var chat_mobile_mode: bool = false
|
||||
@export var paint_dock_right: bool = true
|
||||
@export var chat_dock_right: bool = DEFAULT_CHAT_DOCK_RIGHT
|
||||
@export var chat_mobile_mode: bool = DEFAULT_CHAT_MOBILE_MODE
|
||||
@export var paint_dock_right: bool = DEFAULT_PAINT_DOCK_RIGHT
|
||||
@export var presentation_layout_customized: bool = false
|
||||
@export var fullscreen_enabled: bool = false
|
||||
@export_range(0.0, 1.0, 0.01) var master_volume: float = 1.0
|
||||
@export_range(0.0, 1.0, 0.01) var music_volume: float = 1.0
|
||||
|
|
@ -81,6 +85,7 @@ func copy() -> PlayerSettings:
|
|||
result.chat_dock_right = chat_dock_right
|
||||
result.chat_mobile_mode = chat_mobile_mode
|
||||
result.paint_dock_right = paint_dock_right
|
||||
result.presentation_layout_customized = presentation_layout_customized
|
||||
result.fullscreen_enabled = fullscreen_enabled
|
||||
result.master_volume = master_volume
|
||||
result.music_volume = music_volume
|
||||
|
|
@ -91,6 +96,20 @@ func copy() -> PlayerSettings:
|
|||
return result
|
||||
|
||||
|
||||
func normalize_implicit_presentation_layout() -> bool:
|
||||
if presentation_layout_customized:
|
||||
return false
|
||||
var changed: bool = (
|
||||
chat_dock_right != DEFAULT_CHAT_DOCK_RIGHT
|
||||
or chat_mobile_mode != DEFAULT_CHAT_MOBILE_MODE
|
||||
or paint_dock_right != DEFAULT_PAINT_DOCK_RIGHT
|
||||
)
|
||||
chat_dock_right = DEFAULT_CHAT_DOCK_RIGHT
|
||||
chat_mobile_mode = DEFAULT_CHAT_MOBILE_MODE
|
||||
paint_dock_right = DEFAULT_PAINT_DOCK_RIGHT
|
||||
return changed
|
||||
|
||||
|
||||
static func _is_valid_audio_volume(value: float) -> bool:
|
||||
return (
|
||||
is_finite(value)
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@ func load_settings() -> bool:
|
|||
presentation.has("paint_dock_right")
|
||||
and typeof(presentation["paint_dock_right"]) != TYPE_BOOL
|
||||
)
|
||||
or (
|
||||
presentation.has("layout_customized")
|
||||
and typeof(presentation["layout_customized"]) != TYPE_BOOL
|
||||
)
|
||||
or (
|
||||
presentation.has("fullscreen_enabled")
|
||||
and typeof(presentation["fullscreen_enabled"]) != TYPE_BOOL
|
||||
|
|
@ -135,6 +139,12 @@ func load_settings() -> bool:
|
|||
presentation.get("chat_mobile_mode", false)
|
||||
)
|
||||
loaded.paint_dock_right = bool(presentation.get("paint_dock_right", true))
|
||||
loaded.presentation_layout_customized = bool(
|
||||
presentation.get("layout_customized", false)
|
||||
)
|
||||
var normalized_implicit_layout: bool = (
|
||||
loaded.normalize_implicit_presentation_layout()
|
||||
)
|
||||
loaded.fullscreen_enabled = bool(
|
||||
presentation.get("fullscreen_enabled", false)
|
||||
)
|
||||
|
|
@ -147,7 +157,7 @@ func load_settings() -> bool:
|
|||
if not loaded.is_valid():
|
||||
return _use_defaults_after_corruption("Player settings values are invalid.")
|
||||
current_settings = loaded
|
||||
_is_dirty = false
|
||||
_is_dirty = normalized_implicit_layout
|
||||
_apply_audio_settings(current_settings)
|
||||
emit_signal("settings_changed", current_settings)
|
||||
return true
|
||||
|
|
@ -157,7 +167,9 @@ func apply_settings(settings: PlayerSettings) -> bool:
|
|||
if settings == null or not settings.is_valid():
|
||||
return false
|
||||
var previous: PlayerSettings = current_settings
|
||||
current_settings = settings.copy()
|
||||
var normalized_settings := settings.copy()
|
||||
normalized_settings.normalize_implicit_presentation_layout()
|
||||
current_settings = normalized_settings
|
||||
_is_dirty = true
|
||||
if not save_now():
|
||||
current_settings = previous
|
||||
|
|
@ -240,6 +252,9 @@ func save_now() -> bool:
|
|||
"chat_dock_right": current_settings.chat_dock_right,
|
||||
"chat_mobile_mode": current_settings.chat_mobile_mode,
|
||||
"paint_dock_right": current_settings.paint_dock_right,
|
||||
"layout_customized": (
|
||||
current_settings.presentation_layout_customized
|
||||
),
|
||||
"fullscreen_enabled": current_settings.fullscreen_enabled,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue