mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
update UIActor
- to set Label styles for font inside Table
This commit is contained in:
@@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
@@ -50,6 +51,10 @@ public class UIActor extends Group {
|
|||||||
newActor = new Label("", Controls.GetSkin());
|
newActor = new Label("", Controls.GetSkin());
|
||||||
readLabelProperties((Label) newActor, new OrderedMap.OrderedMapEntries<>(element));
|
readLabelProperties((Label) newActor, new OrderedMap.OrderedMapEntries<>(element));
|
||||||
break;
|
break;
|
||||||
|
case "Table":
|
||||||
|
newActor = new Table(Controls.GetSkin());
|
||||||
|
readTableProperties((Table) newActor, new OrderedMap.OrderedMapEntries<>(element));
|
||||||
|
break;
|
||||||
case "Image":
|
case "Image":
|
||||||
newActor = new Image();
|
newActor = new Image();
|
||||||
readImageProperties((Image) newActor, new OrderedMap.OrderedMapEntries<>(element));
|
readImageProperties((Image) newActor, new OrderedMap.OrderedMapEntries<>(element));
|
||||||
@@ -161,6 +166,16 @@ public class UIActor extends Group {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void readTableProperties(Table newActor, ObjectMap.Entries<String, String> entries) {
|
||||||
|
for (ObjectMap.Entry property : entries) {
|
||||||
|
switch (property.key.toString()) {
|
||||||
|
case "font":
|
||||||
|
newActor.getSkin().get(Label.LabelStyle.class).font = Controls.GetSkin().getFont(property.value.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void readSelectorProperties(Selector newActor, ObjectMap.Entries<String, String> entries) {
|
private void readSelectorProperties(Selector newActor, ObjectMap.Entries<String, String> entries) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,51 @@
|
|||||||
{
|
{
|
||||||
"width": 480,
|
"width": 480,
|
||||||
"height": 270,
|
"height": 270,
|
||||||
"yDown": true,
|
"yDown": true,
|
||||||
"elements":[
|
"elements": [
|
||||||
{
|
{
|
||||||
"type" : "Image",
|
"type": "Image",
|
||||||
"image":"ui/title_bg.png",
|
"image": "ui/title_bg.png",
|
||||||
"width": 480,
|
"width": 480,
|
||||||
"height": 270
|
"height": 270
|
||||||
} ,
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type" : "Image",
|
"type": "Image",
|
||||||
"name": "preview",
|
"name": "preview",
|
||||||
"x": 364,
|
"x": 364,
|
||||||
"y": 10 ,
|
"y": 10,
|
||||||
"width": 96,
|
"width": 96,
|
||||||
"height": 54
|
"height": 54
|
||||||
} ,
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type" : "Scroll",
|
"type": "Scroll",
|
||||||
"name": "saveSlots",
|
"name": "saveSlots",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 10 ,
|
"y": 10,
|
||||||
"width": 344,
|
"width": 344,
|
||||||
"height": 235
|
"height": 235
|
||||||
} ,
|
},
|
||||||
{
|
{
|
||||||
"type" : "TextButton",
|
"type": "TextButton",
|
||||||
"name" : "return" ,
|
"name": "return",
|
||||||
"text" : "Back" ,
|
"text": "Back",
|
||||||
"width": 48,
|
"width": 48,
|
||||||
"height": 16,
|
"height": 16,
|
||||||
"x": 15,
|
"x": 15,
|
||||||
"y": 250
|
"y": 250
|
||||||
} ,
|
},
|
||||||
{
|
{
|
||||||
"type" : "TextButton",
|
"type": "TextButton",
|
||||||
"name" : "save" ,
|
"name": "save",
|
||||||
"text" : "saveLoad" ,
|
"text": "saveLoad",
|
||||||
"width": 48,
|
"width": 48,
|
||||||
"height": 16,
|
"height": 16,
|
||||||
"x": 115,
|
"x": 115,
|
||||||
"y": 250
|
"y": 250
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"type": "Table",
|
||||||
|
"font": "default"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -2,96 +2,103 @@
|
|||||||
"width": 480,
|
"width": 480,
|
||||||
"height": 270,
|
"height": 270,
|
||||||
"yDown": true,
|
"yDown": true,
|
||||||
"elements":[
|
"elements": [
|
||||||
{
|
{
|
||||||
"type" : "Image",
|
"type": "Image",
|
||||||
"image":"ui/title_bg.png",
|
"image": "ui/title_bg.png",
|
||||||
"width": 480,
|
"width": 480,
|
||||||
"height": 270
|
"height": 270
|
||||||
} ,
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"type" : "Scroll",
|
"type": "Scroll",
|
||||||
"name": "enemies",
|
"name": "enemies",
|
||||||
"x": 206,
|
"x": 206,
|
||||||
"y": 10 ,
|
"y": 10,
|
||||||
"width": 256,
|
"width": 256,
|
||||||
"height": 235
|
"height": 235
|
||||||
} ,
|
},
|
||||||
{
|
{
|
||||||
"type" : "Image",
|
"type": "Image",
|
||||||
"name": "avatar",
|
"name": "avatar",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 10 ,
|
"y": 10,
|
||||||
"width": 64,
|
"width": 64,
|
||||||
"height": 64
|
"height": 64
|
||||||
} ,
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"name": "totalWins",
|
"name": "totalWins",
|
||||||
"x": 90,
|
"x": 90,
|
||||||
"y": 84 ,
|
"y": 84,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"text": "Win:",
|
"text": "Win:",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 84 ,
|
"y": 84,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"name": "totalLoss",
|
"name": "totalLoss",
|
||||||
"x": 90,
|
"x": 90,
|
||||||
"y": 104 ,
|
"y": 104,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"text": "Loss:",
|
"text": "Loss:",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 104 ,
|
"y": 104,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"name": "lossWinRatio",
|
"name": "lossWinRatio",
|
||||||
"x": 90,
|
"x": 90,
|
||||||
"y": 124 ,
|
"y": 124,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Label",
|
"type": "Label",
|
||||||
"text": "Win Loss Ratio:",
|
"text": "Win Loss Ratio:",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 124 ,
|
"y": 124,
|
||||||
"width": 80,
|
"width": 80,
|
||||||
"height": 24
|
"height": 24,
|
||||||
} ,
|
"font": "default"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type" : "Image",
|
"type": "Image",
|
||||||
"image" : "ui/avatarhud.png" ,
|
"image": "ui/avatarhud.png",
|
||||||
"x": 10,
|
"x": 10,
|
||||||
"y": 10 ,
|
"y": 10,
|
||||||
"width": 64,
|
"width": 64,
|
||||||
"height": 64
|
"height": 64
|
||||||
} ,
|
},
|
||||||
{
|
{
|
||||||
"type" : "TextButton",
|
"type": "TextButton",
|
||||||
"name" : "return" ,
|
"name": "return",
|
||||||
"text" : "Back" ,
|
"text": "Back",
|
||||||
"width": 48,
|
"width": 48,
|
||||||
"height": 16,
|
"height": 16,
|
||||||
"x": 15,
|
"x": 15,
|
||||||
"y": 250
|
"y": 250
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Table",
|
||||||
|
"font": "default"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user