Creating new voice acting mod at request of another author.
This commit is contained in:
parent
c474ce1a8d
commit
32c4ba1d65
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27428.2037
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocalization", "Vocalization\Vocalization.csproj", "{1651701C-DB36-43C7-B66D-2700171DD9A9}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{1651701C-DB36-43C7-B66D-2700171DD9A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1651701C-DB36-43C7-B66D-2700171DD9A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1651701C-DB36-43C7-B66D-2700171DD9A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1651701C-DB36-43C7-B66D-2700171DD9A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {4C50BF63-11B5-41DB-B244-337AF4EF66DC}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,53 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Vocalization.Framework
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A class that handles all of the storage of references to the audio files for this character.
|
||||||
|
/// </summary>
|
||||||
|
public class CharacterVoiceCue
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the NPC.
|
||||||
|
/// </summary>
|
||||||
|
public string name;
|
||||||
|
/// <summary>
|
||||||
|
/// A dictionary of dialogue strings that correspond to audio files.
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, string> dialogueCues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the NPC.</param>
|
||||||
|
public CharacterVoiceCue(string name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.dialogueCues = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plays the associated dialogue file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dialogueString">The current dialogue string to play audio for.</param>
|
||||||
|
public void speak(string dialogueString)
|
||||||
|
{
|
||||||
|
string voiceFileName = "";
|
||||||
|
bool exists = dialogueCues.TryGetValue(dialogueString, out voiceFileName);
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
|
Vocalization.soundManager.swapSounds(voiceFileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vocalization.ModMonitor.Log("The dialogue cue for the current dialogue could not be found. Please ensure that the dialogue is added the character's voice file and that the proper file for the voice exists.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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("Vocalization")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Vocalization")]
|
||||||
|
[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("1651701c-db36-43c7-b66d-2700171dd9a9")]
|
||||||
|
|
||||||
|
// 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,197 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using StardewModdingAPI;
|
||||||
|
using StardewValley;
|
||||||
|
using StardewValley.Menus;
|
||||||
|
using Vocalization.Framework;
|
||||||
|
|
||||||
|
namespace Vocalization
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TODO:
|
||||||
|
///
|
||||||
|
/// Make a directory where all of the wav files will be stored. (Done?)
|
||||||
|
/// Load in said wav files.(Done?)
|
||||||
|
///
|
||||||
|
/// Find way to add in supported dialogue via some sort of file system. (Done?)
|
||||||
|
/// -Make each character folder have a .json that has....
|
||||||
|
/// -Character Name(Done?)
|
||||||
|
/// -Dictionary of supported dialogue lines and values for .wav files. (Done?)
|
||||||
|
/// -*Note* The value for the dialogue dictionaries is the name of the file excluding the .wav extension.
|
||||||
|
///
|
||||||
|
/// Find way to play said wave files. (Done?)
|
||||||
|
///
|
||||||
|
/// Sanitize input to remove variables such as pet names, farm names, farmer name.
|
||||||
|
///
|
||||||
|
/// Add in dialogue for npcs into their respective VoiceCue.json files.
|
||||||
|
///
|
||||||
|
/// Add support for different kinds of menus. TV, shops, etc.
|
||||||
|
/// </summary>
|
||||||
|
public class Vocalization : Mod
|
||||||
|
{
|
||||||
|
public static IModHelper ModHelper;
|
||||||
|
public static IMonitor ModMonitor;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string that keeps track of the previous dialogue said to ensure that dialogue isn't constantly repeated while the text box is open.
|
||||||
|
/// </summary>
|
||||||
|
public static string previousDialogue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Simple Sound Manager class that handles playing and stoping dialogue.
|
||||||
|
/// </summary>
|
||||||
|
public static SimpleSoundManager.Framework.SoundManager soundManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path to the folder where all of the NPC folders for dialogue .wav files are kept.
|
||||||
|
/// </summary>
|
||||||
|
public static string VoicePath = "";
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A dictionary that keeps track of all of the npcs whom have voice acting for their dialogue.
|
||||||
|
/// </summary>
|
||||||
|
public static Dictionary<string, CharacterVoiceCue> DialogueCues;
|
||||||
|
|
||||||
|
public override void Entry(IModHelper helper)
|
||||||
|
{
|
||||||
|
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||||
|
DialogueCues = new Dictionary<string, CharacterVoiceCue>();
|
||||||
|
|
||||||
|
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||||
|
StardewModdingAPI.Events.MenuEvents.MenuClosed += MenuEvents_MenuClosed;
|
||||||
|
|
||||||
|
|
||||||
|
previousDialogue = "";
|
||||||
|
|
||||||
|
ModMonitor = Monitor;
|
||||||
|
ModHelper = Helper;
|
||||||
|
|
||||||
|
soundManager = new SimpleSoundManager.Framework.SoundManager();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs whenever any onscreen menu is closed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void MenuEvents_MenuClosed(object sender, StardewModdingAPI.Events.EventArgsClickableMenuClosed e)
|
||||||
|
{
|
||||||
|
//Clean out my previous dialogue when I close any sort of menu.
|
||||||
|
previousDialogue = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs after the game is loaded to initialize all of the mod's files.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
initialzeDirectories();
|
||||||
|
loadAllVoiceFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs every game tick to check if the player is talking to an npc.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Game1.currentSpeaker != null)
|
||||||
|
{
|
||||||
|
string speakerName = Game1.currentSpeaker.Name;
|
||||||
|
if (Game1.activeClickableMenu.GetType() == typeof(StardewValley.Menus.DialogueBox))
|
||||||
|
{
|
||||||
|
StardewValley.Menus.DialogueBox dialogueBox =(DialogueBox)Game1.activeClickableMenu;
|
||||||
|
string currentDialogue = dialogueBox.getCurrentString();
|
||||||
|
if (previousDialogue != currentDialogue)
|
||||||
|
{
|
||||||
|
ModMonitor.Log(speakerName);
|
||||||
|
previousDialogue = currentDialogue; //Update my previously read dialogue so that I only read the new string once when it appears.
|
||||||
|
ModMonitor.Log(currentDialogue); //Print out my dialogue.
|
||||||
|
|
||||||
|
|
||||||
|
//Do logic here to figure out what audio clips to play.
|
||||||
|
//Sanitize input here!
|
||||||
|
//Load all game dialogue files and then sanitize input for that???
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs after loading.
|
||||||
|
/// </summary>
|
||||||
|
private void initialzeDirectories()
|
||||||
|
{
|
||||||
|
string basePath = ModHelper.DirectoryPath;
|
||||||
|
string contentPath = Path.Combine(basePath, "Content");
|
||||||
|
string audioPath = Path.Combine(contentPath, "Audio");
|
||||||
|
string voicePath = Path.Combine(audioPath, "VoiceFiles");
|
||||||
|
VoicePath = voicePath; //Set a static reference to my voice files directory.
|
||||||
|
|
||||||
|
List<string> characterDialoguePaths = new List<string>();
|
||||||
|
|
||||||
|
//Get a list of all characters in the game and make voice directories for them.
|
||||||
|
foreach (var loc in Game1.locations)
|
||||||
|
{
|
||||||
|
foreach(var NPC in loc.characters)
|
||||||
|
{
|
||||||
|
string characterPath = Path.Combine(voicePath, NPC.Name);
|
||||||
|
characterDialoguePaths.Add(characterPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a list of new directories if the corresponding character directory doesn't exist.
|
||||||
|
//Note: A modder could also manually add in their own character directory for voice lines instead of having to add it via code.
|
||||||
|
foreach(var dir in characterDialoguePaths)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads in all of the .wav files associated with voice acting clips.
|
||||||
|
/// </summary>
|
||||||
|
public void loadAllVoiceFiles()
|
||||||
|
{
|
||||||
|
List<string> directories = Directory.GetDirectories(VoicePath).ToList();
|
||||||
|
foreach(var dir in directories)
|
||||||
|
{
|
||||||
|
List<string> audioClips = Directory.GetFiles(dir, ".wav").ToList();
|
||||||
|
//For every .wav file in every character voice clip directory load in the voice clip.
|
||||||
|
foreach(var file in audioClips)
|
||||||
|
{
|
||||||
|
string fileName = Path.GetFileNameWithoutExtension(file);
|
||||||
|
soundManager.loadWavFile(ModHelper, fileName, file);
|
||||||
|
ModMonitor.Log("Loaded sound file: " + fileName+ " from: "+ file);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the character dialogue cues (aka when the character should "speak") from the .json file.
|
||||||
|
string voiceCueFile=Path.Combine(dir,"VoiceCues.json");
|
||||||
|
string characterName = Path.GetFileName(dir);
|
||||||
|
|
||||||
|
//If a file was not found, create one and add it to the list of character voice cues.
|
||||||
|
if (!File.Exists(voiceCueFile))
|
||||||
|
{
|
||||||
|
CharacterVoiceCue cue= new CharacterVoiceCue(characterName);
|
||||||
|
ModHelper.WriteJsonFile<CharacterVoiceCue>(Path.Combine(dir, "VoiceCues.json"), cue);
|
||||||
|
DialogueCues.Add(characterName, cue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CharacterVoiceCue cue=ModHelper.ReadJsonFile<CharacterVoiceCue>(voiceCueFile);
|
||||||
|
DialogueCues.Add(characterName,cue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{1651701C-DB36-43C7-B66D-2700171DD9A9}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Vocalization</RootNamespace>
|
||||||
|
<AssemblyName>Vocalization</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</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="Netcode">
|
||||||
|
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Netcode.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Class1.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="manifest.json" />
|
||||||
|
<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>
|
||||||
|
</Project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"Name": "Vocalization",
|
||||||
|
"Author": "Alpha_Omegasis, DonDemitri, Various Voice Actors/Actresses",
|
||||||
|
"Version": "0.0.1",
|
||||||
|
"Description": "A mod that brings voice acting to Stardew Valley.",
|
||||||
|
"UniqueID": "Omegasis.Vocalization",
|
||||||
|
"EntryDll": "Vocalization.dll",
|
||||||
|
"MinimumApiVersion": "2.0",
|
||||||
|
"UpdateKeys": []
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
038fb9dcd07cce9441d42d4051eb2db1b115c7e2
|
|
@ -0,0 +1,8 @@
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\bin\Debug\Vocalization.dll
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\bin\Debug\Vocalization.pdb
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\obj\Debug\Vocalization.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\obj\Debug\Vocalization.dll
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\obj\Debug\Vocalization.pdb
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\bin\Debug\Netcode.dll
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\bin\Debug\Netcode.pdb
|
||||||
|
C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\obj\Debug\Vocalization.csproj.CopyComplete
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net461" />
|
||||||
|
</packages>
|
Binary file not shown.
|
@ -0,0 +1,144 @@
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<!--*********************************************
|
||||||
|
** Import build tasks
|
||||||
|
**********************************************-->
|
||||||
|
<UsingTask TaskName="DeployModTask" AssemblyFile="StardewModdingAPI.ModBuildConfig.dll" />
|
||||||
|
|
||||||
|
<!--*********************************************
|
||||||
|
** Find the basic mod metadata
|
||||||
|
**********************************************-->
|
||||||
|
<!-- import developer's custom settings (if any) -->
|
||||||
|
<Import Condition="$(OS) != 'Windows_NT' AND Exists('$(HOME)\stardewvalley.targets')" Project="$(HOME)\stardewvalley.targets" />
|
||||||
|
<Import Condition="$(OS) == 'Windows_NT' AND Exists('$(USERPROFILE)\stardewvalley.targets')" Project="$(USERPROFILE)\stardewvalley.targets" />
|
||||||
|
|
||||||
|
<!-- set setting defaults -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- map legacy settings -->
|
||||||
|
<ModFolderName Condition="'$(ModFolderName)' == '' AND '$(DeployModFolderName)' != ''">$(DeployModFolderName)</ModFolderName>
|
||||||
|
<ModZipPath Condition="'$(ModZipPath)' == '' AND '$(DeployModZipTo)' != ''">$(DeployModZipTo)</ModZipPath>
|
||||||
|
|
||||||
|
<!-- set default settings -->
|
||||||
|
<ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName>
|
||||||
|
<ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath>
|
||||||
|
<EnableModDeploy Condition="'$(EnableModDeploy)' == ''">True</EnableModDeploy>
|
||||||
|
<EnableModZip Condition="'$(EnableModZip)' == ''">True</EnableModZip>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- find platform + game path -->
|
||||||
|
<Choose>
|
||||||
|
<When Condition="$(OS) == 'Unix' OR $(OS) == 'OSX'">
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- Linux -->
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.local/share/Steam/steamapps/common/Stardew Valley</GamePath>
|
||||||
|
|
||||||
|
<!-- Mac (may be 'Unix' or 'OSX') -->
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">/Applications/Stardew Valley.app/Contents/MacOS</GamePath>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
</When>
|
||||||
|
<When Condition="$(OS) == 'Windows_NT'">
|
||||||
|
<PropertyGroup>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32))</GamePath>
|
||||||
|
<GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</GamePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
</When>
|
||||||
|
</Choose>
|
||||||
|
|
||||||
|
|
||||||
|
<!--*********************************************
|
||||||
|
** Inject the assembly references and debugging configuration
|
||||||
|
**********************************************-->
|
||||||
|
<Choose>
|
||||||
|
<When Condition="$(OS) == 'Windows_NT'">
|
||||||
|
<!-- references -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Stardew Valley">
|
||||||
|
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="StardewModdingAPI">
|
||||||
|
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
|
||||||
|
<HintPath>$(GamePath)\xTile.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- launch game for debugging -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartAction>Program</StartAction>
|
||||||
|
<StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
|
||||||
|
<StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
</When>
|
||||||
|
<Otherwise>
|
||||||
|
<!-- references -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="MonoGame.Framework">
|
||||||
|
<HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="StardewValley">
|
||||||
|
<HintPath>$(GamePath)\StardewValley.exe</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="StardewModdingAPI">
|
||||||
|
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="xTile">
|
||||||
|
<HintPath>$(GamePath)\xTile.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
</Otherwise>
|
||||||
|
</Choose>
|
||||||
|
|
||||||
|
|
||||||
|
<!--*********************************************
|
||||||
|
** Deploy mod files & create release zip after build
|
||||||
|
**********************************************-->
|
||||||
|
<!-- if game path or OS is invalid, show one user-friendly error instead of a slew of reference errors -->
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
<Error Condition="'$(OS)' != 'OSX' AND '$(OS)' != 'Unix' AND '$(OS)' != 'Windows_NT'" Text="The mod build package doesn't recognise OS type '$(OS)'." />
|
||||||
|
|
||||||
|
<Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see details at https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#game-path." />
|
||||||
|
<Error Condition="'$(OS)' == 'Windows_NT' AND !Exists('$(GamePath)\Stardew Valley.exe')" Text="The mod build package found a a game folder at $(GamePath), but it doesn't contain the Stardew Valley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
|
||||||
|
<Error Condition="'$(OS)' != 'Windows_NT' AND !Exists('$(GamePath)\StardewValley.exe')" Text="The mod build package found a a game folder at $(GamePath), but it doesn't contain the StardewValley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
|
||||||
|
<Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<!-- deploy mod files & create release zip -->
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
<DeployModTask
|
||||||
|
ModFolderName="$(ModFolderName)"
|
||||||
|
ModZipPath="$(ModZipPath)"
|
||||||
|
|
||||||
|
EnableModDeploy="$(EnableModDeploy)"
|
||||||
|
EnableModZip="$(EnableModZip)"
|
||||||
|
|
||||||
|
ProjectDir="$(ProjectDir)"
|
||||||
|
TargetDir="$(TargetDir)"
|
||||||
|
GameDir="$(GamePath)"
|
||||||
|
/>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
Binary file not shown.
Loading…
Reference in New Issue