audio work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-17 21:04:46 -04:00
parent b3af26b6a0
commit b8a0db5974
21 changed files with 180 additions and 38 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -101,6 +101,10 @@
"equipData": {
"equipClass" : "weapon2H"
},
"itemAudio": {
"uiGrabAudio" : "Audio/ui/items/specific/Pick Up Metal A.wav",
"uiReleaseAudio" : "Audio/ui/items/specific/Drop Metal A.wav"
},
"tokens" : [
"GRAVITY",
"MELEE",

View File

@ -16,7 +16,6 @@
Ticketed randomizer node for BTs to more heavily weight attacking and waiting
+ feedback driven requirements
Much much much much more UI sound effects
UI spacing and scaling
Come up with a title for the game and create a title menu for it (ideally with some animation and music)
Better skybox
@ -31,6 +30,7 @@
- Spawn player in a town with a quest to complete a nearby dungeon
+ bug fixes
Fix skeleton right strafe
Fix return to title menu synchronization bug
+ unreproducible bugs

View File

@ -789,6 +789,9 @@ Refactor menus to package under client
Fix buffered scrollable regression in above work
Memory fix
Start proliferating audio through ui
Item-based ui audio
Better sfx for opening/closing inventory menu
Different title menu audio
# TODO

View File

@ -5,6 +5,7 @@ import java.util.List;
import electrosphere.client.ui.menu.WindowUtils;
import electrosphere.client.ui.menu.ingame.MenuGeneratorsTerrainEditing;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
import electrosphere.entity.scene.SceneFile;
@ -85,7 +86,7 @@ public class MenuGeneratorsLevelEditor {
Button deleteButton = Button.createButton(" X ", () -> {
SaveUtils.deleteSave(saveName);
WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu());
});
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
deleteButton.setMarginRight(10);
@ -96,7 +97,7 @@ public class MenuGeneratorsLevelEditor {
Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true;
Globals.threadManager.start(loadingThread);
});
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
//
//button (edit Level)
@ -105,7 +106,7 @@ public class MenuGeneratorsLevelEditor {
//launch level editor
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LEVEL_EDITOR, saveName);
Globals.threadManager.start(loadingThread);
});
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE);
//create row
Div row = Div.createRow(
@ -208,7 +209,7 @@ public class MenuGeneratorsLevelEditor {
//launch level editor
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LEVEL_EDITOR, inFlightLevel);
Globals.threadManager.start(loadingThread);
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
return rVal;

View File

@ -3,6 +3,7 @@ package electrosphere.client.ui.menu.mainmenu;
import electrosphere.client.ui.menu.MenuGenerators;
import electrosphere.client.ui.menu.WindowUtils;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
import electrosphere.renderer.ui.elements.Button;
@ -37,22 +38,22 @@ public class MenuGeneratorsTitleMenu {
//button (multiplayer)
rVal.addChild(Button.createButtonCentered("Singleplayer", () -> {
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (multiplayer)
rVal.addChild(Button.createButtonCentered("Multiplayer", () -> {
WindowUtils.replaceMainMenuContents(MenuGenerators.createMultiplayerMenu());
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (static level)
rVal.addChild(Button.createButtonCentered("Level Editor", () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsLevelEditor.createLevelEditorTopMenu());
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (options)
rVal.addChild(Button.createButtonCentered("Options", () -> {
WindowUtils.replaceMainMenuContents(MenuGenerators.createOptionsMainMenu());
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (sp debug)
rVal.addChild(Button.createButtonCentered("Debug SP Quickstart", () -> {
@ -60,17 +61,17 @@ public class MenuGeneratorsTitleMenu {
Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true;
Globals.threadManager.start(loadingThread);
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (ui testing)
rVal.addChild(Button.createButtonCentered("UI Testing", () -> {
WindowUtils.replaceMainMenuContents(MenuGeneratorsUITesting.createUITestMenu());
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
//button (Viewport Test)
rVal.addChild(Button.createButtonCentered("Viewport Test", () -> {
Globals.threadManager.start(new LoadingThread(LoadingThreadType.LOAD_VIEWPORT));
}));
}).setOnClickAudio(AssetDataStrings.UI_TONE_BUTTON_TITLE));
return rVal;
}

View File

@ -989,7 +989,7 @@ public class ControlHandler {
Globals.controlHandler.hintUpdateControlState(ControlsState.INVENTORY);
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_TONE_CONFIRM_PRIMARY, VirtualAudioSourceType.UI, false);
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_INVENTORY_OPEN, VirtualAudioSourceType.UI, false);
}
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(true);
//
@ -997,6 +997,9 @@ public class ControlHandler {
} else if(InventoryUtils.hasNaturalInventory(Globals.playerEntity) && Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) != null){
Globals.elementService.closeWindow(WindowStrings.WINDOW_CHARACTER);
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_INVENTORY_CLOSE, VirtualAudioSourceType.UI, false);
}
}
}});
controls.get(INPUT_CODE_INVENTORY_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);

View File

@ -540,8 +540,6 @@ public class Globals {
*/
public static void initDefaultAudioResources(){
String[] audioToInit = new String[]{
"/Audio/inventoryGrabItem.ogg",
"/Audio/inventorySlotItem.ogg",
"/Audio/ambienceWind1SeamlessMono.ogg",
"/Audio/weapons/swordUnsheath1.ogg",
"/Audio/weapons/swoosh-03.ogg",
@ -563,6 +561,11 @@ public class Globals {
AssetDataStrings.UI_TONE_BACK_SECONDARY,
AssetDataStrings.UI_TONE_ERROR_PRIMARY,
AssetDataStrings.UI_TONE_ERROR_SECONDARY,
AssetDataStrings.UI_TONE_BUTTON_TITLE,
AssetDataStrings.UI_SFX_ITEM_GRAB,
AssetDataStrings.UI_SFX_ITEM_RELEASE,
AssetDataStrings.UI_SFX_INVENTORY_OPEN,
AssetDataStrings.UI_SFX_INVENTORY_CLOSE,
};
LoggerInterface.loggerStartup.INFO("Loading default audio resources");
for(String path : audioToInit){

View File

@ -17,7 +17,7 @@ public class AssetDataStrings {
public static final String UNITCUBE = "unitCube";
/**
* UI audio
* UI generic audio
*/
public static final String UI_TONE_CONFIRM_PRIMARY = "Audio/ui/generic/confirm_style_4_001.wav";
public static final String UI_TONE_CONFIRM_SECONDARY = "Audio/ui/generic/confirm_style_4_003.wav";
@ -28,4 +28,21 @@ public class AssetDataStrings {
public static final String UI_TONE_ERROR_PRIMARY = "Audio/ui/generic/error_style_4_002.wav";
public static final String UI_TONE_ERROR_SECONDARY = "Audio/ui/generic/error_style_4_001.wav";
/**
* UI button-specific audio
*/
public static final String UI_TONE_BUTTON_TITLE = "Audio/ui/generic/back_style_4_007.wav";
/**
* UI menu audio
*/
public static final String UI_SFX_INVENTORY_OPEN = "Audio/ui/menu/Open Inventory Bag A.wav";
public static final String UI_SFX_INVENTORY_CLOSE = "Audio/ui/menu/Close Inventory Bag A.wav";
/**
* UI item audio
*/
public static final String UI_SFX_ITEM_GRAB = "Audio/ui/items/inventoryGrabItem.ogg";
public static final String UI_SFX_ITEM_RELEASE = "Audio/ui/items/inventorySlotItem.ogg";
}

View File

@ -21,6 +21,7 @@ import electrosphere.entity.state.gravity.ServerGravityTree;
import electrosphere.entity.state.hitbox.HitboxCollectionState;
import electrosphere.entity.types.EntityTypes.EntityType;
import electrosphere.entity.types.common.CommonEntityUtils;
import electrosphere.game.data.item.ItemAudio;
import electrosphere.game.data.item.type.EquipData;
import electrosphere.game.data.item.type.EquipWhitelist;
import electrosphere.game.data.item.type.Item;
@ -75,6 +76,15 @@ public class ItemUtils {
} else {
rVal.putData(EntityDataStrings.ITEM_ICON,genericItemIconPath);
}
if(item.getItemAudio() != null){
ItemAudio audio = item.getItemAudio();
if(audio.getUIGrabAudio() != null && audio.getUIGrabAudio() != ""){
Globals.assetManager.addAudioPathToQueue(audio.getUIGrabAudio());
}
if(audio.getUIReleaseAudio() != null && audio.getUIReleaseAudio() != ""){
Globals.assetManager.addAudioPathToQueue(audio.getUIReleaseAudio());
}
}
//
//

View File

@ -0,0 +1,34 @@
package electrosphere.game.data.item;
/**
* Audio data related to the item
*/
public class ItemAudio {
/**
* The audio to play on grabbing the item icon in the ui
*/
String uiGrabAudio;
/**
* The audio to play on releasing the item icon in the ui
*/
String uiReleaseAudio;
/**
* Gets the audio to play on grabbing the item icon in the ui
* @return The audio path if it exists, null otherwise
*/
public String getUIGrabAudio(){
return uiGrabAudio;
}
/**
* Gets the audio to play on releasing the item icon in the ui
* @return The audio path if it exists, null otherwise
*/
public String getUIReleaseAudio(){
return uiReleaseAudio;
}
}

View File

@ -1,6 +1,7 @@
package electrosphere.game.data.item.type;
import electrosphere.game.data.common.CommonEntityType;
import electrosphere.game.data.item.ItemAudio;
/**
* Data on a given item
@ -16,6 +17,11 @@ public class Item extends CommonEntityType {
//The data defining how this item is equipped
EquipData equipData;
/**
* The audio data for the item
*/
ItemAudio itemAudio;
/**
* the idle animation for the item
* @return
@ -47,5 +53,13 @@ public class Item extends CommonEntityType {
public EquipData getEquipData(){
return equipData;
}
/**
* Gets the item audio data
* @return The audio data if specified, null otherwise
*/
public ItemAudio getItemAudio(){
return itemAudio;
}
}

View File

@ -14,6 +14,7 @@ import electrosphere.entity.state.inventory.RelationalInventoryState;
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
import electrosphere.entity.types.item.ItemUtils;
import electrosphere.game.data.creature.type.equip.EquipPoint;
import electrosphere.game.data.item.type.Item;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.ui.elements.Div;
import electrosphere.renderer.ui.elements.ImagePanel;
@ -52,6 +53,15 @@ public class EquipmentInventoryPanel {
div.setOnDragRelease(new DragEventCallback() {public boolean execute(DragEvent event){
LoggerInterface.loggerUI.INFO("Character inventory received drag release event");
if(Globals.draggedItem != null){
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
}
//null out global state
Globals.dragSourceInventory = null;
Globals.draggedItem = null;
@ -92,16 +102,17 @@ public class EquipmentInventoryPanel {
String texturePath = "Textures/ui/uiFrame1.png";
boolean hasItem = false;
String slotId = slots.get(i);
Entity currentItem = null;
equipPoint = inventory.getEquipPointFromSlot(slotId);
if(!equipPoint.isCombinedPoint()){
if(inventory.getItemSlot(slotId) != null && inventory.getItemSlot(slotId) != Globals.draggedItem){
Entity currentItem = inventory.getItemSlot(slotId);
currentItem = inventory.getItemSlot(slotId);
//get texture path from item
texturePath = ItemUtils.getItemIcon(currentItem);
//flag that this isn't an empty slot
hasItem = true;
} else if(inventory.getCombinedPoint(slotId) != null && inventory.hasItemInSlot(inventory.getCombinedPoint(slotId).getEquipPointId()) && inventory.getItemSlot(inventory.getCombinedPoint(slotId).getEquipPointId()) != Globals.draggedItem){
Entity currentItem = inventory.getItemSlot(inventory.getCombinedPoint(slotId).getEquipPointId());
currentItem = inventory.getItemSlot(inventory.getCombinedPoint(slotId).getEquipPointId());
//get texture path from item
texturePath = ItemUtils.getItemIcon(currentItem);
//flag that this isn't an empty slot
@ -109,6 +120,7 @@ public class EquipmentInventoryPanel {
equipPoint = inventory.getCombinedPoint(slotId);
slotId = equipPoint.getEquipPointId();
}
Entity finalEnt = currentItem;
if(!Globals.assetManager.hasLoadedTexture(texturePath)){
Globals.assetManager.addTexturePathtoQueue(texturePath);
}
@ -139,7 +151,12 @@ public class EquipmentInventoryPanel {
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, PlayerInventoryWindow.createPlayerInventoryWindow(Globals.playerEntity));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIGrabAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIGrabAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
}
}
return false;
}});
@ -166,29 +183,37 @@ public class EquipmentInventoryPanel {
int itemId = i;
panel.setOnDragRelease(new DragEventCallback(){public boolean execute(DragEvent event){
if(Globals.dragSourceInventory instanceof RelationalInventoryState){
Entity item = Globals.draggedItem;
if(ItemUtils.getContainingParent(item) != Globals.playerEntity){
if(ItemUtils.getContainingParent(Globals.draggedItem) != Globals.playerEntity){
throw new UnsupportedOperationException("Unimplemented!");
}
} else if(Globals.dragSourceInventory instanceof UnrelationalInventoryState){
Entity item = Globals.draggedItem;
if(inventory.canEquipItemToSlot(item, slots.get(itemId))){
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
equipState.commandAttemptEquip(item,inventory.getEquipPointFromSlot(slots.get(itemId)));
equipState.commandAttemptEquip(Globals.draggedItem,inventory.getEquipPointFromSlot(slots.get(itemId)));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
}
} else if(inventory.canEquipItemToCombinedSlot(item, slots.get(itemId))){
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
equipState.commandAttemptEquip(item,combinedPoint);
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
}
}
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
}
//update ui

View File

@ -11,6 +11,7 @@ import electrosphere.entity.state.inventory.InventoryUtils;
import electrosphere.entity.state.inventory.RelationalInventoryState;
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
import electrosphere.entity.types.item.ItemUtils;
import electrosphere.game.data.item.type.Item;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.ui.elements.Div;
import electrosphere.renderer.ui.elements.ImagePanel;
@ -70,6 +71,15 @@ public class NaturalInventoryPanel {
}
}
}
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
}
//clear ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
@ -96,13 +106,15 @@ public class NaturalInventoryPanel {
for(int i = 0; i < inventory.getCapacity(); i++){
String texturePath = "Textures/ui/uiFrame1.png";
boolean hasItem = false;
Entity currentItem = null;
if(i < inventory.getItems().size() && inventory.getItems().get(i) != Globals.draggedItem){
Entity currentItem = inventory.getItems().get(i);
currentItem = inventory.getItems().get(i);
//get texture path from item
texturePath = ItemUtils.getItemIcon(currentItem);
//flag that this isn't an empty slot
hasItem = true;
}
Entity finalEnt = currentItem;
if(!Globals.assetManager.hasLoadedTexture(texturePath)){
Globals.assetManager.addTexturePathtoQueue(texturePath);
}
@ -133,7 +145,12 @@ public class NaturalInventoryPanel {
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, PlayerInventoryWindow.createPlayerInventoryWindow(Globals.playerEntity));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIGrabAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIGrabAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventoryGrabItem.ogg", VirtualAudioSourceType.UI, false);
}
}
return false;
}});
@ -158,18 +175,22 @@ public class NaturalInventoryPanel {
} else {
panel.setOnDragRelease(new DragEventCallback(){public boolean execute(DragEvent event){
if(Globals.dragSourceInventory instanceof RelationalInventoryState){
Entity item = Globals.draggedItem;
if(ClientEquipState.hasEquipState(entity) && InventoryUtils.hasEquipInventory(entity)){
RelationalInventoryState equipInventory = InventoryUtils.getEquipInventory(entity);
ClientEquipState equipState = ClientEquipState.getEquipState(entity);
equipState.commandAttemptUnequip(equipInventory.getItemSlot(item));
equipState.commandAttemptUnequip(equipInventory.getItemSlot(Globals.draggedItem));
}
} else if(Globals.dragSourceInventory instanceof UnrelationalInventoryState){
Entity item = Globals.draggedItem;
if(ItemUtils.getContainingParent(item) != Globals.playerEntity){
if(ItemUtils.getContainingParent(Globals.draggedItem) != Globals.playerEntity){
throw new UnsupportedOperationException("Unimplemented!");
}
}
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
if(itemData.getItemAudio() != null && itemData.getItemAudio().getUIReleaseAudio() != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(itemData.getItemAudio().getUIReleaseAudio(), VirtualAudioSourceType.UI, false);
} else {
Globals.virtualAudioSourceManager.createVirtualAudioSource("/Audio/inventorySlotItem.ogg", VirtualAudioSourceType.UI, false);
}
//update ui
Globals.dragSourceInventory = null;
Globals.draggedItem = null;

View File

@ -1,9 +1,11 @@
package electrosphere.renderer.ui.components;
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
import electrosphere.client.ui.menu.WindowStrings;
import electrosphere.client.ui.menu.WindowUtils;
import electrosphere.controls.ControlHandler.ControlsState;
import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.engine.signal.Signal.SignalType;
import electrosphere.entity.Entity;
import electrosphere.entity.state.inventory.InventoryUtils;
@ -50,6 +52,9 @@ public class PlayerInventoryWindow {
} else {
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
}
if(Globals.virtualAudioSourceManager != null){
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.UI_SFX_INVENTORY_CLOSE, VirtualAudioSourceType.UI, false);
}
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
return false;
}});

View File

@ -298,8 +298,9 @@ public class Button extends StandardContainerElement implements DrawableElement,
* Sets the audio path to play on click
* @param audioPath The audio path
*/
public void setOnClickAudio(String audioPath){
public Button setOnClickAudio(String audioPath){
this.audioPathOnClick = audioPath;
return this;
}
}