Files
aego/modules/gameplay/editor/profile.go
sanspie f22242e5aa
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
Stage 11g2–11g3: registry texts, CLI and the site in Russian (D348)
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.
2026-10-25 15:31:22 +03:00

35 lines
1.2 KiB
Go

package editor
import (
"aego/editor/core/context"
"aego/engine/i18n"
"aego/modules/gameplay"
"aego/ui/widgets"
)
type profileState struct {
last gameplay.Stats
}
func perStep(now, prev, steps uint64) float64 {
if steps == 0 {
return 0
}
return float64(now-prev) / float64(steps)
}
func (p *plugin) profile(ed *context.Editor) {
ui := ed.UI
s := gameplay.Of(ed.Docs.ActiveWorld())
if s == nil {
widgets.LabelDim(ui, i18n.Tr("i18n.gameplay.gameplay_runs_only_in_play", "Gameplay runs only in Play"))
return
}
st := s.Stats()
prev := p.prof.last
steps := st.Steps - prev.Steps
widgets.Label(ui, i18n.Tr("i18n.gameplay.profile_controllers", "Controllers {controllers} per step, casts {casts} per step", i18n.Float("controllers", float64(perStep(st.Controllers, prev.Controllers, steps)), 0), i18n.Float("casts", float64(perStep(st.Casts, prev.Casts, steps)), 1)))
widgets.Label(ui, i18n.Tr("i18n.gameplay.profile_events", "Hits {hits}, deaths {deaths}, respawns {respawns}, pickups {pickups}", i18n.Int("hits", int64(st.Hits)), i18n.Int("deaths", int64(st.Deaths)), i18n.Int("respawns", int64(st.Respawns)), i18n.Int("pickups", int64(st.Pickups))))
p.prof.last = st
}