Tons of 1.3 updates. Also support for multiplayer custom objects in Stardust is slowly coming about!

This commit is contained in:
2018-08-06 14:01:44 -07:00
parent 0cf9b68560
commit 3af2da68fa
25 changed files with 415 additions and 71 deletions

View File

@ -189,7 +189,7 @@ namespace Omegasis.HappyBirthday
{
if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival())
return;
if (!this.HasChosenBirthday && Game1.activeClickableMenu == null)
if (!this.HasChosenBirthday && Game1.activeClickableMenu == null && Game1.player.Name.ToLower()!="unnamed farmhand")
{
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
this.CheckedForBirthday = false;
@ -362,6 +362,16 @@ namespace Omegasis.HappyBirthday
Random rnd2 = new Random();
int r2 = rnd2.Next(this.PossibleBirthdayGifts.Count);
gift = this.PossibleBirthdayGifts.ElementAt(r2);
//Attempt to balance sapplings from being too OP as a birthday gift.
if (gift.Name.Contains("Sapling"))
{
gift.Stack = 1; //A good investment?
}
if(gift.Name.Contains("Rare Seed"))
{
gift.Stack = 2; //Still a little op but less so than 5.
}
if (Game1.player.isInventoryFull())
Game1.createItemDebris(gift, Game1.player.getStandingPosition(), Game1.player.getDirection());
else

View File

@ -3,8 +3,8 @@
"Author": "Alpha_Omegasis",
"Version": {
"MajorVersion": 1,
"MinorVersion": 6,
"PatchVersion": 0,
"MinorVersion": 7,
"PatchVersion": 1,
"Build": null
},
"MinimumApiVersion": "1.15",

View File

@ -9,11 +9,24 @@ namespace Omegasis.SaveAnywhere.API
public event EventHandler AfterSave;
public event EventHandler AfterLoad;
public SaveAnywhereAPI(SaveManager manager)
{
BeforeSave = new EventHandler(empty);
AfterSave= new EventHandler(empty);
AfterLoad= new EventHandler(empty);
manager.BeforeSave += (sender, e) => { BeforeSave.Invoke(sender, e); };
manager.AfterSave += (sender, e) => { AfterSave.Invoke(sender, e); };
manager.AfterLoad += (sender, e) => { AfterLoad.Invoke(sender, e); };
}
/// <summary>
/// Used to initialize empty event handlers.
/// </summary>
/// <param name="o"></param>
/// <param name="args"></param>
private void empty(object o, EventArgs args){
}
}
}

View File

@ -63,6 +63,16 @@ namespace Omegasis.SaveAnywhere.Framework
this.Helper = helper;
this.Reflection = reflection;
this.OnLoaded = onLoaded;
this.BeforeSave = new EventHandler(empty);
this.AfterSave = new EventHandler(empty);
this.AfterLoad = new EventHandler(empty);
}
private void empty(object o, EventArgs args)
{
}
/// <summary>Perform any required update logic.</summary>
@ -87,8 +97,8 @@ namespace Omegasis.SaveAnywhere.Framework
{
currentSaveMenu.SaveComplete -= CurrentSaveMenu_SaveComplete;
currentSaveMenu = null;
AfterSave.Invoke(this, EventArgs.Empty);
}
/// <summary>Clear saved data.</summary>
@ -155,6 +165,7 @@ namespace Omegasis.SaveAnywhere.Framework
// Notify other mods that load is complete
AfterLoad.Invoke(this, EventArgs.Empty);
}
/// <summary>

View File

@ -79,10 +79,12 @@ namespace Omegasis.SaveAnywhere
return api;
}
/*Notes. Mods that want to support save anywhere will get the api for Save anywhere and then add their clean up code to the events that happen for Before/After Save and Loading.
Example with pseudo code.
SaveAnywhere.api.BeforeSave+=StardustCore.Objects.CleanUpBeforeSave;
We then can use function wrapping (is that what it's called?) to just handle calling the actual function that deals with clean-up code.
*/
/*********
** Private methods
*********/

View File

