Adding drop item sound
parent
ac8f8c494c
commit
e696440ce6
BIN
drop_item.wav
BIN
drop_item.wav
Binary file not shown.
|
@ -222,21 +222,19 @@ namespace stardew_access
|
|||
});
|
||||
#endregion
|
||||
|
||||
#region Custom Sounds
|
||||
/*CueDefinition myCueDefinition = new CueDefinition();
|
||||
|
||||
// Adding the name for the cue, which will be
|
||||
// the name of the audio to play when using sound functions.
|
||||
myCueDefinition.name = "myNewSound";
|
||||
// If this sound is played multiple times in quick succession,
|
||||
// only one sound instance will play at a time.
|
||||
myCueDefinition.instanceLimit = 1;
|
||||
myCueDefinition.limitBehavior = CueDefinition.LimitBehavior.ReplaceOldest;
|
||||
// Get the audio file and add it to a SoundEffect.
|
||||
SoundEffect sound_effect;
|
||||
string filePathCombined = Path.Combine(this.Helper.DirectoryPath, "mySound.wav");
|
||||
System.IO.FileStream stream = new System.IO.FileStream(filePathCombined, System.IO.FileMode.Open)
|
||||
sound_effect = SoundEffect.FromStream(stream);*/
|
||||
#region Custom Drop Item Sound
|
||||
CueDefinition sa_drop_item = new CueDefinition();
|
||||
sa_drop_item.name = "sa_drop_item";
|
||||
sa_drop_item.instanceLimit = 1;
|
||||
sa_drop_item.limitBehavior = CueDefinition.LimitBehavior.ReplaceOldest;
|
||||
SoundEffect audio;
|
||||
string filePathCombined = Path.Combine(this.Helper.DirectoryPath, "drop_item.wav");
|
||||
using (FileStream stream = new(filePathCombined, FileMode.Open))
|
||||
{
|
||||
audio = SoundEffect.FromStream(stream);
|
||||
}
|
||||
sa_drop_item.SetSound(audio, Game1.audioEngine.GetCategoryIndex("Sound"), false);
|
||||
Game1.soundBank.AddCue(sa_drop_item);
|
||||
#endregion
|
||||
|
||||
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||
|
|
|
@ -7,7 +7,11 @@ namespace stardew_access.Patches
|
|||
{
|
||||
internal class GameMenuPatches
|
||||
{
|
||||
internal static string hoveredItemQueryKey = "";
|
||||
internal static string geodeMenuQueryKey = "";
|
||||
internal static string itemGrabMenuQueryKey = "";
|
||||
internal static string craftingPageQueryKey = "";
|
||||
internal static string inventoryPageQueryKey = "";
|
||||
|
||||
internal static void GeodeMenuPatch(GeodeMenu __instance)
|
||||
{
|
||||
|
@ -52,6 +56,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
geodeMenuQueryKey = toSpeak;
|
||||
ScreenReader.say(toSpeak, true);
|
||||
Game1.playSound("sa_drop_item");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +87,8 @@ namespace stardew_access.Patches
|
|||
#endregion
|
||||
|
||||
#region Narrate hovered item
|
||||
narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y);
|
||||
if(narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y))
|
||||
geodeMenuQueryKey = "";
|
||||
#endregion
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -110,18 +116,34 @@ namespace stardew_access.Patches
|
|||
#region Narrate buttons in the menu
|
||||
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||
{
|
||||
ScreenReader.sayWithMenuChecker("Ok Button", true);
|
||||
string toSpeak = "Ok Button";
|
||||
if(itemGrabMenuQueryKey != toSpeak)
|
||||
{
|
||||
itemGrabMenuQueryKey = toSpeak;
|
||||
ScreenReader.say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
|
||||
{
|
||||
ScreenReader.sayWithMenuChecker("Trash Can", true);
|
||||
string toSpeak = "Trash Can";
|
||||
if (itemGrabMenuQueryKey != toSpeak)
|
||||
{
|
||||
itemGrabMenuQueryKey = toSpeak;
|
||||
ScreenReader.say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
|
||||
{
|
||||
ScreenReader.sayWithMenuChecker("Drop Item", true);
|
||||
string toSpeak = "Drop Item";
|
||||
if (itemGrabMenuQueryKey != toSpeak)
|
||||
{
|
||||
itemGrabMenuQueryKey = toSpeak;
|
||||
ScreenReader.say(toSpeak, true);
|
||||
Game1.playSound("sa_drop_item");
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
@ -204,7 +226,8 @@ namespace stardew_access.Patches
|
|||
}
|
||||
|
||||
#region Narrate hovered item
|
||||
narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true);
|
||||
if(narrateHoveredItemInInventory(__instance.inventory.inventory, __instance.inventory.actualInventory, x, y, true))
|
||||
inventoryPageQueryKey = "";
|
||||
#endregion
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -389,9 +412,9 @@ namespace stardew_access.Patches
|
|||
toSpeak = "Empty Slot";
|
||||
}
|
||||
|
||||
if (geodeMenuQueryKey != $"{toSpeak}:{i}")
|
||||
if (hoveredItemQueryKey != $"{toSpeak}:{i}")
|
||||
{
|
||||
geodeMenuQueryKey = $"{toSpeak}:{i}";
|
||||
hoveredItemQueryKey = $"{toSpeak}:{i}";
|
||||
ScreenReader.say(toSpeak, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -264,6 +264,8 @@ namespace stardew_access.Patches
|
|||
{
|
||||
GameMenuPatches.geodeMenuQueryKey = "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>stardew_access</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
@ -12,13 +12,8 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="AccessibleOutput" Version="1.0.0" />
|
||||
<PackageReference Include="AutoHotkey.Interop" Version="1.0.0.1" />
|
||||
<PackageReference Include="Lib.Harmony" Version="2.1.1" />
|
||||
<PackageReference Include="Lib.Harmony" Version="2.2.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue