Fixed animation code not working.

This commit is contained in:
JoshuaNavarro 2019-12-06 14:05:58 -08:00
parent 69170b6d54
commit aed54a63ff
5 changed files with 74 additions and 6 deletions

View File

@ -9,6 +9,7 @@ using StardustCore.Events.Preconditions;
using StardustCore.Events.Preconditions.TimeSpecific; using StardustCore.Events.Preconditions.TimeSpecific;
using StardewValley; using StardewValley;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using StardustCore.Events.Preconditions.PlayerSpecific;
namespace Omegasis.HappyBirthday.Framework namespace Omegasis.HappyBirthday.Framework
{ {
@ -22,20 +23,34 @@ namespace Omegasis.HappyBirthday.Framework
conditions.Add(new FarmerBirthdayPrecondition()); conditions.Add(new FarmerBirthdayPrecondition());
conditions.Add(new LocationPrecondition(Game1.getLocationFromName("CommunityCenter"))); conditions.Add(new LocationPrecondition(Game1.getLocationFromName("CommunityCenter")));
conditions.Add(new TimePrecondition(600, 2600)); conditions.Add(new TimePrecondition(600, 2600));
//conditions.Add(new HasUnlockedCommunityCenter()); //Infered by the fact that you must enter the community center to trigger this event anyways.
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 32, 16, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>())); EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 32, 16, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
e.AddInJunimoActor("Juni", new Microsoft.Xna.Framework.Vector2(32, 14), Color.Blue); e.AddInJunimoActor("Juni", new Microsoft.Xna.Framework.Vector2(32, 14), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
e.AddInJunimoActor("Juni2", new Microsoft.Xna.Framework.Vector2(30, 15), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
e.AddInJunimoActor("Juni3", new Microsoft.Xna.Framework.Vector2(34, 15), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
e.globalFadeIn(); e.globalFadeIn();
e.moveFarmerUp(6, EventHelper.FacingDirection.Up, false); e.moveFarmerUp(6, EventHelper.FacingDirection.Up, false);
e.ViewportLerpTileOffset(new Microsoft.Xna.Framework.Point(0,-6),60*6,true);
e.moveActorLeft("Juni", 1, EventHelper.FacingDirection.Down, false); //e.moveActorLeft("Juni", 1, EventHelper.FacingDirection.Down, false);
e.animate("Juni", true, true, 70, new List<int>()
{
28,
29,
30,
31
});
//
e.playSound("junimoMeep1"); e.playSound("junimoMeep1");
//e.addObjectToPlayersInventory(64, 22,true); //e.addObjectToPlayersInventory(64, 22,true);
//e.addTemporaryActor_NPC("Junimo", 16, 16, 32, 14, EventHelper.FacingDirection.Down, false); //e.addTemporaryActor_NPC("Junimo", 16, 16, 32, 14, EventHelper.FacingDirection.Down, false);
e.ViewportLerpTileOffset(new Microsoft.Xna.Framework.Point(0, -6), 60 * 6, false);
e.showMessage("Community center birthday here."); e.showMessage("Community center birthday here.");
//Notes //Notes

View File

@ -672,9 +672,9 @@ namespace StardustCore.Events
b.Append("animate "); b.Append("animate ");
b.Append(ActorName); b.Append(ActorName);
b.Append(" "); b.Append(" ");
b.Append(Flip); b.Append(Flip.ToString().ToLowerInvariant());
b.Append(" "); b.Append(" ");
b.Append(Loop); b.Append(Loop.ToString().ToLowerInvariant());
b.Append(" "); b.Append(" ");
b.Append(FrameDuration); b.Append(FrameDuration);
b.Append(" "); b.Append(" ");

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class HasUnlockedCommunityCenter:EventPrecondition
{
public HasUnlockedCommunityCenter()
{
}
public override bool meetsCondition()
{
return Game1.player.eventsSeen.Contains(611439);
}
}
}

View File

@ -608,6 +608,34 @@ namespace StardustCore.IlluminateFramework
return new Color(r, g, b, a); return new Color(r, g, b, a);
} }
/// <summary>
/// Gets a random junimo color from the possible junimo colors.
/// </summary>
/// <returns></returns>
public static Color getRandomJunimoColor()
{
List<Color> colors = new List<Color>();
colors.Add(Color.Red);
colors.Add(Color.Goldenrod);
colors.Add(Color.Yellow);
colors.Add(Color.Lime);
colors.Add(Color.MediumPurple);
colors.Add(Color.Salmon);
colors.Add(Color.White);
colors.Add(Color.LimeGreen);
colors.Add(Color.Orange);
colors.Add(Color.LightGreen);
colors.Add(Color.Tan);
colors.Add(Color.GreenYellow);
colors.Add(Color.LawnGreen);
colors.Add(Color.PaleGreen);
colors.Add(Color.Turquoise);
colors.Add(Color.Gold);
colors.Add(Color.BlanchedAlmond);
colors.Add(new Color(160, 20, 220)); //???
return colors[Game1.random.Next(0, colors.Count)];
}
/// <summary>Invert the color passed in.</summary> /// <summary>Invert the color passed in.</summary>
public static Color invertColor(Color c, int alpha = 255) public static Color invertColor(Color c, int alpha = 255)
{ {

View File

@ -114,6 +114,7 @@
<Compile Include="Events\Preconditions\PlayerSpecific\HasItem.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\HasItem.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasNotRecievedLetter.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\HasNotRecievedLetter.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasRecievedLetter.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\HasRecievedLetter.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasUnlockedCommunityCenter.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\MineBottomHit.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\MineBottomHit.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\NotDatingAnyone.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\NotDatingAnyone.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\PetPreference.cs" /> <Compile Include="Events\Preconditions\PlayerSpecific\PetPreference.cs" />