Update schema with the last modifications of gui_rw_test2 commit

This commit is contained in:
Christian Rendina 2024-12-18 18:59:16 +01:00
parent c1f70b1eb0
commit 329bec23ed
5 changed files with 20 additions and 15 deletions

View File

@ -8,8 +8,10 @@ public class NBTWriter {
{
NBTOutput out = new NBTOutput();
out.put(NBTTags.IsInGame.value(), scr.IsInGame);
out.put(NBTTags.IsPanorama.value(), scr.IsPanorama);
if (scr.IsPanorama != null)
out.put(NBTTags.IsPanorama.value(), scr.IsPanorama);
if (scr.Background != null)
out.put(NBTTags.Background.value(), scr.Background);
if (!scr.Children.isEmpty())
{

View File

@ -38,16 +38,18 @@ public class XMLReader {
Node scrXml = nodes.item(0);
Node panorama = scrXml.getAttributes().getNamedItem("panorama");
if (panorama == null)
return null;
Node ingame = scrXml.getAttributes().getNamedItem("ingame");
if (ingame == null)
return null;
Screen scr = new Screen();
scr.IsInGame = Boolean.parseBoolean(ingame.getNodeValue());
scr.IsPanorama = Boolean.parseBoolean(panorama.getNodeValue());
NamedNodeMap attrs = scrXml.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node attr = attrs.item(i);
switch (attr.getNodeName())
{
case "panorama" -> scr.IsPanorama = Boolean.parseBoolean(attr.getNodeValue());
case "background" -> scr.Background = Integer.parseInt(attr.getNodeValue());
}
}
NodeList children = scrXml.getChildNodes();
int childrenlen = children.getLength();

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
public class Screen {
public boolean IsPanorama = false;
public boolean IsInGame = false;
public Boolean IsPanorama = null;
public Integer Background = null;
public List<BaseGui> Children = new ArrayList<>();
}

View File

@ -14,9 +14,9 @@ public enum NBTTags {
AnchorX,
AnchorY,
// Screen tags
IsInGame,
IsPanorama,
Childs,
Background,
// Label tags
Rotation,
Scale,
@ -36,6 +36,7 @@ public enum NBTTags {
DrawRight,
DrawTop,
DrawBottom;
// end of Version 1 tags
public String value()
{

View File

@ -117,7 +117,7 @@
</xs:element>
</xs:sequence>
<xs:attribute name="panorama" type="xs:boolean" default="false" />
<xs:attribute name="ingame" type="xs:boolean" default="false" />
<xs:attribute name="background" type="xs:integer" />
</xs:complexType>
</xs:element>
</xs:schema>