Deleted some junk. Symphony Menu now works as intended, added save, add button, hover text, better music deciding, and wav volume support.

This commit is contained in:
JoshuaNavarro 2019-06-22 14:37:13 -07:00
parent 2252aa952a
commit bff69c2a96
27 changed files with 321 additions and 471 deletions

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.489
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MappingExample", "MappingExample\MappingExample.csproj", "{9A1AE9A3-D593-443A-985F-5BB43590CD63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A1AE9A3-D593-443A-985F-5BB43590CD63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A1AE9A3-D593-443A-985F-5BB43590CD63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A1AE9A3-D593-443A-985F-5BB43590CD63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A1AE9A3-D593-443A-985F-5BB43590CD63}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F8F5CF98-7807-4798-954F-B4A281A1ABE4}
EndGlobalSection
EndGlobal

View File

@ -1,8 +0,0 @@
using System;
namespace MappingExample
{
public class Class1
{
}
}

View File

@ -1,7 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.489
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MappingExampleTry2", "MappingExampleTry2\MappingExampleTry2.csproj", "{762317CC-06EF-4EF3-952E-6066F02505F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{762317CC-06EF-4EF3-952E-6066F02505F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{762317CC-06EF-4EF3-952E-6066F02505F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{762317CC-06EF-4EF3-952E-6066F02505F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{762317CC-06EF-4EF3-952E-6066F02505F6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6DC711D7-66B3-4C29-A02C-36A2B3BE71C5}
EndGlobalSection
EndGlobal

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MappingExampleTry2
{
public class Class1
{
}
}

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>762317cc-06ef-4ef3-952e-6066f02505f6</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MappingExampleTry2</RootNamespace>
<AssemblyName>MappingExampleTry2</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System"/>
<Reference Include="System.Core"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>
<Reference Include="Microsoft.CSharp"/>
<Reference Include="System.Data"/>
<Reference Include="System.Net.Http"/>
<Reference Include="System.Xml"/>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MappingExampleTry2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MappingExampleTry2")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("762317cc-06ef-4ef3-952e-6066f02505f6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using StardewModdingAPI;
namespace StardewSymphonyRemastered
@ -17,10 +18,14 @@ namespace StardewSymphonyRemastered
/// <summary>The key binding to open the menu music.</summary>
public SButton KeyBinding { get; set; } = SButton.L;
/// <summary>Whether to write a JSON file for every possible option for a music pack. Use at your own risk!</summary>
public bool WriteAllConfigMusicOptions { get; set; } = false;
/// <summary>Whether to completely disable the Stardew Valley OST.</summary>
public bool DisableStardewMusic { get; set; } = false;
public List<string> LocationsToIgnoreWarpMusicChange { get; set; } = new List<string>();
public Config()
{
this.LocationsToIgnoreWarpMusicChange = new List<string>();
}
}
}

View File

@ -69,6 +69,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
public Button playButton;
public Button stopButton;
public Button backButton;
public Button saveButton;
private Vector2 seasonButtonPosition;
private Vector2 timeButtonPosition;
@ -189,6 +190,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
Vector2 backPos = new Vector2(this.width * .1f + 64, this.height * .05f); //Put it to the right of the music disk
this.backButton = new Button("BackButton", new Rectangle((int)backPos.X, (int)backPos.Y, 64, 64), StardewSymphony.textureManager.getTexture("BackButton"), "", new Rectangle(0, 0, 16, 16), 4f, new Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
Vector2 savePos = new Vector2(this.width * .1f + 256 + 32, this.height * .05f + 64); //Put it to the right of the music disk
this.saveButton = new Button("SaveIcon", new Rectangle((int)savePos.X, (int)savePos.Y, 64, 64), StardewSymphony.textureManager.getTexture("SaveIcon"), "", new Rectangle(0, 0, 32, 32), 2f, new Animation(new Rectangle(0, 0, 32, 32)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
this.seasonButtonPosition = new Vector2(this.width * .1f + 64, this.height * .05f + (64 * 5));
this.weatherButtonPosition = new Vector2(this.width * .1f + (64*2), this.height * .05f + (64*5));
@ -238,6 +241,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
return;
}
if(this.drawMode== DrawMode.DifferentSelectionTypesModePage && this.saveButton.containsPoint(x, y))
{
this.CurrentMusicPack.SaveSettings();
Game1.playSound("coin");
return;
}
if (this.backButton.containsPoint(x, y))
{
Game1.playSound("coin");
@ -608,7 +618,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (button.name == "DayIcon" || button.name == "NightIcon" || musicPack.SongInformation.TimesOfDay.Contains(button.name))
{
this.currentlySelectedTime = button.clone(position,false);
this.drawMode = DrawMode.LocationSelection;
this.drawMode = DrawMode.DifferentSelectionTypesModePage;
buttonSelected = true;
}
@ -763,7 +773,19 @@ namespace StardewSymphonyRemastered.Framework.Menus
hoverTextOver = true;
}
}
if(hoverTextOver==false)
if (this.addButton.containsPoint(x, y) && this.drawMode== DrawMode.DifferentSelectionTypesModePage)
{
this.hoverText = "Add conditionals to song."+Environment.NewLine+Environment.NewLine+"This button adds a new set of conditionals"+Environment.NewLine+"for when this song should play."+Environment.NewLine+ "Every time a conditional is added it is" + Environment.NewLine + "then checked every time this mod tries to select music." + Environment.NewLine+"Multiple conditionals can exist for the same song.";
hoverTextOver = true;
}
if (this.saveButton.containsPoint(x, y) && this.drawMode == DrawMode.DifferentSelectionTypesModePage)
{
this.hoverText = "Save all changes for current music pack."+Environment.NewLine+Environment.NewLine+"Saves all song conditionals to the music pack's .json files"+Environment.NewLine+ "so that way information isn't lost in " + Environment.NewLine + "case the game crashes before sleeping." + Environment.NewLine+ "All music pack settings will be saved automatically" + Environment.NewLine + "when the day ends.";
hoverTextOver = true;
}
if (hoverTextOver==false)
{
this.hoverText = "";
}
@ -1595,12 +1617,92 @@ namespace StardewSymphonyRemastered.Framework.Menus
private void addSong()
{
//Depreceiated
//Used to actually save the song.
this.CurrentMusicPack.SongInformation.songs[this.currentSelectedSong.name].AddSongConditional(this.generateSongTriggerKeyFromSelection());
}
/// <summary>Generate the trigger key based on used selection.</summary>
public string generateSongTriggerKeyFromSelection()
{
string key = "";
string seperator = "_";
//Seasonal selection region
#region
if (this.currentlySelectedSeason != null)
{
if (this.currentlySelectedSeason.name == "SpringButton" || this.currentlySelectedSeason.name == "SummerButton" || this.currentlySelectedSeason.name == "FallButton" || this.currentlySelectedSeason.name == "WinterButton")
{
if (this.currentlySelectedSeason.name == "SpringButton") key += "spring";
else if (this.currentlySelectedSeason.name == "SummerButton") key += "summer";
else if (this.currentlySelectedSeason.name == "FallButton") key += "fall";
else if (this.currentlySelectedSeason.name == "WinterButton") key += "winter";
}
}
if (this.currentlySelectedWeather != null)
{
if (this.currentlySelectedWeather.name == "SunnyIcon") key += seperator + "sunny";
if (this.currentlySelectedWeather.name == "RainyIcon") key += seperator + "rain";
if (this.currentlySelectedWeather.name == "WeatherDebrisIcon") key += seperator + "debris";
if (this.currentlySelectedWeather.name == "WeatherFestivalIcon") key += seperator + "festival";
if (this.currentlySelectedWeather.name == "SnowIcon") key += seperator + "snow";
if (this.currentlySelectedWeather.name == "StormIcon") key += seperator + "lightning";
if (this.currentlySelectedWeather.name == "WeddingIcon") key += seperator + "wedding";
}
if (this.currentlySelectedTime != null)
{
if (this.currentlySelectedTime.name == "DayIcon") key += seperator + "day";
if (this.currentlySelectedTime.name == "NightIcon") key += seperator + "night";
for (int i = 1; i <= 12; i++)
{
if (this.currentlySelectedTime.name == i.ToString() + "A.M.") key += seperator + i.ToString() + "A.M.";
if (this.currentlySelectedTime.name == i.ToString() + "P.M.") key += seperator + i.ToString() + "P.M.";
}
}
if (this.currentlySelectedLocation != null)
{
if (this.currentlySelectedLocation.label.Contains("Cabin"))
{
key += seperator + this.currentlySelectedLocation.name;
}
else
{
key += seperator + this.currentlySelectedLocation.label;
}
}
if (this.currentlySelectedDay != null)
{
if (this.currentlySelectedDay.name == "SundayIcon") key += seperator + "sunday";
if (this.currentlySelectedDay.name == "MondayIcon") key += seperator + "monday";
if (this.currentlySelectedDay.name == "TuesdayIcon") key += seperator + "tuesday";
if (this.currentlySelectedDay.name == "WednesdayIcon") key += seperator + "wednesday";
if (this.currentlySelectedDay.name == "ThursdayIcon") key += seperator + "thursday";
if (this.currentlySelectedDay.name == "FridayIcon") key += seperator + "friday";
if (this.currentlySelectedDay.name == "SaturdayIcon") key += seperator + "saturday";
}
if (this.currentlySelectedMenu != null) key += seperator + this.currentlySelectedMenu.label;
if (this.currentlySelectedFestival != null) key += seperator + this.currentlySelectedFestival.label;
if (this.currentlySelectedEvent != null) key += seperator + this.currentlySelectedEvent.label;
#endregion
return key;
}
private void deleteSong()
{
//Check selections for draw mode and then remove if necessary
if (this.currentlySelectedSeason != null) this.currentlySelectedSeason = null;
if (this.currentlySelectedWeather != null) this.currentlySelectedWeather = null;
if (this.currentlySelectedTime != null) this.currentlySelectedTime = null;
if (this.currentlySelectedDay != null) this.currentlySelectedDay = null;
if (this.currentlySelectedLocation != null) this.currentlySelectedLocation = null;
if (this.currentlySelectedEvent != null) this.currentlySelectedEvent = null;
if (this.currentlySelectedFestival != null) this.currentlySelectedFestival = null;
if (this.currentlySelectedMenu != null) this.currentlySelectedMenu = null;
this.goBack();
}
/// <summary>
/// Returns to a previous menu screen.
@ -1620,6 +1722,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
else if (this.drawMode == DrawMode.SongSelectionMode)
{
this.drawMode = DrawMode.AlbumFancySelection;
this.currentSelectedSong = null;
this.updateFancyButtons();
}
}
@ -1936,6 +2039,12 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
this.deleteButton.draw(b);
}
if(this.drawMode== DrawMode.DifferentSelectionTypesModePage)
{
this.addButton.draw(b);
this.saveButton.draw(b);
}
}

