From 76f3da5da7d09d271cd702f110ebde7e242fa8b6 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 10 Oct 2022 00:12:52 +0200 Subject: [PATCH] Fixed app callback events --- .../gdxapp4d/app/tosamp/TosAmpDeskApp.java | 5 +++++ .../gdxapp4d/vrgem4/service/deskapp/AbstractDeskApp.java | 4 ++++ .../gdxapp4d/vrgem4/service/deskapp/DeskApp.java | 2 ++ .../gdxapp4d/vrgem4/view/DeskTopScreenMenu.java | 3 +++ 4 files changed, 14 insertions(+) diff --git a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpDeskApp.java b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpDeskApp.java index 7b526c9d..70b5141b 100644 --- a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpDeskApp.java +++ b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpDeskApp.java @@ -42,6 +42,11 @@ public class TosAmpDeskApp extends AbstractDeskApp implements DeskAppRenderer { return bundle.getString(TosAmpDeskApp.class.getSimpleName()+"."+key); } + @Override + public void exit() { + music.stop(); + } + public void create() { getContours().setTitle(getTxt("title")); getContours().registrateContour(DeskAppContourSection.MAIN, this); diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/AbstractDeskApp.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/AbstractDeskApp.java index 3230265a..0c67b86a 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/AbstractDeskApp.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/AbstractDeskApp.java @@ -23,4 +23,8 @@ abstract public class AbstractDeskApp implements DeskApp { @Override public void hide() { } + + @Override + public void exit() { + } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskApp.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskApp.java index 900e545e..8d218ec7 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskApp.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/deskapp/DeskApp.java @@ -12,4 +12,6 @@ public interface DeskApp { void show(); void hide(); + + void exit(); } 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 abaf9ba0..478caba6 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 @@ -65,6 +65,7 @@ public class DeskTopScreenMenu { if (ImGui.menuItem(FontAwesomeIcons.WindowClose + " Exit", "", fileCloseSelected, deskApp != null)) { fileCloseSelected.set(false); if (deskApp != null) { + deskApp.exit(); appScreen.getDeskAppController().removeDeskApp(deskApp); appScreen.getDeskAppController().setCurrentDeskApp(null); } @@ -155,6 +156,7 @@ public class DeskTopScreenMenu { private void renderTOS4Menu(DeskTopScreen appScreen) { if (ImGui.beginMenu("仙" + " TOS⁴")) { if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality", "", tosSelfSelected, appScreen.getDeskAppController().getCurrentDeskApp() != null)) { + appScreen.getDeskAppController().getCurrentDeskApp().hide(); appScreen.getDeskAppController().setCurrentDeskApp(null); tosSelfSelected.set(false); } @@ -164,6 +166,7 @@ public class DeskTopScreenMenu { enabled = false; } if (ImGui.menuItem(app.getContours().getTitle(), "", tosSelfSelected, enabled)) { + app.show(); appScreen.getDeskAppController().setCurrentDeskApp(app); tosSelfSelected.set(false); }