Fix SelectBox ScrollPane being transparent (#8889)

and make Skin.json conform to JSON standard
This commit is contained in:
SomeTroglodyte
2023-03-15 08:04:51 +01:00
committed by GitHub
parent 988f404ebc
commit f1c891252e
2 changed files with 309 additions and 298 deletions

View File

@ -1,313 +1,322 @@
{ {
com.badlogic.gdx.graphics.g2d.BitmapFont: { "com.badlogic.gdx.graphics.g2d.BitmapFont": {
button: "Nativefont" "button": "Nativefont",
font: "Nativefont" "font": "Nativefont",
title: "Nativefont" "title": "Nativefont"
} },
com.badlogic.gdx.graphics.Color: { "com.badlogic.gdx.graphics.Color": {
black: { "black": {
r: 0 "r": 0,
g: 0 "g": 0,
b: 0 "b": 0,
a: 1 "a": 1
} },
color: { "color": {
r: 0.2 "r": 0.2,
g: 0.3 "g": 0.3,
b: 0.5 "b": 0.5,
a: 1 "a": 1
} },
gray: { "gray": {
r: 0.5 "r": 0.5,
g: 0.5 "g": 0.5,
b: 0.5 "b": 0.5,
a: 1 "a": 1
} },
dark-gray: { "dark-gray": {
a: 1.0, "r": 0.25,
b: 0.25, "g": 0.25,
g: 0.25, "b": 0.25,
r: 0.25 "a": 1
} },
disabled: { "disabled": {
a: 1.0, "r": 0.14509805,
b: 0.24313726, "g": 0.16862746,
g: 0.16862746, "b": 0.24313726,
r: 0.14509805 "a": 1
} },
highlight: { "highlight": {
a: 1.0, "r": 0.39607844,
b: 0.44705883, "g": 0.8627451,
g: 0.8627451, "b": 0.44705883,
r: 0.39607844 "a": 1
} },
pressed: { "pressed": {
r: 0.2529412 "r": 0.2529412,
g: 0.6 "g": 0.6,
b: 0.33313715 "b": 0.33313715,
a: 1 "a": 1
} },
selection: { "selection": {
r: 0.22745098 "r": 0.22745098,
g: 0.59607846 "g": 0.59607846,
b: 0.85882354 "b": 0.85882354,
a: 1 "a": 1
} },
white: { "white": {
r: 1 "r": 1,
g: 1 "g": 1,
b: 1 "b": 1,
a: 1 "a": 1
} },
positive: { "positive": {
a: 1.0, "r": 0.12156863,
b: 0.21960784, "g": 0.49411765,
g: 0.49411765, "b": 0.21960784,
r: 0.12156863 "a": 1
} },
negative: { "negative": {
a: 1.0, "r": 0.5529412,
b: 0.0, "g": 0.03137255,
g: 0.03137255, "b": 0.0,
r: 0.5529412 "a": 1
} },
negative-highlight: { "negative-highlight": {
a: 1.0, "r": 0.8666667,
b: 0.050980393, "g": 0.078431375,
g: 0.078431375, "b": 0.050980393,
r: 0.8666667 "a": 1
} },
negative-selected: { "negative-selected": {
a: 1.0, "r": 0.7764706,
b: 0.039215688, "g": 0.0627451,
g: 0.0627451, "b": 0.039215688,
r: 0.7764706 "a": 1
} }
} },
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: { "com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable": {
button-c: { "button-c": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: color "color": "color"
} },
button-p: { "button-p": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: pressed "color": "pressed"
} },
button-h: { "button-h": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: highlight "color": "highlight"
} },
button-disabled: { "button-disabled": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: disabled "color": "disabled"
} },
button-positive: { "button-positive": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: positive "color": "positive"
} },
button-negative: { "button-negative": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: negative "color": "negative"
} },
button-negative-pressed: { "button-negative-pressed": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: negative-selected "color": "negative-selected"
} },
button-negative-hover: { "button-negative-hover": {
name: "RoundedEdgeRectangle" "name": "RoundedEdgeRectangle",
color: negative-highlight "color": "negative-highlight"
} },
checkbox-c: { "checkbox-c": {
name: "Checkbox" "name": "Checkbox",
color: color "color": "color"
} },
checkbox-pressed-c: { "checkbox-pressed-c": {
name: "Checkbox-pressed" "name": "Checkbox-pressed",
color: color "color": "color"
} },
list-c: { "list-c": {
name: "RectangleWithOutline" "name": "RectangleWithOutline",
color: color "color": "color"
} },
scrollbar-c: { "scrollbar-c": {
name: "Scrollbar" "name": "Scrollbar",
color: color "color": "color"
} },
select-box-c: { "select-box-c": {
name: "Select-box" "name": "Select-box",
color: color "color": "color"
} },
select-box-pressed-c: { "select-box-pressed-c": {
name: "Select-box-pressed" "name": "Select-box-pressed",
color: color "color": "color"
} },
select-box-h: { "select-box-h": {
name: "Select-box" "name": "Select-box",
color: highlight "color": "highlight"
} },
slider-knob-c: { "select-box-scroll-bg-c": {
name: "Circle" "name": "Scrollbar",
color: color "color": "default-clear"
} },
slider-horizontal-s: { "slider-knob-c": {
name: "Rectangle" "name": "Circle",
color: selection "color": "color"
} },
slider-vertical-s: { "slider-horizontal-s": {
name: "Rectangle" "name": "Rectangle",
color: selection "color": "selection"
} },
slider-knob-h: { "slider-vertical-s": {
name: "Circle" "name": "Rectangle",
color: highlight "color": "selection"
} },
slider-horizontal-p: { "slider-knob-h": {
name: "Rectangle" "name": "Circle",
color: pressed "color": "highlight"
} },
slider-vertical-p: { "slider-horizontal-p": {
name: "Rectangle" "name": "Rectangle",
color: pressed "color": "pressed"
} },
splitpane-horizontal-c: { "slider-vertical-p": {
name: "RectangleWithOutline" "name": "Rectangle",
color: color "color": "pressed"
} },
splitpane-vertical-c: { "splitpane-horizontal-c": {
name: "RectangleWithOutline" "name": "RectangleWithOutline",
color: color "color": "color"
} },
textfield-c: { "splitpane-vertical-c": {
name: "RoundedEdgeRectangle" "name": "RectangleWithOutline",
color: color "color": "color"
} },
selection: { "textfield-c": {
name: "Rectangle" "name": "RoundedEdgeRectangle",
color: selection "color": "color"
} },
white: { "selection": {
name: "Rectangle" "name": "Rectangle",
color: white "color": "selection"
} },
} "white": {
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: { "name": "Rectangle",
default: { "color": "white"
up: button-c }
down: button-p },
over: button-h "com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle": {
} "default": {
} "up": "button-c",
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: { "down": "button-p",
default: { "over": "button-h"
checkboxOn: checkbox-pressed-c }
checkboxOff: checkbox-c },
font: button "com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle": {
fontColor: color "default": {
downFontColor: pressed "checkboxOn": "checkbox-pressed-c",
overFontColor: highlight "checkboxOff": "checkbox-c",
} "font": "button",
} "fontColor": "color",
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: { "downFontColor": "pressed",
default: { "overFontColor": "highlight"
font: font }
fontColor: color },
} "com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
} "default": {
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: { "font": "font",
default: { "fontColor": "color"
font: font }
fontColorSelected: white },
fontColorUnselected: white "com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle": {
selection: selection "default": {
background: list-c "font": "font",
} "fontColorSelected": "white",
} "fontColorUnselected": "white",
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: { "selection": "selection",
default: { "background": "list-c"
hScrollKnob: scrollbar-c }
vScrollKnob: scrollbar-c },
} "com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle": {
} "default": {
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: { "hScrollKnob": "scrollbar-c",
default: { "vScrollKnob": "scrollbar-c"
font: font },
fontColor: white "select-box-scroll": {
background: select-box-c "background": "select-box-scroll-bg-c",
scrollStyle: default "hScrollKnob": "scrollbar-c",
listStyle: default "vScrollKnob": "scrollbar-c"
backgroundOver: select-box-h }
backgroundOpen: select-box-pressed-c },
} "com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle": {
} "default": {
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: { "font": "font",
default-horizontal: { "fontColor": "white",
knobOver: slider-knob-h "background": "select-box-c",
knobDown: slider-knob-h "scrollStyle": "select-box-scroll",
background: slider-horizontal-p "listStyle": "default",
knob: slider-knob-c "backgroundOver": "select-box-h",
knobBefore: slider-horizontal-s "backgroundOpen": "select-box-pressed-c"
} }
default-vertical: { },
knobOver: slider-knob-h "com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle": {
knobDown: slider-knob-h "default-horizontal": {
background: slider-vertical-p "knobOver": "slider-knob-h",
knob: slider-knob-c "knobDown": "slider-knob-h",
knobBefore: slider-vertical-s "background": "slider-horizontal-p",
} "knob": "slider-knob-c",
} "knobBefore": "slider-horizontal-s"
com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: { },
default-horizontal: { "default-vertical": {
handle: splitpane-horizontal-c "knobOver": "slider-knob-h",
} "knobDown": "slider-knob-h",
default-vertical: { "background": "slider-vertical-p",
handle: splitpane-vertical-c "knob": "slider-knob-c",
} "knobBefore": "slider-vertical-s"
} }
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: { },
default: { "com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle": {
font: button "default-horizontal": {
fontColor: white "handle": "splitpane-horizontal-c"
downFontColor: white },
overFontColor: dark-gray "default-vertical": {
up: button-c "handle": "splitpane-vertical-c"
down: button-p }
over: button-h },
} "com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
positive: { "default": {
font: button "font": "button",
fontColor: white "fontColor": "white",
downFontColor: white "downFontColor": "white",
overFontColor: dark-gray "overFontColor": "dark-gray",
up: button-positive "up": "button-c",
down: button-p "down": "button-p",
over: button-h "over": "button-h"
} },
negative: { "positive": {
font: button "font": "button",
fontColor: white "fontColor": "white",
downFontColor: white "downFontColor": "white",
overFontColor: white "overFontColor": "dark-gray",
up: button-negative "up": "button-positive",
down: button-negative-pressed "down": "button-p",
over: button-negative-hover "over": "button-h"
} },
disabled: { "negative": {
font: button "font": "button",
fontColor: white "fontColor": "white",
downFontColor: white "downFontColor": "white",
overFontColor: white "overFontColor": "white",
up: button-disabled "up": "button-negative",
down: button-disabled "down": "button-negative-pressed",
over: button-disabled "over": "button-negative-hover"
} },
} "disabled": {
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: { "font": "button",
default: { "fontColor": "white",
font: font "downFontColor": "white",
fontColor: white "overFontColor": "white",
background: textfield-c "up": "button-disabled",
cursor: white "down": "button-disabled",
selection: selection "over": "button-disabled"
}
},
"com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle": {
"default": {
"font": "font",
"fontColor": "white",
"background": "textfield-c",
"cursor": "white",
"selection": "selection"
} }
} }
} }

View File

@ -117,10 +117,12 @@ abstract class BaseScreen : Screen {
lateinit var skin: Skin lateinit var skin: Skin
lateinit var skinStrings: SkinStrings lateinit var skinStrings: SkinStrings
fun setSkin() { fun setSkin() {
Fonts.resetFont() Fonts.resetFont()
skinStrings = SkinStrings() skinStrings = SkinStrings()
skin = Skin().apply { skin = Skin().apply {
add("default-clear", clearColor, Color::class.java)
add("Nativefont", Fonts.font, BitmapFont::class.java) add("Nativefont", Fonts.font, BitmapFont::class.java)
add("RoundedEdgeRectangle", skinStrings.getUiBackground("", skinStrings.roundedEdgeRectangleShape), Drawable::class.java) add("RoundedEdgeRectangle", skinStrings.getUiBackground("", skinStrings.roundedEdgeRectangleShape), Drawable::class.java)
add("Rectangle", ImageGetter.getDrawable(""), Drawable::class.java) add("Rectangle", ImageGetter.getDrawable(""), Drawable::class.java)