mirror of
https://github.com/RDCN-Community-Developers/rdkt.git
synced 2026-09-05 01:35:31 +08:00
Added docs for setting themes.
This commit is contained in:
@@ -3,6 +3,11 @@ package cn.rdlevel.rdkt.core.data
|
|||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The easing function to use for some animations.
|
||||||
|
*
|
||||||
|
* @see <a href="https://easings.net/">Easings.net</a> for more details on the easing functions.
|
||||||
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public enum class Easing {
|
public enum class Easing {
|
||||||
@SerialName("Linear")
|
@SerialName("Linear")
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import kotlinx.serialization.Serializable
|
|||||||
import kotlinx.serialization.json.JsonClassDiscriminator
|
import kotlinx.serialization.json.JsonClassDiscriminator
|
||||||
import kotlinx.serialization.json.JsonIgnoreUnknownKeys
|
import kotlinx.serialization.json.JsonIgnoreUnknownKeys
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Themes that can be used to set theme in [SetThemeEvent][cn.rdlevel.rdkt.core.events.SetThemeEvent].
|
||||||
|
*/
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
@Serializable
|
@Serializable
|
||||||
@JsonClassDiscriminator("preset")
|
@JsonClassDiscriminator("preset")
|
||||||
@@ -353,19 +356,49 @@ public sealed interface Theme {
|
|||||||
public class ProceduralTree : AbstractTheme()
|
public class ProceduralTree : AbstractTheme()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A theme that has variants.
|
||||||
|
*
|
||||||
|
* @property variant The variant of the theme.
|
||||||
|
*/
|
||||||
public sealed interface VariedTheme<E : Enum<E>> : Theme {
|
public sealed interface VariedTheme<E : Enum<E>> : Theme {
|
||||||
public var variant: E
|
public var variant: E
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A theme that can have its position adjusted.
|
||||||
|
*/
|
||||||
public sealed interface PositionedTheme : Theme {
|
public sealed interface PositionedTheme : Theme {
|
||||||
|
/**
|
||||||
|
* Whether to enable position adjustment for the theme. If false, the position of the theme will be default or unchanged.
|
||||||
|
*/
|
||||||
public var enablePosition: Boolean
|
public var enablePosition: Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The valid range for the [positionX].
|
||||||
|
*/
|
||||||
public val positionXRange: ClosedFloatingPointRange<Double>
|
public val positionXRange: ClosedFloatingPointRange<Double>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The X position of the theme pixels. The default position is 0.
|
||||||
|
* The valid range depends on the theme, and should be within [positionXRange].
|
||||||
|
*
|
||||||
|
* Will be ignored if [enablePosition] is false.
|
||||||
|
*/
|
||||||
public var positionX: Double
|
public var positionX: Double
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration of the position change animation in beats.
|
||||||
|
*
|
||||||
|
* Will be ignored if [enablePosition] is false.
|
||||||
|
*/
|
||||||
public var positionDuration: Double
|
public var positionDuration: Double
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The easing function for the position change animation.
|
||||||
|
*
|
||||||
|
* Will be ignored if [enablePosition] is false.
|
||||||
|
*/
|
||||||
public var positionEase: Easing
|
public var positionEase: Easing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ import cn.rdlevel.rdkt.core.serialization.Flatten
|
|||||||
import cn.rdlevel.rdkt.core.serialization.flatten
|
import cn.rdlevel.rdkt.core.serialization.flatten
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the theme for the selected rooms.
|
||||||
|
*
|
||||||
|
* @property theme The theme to set.
|
||||||
|
*/
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
@Serializable(SetThemeEvent.Serializer::class)
|
@Serializable(SetThemeEvent.Serializer::class)
|
||||||
@KeepGeneratedSerializer
|
@KeepGeneratedSerializer
|
||||||
|
|||||||
Reference in New Issue
Block a user