@ -1,7 +1,7 @@
{
"Name": "Save Anywhere",
"Author": "Alpha_Omegasis",
"Version": "2.7.2",
"Version": "2.8.1",
"Description": "Lets you save almost anywhere.",
"UniqueID": "Omegasis.SaveAnywhere",
"EntryDll": "SaveAnywhere.dll",

View File

@ -32,5 +32,9 @@ namespace SimpleSoundManager.Framework
/// </summary>
/// <returns></returns>
Sound clone();
string getSoundName();
bool isStopped();
}
}

View File

@ -9,18 +9,14 @@ using System.Threading.Tasks;
namespace SimpleSoundManager.Framework
{
/// <summary>
/// TODO:
/// Play, stop, pause songs.
/// </summary>
class SoundManager
public class SoundManager
{
public Dictionary<string,Sound> sounds;
public Dictionary<string, XACTMusicPair> musicBanks;
public List<Sound> currentlyPlayingSounds = new List<Sound>();
/// <summary>
/// Constructor for this class.
/// </summary>
@ -28,6 +24,7 @@ namespace SimpleSoundManager.Framework
{
this.sounds = new Dictionary<string, Sound>();
this.musicBanks = new Dictionary<string, XACTMusicPair>();
currentlyPlayingSounds = new List<Sound>();
}
/// <summary>
@ -37,7 +34,7 @@ namespace SimpleSoundManager.Framework
/// <param name="pathToWav"></param>
public void loadWavFile(string soundName,string pathToWav)
{
WavSound wav = new WavSound(pathToWav);
WavSound wav = new WavSound(soundName,pathToWav);
this.sounds.Add(soundName,wav);
}
@ -49,7 +46,7 @@ namespace SimpleSoundManager.Framework
/// <param name="pathToWav"></param>
public void loadWavFile(IModHelper helper,string soundName,string pathToWav)
{
WavSound wav = new WavSound(helper ,pathToWav);
WavSound wav = new WavSound(helper ,soundName,pathToWav);
this.sounds.Add(soundName,wav);
}
@ -61,7 +58,7 @@ namespace SimpleSoundManager.Framework
/// <param name="pathToWav"></param>
public void loadWavFile(IModHelper helper,string songName,List<string> pathToWav)
{
WavSound wav = new WavSound(helper,pathToWav);
WavSound wav = new WavSound(helper,songName,pathToWav);
this.sounds.Add(songName,wav);
}
@ -133,5 +130,92 @@ namespace SimpleSoundManager.Framework
return null;
}
/// <summary>
/// Play the sound with the given name.
/// </summary>
/// <param name="soundName"></param>
public void playSound(string soundName)
{
foreach(var sound in this.sounds)
{
if (sound.Key == soundName)
{
var s=getSoundClone(soundName);
s.play();
this.currentlyPlayingSounds.Add(s);
break;
}
}
}
/// <summary>
/// Stop the sound that is playing.
/// </summary>
/// <param name="soundName"></param>
public void stopSound(string soundName)
{
List<Sound> removalList = new List<Sound>();
foreach (var sound in this.currentlyPlayingSounds)
{
if (sound.getSoundName() == soundName)
{
sound.stop();
removalList.Add(sound);
}
}
foreach(var v in removalList)
{
this.currentlyPlayingSounds.Remove(v);
}
}
/// <summary>
/// Pause the sound with this name?
/// </summary>
/// <param name="soundName"></param>
public void pauseSound(string soundName)
{
List<Sound> removalList = new List<Sound>();
foreach (var sound in this.currentlyPlayingSounds)
{
if (sound.getSoundName() == soundName)
{
sound.pause();
removalList.Add(sound);
}
}
foreach (var v in removalList)
{
this.currentlyPlayingSounds.Remove(v);
}
}
public void update()
{
List<Sound> removalList = new List<Sound>();
foreach(Sound song in this.currentlyPlayingSounds)
{
if (song.isStopped())
{
removalList.Add(song);
}
}
foreach(var v in removalList)
{
this.currentlyPlayingSounds.Remove(v);
}
}
public void stopAllSounds()
{
foreach(var v in this.currentlyPlayingSounds)
{
v.stop();
}
}
}
}

View File