View File

@ -20,9 +20,6 @@ namespace StardewSymphonyRemastered.Framework.V2
/// <summary>The delay timer between songs.</summary>
private readonly Timer Timer = new Timer();
private bool lastSongWasLocationSpecific;
/*********
** Accessors
*********/
@ -152,49 +149,29 @@ namespace StardewSymphonyRemastered.Framework.V2
/// Get a list of applicable songs to play in the given menu and find one to play.
/// </summary>
/// <param name="songListKey"></param>
public void SelectMenuMusic(string songListKey)
public bool SelectMenuMusic(string songListKey)
{
// stop timer when new music is selected
this.Timer.Enabled = false;
// get applicable music packs
var listOfValidMusicPacks = this.GetApplicableMusicPacks(songListKey);
if (listOfValidMusicPacks.Count == 0)
return;
// swap to new music pack
var pair = listOfValidMusicPacks.ElementAt(this.Random.Next(0, listOfValidMusicPacks.Count - 1));
this.SwapMusicPacks(pair.Key.Name);
string songName = pair.Value.ElementAt(this.Random.Next(0, pair.Value.Count));
this.CurrentMusicPack.PlaySong(songName);
if (this.selectMusic(songListKey, false))
{
StardewSymphony.menuChangedMusic = true;
return true;
}
StardewSymphony.menuChangedMusic = false;
return false;
}
/// <summary>Select the actual song to be played right now based on the selector key. The selector key should be called when the player's location changes.</summary>
public void selectMusic(string songListKey, bool warpCheck = false)
public bool selectMusic(string songListKey, bool warpCheck = false)
{
if (warpCheck == true && StardewSymphony.Config.LocationsToIgnoreWarpMusicChange.Contains(Game1.player.currentLocation.Name))
{
return false;
}
//Prevent generic song changes when running about.
if (SongSpecificsV2.IsKeyGeneric(songListKey))
{
if (this.CurrentMusicPack != null)
{
if (this.CurrentMusicPack.IsPlaying()) return;
}
}
//If I have warped and the key only is to be played when time changes prevent a new song from playing.
//If the key is more specific (I.E has a location associated with it) then music will change.
if (warpCheck == true && SongSpecificsV2.IsKeyTimeSpecific(songListKey))
{
if (this.CurrentMusicPack != null)
{
if (this.CurrentMusicPack.IsPlaying()) return;
}
}
SongConditionals conditional = new SongConditionals(songListKey);
// stop timer timer when music is selected
this.Timer.Enabled = false;
@ -205,44 +182,124 @@ namespace StardewSymphonyRemastered.Framework.V2
//If the list of valid packs are 0, check if I'm currently at an event or festival or get some location specific music and try to play a generalized song from there.
if (listOfValidMusicPacks.Count == 0)
{
//No valid songs to play at this time.
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".7 Are you sure you did this properly?");
StardewSymphony.menuChangedMusic = false;
return;
return false;
}
//All music packs that have songs have been taken into acount.
//Check all songs in all music packs to see if it can be played here.
SongConditionals conditional = new SongConditionals(songListKey);
List<KeyValuePair<MusicPackV2, string>> packSongNames = new List<KeyValuePair<MusicPackV2, string>>();
List<KeyValuePair<MusicPackV2, string>> locpackSongNames = new List<KeyValuePair<MusicPackV2, string>>();
foreach (var ok in listOfValidMusicPacks)
{
foreach (SongInformation song in ok.Key.SongInformation.songs.Values)
{
if (song.canBePlayed(songListKey))
{
foreach(SongConditionals con in song.songConditionals.Values)
{
if (con.isLocationSpecific() == false)
{
//If the key is generic skip over it.
if (con.isKeyGeneric())
{
if (this.CurrentMusicPack != null)
{
//If I am trying to play a generic song and a generic song is playing don't change the music.
//If I am trying to play a generic song and a non-generic song is playing, then play my generic song since I don't want to play the specific music anymore.
if ((conditional.isLocationSpecific()==false&&conditional.isTimeSpecific()==false) && (this.CurrentMusicPack.IsPlaying() && !this.lastSongWasLocationSpecific))
if (this.CurrentMusicPack.IsPlaying()) continue;
}
}
//If I have warped and the key only is to be played when time changes prevent a new song from playing.
//If the key is more specific (I.E has a location associated with it) then music will change.
if (warpCheck == true && con.isTimeSpecific())
{
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Non specific music change detected. Not going to change the music this time");
return;
if (this.CurrentMusicPack != null)
{
if (this.CurrentMusicPack.IsPlaying()) continue;
}
}
}
else
{
locpackSongNames.Add(new KeyValuePair<MusicPackV2, string>(ok.Key, song.name));
}
}
packSongNames.Add(new KeyValuePair<MusicPackV2, string>(ok.Key, song.name));
}
}
}
this.lastSongWasLocationSpecific = conditional.isLocationSpecific();
//If there is a valid key for the place/time/event/festival I am at, play it!
int randInt = this.Random.Next(0, listOfValidMusicPacks.Count - 1);
int randInt = this.Random.Next(0, packSongNames.Count - 1);
var musicPackPair = listOfValidMusicPacks.ElementAt(randInt);
var musicPackPair = packSongNames.ElementAt(randInt);
/*
//Check to see if the only location song was the one I was just playing. If so ignore it and chose more generic music.
if (locpackSongNames.Count == 1)
{
if (musicPackPair.Key == locpackSongNames[0].Key)
{
if (musicPackPair.Value == locpackSongNames[0].Value)
{
//Don't care
}
}
}
//If not the try to chose another location specific song.
else
{
packSongNames = locpackSongNames;
randInt = this.Random.Next(0, packSongNames.Count - 1);
musicPackPair = packSongNames.ElementAt(randInt);
}*/
while (true)
{
if (this.CurrentMusicPack != null)
{
if (packSongNames.Count == 0) return false;
if (musicPackPair.Key.Name == this.CurrentMusicPack.Name)
{
if (musicPackPair.Value == this.CurrentMusicPack.CurrentSongName)
{
if (packSongNames.Count == 1) return false;
else
{
//Used to eliminate chosing the same song from the same pack.
packSongNames.Remove(musicPackPair);
randInt = this.Random.Next(0, packSongNames.Count - 1);
musicPackPair = packSongNames.ElementAt(randInt);
}
}
else
{
//Different song from same pack
break;
}
}
else
{
//Different pack so probably different song.
break;
}
}
else
{
break;
}
}
//used to swap the music packs and stop the last playing song.
this.SwapMusicPacks(musicPackPair.Key.Name);
string songName = musicPackPair.Value.ElementAt(this.Random.Next(0, musicPackPair.Value.Count));
string songName = musicPackPair.Value;
this.CurrentMusicPack.PlaySong(songName);
return true;
}

