Fixed continuous events causing an error when finished. Found out code to add in junimos as actors.

This commit is contained in:
JoshuaNavarro 2019-12-06 11:34:58 -08:00
parent b553aff0d2
commit 2609f3339a
4 changed files with 140 additions and 5 deletions

View File

@ -16,6 +16,7 @@ namespace Omegasis.HappyBirthday.Framework
public static EventHelper CommunityCenterBirthday()
{
//TODO Junimos
List<EventPrecondition> conditions = new List<EventPrecondition>();
conditions.Add(new FarmerBirthdayPrecondition());
conditions.Add(new LocationPrecondition(Game1.getLocationFromName("CommunityCenter")));
@ -24,12 +25,104 @@ namespace Omegasis.HappyBirthday.Framework
e.globalFadeIn();
e.moveFarmerUp(6, EventHelper.FacingDirection.Up, false);
e.ViewportLerpTileOffset(new Microsoft.Xna.Framework.Point(0,-6),60*6,true);
e.addObjectToPlayersInventory(64, 22,true);
//e.addObjectToPlayersInventory(64, 22,true);
e.addTemporaryActor_NPC("Junimo", 16, 16, 32, 14, EventHelper.FacingDirection.Down, false);
e.actorJump("Junimo");
e.showMessage("Community center birthday here.");
//Notes
//Add a temporary actor (or sprite) to the screen.
//Use the attachCharacterToTempSprite command to stitch them together?
/*
*
*
* else if (strArray[index].Equals("Junimo"))
{
List<NPC> actors = this.actors;
Junimo junimo = new Junimo(new Vector2((float)(Convert.ToInt32(strArray[index + 1]) * 64), (float)(Convert.ToInt32(strArray[index + 2]) * 64 - 32)), Game1.currentLocation.Name.Equals("AbandonedJojaMart") ? 6 : -1, false);
junimo.Name = "Junimo";
junimo.EventActor = true;
actors.Add((NPC)junimo);
}
*/
e.end();
return e;
}
/*
public static EventHelper DatingBirthday_Penny()
{
}
public static EventHelper DatingBirthday_Maru()
{
}
public static EventHelper DatingBirthday_Leah()
{
}
public static EventHelper DatingBirthday_Abigail()
{
}
public static EventHelper DatingBirthday_Emily()
{
}
public static EventHelper DatingBirthday_Haley()
{
}
public static EventHelper DatingBirthday_Sam()
{
}
public static EventHelper DatingBirthday_Sebastian()
{
}
public static EventHelper DatingBirthday_Elliott()
{
}
public static EventHelper DatingBirthday_Shane()
{
}
public static EventHelper DatingBirthday_Harvey()
{
}
public static EventHelper DatingBirthday_Alex()
{
}
public static EventHelper Birthday_Krobus()
{
}
public static EventHelper MarriedBirthday_NoKids()
{
}
public static EventHelper MarriedBirthday_OneKids()
{
}
public static EventHelper MarriedBirthday_TwoKids()
{
}
*/
}
}

View File

@ -470,12 +470,36 @@ namespace StardustCore.Events
b.Append(" ");
b.Append(TileY.ToString());
b.Append(" ");
b.Append(Direction);
b.Append(this.getFacingDirectionNumber(Direction));
b.Append(" ");
b.Append(Breather);
b.Append(" ");
b.Append("Character");
this.add(b);
}
public virtual void addTemporaryActor_NPC(string npc, int SpriteWidth, int SpriteHeight, int TileX, int TileY, FacingDirection Direction, bool Breather)
{
StringBuilder b = new StringBuilder();
b.Append("addTemporaryActor ");
b.Append(npc);
b.Append(" ");
b.Append(SpriteWidth.ToString());
b.Append(" ");
b.Append(SpriteHeight.ToString());
b.Append(" ");
b.Append(TileX.ToString());
b.Append(" ");
b.Append(TileY.ToString());
b.Append(" ");
b.Append(this.getFacingDirectionNumber(Direction));
b.Append(" ");
b.Append(Breather);
b.Append(" ");
b.Append("Character");
this.add(b);
}
/// <summary>
/// Add a temporary actor. 'breather' is boolean. The category determines where the texture will be loaded from, default is Character. Animal name only applies to animal.
/// </summary>
@ -503,6 +527,8 @@ namespace StardustCore.Events
b.Append(" ");
b.Append(Direction);
b.Append(" ");
b.Append(Breather);
b.Append(" ");
b.Append("Animal");
b.Append(" ");
b.Append(AnimalName);
@ -535,6 +561,8 @@ namespace StardustCore.Events
b.Append(" ");
b.Append(Direction);
b.Append(" ");
b.Append(Breather);
b.Append(" ");
b.Append("Monster");
this.add(b);
}

View File

@ -21,12 +21,14 @@ namespace StardustCore.Events
public Dictionary<string, Action<EventManager,string>> concurrentEventActions;
private Dictionary<string, Action<EventManager, string>> _concurrentEventActionsGC;
public EventManager()
{
this.events = new Dictionary<string, EventHelper>();
this.customEventLogic = new Dictionary<string, Action<EventManager,string>>();
this.concurrentEventActions = new Dictionary<string, Action<EventManager,string>>();
this._concurrentEventActionsGC = new Dictionary<string, Action<EventManager, string>>();
this.customEventLogic.Add("Omegasis.EventFramework.AddObjectToPlayersInventory", ExtraEventActions.addObjectToPlayerInventory);
this.customEventLogic.Add("Omegasis.EventFramework.ViewportLerp", ExtraEventActions.ViewportLerp);
@ -72,6 +74,12 @@ namespace StardustCore.Events
string commandName = this.getGameCurrentEventCommandStringName();
//HappyBirthday.ModMonitor.Log("Current event command name is: " + commandName, StardewModdingAPI.LogLevel.Info);
foreach (KeyValuePair<string, Action<EventManager, string>> pair in this._concurrentEventActionsGC)
{
this.concurrentEventActions.Remove(pair.Key);
}
this._concurrentEventActionsGC.Clear();
foreach (KeyValuePair<string,Action<EventManager,string>> pair in this.concurrentEventActions)
{
pair.Value.Invoke(this,pair.Key);
@ -87,7 +95,7 @@ namespace StardustCore.Events
{
if (this.concurrentEventActions.ContainsKey(Key))
{
this.concurrentEventActions.Remove(Key);
this._concurrentEventActionsGC.Remove(Key);
}
}

View File

@ -34,6 +34,12 @@ namespace StardustCore.Events
Game1.CurrentEvent.CurrentCommand++;
}
/// <summary>
/// Lerp the camera to a specified position.
/// </summary>
/// <param name="EventManager"></param>
/// <param name="EventData"></param>
public static void ViewportLerp(EventManager EventManager,string EventData)
{
string[] splits = EventData.Split(' ');