Improve GUI guest sorting and presence display

This commit is contained in:
every_holiday
2026-06-24 02:38:06 +09:00
parent b6421958af
commit ab9551c241
8 changed files with 398 additions and 1 deletions

View File

@@ -0,0 +1,47 @@
package app
import "sync"
type RuntimeState struct {
mu sync.RWMutex
DiscordMuted bool
LastOCRText string
LastTranslate string
CurrentWorld string
}
var runtimeState = &RuntimeState{}
var guestTracker *GuestTracker
func SetGuestTracker(t *GuestTracker) { guestTracker = t }
func GetGuestTracker() *GuestTracker { return guestTracker }
func SetDiscordMuted(v bool) {
runtimeState.mu.Lock()
defer runtimeState.mu.Unlock()
runtimeState.DiscordMuted = v
}
func SetOCRText(v string) {
runtimeState.mu.Lock()
defer runtimeState.mu.Unlock()
runtimeState.LastOCRText = v
}
func SetTranslateText(v string) {
runtimeState.mu.Lock()
defer runtimeState.mu.Unlock()
runtimeState.LastTranslate = v
}
func SetCurrentWorld(v string) {
runtimeState.mu.Lock()
defer runtimeState.mu.Unlock()
runtimeState.CurrentWorld = v
}
func SnapshotRuntime() RuntimeState {
runtimeState.mu.RLock()
defer runtimeState.mu.RUnlock()
return *runtimeState
}