From 71e4719cdf8f64525b3169e4cfc32081330f727f Mon Sep 17 00:00:00 2001 From: Willem Date: Sat, 5 Feb 2022 17:00:19 +0100 Subject: [PATCH] Added warpcore driver --- .../distributedrebirth/gdxapp/Demo4DMain.java | 31 ++++++++-- .../base2t/part/warp/TOSWarpCore.java | 59 +++++++++++++------ .../base2t/part/warp/TOSWarpCoreDriver.java | 21 ++++++- .../numberxd/base2t/part/warp/WarpCipher.java | 42 ------------- .../base2t/part/warp/WarpCipherHeart.java | 33 ----------- .../base2t/part/warp/WaterBucket.java | 17 ++++++ .../base2t/part/warp/WaterCipher.java | 46 +++++++++++++++ .../base2t/part/warp/WaterCipherHeart.java | 37 ++++++++++++ ...artCore.java => WaterCipherHeartTone.java} | 23 +++++--- .../META-INF/warpcore/warpcore-lang.eld | 46 +++++++++++++++ .../META-INF/warpcore/warpcore-modules.xml | 10 ++++ .../src/resources/META-INF/x4o-drivers.xml | 3 + 12 files changed, 261 insertions(+), 107 deletions(-) delete mode 100644 demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipher.java delete mode 100644 demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeart.java create mode 100644 demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterBucket.java create mode 100644 demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipher.java create mode 100644 demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeart.java rename demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/{WarpCipherHeartCore.java => WaterCipherHeartTone.java} (61%) create mode 100644 demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-lang.eld create mode 100644 demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-modules.xml diff --git a/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java index 02abb751..402b7a99 100644 --- a/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java +++ b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java @@ -32,6 +32,8 @@ import love.distributedrebirth.gdxapp.screen.ScreenLoading; import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D; import love.distributedrebirth.gdxapp.screen.SystemBaseGlyphRenderer; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; +import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCoreDriver; +import love.distributedrebirth.numberxd.base2t.part.warp.WaterBucket; import net.spookygames.gdx.nativefilechooser.NativeFileChooser; /** @@ -72,23 +74,38 @@ public class Demo4DMain extends Game { } ImGuiSetup.init(); - int fileArgu = args.indexOf("warpcore-load"); - if (fileArgu != -1) { - // TODO: load warpcore + try { + if (args.contains("warpcore-load")) { + System.out.println("warpcore-load: requested"); + WaterBucket bucket = TOSWarpCoreDriver.getInstance().createReader().readFile("./warpcore.xml"); + TOSWarpCore.INSTANCE.BãßArmWarpCore(bucket); + } + if (args.contains("warpcore-save")) { + System.out.println("warpcore-save: requested"); + WaterBucket bucket = TOSWarpCore.INSTANCE.BãßCurrentWarpCore(); + TOSWarpCoreDriver.getInstance().createWriter().writeFile(bucket, "./warpcore.xml"); + } + } catch (Exception e) { + throw new RuntimeException(e); } if (!args.contains("warpcore-nolock")) { TOSWarpCore.INSTANCE.BãßLockWarpCipher(); + } else { + System.out.println("warpcore-nolock: requested"); } if (args.contains("full-screen")) { + System.out.println("full-screen: requested"); Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); } - if (args.contains("no-intro")) { + if (args.contains("intro-skip")) { + System.out.println("intro-skip: requested"); selectScreen(ScreenDefault.class); music.play(MusicSongType.BACKGROUND); } else { selectScreen(ScreenIntro.class); } + } public void create() { @@ -100,8 +117,12 @@ public class Demo4DMain extends Game { camera.update(); batch.setProjectionMatrix(camera.combined); + boolean musicStop = args.contains("music-stop"); + if (musicStop) { + System.out.println("music-stop: requested"); + } music = new MusicManager(); - music.init(args.contains("no-music")); + music.init(musicStop); screens = new HashMap<>(); widgets = new HashMap<>(); diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java index 923d72a4..bb2dc509 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java @@ -1,9 +1,13 @@ package love.distributedrebirth.numberxd.base2t.part.warp; +import java.util.HashMap; +import java.util.Map; + import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ; import love.distributedrebirth.numberxd.base2t.BasePartFactory; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartKeyʸᴰ; import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @@ -22,37 +26,54 @@ public enum TOSWarpCore implements BãßBȍőnEnumInstanceʸᴰ { } } - public WarpCipher BãßSaveWarpCipher() { - WarpCipher warpCore = new WarpCipher(); + public WaterBucket BãßCurrentWarpCore() { + WaterCipher warpCipher = new WaterCipher(); if (armedWarpCipherName == null) { - warpCore.setCipherName("default"); + warpCipher.setName("default"); } else { - warpCore.setCipherName(armedWarpCipherName); + warpCipher.setName(armedWarpCipherName); } if (armedWarpCipherDescription == null) { - warpCore.setCipherName("Current active cipher."); + warpCipher.setName("Current active cipher."); } else { - warpCore.setCipherDescription(armedWarpCipherDescription); + warpCipher.setDescription(armedWarpCipherDescription); } for (int base:BasePartFactory.INSTANCE.BãßBases()) { - WarpCipherHeart heart = new WarpCipherHeart(); + WaterCipherHeart heart = new WaterCipherHeart(); BãßBȍőnPartʸᴰ[] bases = BasePartFactory.INSTANCE.BãßBuildPartsByBase(base); - heart.setPartKey(bases[0].BȍőnNaamI18N()); + heart.setBass(bases[0].BãßInstances().length); for (BãßBȍőnPartʸᴰ part:bases) { - WarpCipherHeartCore core = new WarpCipherHeartCore(); - core.setIdentifierTone(part.BȍőnIdentifierTone()); - core.setChinaKey(part.BȍőnChinaKey()); - core.setChinaValue(part.BȍőnChinaValue()); - heart.getHeartCores().add(core); + WaterCipherHeartTone tone = new WaterCipherHeartTone(); + tone.setPart(part.BȍőnNaam()); + tone.setDialTone(part.BȍőnDialTone()); + tone.setChinaKey(part.BȍőnChinaKey()); + tone.setChinaValue(part.BȍőnChinaValue()); + heart.addHeartTone(tone); } - warpCore.getCipherHearts().add(heart); + warpCipher.getCipherHearts().add(heart); } - return warpCore; + WaterBucket bucket = new WaterBucket(); + bucket.fillWater(warpCipher); + return bucket; } - public void BãßLoadWarpCipher(WarpCipher warpCore) { - armedWarpCipherName = warpCore.getCipherName(); - armedWarpCipherDescription = warpCore.getCipherDescription(); - // TODO: load warpcore + public void BãßArmWarpCore(WaterBucket warpBucket) { + armedWarpCipherName = warpBucket.theWater().getName(); + armedWarpCipherDescription = warpBucket.theWater().getDescription(); + for (WaterCipherHeart heart:warpBucket.theWater().getCipherHearts()) { + BãßBȍőnPartʸᴰ[] bases = BasePartFactory.INSTANCE.BãßBuildPartsByBase(heart.getBass()); + Map> baseParts = new HashMap<>(); + for (BãßBȍőnPartʸᴰ base:bases) { + baseParts.put(base.BȍőnNaam(), base); + } + for (WaterCipherHeartTone tone:heart.getHeartTones()) { + BãßBȍőnPartʸᴰ bassTone = baseParts.get(tone.getPart()); + @SuppressWarnings("unchecked") + BãßBȍőnCoffinOpenʸᴰ coffin = BãßBȍőnCoffinOpenʸᴰ.class.cast(bassTone.GET_BBC()); + coffin.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.DIAL_TONE, tone.getDialTone()); + coffin.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_KEY, tone.getChinaKey()); + coffin.PUT_OBJ(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE, tone.getChinaValue()); + } + } } } diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCoreDriver.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCoreDriver.java index 13431e0f..2b2ec2cb 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCoreDriver.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCoreDriver.java @@ -1,5 +1,24 @@ package love.distributedrebirth.numberxd.base2t.part.warp; -public class TOSWarpCoreDriver { +import org.x4o.xml.X4ODriver; +import org.x4o.xml.X4ODriverManager; +public class TOSWarpCoreDriver extends X4ODriver { + + static final public String LANGUAGE_NAME = "warpcore"; + static final public String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION}; + + @Override + public String getLanguageName() { + return LANGUAGE_NAME; + } + + @Override + public String[] getLanguageVersions() { + return LANGUAGE_VERSIONS; + } + + static public TOSWarpCoreDriver getInstance() { + return (TOSWarpCoreDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); + } } diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipher.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipher.java deleted file mode 100644 index 7caa1f7d..00000000 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipher.java +++ /dev/null @@ -1,42 +0,0 @@ -package love.distributedrebirth.numberxd.base2t.part.warp; - -import java.util.ArrayList; -import java.util.List; - -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class WarpCipher { - - private String cipherName; - private String cipherDescription; - private List cipherHearts; - - public WarpCipher() { - cipherHearts = new ArrayList<>(); - } - - public String getCipherName() { - return cipherName; - } - - public void setCipherName(String cipherName) { - this.cipherName = cipherName; - } - - public String getCipherDescription() { - return cipherDescription; - } - - public void setCipherDescription(String cipherDescription) { - this.cipherDescription = cipherDescription; - } - - public List getCipherHearts() { - return cipherHearts; - } - - public void setCipherHearts(List cipherHearts) { - this.cipherHearts = cipherHearts; - } -} diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeart.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeart.java deleted file mode 100644 index e35fb3b6..00000000 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeart.java +++ /dev/null @@ -1,33 +0,0 @@ -package love.distributedrebirth.numberxd.base2t.part.warp; - -import java.util.ArrayList; -import java.util.List; - -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class WarpCipherHeart { - - private String partKey; - private List heartCores; - - public WarpCipherHeart() { - heartCores = new ArrayList<>(); - } - - public String getPartKey() { - return partKey; - } - - public void setPartKey(String partKey) { - this.partKey = partKey; - } - - public List getHeartCores() { - return heartCores; - } - - public void setHeartCores(List heartCores) { - this.heartCores = heartCores; - } -} diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterBucket.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterBucket.java new file mode 100644 index 00000000..8af9e9f5 --- /dev/null +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterBucket.java @@ -0,0 +1,17 @@ +package love.distributedrebirth.numberxd.base2t.part.warp; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class WaterBucket { + + private WaterCipher water; + + public WaterCipher theWater() { + return water; + } + + public void fillWater(WaterCipher water) { + this.water = water; + } +} diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipher.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipher.java new file mode 100644 index 00000000..7f6e38e2 --- /dev/null +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipher.java @@ -0,0 +1,46 @@ +package love.distributedrebirth.numberxd.base2t.part.warp; + +import java.util.ArrayList; +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class WaterCipher { + + private String name; + private String description; + private List cipherHearts; + + public WaterCipher() { + cipherHearts = new ArrayList<>(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getCipherHearts() { + return cipherHearts; + } + + public void addCipherHeart(WaterCipherHeart cipherHeart) { + this.cipherHearts.add(cipherHeart); + } + + public void setCipherHearts(List cipherHearts) { + this.cipherHearts = cipherHearts; + } +} diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeart.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeart.java new file mode 100644 index 00000000..4cf966cf --- /dev/null +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeart.java @@ -0,0 +1,37 @@ +package love.distributedrebirth.numberxd.base2t.part.warp; + +import java.util.ArrayList; +import java.util.List; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class WaterCipherHeart { + + private Integer bass; + private List heartTones; + + public WaterCipherHeart() { + heartTones = new ArrayList<>(); + } + + public Integer getBass() { + return bass; + } + + public void setBass(Integer bass) { + this.bass = bass; + } + + public List getHeartTones() { + return heartTones; + } + + public void addHeartTone(WaterCipherHeartTone heartTone) { + heartTones.add(heartTone); + } + + public void setHeartTones(List heartTones) { + this.heartTones = heartTones; + } +} diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeartCore.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeartTone.java similarity index 61% rename from demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeartCore.java rename to demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeartTone.java index af7a5eac..b719e4e4 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WarpCipherHeartCore.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/WaterCipherHeartTone.java @@ -3,21 +3,30 @@ package love.distributedrebirth.numberxd.base2t.part.warp; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class WarpCipherHeartCore { +public class WaterCipherHeartTone { - private String identifierTone; + private String part; + private String dialTone; private String chinaKey; private String chinaValue; - public WarpCipherHeartCore() { + public WaterCipherHeartTone() { } - public String getIdentifierTone() { - return identifierTone; + public String getPart() { + return part; } - public void setIdentifierTone(String identifierTone) { - this.identifierTone = identifierTone; + public void setPart(String part) { + this.part = part; + } + + public String getDialTone() { + return dialTone; + } + + public void setDialTone(String dialTone) { + this.dialTone = dialTone; } public String getChinaKey() { diff --git a/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-lang.eld b/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-lang.eld new file mode 100644 index 00000000..ad27b5b0 --- /dev/null +++ b/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-lang.eld @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-modules.xml b/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-modules.xml new file mode 100644 index 00000000..3d48b7f8 --- /dev/null +++ b/demo4d-numberxd/src/resources/META-INF/warpcore/warpcore-modules.xml @@ -0,0 +1,10 @@ + + + + warpcore-lang.eld + + diff --git a/demo4d-numberxd/src/resources/META-INF/x4o-drivers.xml b/demo4d-numberxd/src/resources/META-INF/x4o-drivers.xml index 3b2b9294..0de0be01 100644 --- a/demo4d-numberxd/src/resources/META-INF/x4o-drivers.xml +++ b/demo4d-numberxd/src/resources/META-INF/x4o-drivers.xml @@ -4,5 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://language.x4o.org/xml/ns/drivers http://language.x4o.org/xml/ns/drivers-1.0.xsd" > + +