Private
Public Access
1
0

big refactor
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 48s

This commit is contained in:
Sebastian Unterschütz
2025-11-25 18:11:47 +01:00
parent 6afcd4aa94
commit 732f507547
17 changed files with 1519 additions and 1295 deletions

83
types.go Normal file
View File

@@ -0,0 +1,83 @@
package main
type ObstacleDef struct {
ID string `json:"id"`
Width float64 `json:"width"`
Height float64 `json:"height"`
Color string `json:"color"`
Image string `json:"image"`
CanTalk bool `json:"canTalk"`
SpeechLines []string `json:"speechLines"`
YOffset float64 `json:"yOffset"`
}
type GameConfig struct {
Obstacles []ObstacleDef `json:"obstacles"`
Backgrounds []string `json:"backgrounds"`
}
// Dynamischer State
type ActiveObstacle struct {
ID string `json:"id"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"w"`
Height float64 `json:"h"`
}
// API Requests/Responses
type Input struct {
Tick int `json:"t"`
Act string `json:"act"`
}
type ValidateRequest struct {
SessionID string `json:"sessionId"`
Inputs []Input `json:"inputs"`
TotalTicks int `json:"totalTicks"`
}
type ValidateResponse struct {
Status string `json:"status"`
VerifiedScore int `json:"verifiedScore"`
ServerObs []ActiveObstacle `json:"serverObs"`
}
type StartResponse struct {
SessionID string `json:"sessionId"`
Seed uint32 `json:"seed"`
}
type SubmitNameRequest struct {
SessionID string `json:"sessionId"`
Name string `json:"name"`
}
type SubmitResponse struct {
ClaimCode string `json:"claimCode"`
}
type LeaderboardEntry struct {
Rank int64 `json:"rank"`
Name string `json:"name"`
Score int `json:"score"`
IsMe bool `json:"isMe"`
}
type AdminActionRequest struct {
SessionID string `json:"sessionId"`
Action string `json:"action"`
}
type AdminEntry struct {
SessionID string `json:"sessionId"`
Name string `json:"name"`
Score int `json:"score"`
Code string `json:"code"`
Time string `json:"time"`
}
type ClaimDeleteRequest struct {
SessionID string `json:"sessionId"`
ClaimCode string `json:"claimCode"`
}