diff --git a/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java b/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java index 6804b951..aa8d1db5 100644 --- a/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java +++ b/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java @@ -8,6 +8,7 @@ import org.osgi.service.component.annotations.Reference; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; @Component public class HeWalletComponent { @@ -21,7 +22,7 @@ public class HeWalletComponent { @Activate void open() { log.info(this, "Activated HeWalletComponent"); - deskAppService.registrateDeskApp(new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp())); + deskAppService.registrateDeskApp(DeskAppMenuSection.INTERNET, new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp())); } @Deactivate diff --git a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java index f8e06559..dd34b026 100644 --- a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java +++ b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java @@ -9,6 +9,7 @@ import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; @Component public class TosAmpComponent { @@ -25,7 +26,7 @@ public class TosAmpComponent { @Activate void open() { log.info(this, "Activated TosAmpComponent"); - deskAppService.registrateDeskApp(new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser()))); + deskAppService.registrateDeskApp(DeskAppMenuSection.MULTIMEDIA, new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser()))); } @Deactivate diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4.java index 411f76c2..56f445e3 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4.java @@ -56,27 +56,36 @@ public enum GDXAppTos4 implements DefaultEnumInstanceᴶᴹˣ registratedSeas = new ArrayList<>(); int result = 0; try { - result = systemWarpShip.loadWaterOcean(context, warpshipDevice.theShip().getEngine(), v -> fireMessageEvent(v), registratedSeas); + result = systemWarpShip.loadWaterOcean(context, registratedSeas, warpshipDevice.theShip().getEngine(), v -> fireMessageEvent(v)); } catch (Exception e) { e.printStackTrace(); fireMessageEvent("ERROR: "+e.getMessage()); @@ -210,27 +210,8 @@ public class GDXAppTos4Activator implements BundleActivator { fireMessageEvent("tos4: chains resolved."); try { - //ServiceReference[] refs = context.getServiceReferences( SystemWarpSea.class.getName(), "(warp.sea.name=*)" ); - for (SystemWarpSea service : registratedSeas) { - //SystemWarpSea service = (SystemWarpSea) context.getService( refs[i] ); - String key = service.getWarpKey(); - File waterHome = service.getWarpHome(); - for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) { - if ("application/vnd.osgi.bundle".equals(magic.getMime())) { - magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again - String overrideBundleKey = key + "." + magic.getFile(); - String overrideBundle = localOverrides.getProperty(overrideBundleKey); - if (overrideBundle == null) { - LOG.debug("installAndStartBundles reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile()); - SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile()); - } else { - LOG.debug("installAndStartBundles reference:file:"+overrideBundle); - SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle); - } - } - } - } - } catch (Exception e) { + systemWarpShip.loadBundles(context, registratedSeas); + } catch (BundleException e) { e.printStackTrace(); fireMessageEvent("ERROR: "+e.getMessage()); startError = true; @@ -315,8 +296,8 @@ public class GDXAppTos4Activator implements BundleActivator { } @Override - public Properties getLocalOverrides() { - return localOverrides; + public void shutdown() { + Gdx.app.exit(); } } @@ -328,7 +309,7 @@ public class GDXAppTos4Activator implements BundleActivator { } @Override - public int loadWaterOcean(BundleContext context, String key, Consumer logger, List registratedSeas) + public int loadWaterOcean(BundleContext context,List registratedSeas, String key, Consumer logger) throws IOException, InterruptedException, X4OConnectionException, SAXException { File waterHome; String override = localOverrides.getProperty(key); @@ -381,7 +362,7 @@ public class GDXAppTos4Activator implements BundleActivator { int result = 0; for (WaterSeaChain chain: ocean.theWater().getSeaChains()) { - result += loadWaterOcean(context, chain.getKey(), logger, registratedSeas); + result += loadWaterOcean(context, registratedSeas, chain.getKey(), logger); } return result; } @@ -401,6 +382,28 @@ public class GDXAppTos4Activator implements BundleActivator { process.waitFor(); return buf.toString(); } + + @Override + public void loadBundles(BundleContext context, List registratedSeas) throws BundleException { + for (SystemWarpSea service : registratedSeas) { + String key = service.getWarpKey(); + File waterHome = service.getWarpHome(); + for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) { + if ("application/vnd.osgi.bundle".equals(magic.getMime())) { + magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again + String overrideBundleKey = key + "." + magic.getFile(); + String overrideBundle = localOverrides.getProperty(overrideBundleKey); + if (overrideBundle == null) { + LOG.debug("loadBundles: "+waterHome.getAbsolutePath()+"/"+magic.getFile()); + GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile()); + } else { + LOG.debug("loadBundles: "+overrideBundle); + GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle); + } + } + } + } + } } public static class SystemGdxLogImpl implements SystemGdxLog, ApplicationLogger { diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootFactory.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java similarity index 98% rename from gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootFactory.java rename to gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java index 3efdcb11..fef73161 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootFactory.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java @@ -1,4 +1,4 @@ -package love.distributedrebirth.gdxapp4d.tos4.service; +package love.distributedrebirth.gdxapp4d.tos4; import java.io.File; import java.io.IOException; @@ -16,7 +16,7 @@ import org.osgi.framework.launch.FrameworkFactory; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class SystemGdxBootFactory { +public class GDXAppTos4BootFactory { public static void installAndStartBundles(BundleContext bundleContext, String... bundleLocations) throws BundleException { for (String location : bundleLocations) { diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java index 2836fab9..26eaedc7 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java @@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory; import com.badlogic.gdx.Gdx; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootFactory; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class GDXAppTos4Startup { @@ -17,7 +16,7 @@ public class GDXAppTos4Startup { public static Framework init(GDXAppTos4 tos4, GDXAppTos4Activator systemActivator) { LOG.info("Startup framework"); - final Framework systemBundle = SystemGdxBootFactory.createFramework(); + final Framework systemBundle = GDXAppTos4BootFactory.createFramework(); final GDXAppTos4BootScreen bootScreen = new GDXAppTos4BootScreen(); systemActivator.addBootListener(bootScreen); diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java index 01388375..e2d6ab0e 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java @@ -1,7 +1,5 @@ package love.distributedrebirth.gdxapp4d.tos4.service; -import java.util.Properties; - import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import net.spookygames.gdx.nativefilechooser.NativeFileChooser; @@ -16,5 +14,5 @@ public interface SystemGdxBootArgs { NativeFileChooser getFileChooser(); - Properties getLocalOverrides(); + void shutdown(); } diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpShip.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpShip.java index 97c2123f..7a07943c 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpShip.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpShip.java @@ -17,5 +17,7 @@ public interface SystemWarpShip { WaterDevice getWarpShip(); - int loadWaterOcean(BundleContext context, String key, Consumer logger, List registratedSeas) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException; + int loadWaterOcean(BundleContext context, List registratedSeas, String key, Consumer logger) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException; + + void loadBundles(BundleContext context, List registratedSeas) throws BundleException; } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java index ebe237a1..eb8479c0 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java @@ -1,12 +1,12 @@ package love.distributedrebirth.gdxapp4d.vrgem4; -import java.io.File; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; import org.osgi.framework.ServiceReference; import com.badlogic.gdx.Gdx; @@ -14,7 +14,6 @@ import com.badlogic.gdx.Gdx; import imgui.type.ImBoolean; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ; -import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootFactory; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip; @@ -32,11 +31,12 @@ import love.distributedrebirth.numberxd.base2t.Base2PartsFactory; import love.distributedrebirth.numberxd.base2t.Base2Terminator; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; -import love.distributedrebirth.warpme.sea.WaterSeaMagic; import love.distributedrebirth.warpme.ship.WaterShipOcean; public class GDXAppVrGem4Activator implements BundleActivator { + private static final int VIEW_SLEEP_TIME = 1234; + @Override public void stop(final BundleContext context) { } @@ -44,7 +44,7 @@ public class GDXAppVrGem4Activator implements BundleActivator { @Override public void start(final BundleContext context) { try { - Thread.sleep(2000); + Thread.sleep(VIEW_SLEEP_TIME); } catch (InterruptedException ignored) { } @@ -145,7 +145,7 @@ public class GDXAppVrGem4Activator implements BundleActivator { GDXAppVrGem4.INSTANCE.init(terminal); - VrGem4DeskAppService deskAppService = new VrGem4DeskAppServiceImpl(); + VrGem4DeskAppServiceImpl deskAppService = new VrGem4DeskAppServiceImpl(); context.registerService(VrGem4DeskAppService.class.getName(), deskAppService, new Hashtable()); bootScreen.bootLine("terminal: added screens"); @@ -174,7 +174,7 @@ public class GDXAppVrGem4Activator implements BundleActivator { int result = 0; try { for (WaterShipOcean ocean:systemWarpShip.getWarpShip().theShip().getShipOceans()) { - result = systemWarpShip.loadWaterOcean(context, ocean.getSea(), v -> bootScreen.bootLine(v), registratedSeas); + result = systemWarpShip.loadWaterOcean(context, registratedSeas, ocean.getSea(), v -> bootScreen.bootLine(v)); } } catch (Exception e) { e.printStackTrace(); @@ -188,31 +188,14 @@ public class GDXAppVrGem4Activator implements BundleActivator { bootScreen.bootLine("vrGEM4: chains resolved."); try { - for (SystemWarpSea service: registratedSeas) { - String key = service.getWarpKey(); - File waterHome = service.getWarpHome(); - for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) { - if ("application/vnd.osgi.bundle".equals(magic.getMime())) { - magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again - String overrideBundleKey = key + "." + magic.getFile(); - String overrideBundle = bootArgs.getLocalOverrides().getProperty(overrideBundleKey); - if (overrideBundle == null) { - SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile()); - } else { - SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle); - } - } - } - } - } catch (Exception e) { + systemWarpShip.loadBundles(context, registratedSeas); + } catch (BundleException e) { e.printStackTrace(); bootScreen.bootLine("ERROR: "+e.getMessage()); return; } - - try { - Thread.sleep(2000); + Thread.sleep(VIEW_SLEEP_TIME); } catch (InterruptedException ignored) { } Gdx.app.postRunnable(new Runnable() { diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4DeskAppServiceImpl.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4DeskAppServiceImpl.java index 34639f0d..e76980f1 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4DeskAppServiceImpl.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4DeskAppServiceImpl.java @@ -1,22 +1,29 @@ package love.distributedrebirth.gdxapp4d.vrgem4; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; public class VrGem4DeskAppServiceImpl implements VrGem4DeskAppService { - private List launchers = new ArrayList<>(); + private Map> menu = new HashMap<>(); - @Override - public List getLaunchers() { - return launchers; + public List getMenuSection(DeskAppMenuSection section) { + List result = menu.get(section); + if (result == null) { + result = new ArrayList<>(); + menu.put(section, result); + } + return result; } @Override - public void registrateDeskApp(DeskAppLauncher launcher) { - launchers.add(launcher); + public void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher) { + getMenuSection(section).add(launcher); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java index 221cd6db..426e53c7 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java @@ -19,7 +19,7 @@ import imgui.flag.ImGuiWindowFlags; import imgui.type.ImBoolean; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.vrgem4.ImGuiSetup; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskApp; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; @@ -43,7 +43,7 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des private ModelBatch modelBatch; private Array modelInstances = new Array(); - public AbstractScreenDesktop(String name, SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public AbstractScreenDesktop(String name, SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { this.create(); screenMenu = new DeskTopScreenMenu(bootArgs, deskAppService); deskAppScreen = new DeskAppController(name); diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java index 9f8a16fd..18997a90 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java @@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop1 extends AbstractScreenDesktop { private Model grid; - public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop1", bootArgs, deskAppService); //backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png")); } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java index 99400c1d..8ccd3850 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java @@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop2 extends AbstractScreenDesktop { private Model grid; - public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop2", bootArgs, deskAppService); //backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png")); } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java index 251b29b4..64f39e07 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java @@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop3 extends AbstractScreenDesktop { private Model grid; - public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop3", bootArgs, deskAppService); } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java index 3bcba71c..38781488 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java @@ -21,7 +21,7 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop4 extends AbstractScreenDesktop { @@ -37,7 +37,7 @@ public class ScreenDesktop4 extends AbstractScreenDesktop { private float colorFade = 0f; private boolean colorPositive = true; - public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop4", bootArgs, deskAppService); shader = new UserColorShader(); shader.init(); diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4DeskAppService.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4DeskAppService.java index 07892bce..69000247 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4DeskAppService.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4DeskAppService.java @@ -1,14 +1,9 @@ package love.distributedrebirth.gdxapp4d.vrgem4.service; - - -import java.util.List; - import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; public interface VrGem4DeskAppService { - - List getLaunchers(); - void registrateDeskApp(DeskAppLauncher launcher); + void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher); } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskAppMenuSection.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskAppMenuSection.java new file mode 100644 index 00000000..6b86d511 --- /dev/null +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskAppMenuSection.java @@ -0,0 +1,21 @@ +package love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp; + +public enum DeskAppMenuSection { + + EDITORS, + EDUCATION, + INTERNET, + MULTIMEDIA, + PROGRAMMING, + SCIENCE, + SHELLS, + SYSTEM, + ; + + private DeskAppMenuSection() { + } + + public boolean isSystem() { + return this == SYSTEM; + } +} diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java index 3fc09f8b..103c5dc7 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java @@ -11,16 +11,17 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.vrgem4.FontAwesomeIcons; import love.distributedrebirth.gdxapp4d.vrgem4.GDXAppVrGem4; +import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenCredits; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop1; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop2; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop3; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop4; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenHelp; -import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskApp; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp; @@ -31,13 +32,13 @@ import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.Unicode4DApp; public class DeskTopScreenMenu { private SystemGdxBootArgs bootArgs; - private VrGem4DeskAppService deskAppService; + private VrGem4DeskAppServiceImpl deskAppService; private List apps; private ImBoolean fileMinimizeSelected = new ImBoolean(false); private ImBoolean fileCloseSelected = new ImBoolean(false); private ImBoolean tosSelfSelected = new ImBoolean(false); - public DeskTopScreenMenu(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { + public DeskTopScreenMenu(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { this.bootArgs = bootArgs; this.deskAppService = deskAppService; apps = new ArrayList<>(); @@ -221,11 +222,23 @@ public class DeskTopScreenMenu { } } ImGui.separator(); - for (DeskAppLauncher launcher: deskAppService.getLaunchers()) { - if (ImGui.menuItem(launcher.getName())) { - DeskApp controller = launcher.getLauncher().get(); - controller.create(); - appScreen.getDeskAppController().addDeskApp(controller); + for (DeskAppMenuSection section: DeskAppMenuSection.values()) { + if (section.isSystem()) { + continue; + } + List menu = deskAppService.getMenuSection(section); + if (menu.isEmpty()) { + continue; + } + if (ImGui.beginMenu(section.name())) { + for (DeskAppLauncher launcher: menu) { + if (ImGui.menuItem(launcher.getName())) { + DeskApp controller = launcher.getLauncher().get(); + controller.create(); + appScreen.getDeskAppController().addDeskApp(controller); + } + } + ImGui.endMenu(); } } ImGui.endMenu(); @@ -244,6 +257,19 @@ public class DeskTopScreenMenu { } ImGui.separator(); + List menu = deskAppService.getMenuSection(DeskAppMenuSection.SYSTEM); + if (!menu.isEmpty()) { + if (ImGui.beginMenu(DeskAppMenuSection.SYSTEM.name())) { + for (DeskAppLauncher launcher: menu) { + if (ImGui.menuItem(launcher.getName())) { + DeskApp controller = launcher.getLauncher().get(); + controller.create(); + appScreen.getDeskAppController().addDeskApp(controller); + } + } + ImGui.endMenu(); + } + } if (ImGui.menuItem(FontAwesomeIcons.CreditCard + " Credits")) { GDXAppVrGem4.INSTANCE.terminal.selectScreen(ScreenCredits.class); } @@ -255,8 +281,7 @@ public class DeskTopScreenMenu { // GDXAppVrGem4.INSTANCE.showImGuiDemo.set(true); } if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) { -// GDXAppVrGem4.INSTANCE.dispose(); - System.exit(0); + bootArgs.shutdown(); } ImGui.endMenu(); } diff --git a/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/BasicConsoleComponent.java b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/BasicConsoleComponent.java index 9bac81d8..61bb5353 100644 --- a/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/BasicConsoleComponent.java +++ b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/BasicConsoleComponent.java @@ -8,6 +8,7 @@ import org.osgi.service.component.annotations.Reference; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; @Component public class BasicConsoleComponent { @@ -21,7 +22,7 @@ public class BasicConsoleComponent { @Activate void open() { log.info(this, "Activate BasicConsoleComponent"); - deskAppService.registrateDeskApp(new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp())); + deskAppService.registrateDeskApp(DeskAppMenuSection.PROGRAMMING, new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp())); } @Deactivate