Merge pull request #30 from janavarro95/Development
Merge from Development
This commit is contained in:
commit
c9054570a9
|
@ -0,0 +1,22 @@
|
|||
|
||||
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}") = "CustomAssetModifier", "CustomAssetModifier\CustomAssetModifier.csproj", "{679F7D40-2728-47BB-A86F-D044816752E2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{679F7D40-2728-47BB-A86F-D044816752E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{679F7D40-2728-47BB-A86F-D044816752E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{679F7D40-2728-47BB-A86F-D044816752E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{679F7D40-2728-47BB-A86F-D044816752E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StardewModdingAPI;
|
||||
using System.IO;
|
||||
using CustomAssetModifier.Framework.Editors;
|
||||
using CustomAssetModifier.Framework;
|
||||
|
||||
namespace CustomAssetModifier
|
||||
{
|
||||
|
||||
public class CustomAssetModifier : Mod
|
||||
{
|
||||
/// <summary>
|
||||
/// Static reference to this mod's helper.
|
||||
/// </summary>
|
||||
public static IModHelper ModHelper;
|
||||
/// <summary>
|
||||
/// Static reference to this mod's monitor.
|
||||
/// </summary>
|
||||
public static IMonitor ModMonitor;
|
||||
|
||||
/// <summary>
|
||||
/// Path for Mod/Content.
|
||||
/// </summary>
|
||||
public static string contentPath;
|
||||
/// <summary>
|
||||
/// Path for Mod/Content/Data
|
||||
/// </summary>
|
||||
public static string dataPath;
|
||||
/// <summary>
|
||||
/// Path for Mod/Content/Data/ObjectInformation
|
||||
/// </summary>
|
||||
public static string objectInformationPath;
|
||||
/// <summary>
|
||||
/// Path for Mod/Content/Templates/ObjectInformation
|
||||
/// </summary>
|
||||
public static string TemplatePath;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Entry function for the mod.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = helper;
|
||||
ModMonitor = Monitor;
|
||||
|
||||
//Just setting up a bunch of paths for the mod.
|
||||
contentPath = Path.Combine(ModHelper.DirectoryPath, "Content");
|
||||
dataPath = Path.Combine(contentPath, "Data");
|
||||
objectInformationPath = Path.Combine(dataPath, "ObjectInformation");
|
||||
TemplatePath = Path.Combine(contentPath, "Templates");
|
||||
|
||||
createDirectories();
|
||||
createBlankObjectTemplate();
|
||||
|
||||
//Add the ObjectInformationEditor asset editor to the list of asset editors that SMAPI uses.
|
||||
ModHelper.Content.AssetEditors.Add(new ObjectInformationEditor());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates the necessary directories for the mod.
|
||||
/// </summary>
|
||||
public void createDirectories()
|
||||
{
|
||||
//Create the Mod/Content directory.
|
||||
if (!Directory.Exists(contentPath)){
|
||||
Directory.CreateDirectory(contentPath);
|
||||
}
|
||||
//Create the Mod/Content/Data directory.
|
||||
if (!Directory.Exists(dataPath))
|
||||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
//Create the Mod/Content/Data/ObjectInformation directory.
|
||||
if (!Directory.Exists(objectInformationPath))
|
||||
{
|
||||
Directory.CreateDirectory(objectInformationPath);
|
||||
}
|
||||
//Create the Mod/Content/Template/ObjectInformation directory.
|
||||
if (!Directory.Exists(TemplatePath))
|
||||
{
|
||||
Directory.CreateDirectory(TemplatePath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the blank object example for dinosaur eggs.
|
||||
/// </summary>
|
||||
public void createBlankObjectTemplate()
|
||||
{
|
||||
var ok = new AssetInformation("107","Dinosaur Egg / 720 / -300 / Arch / A giant dino egg...The entire shell is still intact!/ Mine .01 Mountain .008 / Item 1 107");
|
||||
ok.writeJson(Path.Combine(TemplatePath,"ObjectInformation",ok.id.ToString()+".json"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?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>{679F7D40-2728-47BB-A86F-D044816752E2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CustomAssetModifier</RootNamespace>
|
||||
<AssemblyName>CustomAssetModifier</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="CustomAssetModifier.cs" />
|
||||
<Compile Include="Framework\AssetInformation.cs" />
|
||||
<Compile Include="Framework\Editors\ObjectInformationEditor.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>
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomAssetModifier.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to easily store Dictionary key pair values of (string,string) that are commonly used in .xnb files.
|
||||
/// </summary>
|
||||
public class AssetInformation
|
||||
{
|
||||
public string id; //
|
||||
public string informationString;
|
||||
|
||||
/// <summary>
|
||||
/// Blank constructor.
|
||||
/// </summary>
|
||||
public AssetInformation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normal constructor.
|
||||
/// </summary>
|
||||
/// <param name="ID">The id key used in the asset file. Aslo will be the file's name.</param>
|
||||
/// <param name="DataString">The data string that is to be set after the edit.</param>
|
||||
public AssetInformation(string ID, string DataString)
|
||||
{
|
||||
this.id = ID;
|
||||
this.informationString = DataString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the information to a .json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void writeJson(string path)
|
||||
{
|
||||
CustomAssetModifier.ModHelper.WriteJsonFile(path, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the information from a .json file and return an instance of AssetInformation.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static AssetInformation readJson(string path)
|
||||
{
|
||||
return CustomAssetModifier.ModHelper.ReadJsonFile<AssetInformation>(path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using StardewModdingAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomAssetModifier.Framework.Editors
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Asset editor for assets stored in ObjectInformation.xnb
|
||||
/// </summary>
|
||||
public class ObjectInformationEditor : IAssetEditor
|
||||
{
|
||||
/// <summary>Get whether this instance can edit the given asset.</summary>
|
||||
/// <param name="asset">Basic metadata about the asset being loaded.</param>
|
||||
public bool CanEdit<T>(IAssetInfo asset)
|
||||
{
|
||||
return asset.AssetNameEquals(@"Data\ObjectInformation");
|
||||
}
|
||||
|
||||
/// <summary>Edit a matched asset.</summary>
|
||||
/// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param>
|
||||
public void Edit<T>(IAssetData asset)
|
||||
{
|
||||
string[] files = Directory.GetFiles(CustomAssetModifier.objectInformationPath);
|
||||
foreach (var file in files)
|
||||
{
|
||||
var ok = AssetInformation.readJson(file);
|
||||
asset
|
||||
.AsDictionary<int, string>()
|
||||
.Set(Convert.ToInt32(ok.id), ok.informationString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
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("CustomAssetModifier")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CustomAssetModifier")]
|
||||
[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("679f7d40-2728-47bb-a86f-d044816752e2")]
|
||||
|
||||
// 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")]
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"Name": "Custom Asset Editor",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": {
|
||||
"MajorVersion": 1,
|
||||
"MinorVersion": 0,
|
||||
"PatchVersion": 0,
|
||||
"Build": null
|
||||
},
|
||||
"MinimumApiVersion": "2.3",
|
||||
"Description": "Allows players to edit basic vanilla assets using text files.",
|
||||
"UniqueID": "Omegasis.CustomAssetModifier",
|
||||
"EntryDll": "CustomAssetModifier.dll",
|
||||
"UpdateKeys": [ "" ]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -169,6 +169,9 @@ namespace Omegasis.HappyBirthday.Framework
|
|||
/// <param name="y">The Y-position of the cursor.</param>
|
||||
/// <param name="playSound">Whether to enable sound.</param>
|
||||
public override void receiveLeftClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
//If the season is not selected then the day buttons can't be clicked. Thanks to @Potato#5266 on the SDV discord for this tip.
|
||||
if (this.BirthdaySeason == "spring" || this.BirthdaySeason == "summer" || this.BirthdaySeason == "fall" || this.BirthdaySeason == "winter")
|
||||
{
|
||||
foreach (ClickableTextureComponent button in this.DayButtons)
|
||||
{
|
||||
|
@ -179,6 +182,7 @@ namespace Omegasis.HappyBirthday.Framework
|
|||
button.scale = Math.Max(3.5f, button.scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ClickableTextureComponent button in this.SeasonButtons)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@ namespace Omegasis.HappyBirthday
|
|||
// load settings
|
||||
this.MigrateLegacyData();
|
||||
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
||||
|
||||
//this.SeenEvent = false;
|
||||
//this.Dialogue = new Dictionary<string, Dialogue>();
|
||||
}
|
||||
|
@ -501,9 +502,14 @@ namespace Omegasis.HappyBirthday
|
|||
private void MigrateLegacyData()
|
||||
{
|
||||
// skip if no legacy data or new data already exists
|
||||
try
|
||||
{
|
||||
if (!File.Exists(this.LegacyDataFilePath) || File.Exists(this.DataFilePath))
|
||||
if (this.PlayerData == null) this.PlayerData = new PlayerData();
|
||||
return;
|
||||
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
// migrate to new file
|
||||
try
|
||||
{
|
||||
|
@ -524,5 +530,7 @@ namespace Omegasis.HappyBirthday
|
|||
this.Monitor.Log($"Error migrating data from the legacy 'Player_Birthdays' folder for the current player. Technical details:\n {ex}", LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
{
|
||||
"Name": "Happy Birthday",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": {
|
||||
"MajorVersion": 1,
|
||||
"MinorVersion": 4,
|
||||
"PatchVersion": 3,
|
||||
"Build": null
|
||||
},
|
||||
"MinimumApiVersion": "1.15",
|
||||
"Description": "Adds the farmer's birthday to the game.",
|
||||
"UniqueID": "Omegasis.HappyBirthday",
|
||||
"EntryDll": "HappyBirthday.dll",
|
||||
|
|
|
@ -66,6 +66,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarAI", "..\StarAI\StarAI\
|
|||
{0756D36A-95C8-480D-8EA6-4584C03010C6} = {0756D36A-95C8-480D-8EA6-4584C03010C6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewSymphonyRemastered", "StardewSymphonyRemastered\StardewSymphonyRemastered\StardewSymphonyRemastered.csproj", "{19F64B03-6A9B-49E1-854A-C05D5A014646}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -160,6 +162,10 @@ Global
|
|||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Omegasis.StardewSymphony.Framework.SongsProcessor
|
||||
{
|
||||
public class MusicPack
|
||||
{
|
||||
public MusicPackMetaData musicPackInformation;
|
||||
public List<Song> listOfAllSongs;
|
||||
|
||||
|
||||
public MusicPack(string Name,string pathToFiles)
|
||||
{
|
||||
string extentionInformation = Path.GetExtension(pathToFiles);
|
||||
|
||||
|
||||
if (extentionInformation==".xwb") {
|
||||
this.musicPackInformation = new MusicPackMetaData(Name,pathToFiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.musicPackInformation = new MusicPackMetaData(Name);
|
||||
this.getAllWavFileFromDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
public void getAllWavFileFromDirectory()
|
||||
{
|
||||
string[] files = System.IO.Directory.GetFiles(musicPackInformation.fileLocation, "*.wav");
|
||||
|
||||
foreach(var s in files)
|
||||
{
|
||||
Song song = new Song(Path.GetFileName(musicPackInformation.fileLocation), s, false);
|
||||
this.listOfAllSongs.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
public void playSong(string name)
|
||||
{
|
||||
Song song = returnSong(name);
|
||||
if (song != null)
|
||||
{
|
||||
song.play();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSong(string name)
|
||||
{
|
||||
Song song = returnSong(name);
|
||||
if (song != null)
|
||||
{
|
||||
song.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void resumeSong(string name)
|
||||
{
|
||||
Song song = returnSong(name);
|
||||
if (song != null)
|
||||
{
|
||||
song.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseSong(string name)
|
||||
{
|
||||
Song song = returnSong(name);
|
||||
if (song != null)
|
||||
{
|
||||
song.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void changeVolume(string name,float amount)
|
||||
{
|
||||
Song song = returnSong(name);
|
||||
if (song != null)
|
||||
{
|
||||
song.changeVolume(amount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get's the song from the list.
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <returns></returns>
|
||||
public Song returnSong(string Name)
|
||||
{
|
||||
return listOfAllSongs.Find(item => item.name == Name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Omegasis.StardewSymphony.Framework.SongsProcessor
|
||||
{
|
||||
public class MusicPackMetaData
|
||||
{
|
||||
public string name;
|
||||
public string fileLocation;
|
||||
public bool xwbWavePack;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for non-xwb music packs
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public MusicPackMetaData(string name)
|
||||
{
|
||||
|
||||
this.name = name;
|
||||
this.xwbWavePack = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for xnb music packs
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="fileLocation"></param>
|
||||
public MusicPackMetaData(string name,string fileLocation)
|
||||
{
|
||||
this.name = name;
|
||||
this.fileLocation = fileLocation;
|
||||
this.xwbWavePack = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Omegasis.StardewSymphony.Framework.SongsProcessor
|
||||
{
|
||||
public class Song
|
||||
{
|
||||
public string name;
|
||||
public string fileLocation;
|
||||
public bool existsInMusicXNBFile;
|
||||
|
||||
|
||||
public DynamicSoundEffectInstance dynamicSound;
|
||||
public int position;
|
||||
public int count;
|
||||
public byte[] byteArray;
|
||||
|
||||
public EventHandler<EventArgs> bufferHandler;
|
||||
|
||||
public SongsProcessor.SongState songState;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="Name">Name of the song.</param>
|
||||
/// <param name="FileLocation">Path to the song.</param>
|
||||
/// <param name="ExistsInXNBWavePack">Checks if this song comes from a .xwb file or a .wav file.</param>
|
||||
public Song(string Name, string FileLocation, bool ExistsInXNBWavePack)
|
||||
{
|
||||
this.name = Name;
|
||||
this.fileLocation = FileLocation;
|
||||
this.existsInMusicXNBFile = ExistsInXNBWavePack;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the song from the path so that we can stream it.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DynamicSoundEffectInstance loadSongIntoStream()
|
||||
{
|
||||
|
||||
System.IO.Stream waveFileStream = TitleContainer.OpenStream(this.fileLocation);
|
||||
|
||||
BinaryReader reader = new BinaryReader(waveFileStream);
|
||||
|
||||
int chunkID = reader.ReadInt32();
|
||||
int fileSize = reader.ReadInt32();
|
||||
int riffType = reader.ReadInt32();
|
||||
int fmtID = reader.ReadInt32();
|
||||
int fmtSize = reader.ReadInt32();
|
||||
int fmtCode = reader.ReadInt16();
|
||||
int channels = reader.ReadInt16();
|
||||
int sampleRate = reader.ReadInt32();
|
||||
int fmtAvgBPS = reader.ReadInt32();
|
||||
int fmtBlockAlign = reader.ReadInt16();
|
||||
int bitDepth = reader.ReadInt16();
|
||||
|
||||
if (fmtSize == 18)
|
||||
{
|
||||
// Read any extra values
|
||||
int fmtExtraSize = reader.ReadInt16();
|
||||
reader.ReadBytes(fmtExtraSize);
|
||||
}
|
||||
|
||||
int dataID = reader.ReadInt32();
|
||||
int dataSize = reader.ReadInt32();
|
||||
|
||||
byteArray = reader.ReadBytes(dataSize);
|
||||
|
||||
dynamicSound = new DynamicSoundEffectInstance(sampleRate, (AudioChannels)channels);
|
||||
count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(100));
|
||||
bufferHandler= new EventHandler<EventArgs>(DynamicSound_BufferNeeded);
|
||||
dynamicSound.BufferNeeded += bufferHandler;
|
||||
|
||||
return this.dynamicSound;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null the song out so that we can remove it from memory and switch to another song???
|
||||
/// </summary>
|
||||
public void unloadSongFromStream()
|
||||
{
|
||||
dynamicSound.Stop();
|
||||
dynamicSound.BufferNeeded -= bufferHandler;
|
||||
dynamicSound = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Taken from an example. I'm sure this is necessary to keep streaming the audio.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void DynamicSound_BufferNeeded(object sender, EventArgs e)
|
||||
{
|
||||
dynamicSound.SubmitBuffer(byteArray, position, count / 2);
|
||||
dynamicSound.SubmitBuffer(byteArray, position + count / 2, count / 2);
|
||||
|
||||
position += count;
|
||||
if (position + count > byteArray.Length)
|
||||
{
|
||||
position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the currently playing song.
|
||||
/// </summary>
|
||||
public void stop()
|
||||
{
|
||||
if (this.dynamicSound != null)
|
||||
{
|
||||
if(this.songState==SongState.Playing || this.songState == SongState.Paused)
|
||||
{
|
||||
this.dynamicSound.Stop();
|
||||
this.songState = SongState.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays the current song.
|
||||
/// </summary>
|
||||
public void play()
|
||||
{
|
||||
if (this.dynamicSound != null)
|
||||
{
|
||||
if (getSongState() == SongState.Stopped || getSongState() == SongState.Paused)
|
||||
{
|
||||
this.dynamicSound.Play();
|
||||
this.songState = SongState.Playing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resume the current song from being paused.
|
||||
/// </summary>
|
||||
public void resume()
|
||||
{
|
||||
if (this.dynamicSound != null)
|
||||
{
|
||||
if (getSongState() == SongState.Stopped || getSongState() == SongState.Paused)
|
||||
{
|
||||
this.dynamicSound.Resume();
|
||||
this.songState = SongState.Playing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the current song.
|
||||
/// </summary>
|
||||
public void pause()
|
||||
{
|
||||
if (getSongState() == SongState.Playing || getSongState() == SongState.Stopped)
|
||||
{
|
||||
this.dynamicSound.Pause();
|
||||
this.songState = SongState.Paused;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the volume of the song playing.
|
||||
/// </summary>
|
||||
/// <param name="newVolumeAmount"></param>
|
||||
public void changeVolume(float newVolumeAmount)
|
||||
{
|
||||
if (this.dynamicSound != null)
|
||||
{
|
||||
this.dynamicSound.Volume = newVolumeAmount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the state of the song so that users know if the song is playing, stopped, or paused.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SongState getSongState()
|
||||
{
|
||||
return this.songState;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song is playing or not.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isPlaying()
|
||||
{
|
||||
if (getSongState() == SongState.Playing) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks is the song is paused or not.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isPaused()
|
||||
{
|
||||
if (getSongState() == SongState.Paused) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song is stopped or not.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isStopped()
|
||||
{
|
||||
if (getSongState() == SongState.Stopped) return true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Omegasis.StardewSymphony.Framework.SongsProcessor
|
||||
{
|
||||
public enum SongState
|
||||
{
|
||||
/// <summary>The song is currently playing.</summary>
|
||||
Playing,
|
||||
|
||||
/// <summary>The song is currently paused.</summary>
|
||||
Paused,
|
||||
|
||||
/// <summary>The song is currently stopped.</summary>
|
||||
Stopped
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -154,7 +154,7 @@ namespace Omegasis.StardewSymphony
|
|||
}
|
||||
|
||||
// init sound
|
||||
this.HexProcessor.ProcessHex();
|
||||
this.HexProcessor.ProcessHex(); //Get all of the songs from the music packs.
|
||||
this.SelectMusic();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Framework\ModConfig.cs" />
|
||||
<Compile Include="Framework\SongsProcessor\MusicPack.cs" />
|
||||
<Compile Include="Framework\SongsProcessor\MusicPackMetaData.cs" />
|
||||
<Compile Include="Framework\SongsProcessor\Song.cs" />
|
||||
<Compile Include="Framework\SongsProcessor\SongState.cs" />
|
||||
<Compile Include="Framework\SongsProcessor\WaveFile.cs" />
|
||||
<Compile Include="StardewSymphony.cs" />
|
||||
<Compile Include="Framework\MusicHexProcessor.cs" />
|
||||
<Compile Include="Framework\MusicManager.cs" />
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
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}") = "StardewSymphonyRemastered", "StardewSymphonyRemastered\StardewSymphonyRemastered.csproj", "{19F64B03-6A9B-49E1-854A-C05D5A014646}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,188 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using StardewValley;
|
||||
using StardewSymphonyRemastered.Framework;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
public class MusicHexProcessor
|
||||
{
|
||||
/*********
|
||||
** Properties
|
||||
*********/
|
||||
/// <summary>All of the music/soundbanks and their locations.</summary>
|
||||
private readonly XACTMusicPack MasterList;
|
||||
|
||||
/// <summary>The registered soundbanks.</summary>
|
||||
private readonly List<string> SoundBanks = new List<string>();
|
||||
|
||||
/// <summary>The callback to reset the game audio.</summary>
|
||||
private readonly Action Reset;
|
||||
|
||||
|
||||
/*********
|
||||
** Public methods
|
||||
*********/
|
||||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="masterList">All of the music/soundbanks and their locations.</param>
|
||||
/// <param name="reset">The callback to reset the game audio.</param>
|
||||
public MusicHexProcessor(XACTMusicPack masterList, Action reset)
|
||||
{
|
||||
this.MasterList = masterList;
|
||||
this.Reset = reset;
|
||||
}
|
||||
|
||||
/// <summary>Add a file path to the list of soundbanks.</summary>
|
||||
/// <param name="path">The soundbank file path.</param>
|
||||
public void AddSoundBank(string path)
|
||||
{
|
||||
this.SoundBanks.Add(path);
|
||||
}
|
||||
|
||||
public static List<string> ProcessSongNamesFromHex(XACTMusicPack musicPack, Action reset, string FileName)
|
||||
{
|
||||
int counter = 0;
|
||||
List<string> cleanCueNames = new List<string>();
|
||||
byte[] array = File.ReadAllBytes(FileName);
|
||||
string rawName = FileName.Substring(0, FileName.Length - 4);
|
||||
string cueName = rawName + "CueList.txt";
|
||||
|
||||
if (File.Exists(cueName))
|
||||
{
|
||||
string[] arr = File.ReadAllLines(cueName);
|
||||
List<string> names = new List<string>();
|
||||
foreach(var v in arr)
|
||||
{
|
||||
names.Add(v);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
string hexDumpContents = HexDump(array);
|
||||
|
||||
string rawHexName = rawName + "HexDump.txt";
|
||||
File.WriteAllText(rawHexName, hexDumpContents);
|
||||
|
||||
string[] readText = File.ReadAllLines(rawHexName);
|
||||
string largeString = "";
|
||||
foreach (var line in readText)
|
||||
{
|
||||
try
|
||||
{
|
||||
string newString = "";
|
||||
for (int i = 62; i <= 77; i++)
|
||||
newString += line[i];
|
||||
largeString += newString;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
string[] splits = largeString.Split('ÿ');
|
||||
string fix = "";
|
||||
foreach (string s in splits)
|
||||
{
|
||||
if (s == "") continue;
|
||||
fix += s;
|
||||
}
|
||||
splits = fix.Split('.');
|
||||
|
||||
foreach (var split in splits)
|
||||
{
|
||||
if (split == "") continue;
|
||||
|
||||
try
|
||||
{
|
||||
Game1.waveBank = musicPack.WaveBank;
|
||||
Game1.soundBank = musicPack.SoundBank;
|
||||
|
||||
if (Game1.soundBank.GetCue(split) != null)
|
||||
cleanCueNames.Add(split);
|
||||
|
||||
reset.Invoke();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return cleanCueNames;
|
||||
}
|
||||
|
||||
/*********
|
||||
** Private methods
|
||||
*********/
|
||||
public static string HexDump(byte[] bytes, int bytesPerLine = 16)
|
||||
{
|
||||
if (bytes == null)
|
||||
return "<null>";
|
||||
|
||||
int bytesLength = bytes.Length;
|
||||
|
||||
char[] hexChars = "0123456789ABCDEF".ToCharArray();
|
||||
|
||||
int firstHexColumn =
|
||||
8 // 8 characters for the address
|
||||
+ 3; // 3 spaces
|
||||
|
||||
int firstCharColumn = firstHexColumn
|
||||
+ bytesPerLine * 3 // - 2 digit for the hexadecimal value and 1 space
|
||||
+ (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
|
||||
+ 2; // 2 spaces
|
||||
|
||||
int lineLength = firstCharColumn
|
||||
+ bytesPerLine // - characters to show the ascii value
|
||||
+ Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)
|
||||
|
||||
char[] line = (new String(' ', lineLength - 2) + Environment.NewLine).ToCharArray();
|
||||
int expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
|
||||
StringBuilder result = new StringBuilder(expectedLines * lineLength);
|
||||
|
||||
for (int i = 0; i < bytesLength; i += bytesPerLine)
|
||||
{
|
||||
line[0] = hexChars[(i >> 28) & 0xF];
|
||||
line[1] = hexChars[(i >> 24) & 0xF];
|
||||
line[2] = hexChars[(i >> 20) & 0xF];
|
||||
line[3] = hexChars[(i >> 16) & 0xF];
|
||||
line[4] = hexChars[(i >> 12) & 0xF];
|
||||
line[5] = hexChars[(i >> 8) & 0xF];
|
||||
line[6] = hexChars[(i >> 4) & 0xF];
|
||||
line[7] = hexChars[(i >> 0) & 0xF];
|
||||
|
||||
int hexColumn = firstHexColumn;
|
||||
int charColumn = firstCharColumn;
|
||||
|
||||
for (int j = 0; j < bytesPerLine; j++)
|
||||
{
|
||||
if (j > 0 && (j & 7) == 0) hexColumn++;
|
||||
if (i + j >= bytesLength)
|
||||
{
|
||||
line[hexColumn] = ' ';
|
||||
line[hexColumn + 1] = ' ';
|
||||
line[charColumn] = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
byte b = bytes[i + j];
|
||||
line[hexColumn] = hexChars[(b >> 4) & 0xF];
|
||||
line[hexColumn + 1] = hexChars[b & 0xF];
|
||||
line[charColumn] = GetAsciiSymbol(b);
|
||||
}
|
||||
hexColumn += 3;
|
||||
charColumn++;
|
||||
}
|
||||
result.Append(line);
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
public static char GetAsciiSymbol(byte ch)
|
||||
{
|
||||
if (ch < 32) return '.'; // Non-printable ASCII
|
||||
if (ch < 127) return (char)ch; // Normal ASCII
|
||||
// Handle the hole in Latin-1
|
||||
if (ch == 127) return '.';
|
||||
if (ch < 0x90) return "€.‚ƒ„…†‡ˆ‰Š‹Œ.Ž."[ch & 0xF];
|
||||
if (ch < 0xA0) return ".‘’“”•–—˜™š›œ.žŸ"[ch & 0xF];
|
||||
if (ch == 0xAD) return '.'; // Soft hyphen: this symbol is zero-width even in monospace fonts
|
||||
return (char)ch; // Normal Latin-1
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StardewSymphonyRemastered;
|
||||
using StardewValley;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Make this manage all of the music.
|
||||
///
|
||||
/// Make it be able to load in multiple music packs from a general mod/MusicPacks Directory
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
public class MusicManager
|
||||
{
|
||||
/// <summary>
|
||||
/// A dictionary containing all of the music packs loaded in.
|
||||
/// </summary>
|
||||
public Dictionary<string,MusicPack> musicPacks;
|
||||
|
||||
public MusicPack currentMusicPack;
|
||||
|
||||
Random packSelector;
|
||||
Random songSelector;
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public MusicManager()
|
||||
{
|
||||
this.musicPacks = new Dictionary<string, MusicPack>();
|
||||
this.currentMusicPack = null;
|
||||
packSelector = new Random(Game1.random.Next(1,1000000));
|
||||
songSelector = new Random(Game1.player.deepestMineLevel + Game1.player.facingDirection + packSelector.Next(0,10000));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swaps between referenced music packs and stops the last playing song.
|
||||
/// </summary>
|
||||
/// <param name="nameOfNewMusicPack"></param>
|
||||
public void swapMusicPacks(string nameOfNewMusicPack)
|
||||
{
|
||||
if (isMusicPackValid(nameOfNewMusicPack) == true)
|
||||
{
|
||||
if (this.currentMusicPack.isNull()==false)
|
||||
{
|
||||
this.currentMusicPack.stopSong();
|
||||
}
|
||||
this.currentMusicPack = getMusicPack(nameOfNewMusicPack);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays the song from the currently loaded music pack.
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
public void playSongFromCurrentPack(string songName)
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
this.currentMusicPack.playSong(songName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the paused song from the current music pack.
|
||||
/// </summary>
|
||||
public void pauseSongFromCurrentPack() {
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
this.currentMusicPack.pauseSong();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the song from the current music pack.
|
||||
/// </summary>
|
||||
public void stopSongFromCurrentMusicPack()
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
this.currentMusicPack.stopSong();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes the song from the current music pack.
|
||||
/// </summary>
|
||||
public void resumeSongFromCurrentMusicPack()
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
this.currentMusicPack.resumeSong();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the currently playing song.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string getNameOfCurrentlyPlayingSong()
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
return this.currentMusicPack.getNameOfCurrentSong();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the information associated with the current music pack.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MusicPackMetaData getMusicPackInformation()
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
return this.currentMusicPack.musicPackInformation;
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if the music pack has been loaded into the Music Manager.
|
||||
/// </summary>
|
||||
/// <param name="nameOfMusicPack"></param>
|
||||
/// <returns></returns>
|
||||
public bool isMusicPackValid(string nameOfMusicPack)
|
||||
{
|
||||
if (this.currentMusicPack.isNull() == false)
|
||||
{
|
||||
return musicPacks.ContainsKey(nameOfMusicPack);
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the music pack from the
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public MusicPack getMusicPack(string name)
|
||||
{
|
||||
if (isMusicPackValid(name) == false)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error, the music pack: " + name + " is not found. Please make sure it is loaded in and try again.");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (var pair in this.musicPacks)
|
||||
{
|
||||
if (name == pair.Key) return pair.Value;
|
||||
}
|
||||
return null; //Needed I suppose to ensure this function compiles.
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Iterates across all music packs and determines which music packs contain songs that can be played right now.
|
||||
/// </summary>
|
||||
/// <param name="songListKey"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<MusicPack,List<string>> getListOfApplicableMusicPacks(string songListKey)
|
||||
{
|
||||
Dictionary<MusicPack, List<string>> listOfValidDictionaries = new Dictionary<MusicPack, List<string>>();
|
||||
foreach(var v in this.musicPacks)
|
||||
{
|
||||
var songList= v.Value.songInformation.getSongList(songListKey).Value;
|
||||
if (songList.Count > 0)
|
||||
{
|
||||
listOfValidDictionaries.Add(v.Value, songList);
|
||||
}
|
||||
}
|
||||
return listOfValidDictionaries;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the actual song to be played right now based off of the selector key. The selector key should be called when the player's location changes.
|
||||
/// </summary>
|
||||
/// <param name="songListKey"></param>
|
||||
public void selectMusic(string songListKey)
|
||||
{
|
||||
var listOfValidMusicPacks = getListOfApplicableMusicPacks(songListKey);
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//No valid songs to play at this time.
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack. Are you sure you did this properly?");
|
||||
return;
|
||||
}
|
||||
|
||||
int randInt = packSelector.Next(0, listOfValidMusicPacks.Count-1);
|
||||
|
||||
var musicPackPair = listOfValidMusicPacks.ElementAt(randInt);
|
||||
|
||||
//used to swap the music packs and stop the last playing song.
|
||||
this.swapMusicPacks(musicPackPair.Key.musicPackInformation.name);
|
||||
|
||||
int randInt2 = songSelector.Next(0, musicPackPair.Value.Count);
|
||||
|
||||
var songName = musicPackPair.Value.ElementAt(randInt2);
|
||||
|
||||
this.currentMusicPack.playSong(songName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Make WAV MUSIC PACKS
|
||||
/// </summary>
|
||||
/// <param name="wavMusicPack"></param>
|
||||
public void addMusicPack(WavMusicPack wavMusicPack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a valid xwb music pack to the list of music packs available.
|
||||
/// </summary>
|
||||
/// <param name="xwbMusicPack"></param>
|
||||
public void addMusicPack(XACTMusicPack xwbMusicPack)
|
||||
{
|
||||
this.musicPacks.Add(xwbMusicPack.musicPackInformation.name,xwbMusicPack);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class that xnb and wav packs will derive commonalities from.
|
||||
/// //Make Music Pack Meta data
|
||||
/// </summary>
|
||||
public class MusicPack
|
||||
{
|
||||
public string directory;
|
||||
public StardewSymphonyRemastered.Framework.SongSpecifics songInformation;
|
||||
public MusicPackMetaData musicPackInformation;
|
||||
|
||||
|
||||
public virtual void playSong(string name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void pauseSong()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void stopSong()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void resumeSong()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void loadMusicFiles()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void swapSong(string songName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual string getNameOfCurrentSong()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information regarding information relating to music packs such as name, description, author, and version.
|
||||
/// </summary>
|
||||
public class MusicPackMetaData
|
||||
{
|
||||
|
||||
public string name;
|
||||
public string author;
|
||||
public string description;
|
||||
public string versionInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Constrctor
|
||||
/// </summary>
|
||||
/// <param name="Name">The name to be displayed for the music pack.</param>
|
||||
/// <param name="Author">The author who compiled ths music pack.</param>
|
||||
/// <param name="Description">The description of</param>
|
||||
/// <param name="VersionInfo"></param>
|
||||
public MusicPackMetaData(string Name,string Author,string Description,string VersionInfo)
|
||||
{
|
||||
this.name = Name;
|
||||
this.author = Author;
|
||||
this.description = Description;
|
||||
this.versionInfo = VersionInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// Blank Constructor
|
||||
/// </summary>
|
||||
public MusicPackMetaData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the music pack information from a json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static MusicPackMetaData readFromJson(string path)
|
||||
{
|
||||
return StardewSymphony.ModHelper.ReadJsonFile<MusicPackMetaData>(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the music pack information to a json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void writeToJson(string path)
|
||||
{
|
||||
StardewSymphony.ModHelper.WriteJsonFile<MusicPackMetaData>(path,this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,391 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores information about what songs play when.
|
||||
///
|
||||
/// TODO: Festivals and events
|
||||
/// </summary>
|
||||
public class SongSpecifics
|
||||
{
|
||||
Dictionary<string, List<string>> listOfSongsWithTriggers; //triggerName, <songs>
|
||||
|
||||
Dictionary<string, List<string>> eventSongs;
|
||||
|
||||
Dictionary<string, List<string>> festivalSongs;
|
||||
|
||||
public List<string> listOfSongsWithoutTriggers;
|
||||
|
||||
public static List<string> locations = new List<string>();
|
||||
public static List<string> festivals = new List<string>();
|
||||
public static List<string> events = new List<string>();
|
||||
|
||||
string[] seasons;
|
||||
string[] weather;
|
||||
string[] daysOfWeek;
|
||||
string[] timesOfDay;
|
||||
public static char seperator = '_';
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public SongSpecifics()
|
||||
{
|
||||
seasons = new string[]
|
||||
{
|
||||
"spring",
|
||||
"summer",
|
||||
"fall",
|
||||
"winter"
|
||||
};
|
||||
|
||||
weather = new string[]
|
||||
{
|
||||
"sunny",
|
||||
"rainy",
|
||||
"debris",
|
||||
"lightning",
|
||||
"festival",
|
||||
"snow",
|
||||
"wedding"
|
||||
};
|
||||
daysOfWeek = new string[]
|
||||
{
|
||||
"sunday",
|
||||
"monday",
|
||||
"tuesday",
|
||||
"wednesday",
|
||||
"thursday",
|
||||
"friday",
|
||||
"saturday"
|
||||
};
|
||||
timesOfDay = new string[]
|
||||
{
|
||||
"day",
|
||||
"night"
|
||||
};
|
||||
|
||||
listOfSongsWithTriggers = new Dictionary<string, List<string>>();
|
||||
eventSongs = new Dictionary<string, List<string>>();
|
||||
festivalSongs = new Dictionary<string, List<string>>();
|
||||
|
||||
this.listOfSongsWithoutTriggers = new List<string>();
|
||||
|
||||
this.addSongLists();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Static Methods //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
#region
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Add functionality for events and festivals
|
||||
/// Sum up some conditionals to parse the correct string key to access the songs list.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getCurrentConditionalString()
|
||||
{
|
||||
string key = "";
|
||||
if (Game1.eventUp == true)
|
||||
{
|
||||
//Get the event id an hijack it with some different music
|
||||
//String key="Event_EventName";
|
||||
}
|
||||
else if (Game1.isFestival())
|
||||
{
|
||||
//hijack the name of the festival and load some different songs
|
||||
// string s="Festival_FestivalName";
|
||||
}
|
||||
else
|
||||
{
|
||||
key = getLocationString() + seperator + getSeasonNameString() + seperator + getWeatherString() + seperator + getDayOfWeekString() + seperator + getTimeOfDayString();
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the location lists with the names of all of the major locations in the game.
|
||||
/// </summary>
|
||||
public static void addLocations()
|
||||
{
|
||||
foreach (var v in Game1.locations)
|
||||
{
|
||||
locations.Add(v.name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Find a way to get all of the festivals in the game for this list. Perhapse have a way to check the season and day of the month and equivilate it to something.
|
||||
/// Initialize list of festivals for the game.
|
||||
/// </summary>
|
||||
public static void addFestivals()
|
||||
{
|
||||
//Do some logic for festivals here.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a specific new festival to the list
|
||||
/// </summary>
|
||||
public static void addFestival(string name)
|
||||
{
|
||||
festivals.Add(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Get a list of all of the vanilla events in the game. But how to determine what event is playing is the question.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public static void addEvents()
|
||||
{
|
||||
//Do some logic here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Custom way to add in event to hijack music.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public static void addEvent(string name)
|
||||
{
|
||||
//Do some logic here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a location to the loctaion list.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public static void addLocation(string name)
|
||||
{
|
||||
locations.Add(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the day of the week from what game day it is.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getDayOfWeekString()
|
||||
{
|
||||
int day = Game1.dayOfMonth;
|
||||
int dayOfWeek = day % 7;
|
||||
if (dayOfWeek == 0)
|
||||
{
|
||||
return "sunday";
|
||||
}
|
||||
if (dayOfWeek == 1)
|
||||
{
|
||||
return "monday";
|
||||
}
|
||||
if (dayOfWeek == 2)
|
||||
{
|
||||
return "tuesday";
|
||||
}
|
||||
if (dayOfWeek == 3)
|
||||
{
|
||||
return "wednesday";
|
||||
}
|
||||
if (dayOfWeek == 4)
|
||||
{
|
||||
return "thursday";
|
||||
}
|
||||
if (dayOfWeek == 5)
|
||||
{
|
||||
return "friday";
|
||||
}
|
||||
if (dayOfWeek == 6)
|
||||
{
|
||||
return "saturday";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the current season
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getSeasonNameString()
|
||||
{
|
||||
return Game1.currentSeason.ToLower();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name for the current weather outside.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getWeatherString()
|
||||
{
|
||||
if (Game1.weatherIcon == Game1.weather_sunny) return "sunny";
|
||||
if (Game1.weatherIcon == Game1.weather_rain) return "rainy";
|
||||
if (Game1.weatherIcon == Game1.weather_debris) return "debris";
|
||||
if (Game1.weatherIcon == Game1.weather_lightning) return "lightning";
|
||||
if (Game1.weatherIcon == Game1.weather_festival) return "festival";
|
||||
if (Game1.weatherIcon == Game1.weather_snow) return "snow";
|
||||
if (Game1.weatherIcon == Game1.weather_wedding) return "wedding";
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name for the time of day that it currently is.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getTimeOfDayString()
|
||||
{
|
||||
if (Game1.timeOfDay < Game1.getModeratelyDarkTime()) return "day";
|
||||
else return "night";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the location of where I am at.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getLocationString()
|
||||
{
|
||||
return Game1.currentLocation.name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Non-Static Methods //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// Adds the song's reference to a music pack.
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
public void addSongToMusicPack(string songName)
|
||||
{
|
||||
this.listOfSongsWithoutTriggers.Add(songName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song exists at all in this music pack.
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
/// <returns></returns>
|
||||
public bool isSongInList(string songName)
|
||||
{
|
||||
return listOfSongsWithoutTriggers.Contains(songName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A pretty big function to add in all of the specific songs that play at certain locations_seasons_weather_dayOfWeek_times.
|
||||
/// </summary>
|
||||
public void addSongLists()
|
||||
{
|
||||
foreach (var loc in locations)
|
||||
{
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season, new List<string>());
|
||||
foreach(var Weather in weather)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<string>());
|
||||
foreach(var day in daysOfWeek)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<string>());
|
||||
foreach(var time in timesOfDay)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Add in some default seasonal music because maybe a location doesn't have some music?
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season, new List<string>());
|
||||
foreach (var Weather in weather)
|
||||
{
|
||||
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<string>());
|
||||
foreach (var day in daysOfWeek)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<string>());
|
||||
foreach (var time in timesOfDay)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to access the master list of songs this music pack contains.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public KeyValuePair<string,List<string>>getSongList(string key)
|
||||
{
|
||||
string keyPhrase = key.Split(seperator).ElementAt(0);
|
||||
|
||||
if (keyPhrase == "event")
|
||||
{
|
||||
/*
|
||||
foreach (KeyValuePair<string, List<string>> pair in eventSongs)
|
||||
{
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, eventSongs[key]);
|
||||
}
|
||||
else if (keyPhrase == "festival")
|
||||
{
|
||||
/*
|
||||
foreach (KeyValuePair<string, List<string>> pair in festivalSongs)
|
||||
{
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, festivalSongs[key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
foreach(KeyValuePair<string,List<string>> pair in listOfSongsWithTriggers)
|
||||
{
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a song name to a specific list of songs to play that will play under certain conditions.
|
||||
/// </summary>
|
||||
/// <param name="songListKey"></param>
|
||||
/// <param name="songName"></param>
|
||||
public void addSongToList(string songListKey,string songName)
|
||||
{
|
||||
var songList = getSongList(songListKey);
|
||||
|
||||
songList.Value.Add(songName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a song name from a specific list of songs to play that will play under certain conditions.
|
||||
/// </summary>
|
||||
/// <param name="songListKey"></param>
|
||||
/// <param name="songName"></param>
|
||||
public void removeSongFromList(string songListKey,string songName)
|
||||
{
|
||||
var songList = getSongList(songListKey);
|
||||
songList.Value.Remove(songName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Make this class
|
||||
/// </summary>
|
||||
public class WavMusicPack : MusicPack
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Make this work and add in overrided functions.
|
||||
/// </summary>
|
||||
public class XACTMusicPack: MusicPack
|
||||
{
|
||||
public Microsoft.Xna.Framework.Audio.WaveBank WaveBank;
|
||||
public Microsoft.Xna.Framework.Audio.SoundBank SoundBank;
|
||||
|
||||
|
||||
|
||||
public Cue currentCue;
|
||||
|
||||
|
||||
//Make Music pack meta data. Includes author, version, description.
|
||||
|
||||
public string XWBPath;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="directoryToXwb"></param>
|
||||
/// <param name="pathToXWB"></param>
|
||||
public XACTMusicPack(string directoryToXwb,string pathToXWB)
|
||||
{
|
||||
this.directory = directoryToXwb;
|
||||
this.XWBPath = pathToXWB;
|
||||
this.songInformation = new SongSpecifics();
|
||||
this.currentCue = null;
|
||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
|
||||
if (this.musicPackInformation == null)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.",StardewModdingAPI.LogLevel.Warn);
|
||||
this.musicPackInformation = new MusicPackMetaData("???","???","","0.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load all of the generic music file names into the music pack's information.
|
||||
/// </summary>
|
||||
public override void loadMusicFiles()
|
||||
{
|
||||
this.songInformation.listOfSongsWithoutTriggers=StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this,StardewSymphony.Reset,this.XWBPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the cue from the list of songs.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the song to get.</param>
|
||||
/// <returns></returns>
|
||||
private Cue getCue(string name) {
|
||||
if (this.songInformation.isSongInList(name) == false)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error! The song " + name + " could not be found in music pack " + this.musicPackInformation.name+". Please ensure that this song is part of this music pack located at: "+ this.XWBPath+ " or contact the music pack author: "+this.musicPackInformation.author,StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.SoundBank.GetCue(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play a song.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the song to play.</param>
|
||||
public override void playSong(string name)
|
||||
{
|
||||
this.currentCue = this.getCue(name);
|
||||
if (this.currentCue == null)
|
||||
{
|
||||
return; //getCue will throw the error message.
|
||||
}
|
||||
Game1.waveBank = this.WaveBank;
|
||||
Game1.soundBank = this.SoundBank;
|
||||
this.currentCue.Play();
|
||||
|
||||
StardewSymphony.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause the currently playing song.
|
||||
/// </summary>
|
||||
/// <param name="name">Pause the current song that is playing.</param>
|
||||
public override void pauseSong()
|
||||
{
|
||||
if (this.currentCue == null) return;
|
||||
else
|
||||
{
|
||||
Game1.waveBank = this.WaveBank;
|
||||
Game1.soundBank = this.SoundBank;
|
||||
this.currentCue.Pause();
|
||||
StardewSymphony.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resume playing the current set cue.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public override void resumeSong()
|
||||
{
|
||||
if (this.currentCue == null) return;
|
||||
else
|
||||
{
|
||||
Game1.waveBank = this.WaveBank;
|
||||
Game1.soundBank = this.SoundBank;
|
||||
this.currentCue.Resume();
|
||||
StardewSymphony.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the currently playing song and nulls the current song.
|
||||
/// </summary>
|
||||
public override void stopSong()
|
||||
{
|
||||
if (this.currentCue == null) return;
|
||||
else
|
||||
{
|
||||
Game1.waveBank = this.WaveBank;
|
||||
Game1.soundBank = this.SoundBank;
|
||||
this.currentCue.Stop(AudioStopOptions.Immediate);
|
||||
StardewSymphony.Reset();
|
||||
this.currentCue = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the currently playing song and starts playing a new song.
|
||||
/// </summary>
|
||||
/// <param name="newSongName">The name of the new song to play.</param>
|
||||
public override void swapSong(string newSongName)
|
||||
{
|
||||
this.stopSong();
|
||||
this.playSong(newSongName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the currently playing song.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string getNameOfCurrentSong()
|
||||
{
|
||||
return this.currentCue.Name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
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("StardewSymphonyRemastered")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("StardewSymphonyRemastered")]
|
||||
[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("19f64b03-6a9b-49e1-854a-c05d5a014646")]
|
||||
|
||||
// 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")]
|
|
@ -0,0 +1,162 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardewSymphonyRemastered.Framework;
|
||||
using System.IO;
|
||||
|
||||
namespace StardewSymphonyRemastered
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// BIG WIP. Don't use this at all because it does nothing right now.
|
||||
/// TODO:
|
||||
/// 1.Make Xwb packs work
|
||||
/// 1.5. Make way to load in music packs.
|
||||
/// 2.Make stream files work
|
||||
/// 2.5. Make Music Manager
|
||||
/// 3.Make interface.
|
||||
/// 4.Make sure stuff doesn't blow up.
|
||||
/// 5.Release
|
||||
/// 6.Make videos documenting how to make this mod work.
|
||||
/// 7.Make way to generate new music packs.
|
||||
/// </summary>
|
||||
public class StardewSymphony : Mod
|
||||
{
|
||||
public static WaveBank DefaultWaveBank;
|
||||
public static SoundBank DefaultSoundBank;
|
||||
|
||||
|
||||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
|
||||
public static MusicManager musicManager;
|
||||
|
||||
private string MusicPath;
|
||||
public static string WavMusicDirectory;
|
||||
public static string XACTMusicDirectory;
|
||||
public static string TemplateMusicDirectory;
|
||||
|
||||
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
DefaultSoundBank = Game1.soundBank;
|
||||
DefaultWaveBank = Game1.waveBank;
|
||||
ModHelper = helper;
|
||||
ModMonitor = Monitor;
|
||||
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
|
||||
|
||||
musicManager = new MusicManager();
|
||||
|
||||
MusicPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Music");
|
||||
WavMusicDirectory = Path.Combine(MusicPath, "Wav");
|
||||
XACTMusicDirectory = Path.Combine(MusicPath, "XACT");
|
||||
TemplateMusicDirectory = Path.Combine(MusicPath, "Templates");
|
||||
|
||||
this.createDirectories();
|
||||
this.createBlankXACTTemplate();
|
||||
//load in all packs here.
|
||||
}
|
||||
|
||||
public void createDirectories()
|
||||
{
|
||||
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
|
||||
if (!Directory.Exists(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);
|
||||
if (!Directory.Exists(XACTMusicDirectory)) Directory.CreateDirectory(XACTMusicDirectory);
|
||||
if (!Directory.Exists(TemplateMusicDirectory)) Directory.CreateDirectory(TemplateMusicDirectory);
|
||||
}
|
||||
public void createBlankXACTTemplate()
|
||||
{
|
||||
string path= Path.Combine(TemplateMusicDirectory, "XACT");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
if(!File.Exists(Path.Combine(path, "MusicPackInformation.json"))){
|
||||
MusicPackMetaData blankMetaData = new MusicPackMetaData();
|
||||
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||
}
|
||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||
{
|
||||
string info = "Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName with a new meta data to load it!";
|
||||
File.WriteAllText(Path.Combine(path, "readme.txt"),info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void loadXACTMusicPacks()
|
||||
{
|
||||
string[] listOfDirectories= Directory.GetDirectories(XACTMusicDirectory);
|
||||
foreach(string folder in listOfDirectories)
|
||||
{
|
||||
string waveBank = Path.Combine(folder, "Wave Bank.xwb");
|
||||
string soundBank = Path.Combine(folder, "Sound Bank.xwb");
|
||||
string metaData = Path.Combine(folder, "MusicPackInformation.json");
|
||||
if (!File.Exists(waveBank))
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no file Wave Bank.xwb located in this directory. AKA there is no valid music here.", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(soundBank))
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no file Sound Bank.xwb located in this directory. This is needed to play the music from Wave Bank.xwb", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(metaData))
|
||||
{
|
||||
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
|
||||
}
|
||||
StardewSymphonyRemastered.Framework.XACTMusicPack musicPack = new XACTMusicPack(folder, waveBank);
|
||||
musicManager.addMusicPack(musicPack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the player changes locations. This should determine the next song to play.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
|
||||
{
|
||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events to occur after the game has loaded in.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||
{
|
||||
StardewSymphonyRemastered.Framework.SongSpecifics.addLocations();
|
||||
StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals();
|
||||
StardewSymphonyRemastered.Framework.SongSpecifics.addEvents();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reset the music files for the game.
|
||||
/// </summary>
|
||||
public static void Reset()
|
||||
{
|
||||
Game1.waveBank = DefaultWaveBank;
|
||||
Game1.soundBank = DefaultSoundBank;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?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>{19F64B03-6A9B-49E1-854A-C05D5A014646}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StardewSymphonyRemastered</RootNamespace>
|
||||
<AssemblyName>StardewSymphonyRemastered</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="Framework\MusicPackMetaData.cs" />
|
||||
<Compile Include="StaticExtentions.cs" />
|
||||
<Compile Include="StardewSymphony.cs" />
|
||||
<Compile Include="Framework\MusicHexProcessor.cs" />
|
||||
<Compile Include="Framework\MusicManager.cs" />
|
||||
<Compile Include="Framework\MusicPack.cs" />
|
||||
<Compile Include="Framework\SongSpecifics.cs" />
|
||||
<Compile Include="Framework\WavMusicPack.cs" />
|
||||
<Compile Include="Framework\XACTMusicPack.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>
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered
|
||||
{
|
||||
public static class StaticExtentions
|
||||
{
|
||||
|
||||
public static bool isNull<T>(this T obj)
|
||||
{
|
||||
if (obj == null) return true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -20,6 +20,7 @@ namespace StardustCore
|
|||
public static bool In<T>(this T obj, params T[] args)
|
||||
{
|
||||
return args.Contains(obj);
|
||||
|
||||
}
|
||||
|
||||
public static bool HasValue(this double value)
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Revitalize.Draw
|
|||
|
||||
public static void drawAllObjects()
|
||||
{
|
||||
/*
|
||||
foreach (var v in Lists.DecorationsToDraw)
|
||||
{
|
||||
if (Game1.player.currentLocation == v.thisLocation)
|
||||
|
@ -29,7 +30,7 @@ namespace Revitalize.Draw
|
|||
v.draw(Game1.spriteBatch,(int)v.tileLocation.X,(int)v.tileLocation.Y);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
public static void drawAllFurniture()
|
||||
|
@ -38,6 +39,7 @@ namespace Revitalize.Draw
|
|||
//int i = 0;
|
||||
SpriteBatch b = Game1.spriteBatch;
|
||||
b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);
|
||||
/*
|
||||
foreach (var v in Lists.DecorationsToDraw)
|
||||
{
|
||||
//Log.Async(i);
|
||||
|
@ -48,6 +50,7 @@ namespace Revitalize.Draw
|
|||
}
|
||||
}
|
||||
b.End();
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ namespace Revitalize.Menus
|
|||
}
|
||||
else
|
||||
{
|
||||
if (this.pixels == null) Log.AsyncC("this pixels null");
|
||||
if (CanvasObject == null) Log.AsyncC("cnvas object is null");
|
||||
if (CanvasObject.pixels == null) Log.AsyncC("this canvas object ==null");
|
||||
if (this.pixels == null) //Log.AsyncC("this pixels null");
|
||||
if (CanvasObject == null) //Log.AsyncC("cnvas object is null");
|
||||
if (CanvasObject.pixels == null) //Log.AsyncC("this canvas object ==null");
|
||||
this.pixels = CanvasObject.pixels;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@ namespace Revitalize
|
|||
StardewModdingAPI.Events.ControlEvents.KeyPressed += ShopCall;
|
||||
StardewModdingAPI.Events.ControlEvents.MouseChanged += ControlEvents_MouseChanged;
|
||||
StardewModdingAPI.Events.GameEvents.UpdateTick +=gameMenuCall;
|
||||
StardewModdingAPI.Events.GameEvents.GameLoaded += GameEvents_GameLoaded;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += GameEvents_GameLoaded;
|
||||
StardewModdingAPI.Events.GameEvents.OneSecondTick += MapWipe;
|
||||
StardewModdingAPI.Events.TimeEvents.DayOfMonthChanged += Util.ResetAllDailyBooleans;
|
||||
StardewModdingAPI.Events.TimeEvents.AfterDayStarted+= Util.ResetAllDailyBooleans;
|
||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterSave += SaveEvents_AfterSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterSave;
|
||||
|
@ -234,19 +234,19 @@ namespace Revitalize
|
|||
|
||||
if (R.name == "Town" || R.name == "town")
|
||||
{
|
||||
Log.AsyncO("Adding Town");
|
||||
//Log.AsyncO("Adding Town");
|
||||
// R = new ModTown(v.Map, v.name);
|
||||
}
|
||||
newLoc.Add(R);
|
||||
Log.AsyncC("DONE1");
|
||||
//Log.AsyncC("DONE1");
|
||||
}
|
||||
Game1.locations.Clear();
|
||||
foreach (var v in newLoc)
|
||||
{
|
||||
Game1.locations.Add(v);
|
||||
Log.AsyncC("DONE2");
|
||||
//Log.AsyncC("DONE2");
|
||||
}
|
||||
Log.AsyncC("DONE");
|
||||
//Log.AsyncC("DONE");
|
||||
mapWipe = false;
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ namespace Revitalize
|
|||
{
|
||||
if (e.KeyPressed.ToString() == "J")
|
||||
{
|
||||
Log.AsyncC("Mouse Position " + Game1.getMousePosition());
|
||||
//Log.AsyncC("Mouse Position " + Game1.getMousePosition());
|
||||
}
|
||||
|
||||
if (e.KeyPressed.ToString() == "O")
|
||||
|
@ -337,8 +337,8 @@ namespace Revitalize
|
|||
objShopList.Add(new TestMachine(3, Vector2.Zero, Util.invertColor(LightColors.White), LightColors.White, false, 9, true));
|
||||
objShopList.Add(new SpriteFontObject(0, Vector2.Zero, font.path, Color.White));
|
||||
objShopList.Add(new Decoration(1391, Vector2.Zero));
|
||||
objShopList.Add(new ModularDecoration(1120, Vector2.Zero,"VanillaFurniture"));
|
||||
objShopList.Add(new ModularDecoration(0, Vector2.Zero, "VanillaFurniture"));
|
||||
//objShopList.Add(new ModularDecoration(1120, Vector2.Zero,"VanillaFurniture"));
|
||||
//objShopList.Add(new ModularDecoration(0, Vector2.Zero, "VanillaFurniture"));
|
||||
objShopList.Add(new Magic.Alchemy.Objects.BagofHolding(0, Vector2.Zero, new List<List<Item>>()
|
||||
{
|
||||
new List<Item>()
|
||||
|
@ -394,7 +394,7 @@ namespace Revitalize
|
|||
}
|
||||
foreach(var v in trash)
|
||||
{
|
||||
Log.AsyncC("TRASH");
|
||||
//Log.AsyncC("TRASH");
|
||||
objShopList.Remove(v);
|
||||
}
|
||||
|
||||
|
@ -440,8 +440,8 @@ namespace Revitalize
|
|||
|
||||
if (e.KeyPressed.ToString() == "J")
|
||||
{
|
||||
Log.AsyncC("Player Position " + Game1.player.getTileLocation());
|
||||
Log.AsyncC("Mouse Position " + Game1.currentCursorTile);
|
||||
//Log.AsyncC("Player Position " + Game1.player.getTileLocation());
|
||||
//Log.AsyncC("Mouse Position " + Game1.currentCursorTile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -622,11 +622,11 @@ namespace Revitalize
|
|||
|
||||
public new bool performAction(string action, StardewValley.Farmer who, Location tileLocation)
|
||||
{
|
||||
Log.AsyncG("WHY???");
|
||||
//Log.AsyncG("WHY???");
|
||||
|
||||
Log.AsyncC(action);
|
||||
Log.AsyncM(who);
|
||||
Log.AsyncO(tileLocation);
|
||||
//Log.AsyncC(action);
|
||||
//Log.AsyncM(who);
|
||||
//Log.AsyncO(tileLocation);
|
||||
|
||||
|
||||
if (action != null && who.IsMainPlayer)
|
||||
|
@ -638,7 +638,7 @@ namespace Revitalize
|
|||
string text = array[0];
|
||||
|
||||
|
||||
Log.AsyncG(text);
|
||||
//Log.AsyncG(text);
|
||||
|
||||
|
||||
|
||||
|
@ -2280,7 +2280,7 @@ namespace Revitalize
|
|||
*/
|
||||
public override bool checkAction(Location tileLocation, xTile.Dimensions.Rectangle viewport, StardewValley.Farmer who)
|
||||
{
|
||||
Log.AsyncG("BASLLS");
|
||||
//Log.AsyncG("BASLLS");
|
||||
|
||||
if (this.currentEvent != null && this.currentEvent.isFestival)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Revitalize.Magic.Alchemy.Objects
|
|||
this.inventory = InventoriesToAdd[0];
|
||||
this.inventory.Capacity = InventoriesToAdd[0].Capacity;
|
||||
// this.allInventoriesCapacities.Add(this.inventory.Capacity);
|
||||
Log.AsyncC("WHT THE SNAG");
|
||||
//Log.AsyncC("WHT THE SNAG");
|
||||
foreach (var v in InventoriesToAdd)
|
||||
{
|
||||
// this.allInventories.Add(v);
|
||||
|
|
|
@ -353,13 +353,13 @@ namespace Revitalize.Magic.MagicFunctions
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.AsyncR("BAD Water SPELL");
|
||||
//Log.AsyncR("BAD Water SPELL");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.AsyncC(Game1.currentCursorTile);
|
||||
Log.AsyncC("Cant water here ");
|
||||
//Log.AsyncC(Game1.currentCursorTile);
|
||||
//Log.AsyncC("Cant water here ");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace Revitalize.Menus
|
|||
private void optionButtonClick(string name)
|
||||
{
|
||||
|
||||
Log.AsyncC(name);
|
||||
//Log.AsyncC(name);
|
||||
if (name == "Wilderness")
|
||||
{
|
||||
if (!this.wizardSource)
|
||||
|
@ -155,9 +155,9 @@ namespace Revitalize.Menus
|
|||
Utilities.MapUtilities.removeAllWaterTilesFromMap(Game1.getLocationFromName("Farm"));
|
||||
Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(g);
|
||||
whichFarm = 4;
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath = Path.Combine(Game1.content.RootDirectory, g);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
|
||||
|
||||
|
@ -174,9 +174,9 @@ namespace Revitalize.Menus
|
|||
string g = Path.Combine("Maps", "Farm");
|
||||
Utilities.MapUtilities.removeAllWaterTilesFromMap(Game1.getLocationFromName("Farm"));
|
||||
Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(g);
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath = Path.Combine(Game1.content.RootDirectory, g);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
|
||||
|
||||
|
@ -192,9 +192,9 @@ namespace Revitalize.Menus
|
|||
string g = Path.Combine("Maps", "Farm_Fishing");
|
||||
Utilities.MapUtilities.removeAllWaterTilesFromMap(Game1.getLocationFromName("Farm"));
|
||||
Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(g);
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath = Path.Combine(Game1.content.RootDirectory, g);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
|
||||
Game1.whichFarm = 1;
|
||||
|
@ -228,9 +228,9 @@ namespace Revitalize.Menus
|
|||
string g = Path.Combine("Maps", "Farm_Mining");
|
||||
Utilities.MapUtilities.removeAllWaterTilesFromMap(Game1.getLocationFromName("Farm"));
|
||||
Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(g);
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath = Path.Combine(Game1.content.RootDirectory, g);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
|
||||
Game1.whichFarm = 3;
|
||||
|
@ -246,9 +246,9 @@ namespace Revitalize.Menus
|
|||
string g = Path.Combine("Maps", "Farm_Foraging");
|
||||
Utilities.MapUtilities.removeAllWaterTilesFromMap(Game1.getLocationFromName("Farm"));
|
||||
Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(g);
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath = Path.Combine(Game1.content.RootDirectory, g);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
|
||||
|
||||
|
@ -277,10 +277,10 @@ namespace Revitalize.Menus
|
|||
c.map = v.map;
|
||||
//
|
||||
whichFarm = count;
|
||||
Log.AsyncG("MAP SWAP!");
|
||||
//Log.AsyncG("MAP SWAP!");
|
||||
Class1.persistentMapSwap.mapPath= Path.Combine(Game1.content.RootDirectory,"Maps","Farms", v.clicky.name,v.clicky.name);
|
||||
Class1.persistentMapSwap.folderPath = Path.Combine(Game1.content.RootDirectory, "Maps", "Farms", v.clicky.name);
|
||||
Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Log.AsyncG(Class1.persistentMapSwap.mapPath);
|
||||
//Game1.getLocationFromName("Farm").map = Game1.game1.xTileContent.Load<Map>(Class1.persistentMapSwap.mapPath);
|
||||
Serialize.serializeMapSwapData(Class1.persistentMapSwap);
|
||||
// Util.removeAllWaterTilesFromMap(c);
|
||||
|
@ -658,7 +658,7 @@ namespace Revitalize.Menus
|
|||
string[] spliiter=v.Split('\\');
|
||||
string fileName = spliiter.ElementAt(spliiter.Length-1);
|
||||
string s = fileName;
|
||||
Log.AsyncC(v);
|
||||
//Log.AsyncC(v);
|
||||
fileName= Path.Combine(v.Remove(0, 8),s);
|
||||
try
|
||||
{
|
||||
|
@ -672,14 +672,14 @@ namespace Revitalize.Menus
|
|||
catch(Exception e)
|
||||
{
|
||||
if (e.ToString().Contains("FarmIcons")) continue;
|
||||
Log.AsyncR(e);
|
||||
//Log.AsyncR(e);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var v in fi)
|
||||
{
|
||||
dir2.Add(Path.GetFileNameWithoutExtension(v));
|
||||
Log.AsyncC(v);
|
||||
//Log.AsyncC(v);
|
||||
string f=Path.GetDirectoryName(v);
|
||||
string[] spliiter = f.Split('\\');
|
||||
string fileName = spliiter.ElementAt(spliiter.Length-1);
|
||||
|
@ -694,7 +694,7 @@ namespace Revitalize.Menus
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.AsyncR(e);
|
||||
//Log.AsyncR(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ namespace Revitalize.Menus
|
|||
{
|
||||
// Log.AsyncC("BOO");
|
||||
farmTypeButtons.Add(k.clicky);
|
||||
Log.AsyncC(k.clicky.name);
|
||||
//Log.AsyncC(k.clicky.name);
|
||||
}
|
||||
//TODO: CHECK THE DIRECTORY AND ADD ALL DATA NODES TO THIS LIST
|
||||
|
||||
|
@ -733,7 +733,7 @@ namespace Revitalize.Menus
|
|||
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.AsyncO(e);
|
||||
//Log.AsyncO(e);
|
||||
return Game1.mouseCursors;
|
||||
}
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ namespace Revitalize.Menus
|
|||
if (current.containsPoint(x, y))
|
||||
{
|
||||
this.hoverText = current.label;
|
||||
Log.AsyncM(current.value);
|
||||
//Log.AsyncM(current.value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace Revitalize.Menus
|
|||
{
|
||||
this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
|
||||
Util.addItemToOtherInventory(this.ItemsToGrabMenu.actualInventory, this.heldItem);
|
||||
Log.AsyncG("not full");
|
||||
//Log.AsyncG("not full");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ namespace Revitalize.Menus
|
|||
}
|
||||
// j= this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
|
||||
Util.addItemToOtherInventory(this.ItemsToGrabMenu.actualInventory, i);
|
||||
Log.AsyncG("item swap");
|
||||
//Log.AsyncG("item swap");
|
||||
Game1.activeClickableMenu = new ItemGrabMenu(this.ItemsToGrabMenu.actualInventory,this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
|
||||
Game1.playSound("Ship");
|
||||
this.heldItem = null;
|
||||
|
|
|
@ -83,10 +83,10 @@ namespace Revitalize.Menus.Machines
|
|||
{
|
||||
machine = Machine;
|
||||
Rows = rows;
|
||||
Log.AsyncC(InputInventory.Capacity);
|
||||
//Log.AsyncC(InputInventory.Capacity);
|
||||
this.inputInventory = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, InputInventory, null, 9, 3, 0, 0, true);
|
||||
this.outputInventory = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize *8, this.yPositionOnScreen, false, OutputInventory, null, 9, 3, 0, 0, true);
|
||||
Log.AsyncM(this.inputInventory.actualInventory.Capacity);
|
||||
//Log.AsyncM(this.inputInventory.actualInventory.Capacity);
|
||||
this.inputInventory.capacity = 9;
|
||||
this.outputInventory.capacity = 9;
|
||||
this.inputInventory.actualInventory.Capacity = 9;
|
||||
|
@ -136,7 +136,7 @@ namespace Revitalize.Menus.Machines
|
|||
}
|
||||
this.inputInventory = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, InputInventory, highlightFunction, 9, 3, 0, 0, true);
|
||||
this.outputInventory = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize * 8, this.yPositionOnScreen, false, OutputInventory, null, 9, 3, 0, 0, true);
|
||||
Log.AsyncM(this.inputInventory.actualInventory.Capacity);
|
||||
//Log.AsyncM(this.inputInventory.actualInventory.Capacity);
|
||||
this.inputInventory.capacity = 9;
|
||||
this.inputInventory.capacity = 9;
|
||||
this.inputInventory.actualInventory.Capacity = 9;
|
||||
|
@ -322,7 +322,7 @@ namespace Revitalize.Menus.Machines
|
|||
|
||||
if (this.inputInventory.actualInventory == null)
|
||||
{
|
||||
Log.AsyncG("WTF HOW IS THIS NULL!?!?!?!?!");
|
||||
//Log.AsyncG("WTF HOW IS THIS NULL!?!?!?!?!");
|
||||
}
|
||||
bool f = Util.isInventoryFull(this.inputInventory.actualInventory,true);
|
||||
if (f == false)
|
||||
|
@ -337,9 +337,9 @@ namespace Revitalize.Menus.Machines
|
|||
|
||||
Util.addItemToOtherInventory(this.inputInventory.actualInventory, this.heldItem);
|
||||
// Log.AsyncG("item swap");
|
||||
if (this.machine == null) Log.AsyncC("OK MY MACHINE IS NULL");
|
||||
if (this.inputInventory == null) Log.AsyncG("Input is null");
|
||||
if (this.outputInventory == null) Log.AsyncO("output is null");
|
||||
if (this.machine == null) //Log.AsyncC("OK MY MACHINE IS NULL");
|
||||
if (this.inputInventory == null) //Log.AsyncG("Input is null");
|
||||
if (this.outputInventory == null) //Log.AsyncO("output is null");
|
||||
//Game1.activeClickableMenu = new MachineInventory(this.machine, this.inputInventory.actualInventory,this.outputInventory.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
|
||||
Game1.activeClickableMenu = new Revitalize.Menus.Machines.MachineInventory(this.machine, this.inputInventory.actualInventory, this.outputInventory.actualInventory, 3);
|
||||
// Game1.playSound("Ship");
|
||||
|
@ -351,7 +351,7 @@ namespace Revitalize.Menus.Machines
|
|||
}
|
||||
else
|
||||
{
|
||||
Log.AsyncO("Inventory is full?????");
|
||||
//Log.AsyncO("Inventory is full?????");
|
||||
return;
|
||||
}
|
||||
// this.inputInventory.inventory.Add(new ClickableComponent(new Rectangle(inputInventory.xPositionOnScreen + inputInventory.actualInventory.Count-1 % (this.capacity / this.inputInventory.rows) * Game1.tileSize + this.inputInventory.horizontalGap * (inputInventory.actualInventory.Count-1 % (this.capacity / this.inputInventory.rows)), inputInventory.yPositionOnScreen + inputInventory.actualInventory.Count-1 / (this.capacity / this.inputInventory.rows) * (Game1.tileSize + this.inputInventory.verticalGap) + (inputInventory.actualInventory.Count-1 / (this.capacity / this.inputInventory.rows) - 1) * Game1.pixelZoom - (Game1.tileSize / 5), Game1.tileSize, Game1.tileSize), string.Concat(inputInventory.actualInventory.Count-1)));
|
||||
|
@ -370,7 +370,7 @@ namespace Revitalize.Menus.Machines
|
|||
//outputInventory.actualInventory.Add(new Decoration(3, Vector2.Zero));
|
||||
if (this.outputInventory.actualInventory == null)
|
||||
{
|
||||
Log.AsyncG("WTF HOW IS THIS NULL!?!?!?!?!");
|
||||
//Log.AsyncG("WTF HOW IS THIS NULL!?!?!?!?!");
|
||||
}
|
||||
|
||||
this.heldItem = this.outputInventory.leftClick(x, y, this.heldItem, false);
|
||||
|
@ -448,9 +448,9 @@ namespace Revitalize.Menus.Machines
|
|||
// j= this.inputInventory.leftClick(x, y, this.heldItem, false);
|
||||
// Util.addItemToOtherInventory(this.inputInventory.actualInventory, i);
|
||||
// Log.AsyncG("item swap");
|
||||
if (this.machine == null) Log.AsyncC("OK MY MACHINE IS NULL");
|
||||
if (this.inputInventory == null) Log.AsyncG("Input is null");
|
||||
if (this.outputInventory == null) Log.AsyncO("output is null");
|
||||
if (this.machine == null) //Log.AsyncC("OK MY MACHINE IS NULL");
|
||||
if (this.inputInventory == null) //Log.AsyncG("Input is null");
|
||||
if (this.outputInventory == null) //Log.AsyncO("output is null");
|
||||
//Game1.activeClickableMenu = new MachineInventory(this.machine, this.inputInventory.actualInventory,this.outputInventory.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
|
||||
Game1.activeClickableMenu = new Revitalize.Menus.Machines.MachineInventory(this.machine, this.inputInventory.actualInventory, this.outputInventory.actualInventory, 3);
|
||||
// Game1.playSound("Ship");
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Revitalize.Objects.Machines
|
|||
bool works= Dictionaries.quarryList.TryGetValue(resourceName, out t);
|
||||
if (works == false)
|
||||
{
|
||||
Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
//Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -133,7 +133,7 @@ namespace Revitalize.Objects.Machines
|
|||
bool works = Dictionaries.quarryList.TryGetValue(resourceName, out t);
|
||||
if (works == false)
|
||||
{
|
||||
Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
////Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -267,7 +267,7 @@ namespace Revitalize.Objects.Machines
|
|||
bool works = Dictionaries.quarryList.TryGetValue(ResourceName, out t);
|
||||
if (works == false)
|
||||
{
|
||||
Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
////Log.AsyncR("ERROR, invalid resource type for quarry.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -586,7 +586,7 @@ namespace Revitalize.Objects.Machines
|
|||
// Log.Info(this.Decoration_type);
|
||||
if (this.lightSource != null) this.lightSource.color = new Color(0, 255, 255, 255); //THE COLORS ARE REVERSED!!!!!!!!!!!!
|
||||
this.minutesUntilReady = (this.minutesUntilReady - minutes);
|
||||
Log.Info("minues remaining" + this.minutesUntilReady);
|
||||
////Log.Info("minues remaining" + this.minutesUntilReady);
|
||||
|
||||
// if(this.output!= null) Log.Info("stack size"+this.output.stack);
|
||||
if (Game1.isDarkOut())
|
||||
|
|
|
@ -535,10 +535,10 @@ namespace Revitalize.Objects.Machines
|
|||
|
||||
if (minutesUntilReady == 0)
|
||||
{
|
||||
Log.AsyncC(this.name + "Is ready!");
|
||||
Log.AsyncC(Game1.player.getStandingPosition());
|
||||
// Log.AsyncC(this.name + "Is ready!");
|
||||
// Log.AsyncC(Game1.player.getStandingPosition());
|
||||
Vector2 v2 = new Vector2(this.tileLocation.X * Game1.tileSize, this.tileLocation.Y * Game1.tileSize);
|
||||
Log.AsyncC(v2);
|
||||
//Log.AsyncC(v2);
|
||||
//Game1.createItemDebris((Item)this.heldObject, v2, Game1.player.getDirection());
|
||||
if (this.heldObject != null)
|
||||
{
|
||||
|
@ -832,9 +832,9 @@ namespace Revitalize.Objects.Machines
|
|||
}
|
||||
}
|
||||
this.updateDrawPosition();
|
||||
Log.AsyncO(this.boundingBox);
|
||||
Log.AsyncO(x);
|
||||
Log.AsyncY(y);
|
||||
//Log.AsyncO(this.boundingBox);
|
||||
//Log.AsyncO(x);
|
||||
//Log.AsyncY(y);
|
||||
for (int i = 0; i <= this.boundingBox.X / Game1.tileSize; i++)
|
||||
{
|
||||
return Util.placementAction(this, location, x+1, y, who);
|
||||
|
|
|
@ -260,13 +260,13 @@ namespace Revitalize.Objects.Machines
|
|||
//Game1.activeClickableMenu = new Revitalize.Menus.LightCustomizer(this);
|
||||
if (this.inputInventory == null)
|
||||
{
|
||||
Log.AsyncG(">>>>>>>>??????????????????>>>>>>>>>>>>>");
|
||||
//Log.AsyncG(">>>>>>>>??????????????????>>>>>>>>>>>>>");
|
||||
}
|
||||
if (this.outputInventory == null)
|
||||
{
|
||||
Log.AsyncC(">??????????????");
|
||||
//Log.AsyncC(">??????????????");
|
||||
}
|
||||
Log.AsyncM(this.GetType());
|
||||
//Log.AsyncM(this.GetType());
|
||||
// this.outputInventory.Add(new Revitalize.Objects.Light(0, Vector2.Zero, LightColors.Azure, LightColors.Azure));
|
||||
Game1.activeClickableMenu = new Revitalize.Menus.Machines.MachineInventory(this, this.inputInventory, this.outputInventory, 3);
|
||||
return false;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Revitalize.Resources
|
|||
public static List<Revitalize.Resources.DataNodes.TrackedTerrainDummyDataNode> trackedTerrainFeaturesDummyList;
|
||||
|
||||
public static List<Revitalize.CoreObject> trackedObjectList;
|
||||
public static List<Revitalize.Objects.ModularDecoration> DecorationsToDraw;
|
||||
//public static List<Revitalize.Objects.ModularDecoration> DecorationsToDraw;
|
||||
|
||||
public static List<Type> serializerTypes;
|
||||
public static List<string> saplingNames;
|
||||
|
@ -28,7 +28,7 @@ namespace Revitalize.Resources
|
|||
trackedObjectList = new List<CoreObject>();
|
||||
|
||||
WeatherDebrisSystem.thisWeatherDebris = new List<WeatherDebrisPlus>();
|
||||
DecorationsToDraw = new List<Objects.ModularDecoration>();
|
||||
//DecorationsToDraw = new List<Objects.ModularDecoration>();
|
||||
}
|
||||
|
||||
public static void loadAllListsAfterMovement()
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Revitalize
|
|||
{
|
||||
idk.Add(d);
|
||||
}
|
||||
Log.AsyncC("Progress on saving objects: " + countProcessed + "/" + Lists.trackedObjectList.Count);
|
||||
//Log.AsyncC("Progress on saving objects: " + countProcessed + "/" + Lists.trackedObjectList.Count);
|
||||
removalList.Add(d);
|
||||
}
|
||||
}
|
||||
|
@ -103,14 +103,14 @@ namespace Revitalize
|
|||
{
|
||||
t.worldObj.Invoke(v as CoreObject);
|
||||
}
|
||||
Log.AsyncG("Progress on saving objects: " + countProcessed + "/" + Lists.trackedObjectList.Count);
|
||||
//Log.AsyncG("Progress on saving objects: " + countProcessed + "/" + Lists.trackedObjectList.Count);
|
||||
removalList.Add(v as CoreObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removalList.Clear();
|
||||
Log.AsyncM("Revitalize: Done cleaning world for saving.");
|
||||
//Log.AsyncM("Revitalize: Done cleaning world for saving.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace Revitalize
|
|||
}
|
||||
removalList.Clear();
|
||||
|
||||
Log.AsyncM("Revitalize: Done cleaning inventory!");
|
||||
//Log.AsyncM("Revitalize: Done cleaning inventory!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -247,7 +247,7 @@ namespace Revitalize
|
|||
string a;
|
||||
string[] b;
|
||||
string s="";
|
||||
Log.AsyncC(path);
|
||||
//Log.AsyncC(path);
|
||||
// Log.AsyncC(data);
|
||||
try
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ namespace Revitalize
|
|||
}
|
||||
}
|
||||
|
||||
Log.AsyncG("attempting to parse from path and value of s is " + s);
|
||||
//Log.AsyncG("attempting to parse from path and value of s is " + s);
|
||||
}
|
||||
|
||||
// var cObj = parseBagOfHolding(path); //pair.Value.parse.Invoke(path);
|
||||
|
@ -443,7 +443,7 @@ namespace Revitalize
|
|||
continue;
|
||||
}
|
||||
}
|
||||
Log.AsyncC("CHECK RESULTS " + false);
|
||||
////Log.AsyncC("CHECK RESULTS " + false);
|
||||
return false;
|
||||
// XElement school = doc.Element("School");
|
||||
// school.Add(new XAttribute("ID", "ID_Value"));
|
||||
|
@ -475,12 +475,12 @@ namespace Revitalize
|
|||
|
||||
private static void serializer_UnknownAttribute(object sender, XmlAttributeEventArgs e)
|
||||
{
|
||||
Log.AsyncR(e);
|
||||
//Log.AsyncR(e);
|
||||
}
|
||||
|
||||
private static void serializer_UnknownNode(object sender, XmlNodeEventArgs e)
|
||||
{
|
||||
Log.AsyncR(e);
|
||||
//Log.AsyncR(e);
|
||||
}
|
||||
|
||||
public static void serializeMapSwapData(MapSwapData d)
|
||||
|
@ -989,7 +989,7 @@ namespace Revitalize
|
|||
d.lightsOn = obj.lightsOn;
|
||||
// d.thisLocation = Game1.getLocationFromName(loc);
|
||||
// d.thisLocation = obj.thisLocation;
|
||||
Log.AsyncC(d.thisLocation);
|
||||
//Log.AsyncC(d.thisLocation);
|
||||
d.lightColor = obj.lightColor;
|
||||
d.thisType = obj.thisType;
|
||||
d.removable = obj.removable;
|
||||
|
@ -1003,7 +1003,7 @@ namespace Revitalize
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.AsyncM(e);
|
||||
//Log.AsyncM(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ namespace Revitalize
|
|||
d.lightsOn = obj.lightsOn;
|
||||
// d.thisLocation = Game1.getLocationFromName(loc);
|
||||
// d.thisLocation = obj.thisLocation;
|
||||
Log.AsyncC(d.thisLocation);
|
||||
//Log.AsyncC(d.thisLocation);
|
||||
d.lightColor = obj.lightColor;
|
||||
d.thisType = obj.thisType;
|
||||
d.removable = obj.removable;
|
||||
|
@ -1099,7 +1099,7 @@ namespace Revitalize
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.AsyncM(e);
|
||||
//Log.AsyncM(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ namespace Revitalize
|
|||
d.lightsOn = obj.lightsOn;
|
||||
// d.thisLocation = Game1.getLocationFromName(loc);
|
||||
// d.thisLocation = obj.thisLocation;
|
||||
Log.AsyncC(d.thisLocation);
|
||||
////Log.AsyncC(d.thisLocation);
|
||||
d.lightColor = obj.lightColor;
|
||||
d.thisType = obj.thisType;
|
||||
d.removable = obj.removable;
|
||||
|
@ -1235,7 +1235,7 @@ namespace Revitalize
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.AsyncM(e);
|
||||
//Log.AsyncM(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1577,7 +1577,7 @@ namespace Revitalize
|
|||
{
|
||||
serializer.TypeNameHandling = TypeNameHandling.Auto;
|
||||
serializer.NullValueHandling = NullValueHandling.Ignore;
|
||||
Log.AsyncG("DESERIALIZE THE WORLD");
|
||||
////Log.AsyncG("DESERIALIZE THE WORLD");
|
||||
return base.ReadJson(reader, objectType, existingValue, serializer);
|
||||
}
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ namespace Revitalize
|
|||
TextReader reader = null;
|
||||
try
|
||||
{
|
||||
Log.AsyncC(filePath);
|
||||
////Log.AsyncC(filePath);
|
||||
reader = new StreamReader(filePath);
|
||||
var fileContents = reader.ReadToEnd();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Revitalize
|
|||
|
||||
|
||||
PlayerVariables.initializePlayerVariables();
|
||||
Log.AsyncG("Revitalize: Running on API Version: " + StardewModdingAPI.Constants.ApiVersion);
|
||||
//Log.AsyncG("Revitalize: Running on API Version: " + StardewModdingAPI.Constants.ApiVersion);
|
||||
|
||||
Lists.loadAllListsAtEntry();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Revitalize.Settings
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.AsyncR("Failed to load Machine Settings");
|
||||
////Log.AsyncR("Failed to load Machine Settings");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ namespace Revitalize.Settings
|
|||
if (File.Exists(Path.Combine(Class1.path, "xnb_node.cmd")))
|
||||
{
|
||||
PaintEnabled = true;
|
||||
Log.AsyncG("Revitalize: Paint Module Enabled");
|
||||
//Log.AsyncG("Revitalize: Paint Module Enabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
PaintEnabled = false;
|
||||
Log.AsyncG("Revitalize: Paint Module Disabled");
|
||||
//Log.AsyncG("Revitalize: Paint Module Disabled");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Revitalize.Settings
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.AsyncR(e);
|
||||
//Log.AsyncR(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ namespace Revitalize.Utilities
|
|||
|
||||
public static void removeAllWaterTilesFromMap(GameLocation c)
|
||||
{
|
||||
Log.AsyncM(c.map.Layers[0].LayerWidth);
|
||||
Log.AsyncM(c.map.Layers[0].LayerHeight);
|
||||
//Log.AsyncM(c.map.Layers[0].LayerWidth);
|
||||
//Log.AsyncM(c.map.Layers[0].LayerHeight);
|
||||
for (int i = 0; i < c.map.Layers[0].LayerWidth; i++)
|
||||
{
|
||||
for (int j = 0; j < c.map.Layers[0].LayerHeight; j++)
|
||||
|
@ -97,9 +97,9 @@ namespace Revitalize.Utilities
|
|||
|
||||
}
|
||||
}
|
||||
Log.AsyncY("Position: " + i +" of "+ c.map.Layers[0].LayerWidth);
|
||||
//Log.AsyncY("Position: " + i +" of "+ c.map.Layers[0].LayerWidth);
|
||||
}
|
||||
Log.AsyncC("Removed All Water Tiles from " + c.name);
|
||||
//Log.AsyncC("Removed All Water Tiles from " + c.name);
|
||||
}
|
||||
|
||||
public static Vector2 getMapDimensions(GameLocation loc)
|
||||
|
@ -131,7 +131,7 @@ namespace Revitalize.Utilities
|
|||
}
|
||||
|
||||
}
|
||||
Log.AsyncY("Position: " + i + " of " + newLoc.map.Layers[0].LayerWidth);
|
||||
//Log.AsyncY("Position: " + i + " of " + newLoc.map.Layers[0].LayerWidth);
|
||||
}
|
||||
newLoc.waterTiles = newWaterTiles;
|
||||
return;
|
||||
|
@ -151,7 +151,7 @@ namespace Revitalize.Utilities
|
|||
}
|
||||
foreach (string file in s)
|
||||
{
|
||||
Log.AsyncO(file);
|
||||
//Log.AsyncO(file);
|
||||
string[] reader = File.ReadAllLines(file);
|
||||
try
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ namespace Revitalize.Utilities
|
|||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Log.AsyncR(err);
|
||||
//Log.AsyncR(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Revitalize
|
|||
{
|
||||
public static bool hasWateredAllCropsToday;
|
||||
|
||||
public static void ResetAllDailyBooleans(object sender, EventArgsIntChanged e)
|
||||
public static void ResetAllDailyBooleans(object sender, EventArgs e)
|
||||
{
|
||||
SetUp.createDirectories();
|
||||
hasWateredAllCropsToday = false;
|
||||
|
@ -100,8 +100,8 @@ namespace Revitalize
|
|||
{
|
||||
if (logInfo)
|
||||
{
|
||||
Log.AsyncG("size " + inventory.Count);
|
||||
Log.AsyncG("max " + inventory.Capacity);
|
||||
//Log.AsyncG("size " + inventory.Count);
|
||||
//Log.AsyncG("max " + inventory.Capacity);
|
||||
}
|
||||
|
||||
if (inventory.Count == inventory.Capacity) return true;
|
||||
|
@ -757,7 +757,7 @@ namespace Revitalize
|
|||
else
|
||||
{
|
||||
// Game1.showRedMessage("STEP 2");
|
||||
Log.Info(vector);
|
||||
//Log.Info(vector);
|
||||
|
||||
Vector2 newVec = new Vector2(vector.X, vector.Y);
|
||||
// cObj.boundingBox.Inflate(32, 32);
|
||||
|
@ -768,7 +768,7 @@ namespace Revitalize
|
|||
if(playSound==true) Game1.playSound("woodyStep");
|
||||
else
|
||||
{
|
||||
Log.AsyncG("restoring item from file");
|
||||
//Log.AsyncG("restoring item from file");
|
||||
}
|
||||
//Log.AsyncM("Placed and object");
|
||||
cObj.locationsName = location.name;
|
||||
|
@ -788,10 +788,10 @@ namespace Revitalize
|
|||
|
||||
public static void plantCropHere()
|
||||
{
|
||||
Log.AsyncY(Game1.player.ActiveObject.name);
|
||||
//Log.AsyncY(Game1.player.ActiveObject.name);
|
||||
if (Lists.saplingNames.Contains(Game1.player.ActiveObject.name))
|
||||
{
|
||||
Log.AsyncY("PLANT THE SAPLING");
|
||||
//Log.AsyncY("PLANT THE SAPLING");
|
||||
bool f = plantSappling();
|
||||
|
||||
if (f == true) return;
|
||||
|
@ -907,7 +907,7 @@ namespace Revitalize
|
|||
Game1.showRedMessage("Can't be planted here.");
|
||||
return false;
|
||||
}
|
||||
Log.AsyncR("MAKES NO SENSE");
|
||||
//Log.AsyncR("MAKES NO SENSE");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -962,21 +962,21 @@ namespace Revitalize
|
|||
Class1.persistentMapSwap = Serialize.parseMapSwapData();
|
||||
if (Class1.persistentMapSwap == null)
|
||||
{
|
||||
Log.AsyncG("IS NULL");
|
||||
//Log.AsyncG("IS NULL");
|
||||
Class1.persistentMapSwap = new MapSwapData();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.AsyncM(parseOutContent(Class1.persistentMapSwap.mapPath));
|
||||
//Log.AsyncM(parseOutContent(Class1.persistentMapSwap.mapPath));
|
||||
m = Game1.content.Load<Map>(parseOutContent(Class1.persistentMapSwap.mapPath));
|
||||
Log.AsyncG("Successfully loaded custom farm map.");
|
||||
//Log.AsyncG("Successfully loaded custom farm map.");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
m = null;
|
||||
Log.AsyncM(err);
|
||||
//Log.AsyncM(err);
|
||||
|
||||
|
||||
}
|
||||
|
@ -990,14 +990,14 @@ namespace Revitalize
|
|||
bool[,] oldWaterTiles = v.waterTiles;
|
||||
|
||||
v.map = m;//change this to v.map =(Game1.content.Load<Map>("Path.Combine("Maps,"Farms",folderName,"Farm")));
|
||||
Log.AsyncG("Sucesfully injected custom farm map");
|
||||
//Log.AsyncG("Sucesfully injected custom farm map");
|
||||
Utilities.MapUtilities.loadCustomFarmMap(v, oldLocDimensions, oldWaterTiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.AsyncM("WTF");
|
||||
//Log.AsyncM("WTF");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue