rename elementManager->elementService
This commit is contained in:
parent
5fe6b7a3c4
commit
11dfc5bceb
@ -961,9 +961,9 @@ public class ControlHandler {
|
|||||||
// Window mainMenuWindow = new Window(0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
|
// Window mainMenuWindow = new Window(0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
|
||||||
Window mainMenuInGame = MenuGeneratorsInGame.createInGameMainMenu();
|
Window mainMenuInGame = MenuGeneratorsInGame.createInGameMainMenu();
|
||||||
// mainMenuWindow.addChild(mainMenuInGame);
|
// mainMenuWindow.addChild(mainMenuInGame);
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, mainMenuInGame);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, mainMenuInGame);
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), true);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), true);
|
||||||
Globals.elementManager.focusFirstElement();
|
Globals.elementService.focusFirstElement();
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_MAIN_MENU);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_MAIN_MENU);
|
||||||
//play sound effect
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
@ -978,14 +978,14 @@ public class ControlHandler {
|
|||||||
mainGameControlList.add(controls.get(INPUT_CODE_INVENTORY_OPEN));
|
mainGameControlList.add(controls.get(INPUT_CODE_INVENTORY_OPEN));
|
||||||
inventoryControlList.add(controls.get(INPUT_CODE_INVENTORY_OPEN));
|
inventoryControlList.add(controls.get(INPUT_CODE_INVENTORY_OPEN));
|
||||||
controls.get(INPUT_CODE_INVENTORY_OPEN).setOnClick(new ControlMethod(){public void execute(){
|
controls.get(INPUT_CODE_INVENTORY_OPEN).setOnClick(new ControlMethod(){public void execute(){
|
||||||
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity) && Globals.elementManager.getWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId())) == null){
|
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity) && Globals.elementService.getWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId())) == null){
|
||||||
//create window
|
//create window
|
||||||
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
||||||
Window mainMenuWindow = MenuGeneratorsInventory.createNaturalInventoryMenu(inventory);
|
Window mainMenuWindow = MenuGeneratorsInventory.createNaturalInventoryMenu(inventory);
|
||||||
//register
|
//register
|
||||||
Globals.elementManager.registerWindow(WindowUtils.getInventoryWindowID(inventory.getId()), mainMenuWindow);
|
Globals.elementService.registerWindow(WindowUtils.getInventoryWindowID(inventory.getId()), mainMenuWindow);
|
||||||
//make visible
|
//make visible
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowUtils.getInventoryWindowID(inventory.getId())), true);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowUtils.getInventoryWindowID(inventory.getId())), true);
|
||||||
//controls
|
//controls
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.INVENTORY);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.INVENTORY);
|
||||||
//play sound effect
|
//play sound effect
|
||||||
@ -994,8 +994,8 @@ public class ControlHandler {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
Globals.openInventoriesCount++;
|
Globals.openInventoriesCount++;
|
||||||
} else if(InventoryUtils.hasNaturalInventory(Globals.playerEntity) && Globals.elementManager.getWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId())) != null){
|
} else if(InventoryUtils.hasNaturalInventory(Globals.playerEntity) && Globals.elementService.getWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId())) != null){
|
||||||
Globals.elementManager.closeWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId()));
|
Globals.elementService.closeWindow(WindowUtils.getInventoryWindowID(InventoryUtils.getNaturalInventory(Globals.playerEntity).getId()));
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
controls.get(INPUT_CODE_INVENTORY_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controls.get(INPUT_CODE_INVENTORY_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
@ -1006,13 +1006,13 @@ public class ControlHandler {
|
|||||||
mainGameControlList.add(controls.get(INPUT_CODE_CHARACTER_OPEN));
|
mainGameControlList.add(controls.get(INPUT_CODE_CHARACTER_OPEN));
|
||||||
inventoryControlList.add(controls.get(INPUT_CODE_CHARACTER_OPEN));
|
inventoryControlList.add(controls.get(INPUT_CODE_CHARACTER_OPEN));
|
||||||
controls.get(INPUT_CODE_CHARACTER_OPEN).setOnClick(new ControlMethod(){public void execute(){
|
controls.get(INPUT_CODE_CHARACTER_OPEN).setOnClick(new ControlMethod(){public void execute(){
|
||||||
if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementManager.getWindow(WindowStrings.WINDOW_CHARACTER) == null){
|
if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) == null){
|
||||||
//create window
|
//create window
|
||||||
Window characterInventoryMenu = MenuGeneratorsInventory.createCharacterInventoryMenu(InventoryUtils.getEquipInventory(Globals.playerEntity));
|
Window characterInventoryMenu = MenuGeneratorsInventory.createCharacterInventoryMenu(InventoryUtils.getEquipInventory(Globals.playerEntity));
|
||||||
//register
|
//register
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDOW_CHARACTER, characterInventoryMenu);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_CHARACTER, characterInventoryMenu);
|
||||||
//make visible
|
//make visible
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_CHARACTER), true);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER), true);
|
||||||
//controls
|
//controls
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.INVENTORY);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.INVENTORY);
|
||||||
//play sound effect
|
//play sound effect
|
||||||
@ -1021,8 +1021,8 @@ public class ControlHandler {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
Globals.openInventoriesCount++;
|
Globals.openInventoriesCount++;
|
||||||
} else if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementManager.getWindow(WindowStrings.WINDOW_CHARACTER) != null){
|
} else if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) != null){
|
||||||
Globals.elementManager.closeWindow(WindowStrings.WINDOW_CHARACTER);
|
Globals.elementService.closeWindow(WindowStrings.WINDOW_CHARACTER);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
controls.get(INPUT_CODE_CHARACTER_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controls.get(INPUT_CODE_CHARACTER_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
@ -1132,13 +1132,13 @@ public class ControlHandler {
|
|||||||
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_FORWARD));
|
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_FORWARD));
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_FORWARD).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_FORWARD).setOnPress(new ControlMethod(){public void execute(){
|
||||||
// Globals.currentMenu.incrementMenuOption();
|
// Globals.currentMenu.incrementMenuOption();
|
||||||
Globals.elementManager.focusNextElement();
|
Globals.elementService.focusNextElement();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_BACKWARDS));
|
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_BACKWARDS));
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_BACKWARDS).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_NAVIGATE_BACKWARDS).setOnPress(new ControlMethod(){public void execute(){
|
||||||
// Globals.currentMenu.decrementMenuOption();
|
// Globals.currentMenu.decrementMenuOption();
|
||||||
Globals.elementManager.focusPreviousElement();
|
Globals.elementService.focusPreviousElement();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|
||||||
@ -1146,17 +1146,17 @@ public class ControlHandler {
|
|||||||
//Incrementing a menu element
|
//Incrementing a menu element
|
||||||
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT));
|
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT));
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setOnPress(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.fireEvent(
|
Globals.elementService.fireEvent(
|
||||||
new MenuEvent(MenuEventType.INCREMENT),
|
new MenuEvent(MenuEventType.INCREMENT),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteX(),
|
Globals.elementService.getFocusedElement().getAbsoluteX(),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteY()
|
Globals.elementService.getFocusedElement().getAbsoluteY()
|
||||||
);
|
);
|
||||||
}});
|
}});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setOnRepeat(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setOnRepeat(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.fireEvent(
|
Globals.elementService.fireEvent(
|
||||||
new MenuEvent(MenuEventType.INCREMENT),
|
new MenuEvent(MenuEventType.INCREMENT),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteX(),
|
Globals.elementService.getFocusedElement().getAbsoluteX(),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteY()
|
Globals.elementService.getFocusedElement().getAbsoluteY()
|
||||||
);
|
);
|
||||||
}});
|
}});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_INCREMENT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
@ -1164,13 +1164,13 @@ public class ControlHandler {
|
|||||||
//moving the mouse
|
//moving the mouse
|
||||||
menuNavigationControlList.add(controls.get(MENU_MOUSE_MOVE));
|
menuNavigationControlList.add(controls.get(MENU_MOUSE_MOVE));
|
||||||
controls.get(MENU_MOUSE_MOVE).setOnMove(new Control.MouseCallback(){public void execute(MouseEvent mouseEvent){
|
controls.get(MENU_MOUSE_MOVE).setOnMove(new Control.MouseCallback(){public void execute(MouseEvent mouseEvent){
|
||||||
Globals.elementManager.updateHover(mouseEvent.getCurrentX(), mouseEvent.getCurrentY());
|
Globals.elementService.updateHover(mouseEvent.getCurrentX(), mouseEvent.getCurrentY());
|
||||||
}});
|
}});
|
||||||
|
|
||||||
//scrolling the mouse
|
//scrolling the mouse
|
||||||
menuNavigationControlList.add(controls.get(MENU_SCROLL));
|
menuNavigationControlList.add(controls.get(MENU_SCROLL));
|
||||||
controls.get(MENU_SCROLL).setOnScroll(new Control.ScrollCallback() {public void execute(ScrollEvent scrollEvent){
|
controls.get(MENU_SCROLL).setOnScroll(new Control.ScrollCallback() {public void execute(ScrollEvent scrollEvent){
|
||||||
Globals.elementManager.fireEvent(scrollEvent, GLFW_KEY_X, GLFW_KEY_Z);
|
Globals.elementService.fireEvent(scrollEvent, GLFW_KEY_X, GLFW_KEY_Z);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
//dragging the cursor
|
//dragging the cursor
|
||||||
@ -1181,7 +1181,7 @@ public class ControlHandler {
|
|||||||
if(dragging){
|
if(dragging){
|
||||||
dragging = false;
|
dragging = false;
|
||||||
//fire dragrelease event to elementmanager
|
//fire dragrelease event to elementmanager
|
||||||
Globals.elementManager.dragRelease((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.dragRelease((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
/*
|
/*
|
||||||
@ -1192,11 +1192,11 @@ public class ControlHandler {
|
|||||||
if(!dragging && event.getButton1()){
|
if(!dragging && event.getButton1()){
|
||||||
dragging = true;
|
dragging = true;
|
||||||
//fire dragstart event to elementmanager
|
//fire dragstart event to elementmanager
|
||||||
Globals.elementManager.dragStart((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.dragStart((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
}
|
}
|
||||||
if(dragging){
|
if(dragging){
|
||||||
//fire drag event to elementmanager
|
//fire drag event to elementmanager
|
||||||
Globals.elementManager.drag((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.drag((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
|
|
||||||
@ -1217,17 +1217,17 @@ public class ControlHandler {
|
|||||||
//Decrementing a menu element
|
//Decrementing a menu element
|
||||||
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT));
|
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT));
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setOnPress(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.fireEvent(
|
Globals.elementService.fireEvent(
|
||||||
new MenuEvent(MenuEventType.DECREMENT),
|
new MenuEvent(MenuEventType.DECREMENT),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteX(),
|
Globals.elementService.getFocusedElement().getAbsoluteX(),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteY()
|
Globals.elementService.getFocusedElement().getAbsoluteY()
|
||||||
);
|
);
|
||||||
}});
|
}});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setOnRepeat(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setOnRepeat(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.fireEvent(
|
Globals.elementService.fireEvent(
|
||||||
new MenuEvent(MenuEventType.DECREMENT),
|
new MenuEvent(MenuEventType.DECREMENT),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteX(),
|
Globals.elementService.getFocusedElement().getAbsoluteX(),
|
||||||
Globals.elementManager.getFocusedElement().getAbsoluteY()
|
Globals.elementService.getFocusedElement().getAbsoluteY()
|
||||||
);
|
);
|
||||||
}});
|
}});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_DECREMENT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
@ -1237,9 +1237,9 @@ public class ControlHandler {
|
|||||||
|
|
||||||
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT));
|
menuNavigationControlList.add(controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT));
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_SELECT).setOnPress(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.click(new ClickEvent(
|
Globals.elementService.click(new ClickEvent(
|
||||||
Globals.elementManager.getFocusedElement().getInternalX() + 1,
|
Globals.elementService.getFocusedElement().getInternalX() + 1,
|
||||||
Globals.elementManager.getFocusedElement().getInternalY() + 1,
|
Globals.elementService.getFocusedElement().getInternalY() + 1,
|
||||||
true,
|
true,
|
||||||
Globals.mouseCallback.getButton(GLFW_MOUSE_BUTTON_2)
|
Globals.mouseCallback.getButton(GLFW_MOUSE_BUTTON_2)
|
||||||
));
|
));
|
||||||
@ -1249,7 +1249,7 @@ public class ControlHandler {
|
|||||||
menuNavigationControlList.add(controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY));
|
menuNavigationControlList.add(controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY));
|
||||||
mainGameDebugControlList.add(controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY));
|
mainGameDebugControlList.add(controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY));
|
||||||
controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY).setOnClick(new ControlMethod(){public void execute(){
|
controls.get(INPUT_CODE_MENU_MOUSE_PRIMARY).setOnClick(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.click(new ClickEvent(
|
Globals.elementService.click(new ClickEvent(
|
||||||
(int)xpos,
|
(int)xpos,
|
||||||
(int)ypos,
|
(int)ypos,
|
||||||
true,
|
true,
|
||||||
@ -1265,7 +1265,7 @@ public class ControlHandler {
|
|||||||
// }});
|
// }});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setOnClick(new ControlMethod(){public void execute(){
|
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setOnClick(new ControlMethod(){public void execute(){
|
||||||
// MenuCallbacks.backout(Globals.currentMenu);
|
// MenuCallbacks.backout(Globals.currentMenu);
|
||||||
Globals.elementManager.navigateBackwards();
|
Globals.elementService.navigateBackwards();
|
||||||
// Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
// Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||||
}});
|
}});
|
||||||
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
controls.get(DATA_STRING_INPUT_CODE_MENU_BACKOUT).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
@ -1396,9 +1396,9 @@ public class ControlHandler {
|
|||||||
for(String currentKey : typeKeybinds){
|
for(String currentKey : typeKeybinds){
|
||||||
typingControlList.add(controls.get(currentKey));
|
typingControlList.add(controls.get(currentKey));
|
||||||
controls.get(currentKey).setOnPress(new ControlMethod(){public void execute(){
|
controls.get(currentKey).setOnPress(new ControlMethod(){public void execute(){
|
||||||
Globals.elementManager.fireEventNoPosition(
|
Globals.elementService.fireEventNoPosition(
|
||||||
new KeyboardEvent(convertKeycodeToName(controls.get(currentKey).keyValue)),
|
new KeyboardEvent(convertKeycodeToName(controls.get(currentKey).keyValue)),
|
||||||
Globals.elementManager.getFocusedElement()
|
Globals.elementService.getFocusedElement()
|
||||||
);
|
);
|
||||||
// MenuCallbacks.menuHandleKeypress(Globals.currentMenu,currentKey);
|
// MenuCallbacks.menuHandleKeypress(Globals.currentMenu,currentKey);
|
||||||
}});
|
}});
|
||||||
@ -1440,10 +1440,10 @@ public class ControlHandler {
|
|||||||
if(dragging){
|
if(dragging){
|
||||||
dragging = false;
|
dragging = false;
|
||||||
//fire dragrelease event to elementmanager
|
//fire dragrelease event to elementmanager
|
||||||
Globals.elementManager.dragRelease((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.dragRelease((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
} else {
|
} else {
|
||||||
//fire onclick event to elementmanager
|
//fire onclick event to elementmanager
|
||||||
Globals.elementManager.click(new ClickEvent((int)xpos,(int)ypos,true,Globals.mouseCallback.getButton(GLFW_MOUSE_BUTTON_2)));
|
Globals.elementService.click(new ClickEvent((int)xpos,(int)ypos,true,Globals.mouseCallback.getButton(GLFW_MOUSE_BUTTON_2)));
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
/*
|
/*
|
||||||
@ -1454,11 +1454,11 @@ public class ControlHandler {
|
|||||||
if(!dragging && event.getButton1()){
|
if(!dragging && event.getButton1()){
|
||||||
dragging = true;
|
dragging = true;
|
||||||
//fire dragstart event to elementmanager
|
//fire dragstart event to elementmanager
|
||||||
Globals.elementManager.dragStart((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.dragStart((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
}
|
}
|
||||||
if(dragging){
|
if(dragging){
|
||||||
//fire drag event to elementmanager
|
//fire drag event to elementmanager
|
||||||
Globals.elementManager.drag((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
Globals.elementService.drag((int)xpos,(int)ypos,(int)mouse_lastX,(int)mouse_lastY,(int)(xpos - mouse_lastX),(int)(mouse_lastY - ypos));
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
@ -1568,7 +1568,7 @@ public class ControlHandler {
|
|||||||
rVal = rVal || WindowUtils.windowIsOpen(windowString);
|
rVal = rVal || WindowUtils.windowIsOpen(windowString);
|
||||||
}
|
}
|
||||||
//check if any generated inventory windows are open
|
//check if any generated inventory windows are open
|
||||||
for(String windowId : Globals.elementManager.getCurrentWindowIds()){
|
for(String windowId : Globals.elementService.getCurrentWindowIds()){
|
||||||
rVal = rVal || (WindowUtils.windowIsOpen(windowId) && WindowUtils.isInventoryWindow(windowId));
|
rVal = rVal || (WindowUtils.windowIsOpen(windowId) && WindowUtils.isInventoryWindow(windowId));
|
||||||
}
|
}
|
||||||
//check imgui windows
|
//check imgui windows
|
||||||
@ -1582,10 +1582,10 @@ public class ControlHandler {
|
|||||||
*/
|
*/
|
||||||
private boolean onlyInventoryMenusOpen(){
|
private boolean onlyInventoryMenusOpen(){
|
||||||
boolean foundInventory = false;
|
boolean foundInventory = false;
|
||||||
for(String windowId : Globals.elementManager.getCurrentWindowIds()){
|
for(String windowId : Globals.elementService.getCurrentWindowIds()){
|
||||||
if(WindowUtils.isInventoryWindow(windowId) || WindowStrings.WINDOW_MENU_INVENTORY.equals(windowId) || WindowStrings.WINDOW_CHARACTER.equals(windowId)){
|
if(WindowUtils.isInventoryWindow(windowId) || WindowStrings.WINDOW_MENU_INVENTORY.equals(windowId) || WindowStrings.WINDOW_CHARACTER.equals(windowId)){
|
||||||
foundInventory = true;
|
foundInventory = true;
|
||||||
} else if(Globals.elementManager.getWindow(windowId) instanceof Window == false || ((Window)Globals.elementManager.getWindow(windowId)).visible) {
|
} else if(Globals.elementService.getWindow(windowId) instanceof Window == false || ((Window)Globals.elementService.getWindow(windowId)).visible) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -361,7 +361,7 @@ public class Globals {
|
|||||||
public static InitialAssetLoading initialAssetLoadingThread = new InitialAssetLoading();
|
public static InitialAssetLoading initialAssetLoadingThread = new InitialAssetLoading();
|
||||||
|
|
||||||
//manager for all widgets currently being drawn to screen
|
//manager for all widgets currently being drawn to screen
|
||||||
public static ElementService elementManager;
|
public static ElementService elementService;
|
||||||
public static int openInventoriesCount = 0;
|
public static int openInventoriesCount = 0;
|
||||||
|
|
||||||
//collision world data
|
//collision world data
|
||||||
@ -493,7 +493,7 @@ public class Globals {
|
|||||||
serviceManager.init();
|
serviceManager.init();
|
||||||
//add services here
|
//add services here
|
||||||
Globals.signalSystem = (SignalSystem)serviceManager.registerService(new SignalSystem());
|
Globals.signalSystem = (SignalSystem)serviceManager.registerService(new SignalSystem());
|
||||||
Globals.elementManager = (ElementService)serviceManager.registerService(new ElementService());
|
Globals.elementService = (ElementService)serviceManager.registerService(new ElementService());
|
||||||
serviceManager.instantiate();
|
serviceManager.instantiate();
|
||||||
//
|
//
|
||||||
//End service manager
|
//End service manager
|
||||||
@ -501,7 +501,7 @@ public class Globals {
|
|||||||
|
|
||||||
//
|
//
|
||||||
//Register all signals
|
//Register all signals
|
||||||
Globals.signalSystem.registerService(SignalType.APPLY_YOGA, Globals.elementManager);
|
Globals.signalSystem.registerService(SignalType.APPLY_YOGA, Globals.elementService);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,8 +30,8 @@ public class ClientLoading {
|
|||||||
|
|
||||||
|
|
||||||
protected static void loadCharacterServer(Object[] params){
|
protected static void loadCharacterServer(Object[] params){
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
loadingWindow.setVisible(true);
|
loadingWindow.setVisible(true);
|
||||||
//disable menu input
|
//disable menu input
|
||||||
@ -51,7 +51,7 @@ public class ClientLoading {
|
|||||||
//make loading dialog disappear
|
//make loading dialog disappear
|
||||||
loadingWindow.setVisible(false);
|
loadingWindow.setVisible(false);
|
||||||
//make character creation window visible
|
//make character creation window visible
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), true);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), true);
|
||||||
//recapture window
|
//recapture window
|
||||||
Globals.controlHandler.setRecapture(true);
|
Globals.controlHandler.setRecapture(true);
|
||||||
//log
|
//log
|
||||||
@ -62,8 +62,8 @@ public class ClientLoading {
|
|||||||
|
|
||||||
|
|
||||||
protected static void loadClientWorld(Object[] params){
|
protected static void loadClientWorld(Object[] params){
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
loadingWindow.setVisible(true);
|
loadingWindow.setVisible(true);
|
||||||
//disable menu input
|
//disable menu input
|
||||||
|
|||||||
@ -18,9 +18,9 @@ public class DebugSPWorldLoading {
|
|||||||
|
|
||||||
|
|
||||||
protected static void loadDebugSPWorld(Object[] params){
|
protected static void loadDebugSPWorld(Object[] params){
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
//show loading
|
//show loading
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
loadingWindow.setVisible(true);
|
loadingWindow.setVisible(true);
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,9 @@ public class LevelEditorLoading {
|
|||||||
Globals.aiManager.setActive(false);
|
Globals.aiManager.setActive(false);
|
||||||
|
|
||||||
|
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
//show loading
|
//show loading
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
loadingWindow.setVisible(true);
|
loadingWindow.setVisible(true);
|
||||||
|
|
||||||
|
|||||||
@ -27,9 +27,9 @@ public class LevelLoading {
|
|||||||
}
|
}
|
||||||
String saveName = (String)params[0];
|
String saveName = (String)params[0];
|
||||||
|
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
//show loading
|
//show loading
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||||
loadingWindow.setVisible(true);
|
loadingWindow.setVisible(true);
|
||||||
|
|
||||||
|
|||||||
@ -65,12 +65,12 @@ public class MainMenuLoading {
|
|||||||
* @param params Params (this thread type does not accept any)
|
* @param params Params (this thread type does not accept any)
|
||||||
*/
|
*/
|
||||||
protected static void loadMainMenu(Object[] params){
|
protected static void loadMainMenu(Object[] params){
|
||||||
Window loadingWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING);
|
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||||
if(loadingWindow != null){
|
if(loadingWindow != null){
|
||||||
WindowUtils.recursiveSetVisible(loadingWindow,false);
|
WindowUtils.recursiveSetVisible(loadingWindow,false);
|
||||||
}
|
}
|
||||||
WindowUtils.focusWindow(WindowStrings.WINDOW_MENU_MAIN);
|
WindowUtils.focusWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||||
Window mainMenuWindow = (Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN);
|
Window mainMenuWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
||||||
if(mainMenuWindow != null){
|
if(mainMenuWindow != null){
|
||||||
WindowUtils.recursiveSetVisible(mainMenuWindow, true);
|
WindowUtils.recursiveSetVisible(mainMenuWindow, true);
|
||||||
|
|||||||
@ -23,14 +23,14 @@ public class WindowUtils {
|
|||||||
* @param newMenu The new contents
|
* @param newMenu The new contents
|
||||||
*/
|
*/
|
||||||
public static void replaceMainMenuContents(Element newMenu){
|
public static void replaceMainMenuContents(Element newMenu){
|
||||||
Element mainMenuEl = Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_MAIN);
|
Element mainMenuEl = Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||||
if(mainMenuEl != null && mainMenuEl instanceof Window){
|
if(mainMenuEl != null && mainMenuEl instanceof Window){
|
||||||
Window mainMenu = (Window) mainMenuEl;
|
Window mainMenu = (Window) mainMenuEl;
|
||||||
//todo: destroy elements as well
|
//todo: destroy elements as well
|
||||||
mainMenu.clear();
|
mainMenu.clear();
|
||||||
mainMenu.addChild(newMenu);
|
mainMenu.addChild(newMenu);
|
||||||
Globals.signalSystem.post(SignalType.APPLY_YOGA, mainMenu);
|
Globals.signalSystem.post(SignalType.APPLY_YOGA, mainMenu);
|
||||||
Globals.elementManager.focusFirstElement();
|
Globals.elementService.focusFirstElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ public class WindowUtils {
|
|||||||
recursiveSetVisible(child, visible);
|
recursiveSetVisible(child, visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Globals.elementManager.getFocusedElement() == null){
|
if(Globals.elementService.getFocusedElement() == null){
|
||||||
Globals.elementManager.focusFirstElement();
|
Globals.elementService.focusFirstElement();
|
||||||
}
|
}
|
||||||
if(visible){
|
if(visible){
|
||||||
Globals.signalSystem.post(SignalType.APPLY_YOGA,topLevelMenu);
|
Globals.signalSystem.post(SignalType.APPLY_YOGA,topLevelMenu);
|
||||||
@ -62,8 +62,8 @@ public class WindowUtils {
|
|||||||
* @return true if the window is open, false otherwise
|
* @return true if the window is open, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean windowIsOpen(String windowString){
|
public static boolean windowIsOpen(String windowString){
|
||||||
Element windowElement = Globals.elementManager.getWindow(windowString);
|
Element windowElement = Globals.elementService.getWindow(windowString);
|
||||||
return Globals.elementManager.getWindowList().contains(windowElement);
|
return Globals.elementService.getWindowList().contains(windowElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,34 +84,34 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void replaceWindowContents(String window, Element content){
|
public static void replaceWindowContents(String window, Element content){
|
||||||
Element mainMenuEl = Globals.elementManager.getWindow(window);
|
Element mainMenuEl = Globals.elementService.getWindow(window);
|
||||||
if(mainMenuEl != null && mainMenuEl instanceof Window){
|
if(mainMenuEl != null && mainMenuEl instanceof Window){
|
||||||
Window mainMenu = (Window) mainMenuEl;
|
Window mainMenu = (Window) mainMenuEl;
|
||||||
//todo: destroy elements as well
|
//todo: destroy elements as well
|
||||||
mainMenu.getChildren().clear();
|
mainMenu.getChildren().clear();
|
||||||
mainMenu.addChild(content);
|
mainMenu.addChild(content);
|
||||||
Globals.elementManager.focusFirstElement();
|
Globals.elementService.focusFirstElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pushItemIconToItemWindow(Element itemIcon){
|
public static void pushItemIconToItemWindow(Element itemIcon){
|
||||||
Window targetWindow = (Window) Globals.elementManager.getWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER);
|
Window targetWindow = (Window) Globals.elementService.getWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER);
|
||||||
targetWindow.addChild(itemIcon);
|
targetWindow.addChild(itemIcon);
|
||||||
recursiveSetVisible(targetWindow,true);
|
recursiveSetVisible(targetWindow,true);
|
||||||
Globals.elementManager.pushWindowToFront(targetWindow);
|
Globals.elementService.pushWindowToFront(targetWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cleanItemDraggingWindow(){
|
public static void cleanItemDraggingWindow(){
|
||||||
Window targetWindow = (Window) Globals.elementManager.getWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER);
|
Window targetWindow = (Window) Globals.elementService.getWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER);
|
||||||
targetWindow.getChildren().clear();
|
targetWindow.getChildren().clear();
|
||||||
recursiveSetVisible(targetWindow, false);
|
recursiveSetVisible(targetWindow, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void replaceWindow(String window, Window windowEl){
|
public static void replaceWindow(String window, Window windowEl){
|
||||||
Globals.elementManager.unregisterWindow(window);
|
Globals.elementService.unregisterWindow(window);
|
||||||
Globals.elementManager.registerWindow(window, windowEl);
|
Globals.elementService.registerWindow(window, windowEl);
|
||||||
recursiveSetVisible(windowEl, true);
|
recursiveSetVisible(windowEl, true);
|
||||||
Globals.elementManager.focusFirstElement();
|
Globals.elementService.focusFirstElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,9 +119,9 @@ public class WindowUtils {
|
|||||||
* @param window the window to clean up
|
* @param window the window to clean up
|
||||||
*/
|
*/
|
||||||
public static void closeWindow(String window){
|
public static void closeWindow(String window){
|
||||||
Element windowEl = Globals.elementManager.getWindow(window);
|
Element windowEl = Globals.elementService.getWindow(window);
|
||||||
recursiveSetVisible(windowEl, false);
|
recursiveSetVisible(windowEl, false);
|
||||||
Globals.elementManager.unregisterWindow(window);
|
Globals.elementService.unregisterWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ public class WindowUtils {
|
|||||||
//make sure we're client and the player entity exists
|
//make sure we're client and the player entity exists
|
||||||
if(Globals.RUN_CLIENT && Globals.playerEntity != null){
|
if(Globals.RUN_CLIENT && Globals.playerEntity != null){
|
||||||
//check equip inventory
|
//check equip inventory
|
||||||
if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementManager.containsWindow(WindowStrings.WINDOW_CHARACTER)){
|
if(InventoryUtils.hasEquipInventory(Globals.playerEntity) && Globals.elementService.containsWindow(WindowStrings.WINDOW_CHARACTER)){
|
||||||
//redraw if necessary
|
//redraw if necessary
|
||||||
RelationalInventoryState inventory = InventoryUtils.getEquipInventory(Globals.playerEntity);
|
RelationalInventoryState inventory = InventoryUtils.getEquipInventory(Globals.playerEntity);
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, MenuGeneratorsInventory.createCharacterInventoryMenu(inventory));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, MenuGeneratorsInventory.createCharacterInventoryMenu(inventory));
|
||||||
@ -142,7 +142,7 @@ public class WindowUtils {
|
|||||||
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity)){
|
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity)){
|
||||||
//we need to know the inventory to know which window to check as there can be multiple unrelational inventory screens open
|
//we need to know the inventory to know which window to check as there can be multiple unrelational inventory screens open
|
||||||
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
||||||
if(Globals.elementManager.containsWindow(WindowUtils.getInventoryWindowID(inventory.getId()))){
|
if(Globals.elementService.containsWindow(WindowUtils.getInventoryWindowID(inventory.getId()))){
|
||||||
//once we have the natural inventory, redraw
|
//once we have the natural inventory, redraw
|
||||||
WindowUtils.replaceWindow(WindowUtils.getInventoryWindowID(inventory.getId()), MenuGeneratorsInventory.createNaturalInventoryMenu(inventory));
|
WindowUtils.replaceWindow(WindowUtils.getInventoryWindowID(inventory.getId()), MenuGeneratorsInventory.createNaturalInventoryMenu(inventory));
|
||||||
}
|
}
|
||||||
@ -165,30 +165,30 @@ public class WindowUtils {
|
|||||||
loadingLabel.setText("LOADING");
|
loadingLabel.setText("LOADING");
|
||||||
loadingWindow.addChild(loadingLabel);
|
loadingWindow.addChild(loadingLabel);
|
||||||
Globals.signalSystem.post(SignalType.APPLY_YOGA,loadingWindow);
|
Globals.signalSystem.post(SignalType.APPLY_YOGA,loadingWindow);
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDOW_LOADING, loadingWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_LOADING, loadingWindow);
|
||||||
WindowUtils.recursiveSetVisible(loadingWindow, true);
|
WindowUtils.recursiveSetVisible(loadingWindow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initMainMenuWindow(){
|
static void initMainMenuWindow(){
|
||||||
Window mainMenuWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT,false);
|
Window mainMenuWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0, 0, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT,false);
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDOW_MENU_MAIN, mainMenuWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_MENU_MAIN, mainMenuWindow);
|
||||||
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
WindowUtils.replaceMainMenuContents(MenuGeneratorsTitleMenu.createTitleMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initItemDropWindow(){
|
static void initItemDropWindow(){
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDDOW_ITEM_DROP, MenuGeneratorsInventory.worldItemDropCaptureWindow());
|
Globals.elementService.registerWindow(WindowStrings.WINDDOW_ITEM_DROP, MenuGeneratorsInventory.worldItemDropCaptureWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initItemDragContainerWindow(){
|
static void initItemDragContainerWindow(){
|
||||||
Window itemDragContainerWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0,0,Globals.WINDOW_WIDTH,Globals.WINDOW_HEIGHT,false);
|
Window itemDragContainerWindow = new Window(Globals.renderingEngine.getOpenGLState(), 0,0,Globals.WINDOW_WIDTH,Globals.WINDOW_HEIGHT,false);
|
||||||
Globals.elementManager.registerWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER, itemDragContainerWindow);
|
Globals.elementService.registerWindow(WindowStrings.WINDOW_ITEM_DRAG_CONTAINER, itemDragContainerWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void focusWindow(String window){
|
public static void focusWindow(String window){
|
||||||
Element windowEl = Globals.elementManager.getWindow(window);
|
Element windowEl = Globals.elementService.getWindow(window);
|
||||||
if(windowEl != null){
|
if(windowEl != null){
|
||||||
Globals.elementManager.unregisterWindow(window);
|
Globals.elementService.unregisterWindow(window);
|
||||||
Globals.elementManager.registerWindow(window, windowEl);
|
Globals.elementService.registerWindow(window, windowEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,8 +52,8 @@ public class MenuGeneratorsInGame {
|
|||||||
Div div = Div.createDiv();
|
Div div = Div.createDiv();
|
||||||
rVal.addChild(div);
|
rVal.addChild(div);
|
||||||
div.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
div.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
||||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
Globals.elementService.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME);
|
||||||
} else {
|
} else {
|
||||||
@ -64,8 +64,8 @@ public class MenuGeneratorsInGame {
|
|||||||
|
|
||||||
//Back
|
//Back
|
||||||
div.addChild(Button.createButton("Back", () -> {
|
div.addChild(Button.createButton("Back", () -> {
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
||||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
Globals.elementService.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.MAIN_GAME);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -48,8 +48,8 @@ public class MenuGeneratorsInventory {
|
|||||||
rVal.addChild(div);
|
rVal.addChild(div);
|
||||||
|
|
||||||
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowUtils.getInventoryWindowID(inventory.getId())), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowUtils.getInventoryWindowID(inventory.getId())), false);
|
||||||
Globals.elementManager.unregisterWindow(WindowUtils.getInventoryWindowID(inventory.getId()));
|
Globals.elementService.unregisterWindow(WindowUtils.getInventoryWindowID(inventory.getId()));
|
||||||
//
|
//
|
||||||
Globals.openInventoriesCount--;
|
Globals.openInventoriesCount--;
|
||||||
if(Globals.openInventoriesCount == 0){
|
if(Globals.openInventoriesCount == 0){
|
||||||
@ -160,7 +160,7 @@ public class MenuGeneratorsInventory {
|
|||||||
container.removeChild(panel);
|
container.removeChild(panel);
|
||||||
}
|
}
|
||||||
div.addChild(panel);
|
div.addChild(panel);
|
||||||
Globals.elementManager.fireEvent(event, event.getCurrentX(), event.getCurrentY());
|
Globals.elementService.fireEvent(event, event.getCurrentX(), event.getCurrentY());
|
||||||
}
|
}
|
||||||
panel.setPositionX(div.getAbsoluteX() + itemPosX);
|
panel.setPositionX(div.getAbsoluteX() + itemPosX);
|
||||||
panel.setPositionY(div.getAbsoluteY() + itemPosY);
|
panel.setPositionY(div.getAbsoluteY() + itemPosY);
|
||||||
@ -227,8 +227,8 @@ public class MenuGeneratorsInventory {
|
|||||||
rVal.addChild(div);
|
rVal.addChild(div);
|
||||||
|
|
||||||
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
rVal.setOnNavigationCallback(new NavigationEventCallback() {public boolean execute(NavigationEvent event){
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_CHARACTER), false);
|
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER), false);
|
||||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_CHARACTER);
|
Globals.elementService.unregisterWindow(WindowStrings.WINDOW_CHARACTER);
|
||||||
//
|
//
|
||||||
Globals.openInventoriesCount--;
|
Globals.openInventoriesCount--;
|
||||||
if(Globals.openInventoriesCount == 0){
|
if(Globals.openInventoriesCount == 0){
|
||||||
@ -348,7 +348,7 @@ public class MenuGeneratorsInventory {
|
|||||||
ContainerElement container = (ContainerElement)panel.getParent();
|
ContainerElement container = (ContainerElement)panel.getParent();
|
||||||
container.removeChild(panel);
|
container.removeChild(panel);
|
||||||
}
|
}
|
||||||
Globals.elementManager.fireEvent(event, event.getCurrentX(), event.getCurrentY());
|
Globals.elementService.fireEvent(event, event.getCurrentX(), event.getCurrentY());
|
||||||
div.addChild(panel);
|
div.addChild(panel);
|
||||||
}
|
}
|
||||||
panel.setPositionX(div.getAbsoluteX() + itemPosX);
|
panel.setPositionX(div.getAbsoluteX() + itemPosX);
|
||||||
|
|||||||
@ -41,8 +41,8 @@ public class TutorialMenus {
|
|||||||
|
|
||||||
//Get the window
|
//Get the window
|
||||||
Window windowEl;
|
Window windowEl;
|
||||||
if(Globals.elementManager.containsWindow(WindowStrings.TUTORIAL_POPUP)){
|
if(Globals.elementService.containsWindow(WindowStrings.TUTORIAL_POPUP)){
|
||||||
windowEl = (Window)Globals.elementManager.getWindow(WindowStrings.TUTORIAL_POPUP);
|
windowEl = (Window)Globals.elementService.getWindow(WindowStrings.TUTORIAL_POPUP);
|
||||||
} else {
|
} else {
|
||||||
//create the window
|
//create the window
|
||||||
windowEl = new Window(Globals.renderingEngine.getOpenGLState(),0,0,TUTORIAL_POPUP_WIDTH,TUTORIAL_POPUP_HEIGHT,true);
|
windowEl = new Window(Globals.renderingEngine.getOpenGLState(),0,0,TUTORIAL_POPUP_WIDTH,TUTORIAL_POPUP_HEIGHT,true);
|
||||||
@ -54,7 +54,7 @@ public class TutorialMenus {
|
|||||||
windowEl.setFlexDirection(YogaFlexDirection.Column);
|
windowEl.setFlexDirection(YogaFlexDirection.Column);
|
||||||
windowEl.setAlignItems(YogaAlignment.Center);
|
windowEl.setAlignItems(YogaAlignment.Center);
|
||||||
windowEl.setJustifyContent(YogaJustification.Between);
|
windowEl.setJustifyContent(YogaJustification.Between);
|
||||||
Globals.elementManager.registerWindow(WindowStrings.TUTORIAL_POPUP, windowEl);
|
Globals.elementService.registerWindow(WindowStrings.TUTORIAL_POPUP, windowEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear previous content
|
//clear previous content
|
||||||
|
|||||||
@ -455,7 +455,7 @@ public class RenderingEngine {
|
|||||||
public void drawScreen(){
|
public void drawScreen(){
|
||||||
|
|
||||||
//element manager handle outstanding signals
|
//element manager handle outstanding signals
|
||||||
Globals.elementManager.handleAllSignals();
|
Globals.elementService.handleAllSignals();
|
||||||
|
|
||||||
//calculate render angle for frustum culling
|
//calculate render angle for frustum culling
|
||||||
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
|
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class DebugRendering {
|
|||||||
|
|
||||||
int parentPosX = 0;
|
int parentPosX = 0;
|
||||||
int parentPosY = 0;
|
int parentPosY = 0;
|
||||||
for(Element currentElement : Globals.elementManager.getWindowList()){
|
for(Element currentElement : Globals.elementService.getWindowList()){
|
||||||
if(currentElement instanceof DrawableElement){
|
if(currentElement instanceof DrawableElement){
|
||||||
DrawableElement drawable = (DrawableElement) currentElement;
|
DrawableElement drawable = (DrawableElement) currentElement;
|
||||||
if(drawable.getVisible()){
|
if(drawable.getVisible()){
|
||||||
@ -130,7 +130,7 @@ public class DebugRendering {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void dumpUITree(){
|
public static void dumpUITree(){
|
||||||
for(Element currentElement : Globals.elementManager.getWindowList()){
|
for(Element currentElement : Globals.elementService.getWindowList()){
|
||||||
dumpUITree(currentElement, 1);
|
dumpUITree(currentElement, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class UIPipeline implements RenderPipeline {
|
|||||||
openGLState.glDepthTest(false);
|
openGLState.glDepthTest(false);
|
||||||
openGLState.glBlend(true);
|
openGLState.glBlend(true);
|
||||||
|
|
||||||
for(Element currentElement : Globals.elementManager.getWindowList()){
|
for(Element currentElement : Globals.elementService.getWindowList()){
|
||||||
if(currentElement instanceof DrawableElement){
|
if(currentElement instanceof DrawableElement){
|
||||||
DrawableElement drawable = (DrawableElement) currentElement;
|
DrawableElement drawable = (DrawableElement) currentElement;
|
||||||
if(drawable.getVisible()){
|
if(drawable.getVisible()){
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class ElementService extends SignalServiceImpl {
|
|||||||
* @param windowString The window string
|
* @param windowString The window string
|
||||||
*/
|
*/
|
||||||
public void closeWindow(String windowString){
|
public void closeWindow(String windowString){
|
||||||
Element windowEl = Globals.elementManager.getWindow(windowString);
|
Element windowEl = Globals.elementService.getWindow(windowString);
|
||||||
if(windowEl instanceof Window){
|
if(windowEl instanceof Window){
|
||||||
((Window)windowEl).handleEvent(new NavigationEvent(NavigationEventType.BACKWARD));
|
((Window)windowEl).handleEvent(new NavigationEvent(NavigationEventType.BACKWARD));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class ScrollableContainer extends StandardContainerElement implements Dra
|
|||||||
|
|
||||||
//recursively check if focused element is child of input element or is input element
|
//recursively check if focused element is child of input element or is input element
|
||||||
boolean containsFocusedElement(Element parent){
|
boolean containsFocusedElement(Element parent){
|
||||||
Element focusedElement = Globals.elementManager.getFocusedElement();
|
Element focusedElement = Globals.elementService.getFocusedElement();
|
||||||
if(parent == focusedElement){
|
if(parent == focusedElement){
|
||||||
return true;
|
return true;
|
||||||
} else if(parent instanceof ContainerElement){
|
} else if(parent instanceof ContainerElement){
|
||||||
@ -97,7 +97,7 @@ public class ScrollableContainer extends StandardContainerElement implements Dra
|
|||||||
//figure out if currently focused element is a child or subchild of this container
|
//figure out if currently focused element is a child or subchild of this container
|
||||||
if(containsFocusedElement(this)){
|
if(containsFocusedElement(this)){
|
||||||
//if it is, if it is offscreen, calculate offset to put it onscreen
|
//if it is, if it is offscreen, calculate offset to put it onscreen
|
||||||
Element focused = Globals.elementManager.getFocusedElement();
|
Element focused = Globals.elementService.getFocusedElement();
|
||||||
if(
|
if(
|
||||||
focused.getRelativeX() + focused.getWidth() > this.width ||
|
focused.getRelativeX() + focused.getWidth() > this.width ||
|
||||||
focused.getRelativeY() + focused.getHeight() > this.height ||
|
focused.getRelativeY() + focused.getHeight() > this.height ||
|
||||||
|
|||||||
@ -232,7 +232,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
|||||||
if(onClickCallback != null){
|
if(onClickCallback != null){
|
||||||
onClickCallback.execute(clickEvent);
|
onClickCallback.execute(clickEvent);
|
||||||
} else {
|
} else {
|
||||||
Globals.elementManager.focusElement(this);
|
Globals.elementService.focusElement(this);
|
||||||
propagate = false;
|
propagate = false;
|
||||||
}
|
}
|
||||||
} else if(event instanceof ValueChangeEvent){
|
} else if(event instanceof ValueChangeEvent){
|
||||||
@ -258,7 +258,7 @@ public class TextInput extends StandardContainerElement implements DrawableEleme
|
|||||||
this.setText(this.text + keyEvent.getKey());
|
this.setText(this.text + keyEvent.getKey());
|
||||||
}
|
}
|
||||||
//fire value change event
|
//fire value change event
|
||||||
Globals.elementManager.fireEventNoPosition(new ValueChangeEvent(text), this);
|
Globals.elementService.fireEventNoPosition(new ValueChangeEvent(text), this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -189,9 +189,9 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
|||||||
if(onClickCallback != null){
|
if(onClickCallback != null){
|
||||||
onClickCallback.execute(clickEvent);
|
onClickCallback.execute(clickEvent);
|
||||||
} else {
|
} else {
|
||||||
Globals.elementManager.focusElement(this);
|
Globals.elementService.focusElement(this);
|
||||||
this.value = !this.value;
|
this.value = !this.value;
|
||||||
Globals.elementManager.fireEventNoPosition(new ValueChangeEvent(this.value), this);
|
Globals.elementService.fireEventNoPosition(new ValueChangeEvent(this.value), this);
|
||||||
propagate = false;
|
propagate = false;
|
||||||
}
|
}
|
||||||
} else if(event instanceof ValueChangeEvent){
|
} else if(event instanceof ValueChangeEvent){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user