ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
42 lines
1.8 KiB
Markdown
42 lines
1.8 KiB
Markdown
---
|
|
id: aego/settings
|
|
summary: Читает настройки игрока и проекта, готовит и применяет изменения, задаёт переопределения на сеанс и открывает экран настроек.
|
|
---
|
|
|
|
`Get*` возвращают действующее значение. `Set*` только готовят значение; `Apply` вводит в действие все подготовленные значения разом, а `Revert` отбрасывает их. `Override*` меняют значение только на этот сеанс и никогда не сохраняются. Скрипты с `OnSettingChanged(id string)` узнают о каждом изменении. Песочница документации не загружает модуль настроек, поэтому этому примеру нужен проект. См. [Настройки](ref:settings).
|
|
|
|
## Пример
|
|
|
|
```aes check
|
|
package demo
|
|
|
|
import (
|
|
"aego/log"
|
|
"aego/settings"
|
|
)
|
|
|
|
script Shaker {
|
|
@export var Strength float = 1
|
|
|
|
var frames int
|
|
|
|
func Ready() {
|
|
log.Info("screen shake " + string(settings.GetFloat("accessibility.screenShake")) + ", reduced motion " + string(settings.GetBool("accessibility.reducedMotion")))
|
|
settings.OverrideFloat("accessibility.screenShake", 0.25)
|
|
}
|
|
|
|
func Update(dt float) {
|
|
frames++
|
|
if frames == 30 {
|
|
shake := Strength * settings.GetFloat("accessibility.screenShake")
|
|
log.Info("shaking with " + string(shake))
|
|
settings.ClearOverride("accessibility.screenShake")
|
|
}
|
|
}
|
|
|
|
func OnSettingChanged(id string) {
|
|
log.Info(id + " is now " + string(settings.GetFloat(id)))
|
|
}
|
|
}
|
|
```
|