Update info.
|
@ -66,12 +66,13 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
<PackageReference Include="SharpZipLib">
|
||||
<Version>1.2.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -5,5 +5,14 @@ namespace Omegasis.SaveBackup.Framework
|
|||
{
|
||||
/// <summary>The number of save backups to keep for each type.</summary>
|
||||
public int SaveCount { get; set; } = 30;
|
||||
|
||||
public bool UseZipCompression { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Change this to change where your saves back up.
|
||||
/// </summary>
|
||||
public string AlternateNightlySaveBackupPath { get; set; } = "";
|
||||
|
||||
public string AlternatePreplaySaveBackupPath { get; set; } = "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
||||
using System.Linq;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Omegasis.SaveBackup.Framework;
|
||||
using StardewModdingAPI;
|
||||
using StardewModdingAPI.Events;
|
||||
|
@ -39,7 +41,14 @@ namespace Omegasis.SaveBackup
|
|||
{
|
||||
this.Config = helper.ReadConfig<ModConfig>();
|
||||
|
||||
if (string.IsNullOrEmpty(this.Config.AlternatePreplaySaveBackupPath) == false)
|
||||
{
|
||||
this.BackupSaves(this.Config.AlternatePreplaySaveBackupPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackupSaves(SaveBackup.PrePlayBackupsPath);
|
||||
}
|
||||
|
||||
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||
}
|
||||
|
@ -52,19 +61,39 @@ namespace Omegasis.SaveBackup
|
|||
/// <param name="sender">The event sender.</param>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private void OnSaving(object sender, SavingEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.Config.AlternateNightlySaveBackupPath) == false)
|
||||
{
|
||||
this.BackupSaves(this.Config.AlternateNightlySaveBackupPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackupSaves(SaveBackup.NightlyBackupsPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Back up saves to the specified folder.</summary>
|
||||
/// <param name="folderPath">The folder path in which to generate saves.</param>
|
||||
private void BackupSaves(string folderPath)
|
||||
{
|
||||
// back up saves
|
||||
Directory.CreateDirectory(folderPath);
|
||||
ZipFile.CreateFromDirectory(SaveBackup.SavesPath, Path.Combine(folderPath, $"backup-{DateTime.Now:yyyyMMdd'-'HHmmss}.zip"));
|
||||
if (this.Config.UseZipCompression == false)
|
||||
{
|
||||
|
||||
// delete old backups
|
||||
DirectoryCopy(SaveBackup.SavesPath, Path.Combine(folderPath, $"backup-{DateTime.Now:yyyyMMdd'-'HHmmss}"), true);
|
||||
new DirectoryInfo(folderPath)
|
||||
.EnumerateDirectories()
|
||||
.OrderByDescending(f => f.CreationTime)
|
||||
.Skip(this.Config.SaveCount)
|
||||
.ToList()
|
||||
.ForEach(dir => dir.Delete(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
FastZip fastZip = new FastZip();
|
||||
fastZip.UseZip64 = UseZip64.Off;
|
||||
bool recurse = true; // Include all files by recursing through the directory structure
|
||||
string filter = null; // Dont filter any files at all
|
||||
fastZip.CreateZip(Path.Combine(folderPath, $"backup-{DateTime.Now:yyyyMMdd'-'HHmmss}.zip"), SaveBackup.SavesPath, recurse, filter);
|
||||
new DirectoryInfo(folderPath)
|
||||
.EnumerateFiles()
|
||||
.OrderByDescending(f => f.CreationTime)
|
||||
|
@ -72,5 +101,82 @@ namespace Omegasis.SaveBackup
|
|||
.ToList()
|
||||
.ForEach(file => file.Delete());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// back up saves This used compression but it always causes a library loading issue for OS
|
||||
Directory.CreateDirectory(folderPath);
|
||||
ZipFile.CreateFromDirectory(SaveBackup.SavesPath, Path.Combine(folderPath, $"backup-{DateTime.Now:yyyyMMdd'-'HHmmss}.zip"));
|
||||
|
||||
// delete old backups
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An uncompressed output method.
|
||||
/// </summary>
|
||||
/// <param name="sourceDirName"></param>
|
||||
/// <param name="destDirName"></param>
|
||||
/// <param name="copySubDirs"></param>
|
||||
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
|
||||
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException(
|
||||
"Source directory does not exist or could not be found: "
|
||||
+ sourceDirName);
|
||||
}
|
||||
|
||||
DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
// If the destination directory doesn't exist, create it.
|
||||
if (!Directory.Exists(destDirName))
|
||||
{
|
||||
Directory.CreateDirectory(destDirName);
|
||||
}
|
||||
|
||||
// Get the files in the directory and copy them to the new location.
|
||||
FileInfo[] files = dir.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
string temppath = Path.Combine(destDirName, file.Name);
|
||||
file.CopyTo(temppath, false);
|
||||
}
|
||||
|
||||
// If copying subdirectories, copy them and their contents to new location.
|
||||
if (copySubDirs)
|
||||
{
|
||||
foreach (DirectoryInfo subdir in dirs)
|
||||
{
|
||||
string temppath = Path.Combine(destDirName, subdir.Name);
|
||||
DirectoryCopy(subdir.FullName, temppath, copySubDirs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///<summary>
|
||||
///<see cref="https://github.com/Pathoschild/SMAPI/blob/develop/src/SMAPI.Mods.SaveBackup/ModEntry.cs"/>>
|
||||
///This code originated from Pathoschilds SMAPI SaveBackup Mod. All rights for this code goes to them. If this code is not allowed to be here *please* contact Omegasis to discus a proper work around.
|
||||
/// Create a zip using a process command on MacOS.
|
||||
/// <param name="sourcePath">The file or directory path to zip.</param>
|
||||
/// <param name="destination">The destination file to create.</param>
|
||||
/// </summary>
|
||||
private void CompressUsingMacProcess(string sourcePath, FileInfo destination)
|
||||
{
|
||||
DirectoryInfo saveFolder = new DirectoryInfo(sourcePath);
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "zip",
|
||||
Arguments = $"-rq \"{destination.FullName}\" \"{saveFolder.Name}\" -x \"*.DS_Store\" -x \"__MACOSX\"",
|
||||
WorkingDirectory = $"{saveFolder.FullName}/../",
|
||||
CreateNoWindow = true
|
||||
};
|
||||
new Process { StartInfo = startInfo }.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Advanced Save Backup",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.7.1",
|
||||
"Version": "1.8.0",
|
||||
"Description": "Backs up your save files when loading SMAPI and every in game night when saving.",
|
||||
"UniqueID": "Omegasis.AdvancedSaveBackup",
|
||||
"EntryDll": "AdvancedSaveBackup.dll",
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="StardustCore">
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -532,6 +532,11 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
return new Vector2(globalPosition.X - (float)SeasideScramble.self.camera.viewport.X, globalPosition.Y - (float)SeasideScramble.self.camera.viewport.Y);
|
||||
}
|
||||
|
||||
public bool forceQuit()
|
||||
{
|
||||
this.quitGame = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
namespace Revitalize.Framework.Networking
|
||||
{
|
||||
public class NetClass: INetSerializable, IComparable
|
||||
{
|
||||
/// <summary>
|
||||
/// Strictly used for value types that haven't been casted to NetSerializableObjects
|
||||
/// </summary>
|
||||
public static Dictionary<Type, Type> CastingTypes = new Dictionary<Type, Type>()
|
||||
{
|
||||
{ typeof(string), typeof(NetString) },
|
||||
{typeof(int),typeof(NetInt)},
|
||||
{ typeof(char), typeof(NetChar) },
|
||||
{ typeof(bool), typeof(NetBool) },
|
||||
{ typeof(float), typeof(NetFloat) },
|
||||
{ typeof(double), typeof(NetDouble) },
|
||||
{ typeof(byte), typeof(NetByte) },
|
||||
{ typeof(sbyte), typeof(NetSByte) },
|
||||
{ typeof(Color32), typeof(NetColor32) },
|
||||
{ typeof(Color), typeof(NetColor) },
|
||||
{ typeof(Vector3), typeof(NetVector3) },
|
||||
{ typeof(Vector2), typeof(NetVector2) },
|
||||
{ typeof(Rect), typeof(NetRectangle) },
|
||||
{ typeof(short), typeof(NetShort) },
|
||||
{ typeof(ushort), typeof(NetUShort) },
|
||||
{ typeof(long), typeof(NetLong) },
|
||||
{ typeof(ulong), typeof(NetULong) },
|
||||
{ typeof(uint), typeof(NetUInt) },
|
||||
};
|
||||
|
||||
|
||||
public NetDictionary<NetString, NetString> extraVariables;
|
||||
|
||||
private Guid _guid;
|
||||
|
||||
public virtual Guid GUID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._guid == Guid.Empty)
|
||||
{
|
||||
this._guid = Guid.NewGuid();
|
||||
}
|
||||
return this._guid;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._guid = value;
|
||||
}
|
||||
}
|
||||
|
||||
public NetClass()
|
||||
{
|
||||
this._guid = Guid.NewGuid();
|
||||
}
|
||||
|
||||
|
||||
public virtual void Deserialize(NetDataReader reader)
|
||||
{
|
||||
if (extraVariables == null) this.extraVariables = new NetDictionary<NetString, NetString>();
|
||||
this.extraVariables.Deserialize(reader);
|
||||
this.GUID = reader.GetGuid();
|
||||
}
|
||||
|
||||
public virtual void Serialize(NetDataWriter writer)
|
||||
{
|
||||
if (extraVariables == null) this.extraVariables = new NetDictionary<NetString, NetString>();
|
||||
this.extraVariables.Serialize(writer);
|
||||
writer.Put(this.GUID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an extra variable to the net class.
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="obj"></param>
|
||||
public virtual void addExtraVariable(string Key, object obj)
|
||||
{
|
||||
NetString str = GameManager.Self.serializer.ToJSONString(obj);
|
||||
if (this.extraVariables == null)
|
||||
{
|
||||
this.extraVariables = new NetDictionary<NetString, NetString>();
|
||||
}
|
||||
this.extraVariables.Add(Key, str);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the extra variable from the net class.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
public virtual T getExtraVariable<T>(string Key)
|
||||
{
|
||||
if (this.extraVariables.ContainsKey(Key))
|
||||
{
|
||||
T obj = GameManager.Self.serializer.DeserializeFromJSONString<T>(this.extraVariables[Key]);
|
||||
return obj;
|
||||
}
|
||||
else return default(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes an extra variable added to this net class.
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool removeExtraVariable(string Key)
|
||||
{
|
||||
return this.extraVariables.Remove(Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attemps to cast data that does not inherit from NetSerializableObject to their respective NetSerializable types. Should really only be used for C# value types and some Unity Engine Types.
|
||||
/// </summary>
|
||||
/// <param name="Data"></param>
|
||||
/// <returns></returns>
|
||||
public static NetClass CastNonNetData(object Data)
|
||||
{
|
||||
Type nonNetType = Data.GetType();
|
||||
if (CastingTypes.ContainsKey(nonNetType))
|
||||
{
|
||||
Type netType = CastingTypes[Data.GetType()];
|
||||
object v = Activator.CreateInstance(netType, new object[] { Data });
|
||||
return (NetClass)v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(NetDataReader Reader) where T : NetClass, new()
|
||||
{
|
||||
Type nonNetType = typeof(T);
|
||||
if (CastingTypes.ContainsKey(nonNetType))
|
||||
{
|
||||
object v = Activator.CreateInstance(nonNetType, new object[] { });
|
||||
return (T)v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual int CompareTo(object obj)
|
||||
{
|
||||
if (obj == null) return 1;
|
||||
|
||||
NetClass other = obj as NetClass;
|
||||
if (other != null)
|
||||
return this.GUID.CompareTo(other.GUID);
|
||||
else
|
||||
throw new ArgumentException("Object is not a valid Net matching class!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -285,7 +285,7 @@ namespace Revitalize.Framework.Objects
|
|||
: base.getBoundingBox(tileLocation);
|
||||
}
|
||||
|
||||
public override int sellToStorePrice()
|
||||
public override int sellToStorePrice(long PlayerID=-1)
|
||||
{
|
||||
return this.Price;
|
||||
}
|
||||
|
@ -712,6 +712,7 @@ namespace Revitalize.Framework.Objects
|
|||
return base.canStackWith(other);
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// PyTk Functions //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
|
|
@ -424,11 +424,6 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <returns>An object of specified type T.</returns>
|
||||
public T Deserialize<T>(string p)
|
||||
{
|
||||
string json = "";
|
||||
foreach (string line in File.ReadLines(p))
|
||||
{
|
||||
json += line;
|
||||
}
|
||||
using (StreamReader sw = new StreamReader(p))
|
||||
using (JsonReader reader = new JsonTextReader(sw))
|
||||
{
|
||||
|
@ -446,11 +441,6 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <returns>An object of specified type T.</returns>
|
||||
public object Deserialize(string p, Type T)
|
||||
{
|
||||
string json = "";
|
||||
foreach (string line in File.ReadLines(p))
|
||||
{
|
||||
json += line;
|
||||
}
|
||||
using (StreamReader sw = new StreamReader(p))
|
||||
using (JsonReader reader = new JsonTextReader(sw))
|
||||
{
|
||||
|
|
|
@ -34,9 +34,12 @@
|
|||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="LiteNetLib">
|
||||
<HintPath>..\..\..\LiteNetLib\LiteNetLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PyTK">
|
||||
<HintPath>$(GamePath)\Mods\PyTK\PyTK.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -663,6 +666,7 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Framework\Networking\" />
|
||||
<Folder Include="Framework\Objects\InformationFiles\Extras\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="NAudio" Version="1.8.5" />
|
||||
<PackageReference Include="NAudio.Vorbis" Version="1.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace StardustCore.Animations
|
|||
public int frameDuration;
|
||||
|
||||
/// <summary>The duration until the next frame.</summary>
|
||||
public int frameCountUntilNextAnimation;
|
||||
private int frameCountUntilNextAnimation;
|
||||
|
||||
|
||||
[XmlIgnore]
|
||||
public NetFields NetFields { get; } = new NetFields();
|
||||
|
@ -67,5 +68,9 @@ namespace StardustCore.Animations
|
|||
{
|
||||
this.frameCountUntilNextAnimation = this.frameDuration;
|
||||
}
|
||||
public bool finished()
|
||||
{
|
||||
return this.frameCountUntilNextAnimation == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace StardustCore.Animations
|
|||
{
|
||||
public Dictionary<string, List<Animation>> animations = new SerializableDictionary<string, List<Animation>>();
|
||||
public string currentAnimationName;
|
||||
public int currentAnimationListIndex;
|
||||
private int currentAnimationListIndex;
|
||||
public List<Animation> currentAnimationList = new List<Animation>();
|
||||
public Texture2DExtended objectTexture; ///Might not be necessary if I use the CoreObject texture sheet.
|
||||
public Animation defaultDrawFrame;
|
||||
|
@ -126,7 +126,7 @@ namespace StardustCore.Animations
|
|||
{
|
||||
if (this.currentAnimation.frameDuration == -1 || !this.enabled || this.currentAnimation == this.defaultDrawFrame)
|
||||
return; //This is if this is a default animation or the animation stops here.
|
||||
if (this.currentAnimation.frameCountUntilNextAnimation == 0)
|
||||
if (this.currentAnimation.finished())
|
||||
this.getNextAnimationFrame();
|
||||
this.currentAnimation.tickAnimationFrame();
|
||||
//this.requiresUpdate = true;
|
||||
|
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 244 B After Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |