(edc1704a5) Added: A checkmark and small delay before removal for completed objectives

This commit is contained in:
Joonas Rikkonen
2019-03-28 12:34:04 +02:00
parent aee0290202
commit ef7b0f0ccf
13 changed files with 17 additions and 6 deletions
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
using Barotrauma.Items.Components; using Barotrauma.Items.Components;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using System.Windows;
namespace Barotrauma.Tutorials namespace Barotrauma.Tutorials
{ {
@@ -389,9 +390,21 @@ namespace Barotrauma.Tutorials
private void RemoveCompletedObjective(TutorialSegment objective) private void RemoveCompletedObjective(TutorialSegment objective)
{ {
objective.IsTriggered = true;
RectTransform rectT = new RectTransform(new Point((int)GUI.CheckmarkIcon.size.X, (int)GUI.CheckmarkIcon.size.Y), objective.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
rectT.AbsoluteOffset = new Point(-rectT.Rect.Width - 5, 0);
GUIImage checkmark = new GUIImage(rectT, GUI.CheckmarkIcon);
checkmark.Color = Color.Green;
CoroutineManager.StartCoroutine(WaitForObjectiveEnd(objective));
}
private IEnumerable<object> WaitForObjectiveEnd(TutorialSegment objective)
{
yield return new WaitForSeconds(2.0f);
objectiveFrame.RemoveChild(objective.ReplayButton); objectiveFrame.RemoveChild(objective.ReplayButton);
activeObjectives.Remove(objective); activeObjectives.Remove(objective);
objective.IsTriggered = true;
for (int i = 0; i < activeObjectives.Count; i++) for (int i = 0; i < activeObjectives.Count; i++)
{ {
@@ -804,8 +804,7 @@ namespace Barotrauma
var newItem = Item.Load(itemElement, inventory.Owner.Submarine, createNetworkEvent: true); var newItem = Item.Load(itemElement, inventory.Owner.Submarine, createNetworkEvent: true);
if (newItem == null) { continue; } if (newItem == null) { continue; }
if (!MathUtils.NearlyEqual(newItem.Condition, newItem.MaxCondition) && if (!MathUtils.NearlyEqual(newItem.Condition, newItem.MaxCondition))
GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
{ {
GameMain.NetworkMember.CreateEntityEvent(newItem, new object[] { NetEntityEvent.Type.Status }); GameMain.NetworkMember.CreateEntityEvent(newItem, new object[] { NetEntityEvent.Type.Status });
} }
@@ -192,7 +192,6 @@ namespace Barotrauma.Items.Components
get { return name; } get { return name; }
} }
//TODO: this shouldn't be saved as-is, causes tags ("ItemMsgPressSelect" etc) to be converted into actual texts when saving the subs
[Editable, Serialize("", true)] [Editable, Serialize("", true)]
public string Msg public string Msg
{ {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.