@@ -4,21 +4,107 @@ import org.gitanimals.core.*
44
55sealed interface PersonaEmotionAssets {
66 val personaType: PersonaType
7+ val schemaVersion: Int get() = 1
8+ val name: String
9+ val author: String
10+ val version: String get() = " 1.0.0"
11+ val description: String
12+ val license: String get() = " MIT"
13+ val viewBox: ViewBox
14+ val layout: Layout
15+ val eyeTracking: EyeTracking
16+ val timings: Timings
17+ val hitBoxes: HitBoxes
18+ val sleepingHitboxFiles: List <String >
19+ val miniMode: MiniMode
20+ val objectScale: ObjectScale
21+
722 val error: String
23+ get() = " /assets/images?personaType=${personaType} &emotion=error"
824 val happy: String
25+ get() = " /assets/images?personaType=${personaType} &emotion=happy"
926 val idleFollow: String
27+ get() = " /assets/images?personaType=${personaType} &emotion=idleFollow"
1028 val notification: String
29+ get() = " /assets/images?personaType=${personaType} &emotion=notification"
1130 val thinking: String
31+ get() = " /assets/images?personaType=${personaType} &emotion=thinking"
1232 val typing: String
33+ get() = " /assets/images?personaType=${personaType} &emotion=typing"
34+ val sleeping: String?
35+ get() = null
36+ val waking: String?
37+ get() = null
38+
39+ fun getAsset (emotion : String ): String
1340
1441 data object DessertFox : PersonaEmotionAssets {
1542 override val personaType: PersonaType = PersonaType .DESSERT_FOX
16- override val error: String = dessertFoxErrorEmotionSvg
17- override val happy: String = dessertFoxHappyEmotionSvg
18- override val idleFollow: String = dessertFoxIdleFollowEmotionSvg
19- override val notification: String = dessertFoxNotificationEmotionSvg
20- override val typing: String = dessertFoxTypingEmotionSvg
21- override val thinking: String = dessertFoxThinkingEmotionSvg
43+ override val name: String = " Tanning Fox"
44+ override val author: String = " sumi"
45+ override val description: String =
46+ " A coding fox with a pocket notebook — pixel-perfect fennec inspired by GitAnimals"
47+ override val viewBox = ViewBox (x = - 15 , y = - 25 , width = 45 , height = 45 )
48+ override val layout = Layout (
49+ contentBox = Box (x = - 2 , y = - 2 , width = 20 , height = 18 ),
50+ centerX = 7.5 ,
51+ baselineY = 15.0 ,
52+ visibleHeightRatio = 0.58 ,
53+ baselineBottomRatio = 0.05
54+ )
55+ override val eyeTracking = EyeTracking (
56+ enabled = false ,
57+ states = listOf (" idle" ),
58+ eyeRatioX = 0.52 ,
59+ eyeRatioY = 0.45 ,
60+ maxOffset = 1.5 ,
61+ bodyScale = 0.25 ,
62+ shadowStretch = 0.15 ,
63+ shadowShift = 0.3 ,
64+ ids = EyeTrackingIds (eyes = " eyes-js" , body = " body-js" , shadow = " shadow-js" ),
65+ shadowOrigin = " 7.5px 14px"
66+ )
67+ override val timings = Timings (
68+ minDisplay = mapOf (
69+ " attention" to 4000 ,
70+ " error" to 5000 ,
71+ " notification" to 2500 ,
72+ " working" to 1000 ,
73+ " thinking" to 1000
74+ ),
75+ autoReturn = mapOf (
76+ " attention" to 4000 ,
77+ " error" to 5000 ,
78+ " notification" to 2500
79+ ),
80+ mouseIdleTimeout = 20000 ,
81+ mouseSleepTimeout = 60000 ,
82+ wakeDuration = 5000
83+ )
84+ override val hitBoxes = HitBoxes (
85+ default = Box (x = - 3 , y = - 8 , width = 22 , height = 20 ),
86+ sleeping = Box (x = - 3 , y = - 5 , width = 22 , height = 18 )
87+ )
88+ override val sleepingHitboxFiles = listOf (" sleeping.svg" )
89+ override val miniMode = MiniMode (supported = false )
90+ override val objectScale = ObjectScale (
91+ widthRatio = 1.9 ,
92+ heightRatio = 1.3 ,
93+ offsetX = - 0.45 ,
94+ offsetY = - 0.25
95+ )
96+
97+ override fun getAsset (emotion : String ): String {
98+ return when (emotion) {
99+ " error" -> dessertFoxErrorEmotionSvg
100+ " happy" -> dessertFoxHappyEmotionSvg
101+ " idleFollow" -> dessertFoxIdleFollowEmotionSvg
102+ " notification" -> dessertFoxNotificationEmotionSvg
103+ " thinking" -> dessertFoxThinkingEmotionSvg
104+ " typing" -> dessertFoxTypingEmotionSvg
105+ else -> throw IllegalArgumentException (" Invalid emotion: $emotion " )
106+ }
107+ }
22108 }
23109
24110 companion object {
@@ -30,3 +116,44 @@ sealed interface PersonaEmotionAssets {
30116 }
31117 }
32118}
119+
120+ data class ViewBox (val x : Int , val y : Int , val width : Int , val height : Int )
121+ data class Layout (
122+ val contentBox : Box ,
123+ val centerX : Double ,
124+ val baselineY : Double ,
125+ val visibleHeightRatio : Double ,
126+ val baselineBottomRatio : Double
127+ )
128+
129+ data class Box (val x : Int , val y : Int , val width : Int , val height : Int )
130+ data class EyeTracking (
131+ val enabled : Boolean ,
132+ val states : List <String >,
133+ val eyeRatioX : Double ,
134+ val eyeRatioY : Double ,
135+ val maxOffset : Double ,
136+ val bodyScale : Double ,
137+ val shadowStretch : Double ,
138+ val shadowShift : Double ,
139+ val ids : EyeTrackingIds ,
140+ val shadowOrigin : String
141+ )
142+
143+ data class EyeTrackingIds (val eyes : String , val body : String , val shadow : String )
144+ data class Timings (
145+ val minDisplay : Map <String , Int >,
146+ val autoReturn : Map <String , Int >,
147+ val mouseIdleTimeout : Int ,
148+ val mouseSleepTimeout : Int ,
149+ val wakeDuration : Int
150+ )
151+
152+ data class HitBoxes (val default : Box , val sleeping : Box )
153+ data class MiniMode (val supported : Boolean )
154+ data class ObjectScale (
155+ val widthRatio : Double ,
156+ val heightRatio : Double ,
157+ val offsetX : Double ,
158+ val offsetY : Double
159+ )
0 commit comments