Added warpcore driver

This commit is contained in:
Willem 2022-02-05 17:00:19 +01:00
parent 19e7cc3886
commit 71e4719cdf
12 changed files with 261 additions and 107 deletions

View file

@ -32,6 +32,8 @@ import love.distributedrebirth.gdxapp.screen.ScreenLoading;
import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D; import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D;
import love.distributedrebirth.gdxapp.screen.SystemBaseGlyphRenderer; import love.distributedrebirth.gdxapp.screen.SystemBaseGlyphRenderer;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; 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; import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
/** /**
@ -72,23 +74,38 @@ public class Demo4DMain extends Game {
} }
ImGuiSetup.init(); ImGuiSetup.init();
int fileArgu = args.indexOf("warpcore-load"); try {
if (fileArgu != -1) { if (args.contains("warpcore-load")) {
// TODO: load warpcore 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")) { if (!args.contains("warpcore-nolock")) {
TOSWarpCore.INSTANCE.BãßLockWarpCipher(); TOSWarpCore.INSTANCE.BãßLockWarpCipher();
} else {
System.out.println("warpcore-nolock: requested");
} }
if (args.contains("full-screen")) { if (args.contains("full-screen")) {
System.out.println("full-screen: requested");
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); 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); selectScreen(ScreenDefault.class);
music.play(MusicSongType.BACKGROUND); music.play(MusicSongType.BACKGROUND);
} else { } else {
selectScreen(ScreenIntro.class); selectScreen(ScreenIntro.class);
} }
} }
public void create() { public void create() {
@ -100,8 +117,12 @@ public class Demo4DMain extends Game {
camera.update(); camera.update();
batch.setProjectionMatrix(camera.combined); batch.setProjectionMatrix(camera.combined);
boolean musicStop = args.contains("music-stop");
if (musicStop) {
System.out.println("music-stop: requested");
}
music = new MusicManager(); music = new MusicManager();
music.init(args.contains("no-music")); music.init(musicStop);
screens = new HashMap<>(); screens = new HashMap<>();
widgets = new HashMap<>(); widgets = new HashMap<>();

View file

@ -1,9 +1,13 @@
package love.distributedrebirth.numberxd.base2t.part.warp; 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ȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnEnumInstanceʸᴰ;
import love.distributedrebirth.numberxd.base2t.BasePartFactory; import love.distributedrebirth.numberxd.base2t.BasePartFactory;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartKeyʸᴰ;
import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ; import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
@ -22,37 +26,54 @@ public enum TOSWarpCore implements BãßBȍőnEnumInstanceʸᴰ<TOSWarpCore> {
} }
} }
public WarpCipher BãßSaveWarpCipher() { public WaterBucket BãßCurrentWarpCore() {
WarpCipher warpCore = new WarpCipher(); WaterCipher warpCipher = new WaterCipher();
if (armedWarpCipherName == null) { if (armedWarpCipherName == null) {
warpCore.setCipherName("default"); warpCipher.setName("default");
} else { } else {
warpCore.setCipherName(armedWarpCipherName); warpCipher.setName(armedWarpCipherName);
} }
if (armedWarpCipherDescription == null) { if (armedWarpCipherDescription == null) {
warpCore.setCipherName("Current active cipher."); warpCipher.setName("Current active cipher.");
} else { } else {
warpCore.setCipherDescription(armedWarpCipherDescription); warpCipher.setDescription(armedWarpCipherDescription);
} }
for (int base:BasePartFactory.INSTANCE.BãßBases()) { for (int base:BasePartFactory.INSTANCE.BãßBases()) {
WarpCipherHeart heart = new WarpCipherHeart(); WaterCipherHeart heart = new WaterCipherHeart();
BãßBȍőnPartʸᴰ<?>[] bases = BasePartFactory.INSTANCE.BãßBuildPartsByBase(base); 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) { for (BãßBȍőnPartʸᴰ<?> part:bases) {
WarpCipherHeartCore core = new WarpCipherHeartCore(); WaterCipherHeartTone tone = new WaterCipherHeartTone();
core.setIdentifierTone(part.BȍőnIdentifierTone()); tone.setPart(part.BȍőnNaam());
core.setChinaKey(part.BȍőnChinaKey()); tone.setDialTone(part.BȍőnDialTone());
core.setChinaValue(part.BȍőnChinaValue()); tone.setChinaKey(part.BȍőnChinaKey());
heart.getHeartCores().add(core); 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) { public void BãßArmWarpCore(WaterBucket warpBucket) {
armedWarpCipherName = warpCore.getCipherName(); armedWarpCipherName = warpBucket.theWater().getName();
armedWarpCipherDescription = warpCore.getCipherDescription(); armedWarpCipherDescription = warpBucket.theWater().getDescription();
// TODO: load warpcore for (WaterCipherHeart heart:warpBucket.theWater().getCipherHearts()) {
BãßBȍőnPartʸᴰ<?>[] bases = BasePartFactory.INSTANCE.BãßBuildPartsByBase(heart.getBass());
Map<String, BãßBȍőnPartʸᴰ<?>> 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ʸᴰ<BãßBȍőnPartKeyʸᴰ> 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());
}
}
} }
} }

View file

@ -1,5 +1,24 @@
package love.distributedrebirth.numberxd.base2t.part.warp; 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<WaterBucket> {
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);
}
} }

View file

@ -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<WarpCipherHeart> 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<WarpCipherHeart> getCipherHearts() {
return cipherHearts;
}
public void setCipherHearts(List<WarpCipherHeart> cipherHearts) {
this.cipherHearts = cipherHearts;
}
}

View file

@ -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<WarpCipherHeartCore> heartCores;
public WarpCipherHeart() {
heartCores = new ArrayList<>();
}
public String getPartKey() {
return partKey;
}
public void setPartKey(String partKey) {
this.partKey = partKey;
}
public List<WarpCipherHeartCore> getHeartCores() {
return heartCores;
}
public void setHeartCores(List<WarpCipherHeartCore> heartCores) {
this.heartCores = heartCores;
}
}

View file

@ -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;
}
}

View file

@ -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<WaterCipherHeart> 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<WaterCipherHeart> getCipherHearts() {
return cipherHearts;
}
public void addCipherHeart(WaterCipherHeart cipherHeart) {
this.cipherHearts.add(cipherHeart);
}
public void setCipherHearts(List<WaterCipherHeart> cipherHearts) {
this.cipherHearts = cipherHearts;
}
}

View file

@ -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<WaterCipherHeartTone> heartTones;
public WaterCipherHeart() {
heartTones = new ArrayList<>();
}
public Integer getBass() {
return bass;
}
public void setBass(Integer bass) {
this.bass = bass;
}
public List<WaterCipherHeartTone> getHeartTones() {
return heartTones;
}
public void addHeartTone(WaterCipherHeartTone heartTone) {
heartTones.add(heartTone);
}
public void setHeartTones(List<WaterCipherHeartTone> heartTones) {
this.heartTones = heartTones;
}
}

View file

@ -3,21 +3,30 @@ package love.distributedrebirth.numberxd.base2t.part.warp;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @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 chinaKey;
private String chinaValue; private String chinaValue;
public WarpCipherHeartCore() { public WaterCipherHeartTone() {
} }
public String getIdentifierTone() { public String getPart() {
return identifierTone; return part;
} }
public void setIdentifierTone(String identifierTone) { public void setPart(String part) {
this.identifierTone = identifierTone; this.part = part;
}
public String getDialTone() {
return dialTone;
}
public void setDialTone(String dialTone) {
this.dialTone = dialTone;
} }
public String getChinaKey() { public String getChinaKey() {

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<root:module xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns:eld="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerHost="warpcore.x4o.distributedrebirth.love" providerName="WarpCore Encryption"
id="warpcore-module">
<eld:classBindingHandler id="Bucket-Water"
parentClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterBucket"
childClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipher"
addMethod="fillWater" getMethod="theWater" />
<eld:classBindingHandler id="Water-Heart"
parentClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipher"
childClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipherHeart"
addMethod="addCipherHeart" getMethod="getCipherHearts" />
<eld:classBindingHandler id="Heart-Tone"
parentClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipherHeart"
childClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipherHeartTone"
addMethod="addHeartTone" getMethod="getHeartTones" />
<eld:namespace
uri="http://wrapcore.x4o.distributedrebirth.love/xml/ns/warpcore-root"
schemaUri="http://warpcore.x4o.distributedrebirth.love/xml/ns/warpcore-root-1.0.xsd"
schemaResource="warpcore-root-1.0.xsd" schemaPrefix="root"
description="Root namespace to have nice namespaceing."
name="WarpCore Root Namespace" languageRoot="true" id="root">
<eld:element tag="bucket"
objectClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterBucket"/>
</eld:namespace>
<eld:namespace
uri="http://warpcore.x4o.distributedrebirth.love/xml/ns/warpcore-cipher"
schemaUri="http://warpcore.x4o.distributedrebirth.love/xml/ns/warpcore-cipher-1.0.xsd"
schemaResource="warpcore-lang-1.0.xsd" schemaPrefix="cipher"
description="Language namespace to store warp cipher"
name="WarpCore Language Namespace" id="cipher">
<eld:element tag="water"
objectClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipher" />
<eld:element tag="heart"
objectClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipherHeart" />
<eld:element tag="tone"
objectClass="love.distributedrebirth.numberxd.base2t.part.warp.WaterCipherHeartTone" />
</eld:namespace>
</root:module>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.0">
<eld-resource>warpcore-lang.eld</eld-resource>
</language>
</modules>

View file

@ -4,5 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" xsi:schemaLocation="http://language.x4o.org/xml/ns/drivers http://language.x4o.org/xml/ns/drivers-1.0.xsd"
> >
<driver language="warpcore" className="love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCoreDriver"/>
<!--
<defaultDriver language="numberxd"/> <defaultDriver language="numberxd"/>
-->
</drivers> </drivers>