Improve GUI guest sorting and presence display
This commit is contained in:
47
VRWT_Tool/VRC_OSC/internal/app/state.go
Normal file
47
VRWT_Tool/VRC_OSC/internal/app/state.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user