@ -31,20 +31,20 @@ namespace SimpleSoundManager
/// </summary>
byte[] byteArray;
public List<string> sounds;
public string path;
public string soundName;
/// <summary>
/// Get a raw disk path to the wav file.
/// </summary>
/// <param name="pathToWavFile"></param>
public WavSound(string pathToWavFile)
public WavSound(string name,string pathToWavFile)
{
this.path = pathToWavFile;
LoadWavFromFileToStream();
this.soundName = name;
}
/// <summary>
@ -52,10 +52,11 @@ namespace SimpleSoundManager
/// </summary>
/// <param name="modHelper"></param>
/// <param name="pathInModDirectory"></param>
public WavSound(IModHelper modHelper, string pathInModDirectory)
public WavSound(IModHelper modHelper,string name, string pathInModDirectory)
{
string path = Path.Combine(modHelper.DirectoryPath, pathInModDirectory);
this.path = path;
this.soundName = name;
}
/// <summary>
@ -63,7 +64,7 @@ namespace SimpleSoundManager
/// </summary>
/// <param name="modHelper">The mod helper for the mod you wish to use to load the music files from.</param>
/// <param name="pathPieces">The list of folders and files that make up a complete path.</param>
public WavSound(IModHelper modHelper, List<string> pathPieces)
public WavSound(IModHelper modHelper,string soundName, List<string> pathPieces)
{
string s = modHelper.DirectoryPath;
foreach(var str in pathPieces)
@ -71,6 +72,7 @@ namespace SimpleSoundManager
s = Path.Combine(s, str);
}
this.path = s;
this.soundName = soundName;
}
/// <summary>
@ -224,7 +226,12 @@ namespace SimpleSoundManager
public Sound clone()
{
return new WavSound(this.path);
return new WavSound(this.getSoundName(),this.path);
}
public string getSoundName()
{
return this.soundName;
}
public void restart()

View File