View File

@ -82,6 +82,7 @@ namespace StardewSymphonyRemastered.Framework.V2
this.StopSong();
this.CurrentSongName = name;
this.CurrentSound = sound;
this.CurrentSound.Volume = Game1.options.musicVolumeLevel;
this.CurrentSound.Play();
}
@ -124,11 +125,14 @@ namespace StardewSymphonyRemastered.Framework.V2
foreach (FileInfo file in dataFolder.GetFiles())
{
SongInformation node = this.ContentPack.ReadJsonFile<SongInformation>($"{this.DataFolderName}/{file.Name}");
try
if (this.SongInformation.songs.ContainsKey(Path.GetFileNameWithoutExtension(file.Name)))
{
this.SongInformation.songs.Add(file.Name, node);
this.SongInformation.songs[Path.GetFileNameWithoutExtension(file.Name)].songConditionals = node.songConditionals;
}
else
{
this.SongInformation.songs.Add(Path.GetFileNameWithoutExtension(file.Name), node);
}
catch { }
}
}
}

View File

@ -9,15 +9,14 @@ namespace StardewSymphonyRemastered.Framework.V2
{
public class SongConditionals
{
string season;
string weather;
string time;
string location;
string dayOfWeek;
string eventKey;
string festival;
string menu;
public string season;
public string weather;
public string time;
public string location;
public string dayOfWeek;
public string eventKey;
public string festival;
public string menu;
private readonly string[] seasons;
private readonly string[] weathers;
@ -141,62 +140,13 @@ namespace StardewSymphonyRemastered.Framework.V2
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool canBePlayed(string key)
public bool canBePlayed(SongConditionals other)
{
string tempSeason = "";
string tempWeather = "";
string tempTime = "";
string tempLocation = "";
string tempDayOfWeek = "";
string tempMenu = "";
string tempFestival = "";
string tempEvent = "";
string[] splits = key.Split(seperator);
foreach (string split in splits)
{
//Parse key into conditionals.
if (this.seasons.Contains(split))
{
tempSeason = split;
}
else if (this.weathers.Contains(split))
{
tempWeather = split;
}
else if (this.daysOfWeek.Contains(split))
{
tempDayOfWeek = split;
}
else if (this.timesOfDay.Contains(split))
{
tempTime = split;
}
else if (SongSpecificsV2.menus.Contains(split))
{
tempMenu = split;
}
else if (SongSpecificsV2.locations.Contains(split))
{
tempLocation = split;
}
else if (SongSpecificsV2.events.Contains(split))
{
tempEvent = split;
}
else if (SongSpecificsV2.festivals.Contains(split))
{
tempFestival = split;
}
}
if (this.isLocationSpecific())
{
if (!string.IsNullOrEmpty(tempLocation))
if (!string.IsNullOrEmpty(other.location))
{
if (this.dayOfWeek != tempDayOfWeek) return false; //If there is a check but not the right location return false
if (this.location.Equals(other.location)==false) return false; //If there is a check but not the right location return false
}
else
{
@ -205,9 +155,9 @@ namespace StardewSymphonyRemastered.Framework.V2
}
if (this.isTimeSpecific())
{
if (!string.IsNullOrEmpty(tempTime))
if (!string.IsNullOrEmpty(other.time))
{
if (this.time != tempTime) return false; //If the two times don't match return false
if (this.time.Equals(other.time)==false) return false; //If the two times don't match return false
}
else
{
@ -219,9 +169,9 @@ namespace StardewSymphonyRemastered.Framework.V2
if (this.isDaySpecific())
{
//condition specific check
if (!string.IsNullOrEmpty(tempDayOfWeek))
if (!string.IsNullOrEmpty(other.dayOfWeek))
{
if (this.dayOfWeek != tempDayOfWeek) return false;
if (this.dayOfWeek.Equals(other.dayOfWeek)==false) return false;
}
else
{
@ -232,9 +182,9 @@ namespace StardewSymphonyRemastered.Framework.V2
//Check for season.
if (this.isSeasonSpecific())
{
if (!string.IsNullOrEmpty(tempSeason))
if (!string.IsNullOrEmpty(other.season))
{
if (this.season != tempSeason) return false;
if (this.season.Equals(other.season)==false) return false;
}
else
{
@ -245,9 +195,9 @@ namespace StardewSymphonyRemastered.Framework.V2
//Check for weather.
if (this.isWeatherSpecific())
{
if (!string.IsNullOrEmpty(tempWeather))
if (!string.IsNullOrEmpty(other.weather))
{
if (this.weather != tempWeather) return false;
if (this.weather.Equals(other.weather)==false) return false;
}
else
{
@ -258,31 +208,30 @@ namespace StardewSymphonyRemastered.Framework.V2
if (!string.IsNullOrEmpty(this.menu))
{
if (!string.IsNullOrEmpty(tempMenu))
if (!string.IsNullOrEmpty(other.menu))
{
if (this.menu != tempMenu) return false;
if (this.menu.Equals(other.menu)==false) return false;
}
}
if (!string.IsNullOrEmpty(this.festival))
{
if (!string.IsNullOrEmpty(tempFestival))
if (!string.IsNullOrEmpty(other.festival))
{
if (this.festival != tempFestival) return false;
if (this.festival.Equals(other.festival)==false) return false;
}
}
if (!string.IsNullOrEmpty(this.eventKey))
{
if (!string.IsNullOrEmpty(tempEvent))
if (!string.IsNullOrEmpty(other.eventKey))
{
if (this.eventKey != tempEvent) return false;
if (this.eventKey.Equals(other.eventKey)==false) return false;
}
}
return true;
}
public bool isLocationSpecific()
{
return !string.IsNullOrEmpty(this.location);
@ -306,6 +255,16 @@ namespace StardewSymphonyRemastered.Framework.V2
return !string.IsNullOrEmpty(this.dayOfWeek);
}
/// <summary>
/// Checks if the given conditonal is generic or not.
/// </summary>
/// <returns></returns>
public bool isKeyGeneric()
{
if (this.isTimeSpecific() == false && this.isLocationSpecific() == false) return true;
else return false;
}
/*
public override bool Equals(object obj)
{
if (obj.GetType() != typeof(SongConditionals)) return false;
@ -321,5 +280,20 @@ namespace StardewSymphonyRemastered.Framework.V2
return true;
}
*/
public override string ToString()
{
StringBuilder b = new StringBuilder();
b.Append("Season: " + this.season+Environment.NewLine);
b.Append("Weather: " + this.weather + Environment.NewLine);
b.Append("Time: " + this.time + Environment.NewLine);
b.Append("Location: " + this.location + Environment.NewLine);
b.Append("Day: " + this.dayOfWeek + Environment.NewLine);
b.Append("Festival: " + this.festival + Environment.NewLine);
b.Append("Event: " + this.eventKey + Environment.NewLine);
b.Append("Menu: " + this.menu + Environment.NewLine);
return b.ToString();
}
}
}

View File

@ -52,7 +52,8 @@ namespace StardewSymphonyRemastered.Framework.V2
{
foreach(KeyValuePair<string,SongConditionals> pair in this.songConditionals)
{
if (pair.Value.canBePlayed(key) == true) return true;
SongConditionals temp = new SongConditionals(key);
if (pair.Value.canBePlayed(temp) == true) return true;
}
return false;
}

View File

@ -487,9 +487,12 @@ namespace StardewSymphonyRemastered.Framework.V2
public List<string> getSongList(string key)
{
List<string> songs = new List<string>();
foreach(var v in this.songs)
foreach (var v in this.songs)
{
if (v.Value.canBePlayed(key)) songs.Add(v.Key);
if (v.Value.canBePlayed(key))
{
songs.Add(v.Key);
}
}
return songs;
}

View File

@ -11,15 +11,9 @@ namespace StardewSymphonyRemastered
{
// TODO:
//
// Fixed Farm building glitch,
// Added underground mine support
// Added seasonal selection support
// added just location support
// added in write all config option
//
// Add mod config to have silent rain option.
// Add in shuffle song button that just selects music but probably plays a different song. same as musicManager.selectmusic(getConditionalString);
// Add in a save button to save settings in the menu.
// Added in option to tie in wav sound volume to game sound options.
//Add in way to see all selected options for a song in the menu?
//
// Notes:
// All mods must add events/locations/festivals/menu information to this mod during the Entry function of their mod because once the player is loaded that's when all of the packs are initialized with all of their music.
@ -36,6 +30,7 @@ namespace StardewSymphonyRemastered
public static TextureManager textureManager;
private float oldVolume=-5f;
/*********
** Public methods
*********/
@ -202,6 +197,23 @@ namespace StardewSymphonyRemastered
}
}
}
//Update volume.
if (this.oldVolume < 0f)
{
this.oldVolume = Game1.options.musicVolumeLevel;
}
if (this.oldVolume != Game1.options.musicVolumeLevel)
{
this.oldVolume = Game1.options.musicVolumeLevel;
if (musicManager.CurrentMusicPack != null)
{
if (musicManager.CurrentMusicPack.CurrentSound != null)
{
musicManager.CurrentMusicPack.CurrentSound.Volume = this.oldVolume;
}
}
}
}
/// <summary>Load the textures needed by the mod.</summary>
@ -212,6 +224,8 @@ namespace StardewSymphonyRemastered
return new Texture2DExtended(this.Helper.Content.Load<Texture2D>($"assets/{name}"));
}
textureManager.addTexture("SaveIcon", LoadTexture("SaveIcon.png"));
//Generic Icons
textureManager.addTexture("MusicNote", LoadTexture("MusicNote.png"));
textureManager.addTexture("MusicDisk", LoadTexture("MusicDisk.png"));

View File

@ -242,6 +242,9 @@
<Content Include="assets\RedBallon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="assets\SaveIcon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="assets\SeasonIcon_Fall.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

View File

@ -1,22 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 14 for Windows Desktop
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIUtilities", "UIUtilities\UIUtilities.csproj", "{ABA29468-BAC9-47E9-983A-393FC5489124}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ABA29468-BAC9-47E9-983A-393FC5489124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABA29468-BAC9-47E9-983A-393FC5489124}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABA29468-BAC9-47E9-983A-393FC5489124}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABA29468-BAC9-47E9-983A-393FC5489124}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UIUtilities
{
public class Class1
{
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UIUtilities.MenuComponents
{
class Button : StardewValley.Menus.ClickableComponent
{
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UIUtilities")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UIUtilities")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("aba29468-bac9-47e9-983a-393fc5489124")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ABA29468-BAC9-47E9-983A-393FC5489124}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UIUtilities</RootNamespace>
<AssemblyName>UIUtilities</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="MenuComponents\Button.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
</packages>

Binary file not shown.

Binary file not shown.

Binary file not shown.