Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
- Global flags event on set
- Typo in DiplomataEventController
- Better error description on Item.Find
- Removing duplicated SendQuestStateChange
  • Loading branch information
brunurd committed Mar 29, 2019
1 parent 04d6df9 commit 0be262e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions Diplomata/DiplomataEventController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public class DiplomataEventController
/// Happens every time a context ends.
/// </summary>
public event Action<Context> OnContextEnd;


/// <summary>
/// Happens every time a flag is set.
/// </summary>
public event Action<Flag> OnSetFlag;

/// <summary>
/// Trigger the event OnQuestStart with the quest data that have started.
/// </summary>
Expand Down Expand Up @@ -79,13 +84,23 @@ public void SendItemWasCaught(Item itemWasCaught)
}

/// <summary>
/// Trigger the event OnContextEnd whit the ended context data.
/// Trigger the event OnContextEnd with the ended context data.
/// </summary>
/// <param name="context"></param>
public void SendContextEnd(Context context)
{
if (OnContextEnd != null)
OnContextEnd(context);
}

/// <summary>
/// Trigger the event OnSetFlag when a flag is set.
/// </summary>
/// <param name="flag">The flag.</param>
public void SendOnSetFlag(Flag flag)
{
if (OnSetFlag != null)
OnSetFlag(flag);
}
}
}
2 changes: 1 addition & 1 deletion Diplomata/DiplomataTalkable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ public void NextMessage()
if (flag != null)
{
flag.value = effect.globalFlag.value;
DiplomataManager.EventController.SendOnSetFlag(flag);
}
else
{
Expand Down Expand Up @@ -1042,7 +1043,6 @@ public void NextMessage()
else
{
quest.SetState(effect.questAndState.questStateId);
DiplomataManager.EventController.SendQuestStateChange(quest);

if (OnQuestStateChangeLocal != null)
OnQuestStateChangeLocal(quest);
Expand Down
2 changes: 1 addition & 1 deletion Diplomata/Models/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public static Item Find(Item[] items, string name, string language = "English")
return item;
}
}
Debug.LogError("This item doesn't exist.");
Debug.LogError($"This item \"{name}\" doesn't exist.");
return null;
}

Expand Down

0 comments on commit 0be262e

Please sign in to comment.