@ -130,5 +130,19 @@ namespace SimpleSoundManager.Framework
{
return new XACTSound(this.waveBank, this.soundBank, this.soundName);
}
public string getSoundName()
{
return this.soundName;
}
public bool isStopped()
{
if (this.song == null) return true;
if (this.song.IsStopped) return true;
return false;
}
}
}

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace SimpleSoundManager
{
class XACTMusicPair
public class XACTMusicPair
{
public WaveBank waveBank;
public ISoundBank soundBank;

View File

@ -1,8 +1,8 @@
{
"Name": "Simple Sound Manager",
"Author": "Alpha_Omegasis",
"Version": "2.0.0",
"Description": "A simple framework to play sounds from wave banks.",
"Version": "2.0.1",
"Description": "A simple framework to play sounds from wave banks and wav files.",
"UniqueID": "Omegasis.SimpleSoundManager",
"EntryDll": "SimpleSoundManager.dll",
"MinimumApiVersion": "2.0",

View File

@ -112,7 +112,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (v.Value.musicPackInformation.getTexture() == null)
{
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("MusicDisk");
float scale = 1.00f / ((float)texture.texture.Width / 64f);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
this.musicAlbumButtons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64),texture, "", new Rectangle(0, 0, 16, 16), scale, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.Colors.randomColor(), Color.White,new ButtonFunctionality(new DelegatePairing(null, new List<object>
{
@ -125,8 +125,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
else
{
float scale = 1.00f / ((float)v.Value.musicPackInformation.getTexture().texture.Width / 64f);
this.musicAlbumButtons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), v.Value.musicPackInformation.getTexture(), "", new Rectangle(0, 0, v.Value.musicPackInformation.getTexture().texture.Width, v.Value.musicPackInformation.getTexture().texture.Height), scale, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, StardustCore.IlluminateFramework.LightColorsList.Black, new ButtonFunctionality(new DelegatePairing(null, new List<object>
float scale = 1.00f / ((float)v.Value.musicPackInformation.getTexture().getTexture().Width / 64f);
this.musicAlbumButtons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), v.Value.musicPackInformation.getTexture(), "", new Rectangle(0, 0, v.Value.musicPackInformation.getTexture().getTexture().Width, v.Value.musicPackInformation.getTexture().getTexture().Height), scale, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, StardustCore.IlluminateFramework.LightColorsList.Black, new ButtonFunctionality(new DelegatePairing(null, new List<object>
{
(object)v
}
@ -452,9 +452,9 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("MusicNote");
float scale = 1.00f / ((float)texture.texture.Width / 64f);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Song s = musicPackSongList.ElementAt(i);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(s.name, new Rectangle((int)placement2.X+25, (int)placement2.Y + ((i%6) * 100)+100, 64, 64), texture, s.name, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -472,8 +472,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("GreenBallon");
float scale = 1.00f / ((float)texture.texture.Height / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Height / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.festivals.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.festivals.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -493,8 +493,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("MenuIcon");
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.menus.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.menus.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -512,8 +512,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("StarIcon");
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.events.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.events.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -538,8 +538,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("SPRING TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)springTexture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, springTexture.texture.Width, springTexture.texture.Height);
float scale = 1.00f / ((float)springTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, springTexture.getTexture().Width, springTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), springTexture, "Spring Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
if (Game1.currentSeason == "summer")
@ -552,8 +552,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("SUMMER TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)summerTexture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, summerTexture.texture.Width, summerTexture.texture.Height);
float scale = 1.00f / ((float)summerTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, summerTexture.getTexture().Width, summerTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), summerTexture, "Summer Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
if (Game1.currentSeason == "fall")
@ -566,8 +566,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("FALL TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)fallTexture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, fallTexture.texture.Width, fallTexture.texture.Height);
float scale = 1.00f / ((float)fallTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, fallTexture.getTexture().Width, fallTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), fallTexture, "Fall Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
if (Game1.currentSeason == "winter")
@ -580,8 +580,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("WINTER TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)winterTexture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, winterTexture.texture.Width, winterTexture.texture.Height);
float scale = 1.00f / ((float)winterTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, winterTexture.getTexture().Width, winterTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), winterTexture, "Winter Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -591,8 +591,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Festival Icon placement.
Texture2DExtended festivalTexture = StardewSymphony.textureManager.getTexture("FestivalIcon");
float festivalScale = 1.00f / ((float)festivalTexture.texture.Width / 64f);
Rectangle festivalSrcRect = new Rectangle(0, 0, festivalTexture.texture.Width, festivalTexture.texture.Height);
float festivalScale = 1.00f / ((float)festivalTexture.getTexture().Width / 64f);
Rectangle festivalSrcRect = new Rectangle(0, 0, festivalTexture.getTexture().Width, festivalTexture.getTexture().Height);
this.fancyButtons.Add(new Button("FestivalIcon", new Rectangle((int)festivalPlacement.X, (int)festivalPlacement.Y, 64, 64), festivalTexture, "Festival Music", festivalSrcRect, festivalScale, new Animation(festivalSrcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
if (festivalTexture == null)
{
@ -603,8 +603,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Event Icon placement.
Texture2DExtended eventTexture = StardewSymphony.textureManager.getTexture("EventIcon");
float eventScale = 1.00f / ((float)eventTexture.texture.Width / 64f);
Rectangle eventSrcRectangle = new Rectangle(0, 0, eventTexture.texture.Width, eventTexture.texture.Height);
float eventScale = 1.00f / ((float)eventTexture.getTexture().Width / 64f);
Rectangle eventSrcRectangle = new Rectangle(0, 0, eventTexture.getTexture().Width, eventTexture.getTexture().Height);
this.fancyButtons.Add(new Button("EventIcon", new Rectangle((int)eventPlacement.X, (int)eventPlacement.Y, 64, 64), eventTexture, "Event Music", eventSrcRectangle, eventScale, new Animation(eventSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
if (eventTexture == null)
@ -616,8 +616,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Menu Icon placement.
Texture2DExtended menuTexture = StardewSymphony.textureManager.getTexture("MenuIcon");
float menuScale = 1.00f / ((float)menuTexture.texture.Width / 64f);
Rectangle menuSrcRectangle = new Rectangle(0, 0, menuTexture.texture.Width, menuTexture.texture.Height);
float menuScale = 1.00f / ((float)menuTexture.getTexture().Width / 64f);
Rectangle menuSrcRectangle = new Rectangle(0, 0, menuTexture.getTexture().Width, menuTexture.getTexture().Height);
this.fancyButtons.Add(new Button("MenuIcon", new Rectangle((int)menuPlacement.X, (int)menuPlacement.Y, 64, 64), menuTexture, "Menu Music", menuSrcRectangle, menuScale, new Animation(menuSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
if (menuTexture == null)
@ -705,8 +705,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
display = "Wedding Music";
}
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -742,8 +742,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
StardewSymphony.ModMonitor.Log("HMM A TEXTURE IS NULL: " + i.ToString());
}
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -777,8 +777,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
numOfEmptyCabin++;
}
Texture2DExtended texture2 = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale2 = 1.00f / ((float)texture2.texture.Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.texture.Width, texture2.texture.Height);
float scale2 = 1.00f / ((float)texture2.getTexture().Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.getTexture().Width, texture2.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture2, displayName, srcRect2, scale2, new Animation(srcRect2), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
continue;
}
@ -787,8 +787,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
string displayName = "Empty Cabin "+(numOfEmptyCabin);
numOfEmptyCabin++;
Texture2DExtended texture2 = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale2 = 1.00f / ((float)texture2.texture.Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.texture.Width, texture2.texture.Height);
float scale2 = 1.00f / ((float)texture2.getTexture().Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.getTexture().Width, texture2.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture2, displayName, srcRect2, scale2, new Animation(srcRect2), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
continue;
}
@ -802,8 +802,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, locName, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -866,8 +866,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
display = "Saturday Music";
}
float scale = 1.00f / ((float)texture.texture.Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.texture.Width, texture.texture.Height);
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}

View File

@ -67,6 +67,7 @@ namespace StardewSymphonyRemastered.Framework
public void updateTimer()
{
if (this.currentMusicPack == null) return;
if (this.currentMusicPack.isPlaying()) return;
else
{

View File

@ -216,7 +216,7 @@ namespace StardewSymphonyRemastered
/// <param name="e"></param>
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
{
if (e.KeyPressed.ToString() == Config.KeyBinding)
if (e.KeyPressed.ToString() == Config.KeyBinding && Game1.activeClickableMenu==null)
{
Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
}

View File

@ -240,6 +240,7 @@
<Folder Include="Content\Music\XACT\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.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>

View File

@ -61,6 +61,7 @@ namespace StardustCore
{
SerializationManager.restoreAllModObjects(SerializationManager.trackedObjectList);
List<KeyValuePair<Vector2, MultiTileComponent>> objs = new List<KeyValuePair<Vector2, MultiTileComponent>>();
/*
MultiTileComponent tile1 = new MultiTileComponent(0,"Tileobj1","A basic tile obj",new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test1.png")));
MultiTileComponent tile2 = new MultiTileComponent(0,"Tileobj2", "A basic tile obj", new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test2.png")));
MultiTileComponent tile3 = new MultiTileComponent(0,"Tileobj3", "A basic tile obj", new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test3.png")));
@ -69,8 +70,14 @@ namespace StardustCore
objs.Add(new KeyValuePair<Vector2, MultiTileComponent>(new Vector2(2, 0), tile3));
MultiTileObject collection= new MultiTileObject("MultiTest", "Trying to get multi object testing working", Vector2.Zero, new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test3.png")), objs, StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.LightColorsList.Purple), "MultiTest");
*/
Game1.player.addItemToInventory(collection);
// Game1.player.addItemToInventory(collection);
CoreObject tile1 = new CoreObject(new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test1.png")),0, Vector2.Zero,9);
tile1.description = "Hello";
tile1.Name = "test";
tile1.displayName = "test";
Game1.player.addItemToInventory(tile1);
}
private void SaveEvents_AfterSave(object sender, EventArgs e)

View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using Netcode;
using StardustCore.UIUtilities;
namespace StardustCore.NetCode
{
class NetCoreObject : Netcode.NetField<CoreObject,NetCoreObject>
{
public NetTexture2DExtended texture;
public NetInt which;
public NetVector2 tilePos;
public NetInt InventoryMaxSize;
public NetRectangle sourceRect;
public NetRectangle boundingBox;
public NetCoreObject()
{
}
public NetCoreObject(CoreObject value) : base(value)
{
}
protected override void ReadDelta(BinaryReader reader, NetVersion version)
{
texture = new NetTexture2DExtended();
texture.Read(reader, version);
Value.setExtendedTexture(texture.Value);
which = new NetInt();
which.Read(reader, version);
Value.ParentSheetIndex = which.Value;
tilePos = new NetVector2();
tilePos.Read(reader, version);
Value.TileLocation = tilePos.Value;
InventoryMaxSize = new NetInt();
InventoryMaxSize.Read(reader, version);
Value.inventoryMaxSize = InventoryMaxSize.Value;
sourceRect = new NetRectangle();
sourceRect.Read(reader, version);
Value.sourceRect = sourceRect.Value;
boundingBox = new NetRectangle();
boundingBox.Read(reader, version);
Value.boundingBox.Value = boundingBox.Value;
}
protected override void WriteDelta(BinaryWriter writer)
{
texture = new NetTexture2DExtended(Value.getExtendedTexture());
texture.Write(writer);
which = new NetInt(Value.ParentSheetIndex);
which.Write(writer);
tilePos = new NetVector2(Value.TileLocation);
tilePos.Write(writer);
InventoryMaxSize = new NetInt(Value.inventoryMaxSize);
InventoryMaxSize.Write(writer);
sourceRect = new NetRectangle(Value.sourceRect);
sourceRect.Write(writer);
boundingBox = new NetRectangle(Value.boundingBox.Value);
sourceRect.Write(writer);
}
}
}

View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Netcode;
using StardewValley;
using StardustCore.UIUtilities;
namespace StardustCore.NetCode
{
public class NetTexture2DExtended : Netcode.NetField<UIUtilities.Texture2DExtended, NetTexture2DExtended>
{
public string Name;
public Texture2D texture;
public string path;
public int width;
public int height;
public NetTexture2DExtended()
{
}
public NetTexture2DExtended(Texture2DExtended value) : base(value)
{
}
protected override void ReadDelta(BinaryReader reader, NetVersion version)
{
int width = reader.ReadInt32();
int height = reader.ReadInt32();
Byte[] colorsOne = new byte[width*height*4];
colorsOne = reader.ReadBytes(width*height*4);
texture = new Texture2D(Game1.graphics.GraphicsDevice,width,height);
texture.SetData(colorsOne);
string Name = reader.ReadString();
string path = reader.ReadString();
if (version.IsPriorityOver(this.ChangeVersion))
{
this.CleanSet(new UIUtilities.Texture2DExtended(ModCore.ModHelper, path),true);
}
}
protected override void WriteDelta(BinaryWriter writer)
{
int size = base.Value.getTexture().Width * base.Value.getTexture().Height * 4;
writer.Write(base.Value.getTexture().Width);
writer.Write(base.Value.getTexture().Height);
//writer.Write(size);
texture = Value.getTexture();
Byte[] colorsOne = new byte[size]; //The hard to read,1D array
texture.GetData(colorsOne);
writer.Write(colorsOne);
writer.Write(base.Value.Name);
writer.Write(base.Value.path);
}
}
}

View File

@ -104,16 +104,20 @@ namespace StardustCore
lightColor = Color.Black;
thisType = this.GetType().ToString();
this.NetFields.AddField(new NetCode.NetCoreObject(this));
}
public CoreObject()
{
this.updateDrawPosition();
this.NetFields.AddField(new NetCode.NetCoreObject(this));
}
public CoreObject(bool f)
{
//does nothng
this.NetFields.AddField(new NetCode.NetCoreObject(this));
}
public CoreObject(Texture2DExtended texture,int which, Vector2 Tile, int InventoryMaxSize)
@ -1286,11 +1290,16 @@ namespace StardustCore
{
if (x == -1)
{
//ERROR IS HERE?!?!?!?!?
if (TextureSheet == null)
{
ModCore.ModMonitor.Log("WHY IS EX TEXT NULL?????");
}
spriteBatch.Draw(TextureSheet.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
}
else
{
spriteBatch.Draw(TextureSheet.getTexture(), Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
spriteBatch.Draw(TextureSheet.getTexture(), Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize))), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
}
if (this.heldObject.Value != null)
{
@ -1492,6 +1501,11 @@ namespace StardustCore
{
return this.TextureSheet;
}
public virtual void setExtendedTexture(Texture2DExtended texture)
{
this.TextureSheet = texture;
}
}
}

View File

@ -15,6 +15,11 @@ namespace StardustCore.Objects
//Pass in different function pointers that return bool to check if this default code will run. If not
public MultiTileObject containerObject;
public MultiTileComponent()
{
//this.TextureSheet = new Texture2DExtended();
this.NetFields.AddField(new NetCode.NetTexture2DExtended(this.getExtendedTexture()));
}
public MultiTileComponent(CoreObject part)
{
@ -28,6 +33,8 @@ namespace StardustCore.Objects
}
this.defaultBoundingBox = new Rectangle(0, 0, 16, 16);
this.boundingBox.Value = new Rectangle((int)0 * Game1.tileSize, (int)0* Game1.tileSize, 1 * Game1.tileSize, 1 * Game1.tileSize);
this.NetFields.AddField(new NetCode.NetTexture2DExtended(this.getExtendedTexture()));
}
public MultiTileComponent(int which,String name, String description, Texture2DExtended texture)
@ -44,6 +51,8 @@ namespace StardustCore.Objects
this.defaultSourceRect = this.sourceRect;
this.serializationName = this.GetType().ToString();
this.ParentSheetIndex = which;
this.NetFields.AddField(new NetCode.NetTexture2DExtended(this.getExtendedTexture()));
}
public MultiTileComponent(int which,String name, String description, Animations.AnimationManager animationManager)
@ -61,6 +70,8 @@ namespace StardustCore.Objects
this.defaultSourceRect = this.sourceRect;
this.serializationName = this.GetType().ToString();
this.ParentSheetIndex = which;
this.NetFields.AddField(new NetCode.NetTexture2DExtended(this.getExtendedTexture()));
}
public override bool clicked(Farmer who)
@ -148,6 +159,12 @@ namespace StardustCore.Objects
//The actual planter box being drawn.
if (animationManager == null)
{
if (this.TextureSheet == null)
{
ModCore.ModMonitor.Log("Tex Extended is null???");
}
spriteBatch.Draw(this.TextureSheet.getTexture(), Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
// Log.AsyncG("ANIMATION IS NULL?!?!?!?!");
}

View File

@ -4,7 +4,9 @@ using StardewValley;
using StardustCore.UIUtilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
@ -16,6 +18,11 @@ namespace StardustCore.Objects
public Color categoryColor;
public String categoryName;
public MultiTileObject()
{
}
public MultiTileObject(String Name, String Description,Vector2 tile, Texture2DExtended texture, List<KeyValuePair<Vector2, MultiTileComponent>> Objects, Color CategoryColor, String CategoryName) :base(texture,0,tile,0)
{
this.objects = Objects;
@ -197,7 +204,7 @@ namespace StardustCore.Objects
if (animationManager == null)
{
//FIX SCALE SIZE AND POSITION APPROPRIATELY DEPENDING ON # OF OBJECTS!!!
aosdkpoasdopjsa
//fsfsd
spriteBatch.Draw(v.Value.getExtendedTexture().getTexture(), location+new Vector2(v.Key.X*16,v.Key.Y*16), this.defaultSourceRect, Color.White * transparency, 0f, new Vector2(0, 0), 1, SpriteEffects.None, layerDepth);
}
else

View File

@ -89,6 +89,8 @@
<Compile Include="Interfaces\IToolSerializer.cs" />
<Compile Include="Math\Hex.cs" />
<Compile Include="Math\Hex32.cs" />
<Compile Include="NetCode\NetCoreObject.cs" />
<Compile Include="NetCode\NetTexure2DExtended.cs" />
<Compile Include="Objects\MultiTileComponent.cs" />
<Compile Include="Objects\MultiTileObject.cs" />
<Compile Include="Objects\Tools\BasicToolInfo.cs" />

View File

@ -49,7 +49,7 @@ namespace Omegasis.TimeFreeze
/// <param name="location">The location to check.</param>
private bool ShouldFreezeTime(StardewValley.Farmer player, GameLocation location)
{
if (location.Name == "Mine" || location.Name == "SkullCave" || location.Name == "UndergroundMine" || location.IsOutdoors)
if (location.Name == "Mine" || location.Name == "SkullCave"|| location.Name.StartsWith("SkullCave") || location.Name.StartsWith("UndergroundMine") || location.IsOutdoors)
return false;
if (player.swimming.Value)
{

View File

@ -1,7 +1,7 @@
{
"Name": "Time Freeze",
"Author": "Alpha_Omegasis",
"Version": "1.3.0",
"Version": "1.4.0",
"Description": "Emulates old Harvest Moon-style games where time is frozen inside.",
"UniqueID": "Omegasis.TimeFreeze",
"EntryDll": "TimeFreeze.dll",