(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 System.Linq;
using Microsoft.Xna.Framework.Input;
using System.Windows;
namespace Barotrauma.Tutorials
{
@@ -18,7 +19,7 @@ namespace Barotrauma.Tutorials
private TutorialSegment activeSegment;
private List<TutorialSegment> segments;
private VideoPlayer videoPlayer;
private Steering navConsole;
@@ -389,10 +390,22 @@ namespace Barotrauma.Tutorials
private void RemoveCompletedObjective(TutorialSegment objective)
{
objectiveFrame.RemoveChild(objective.ReplayButton);
activeObjectives.Remove(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);
activeObjectives.Remove(objective);
for (int i = 0; i < activeObjectives.Count; i++)
{
activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i);
@@ -804,8 +804,7 @@ namespace Barotrauma
var newItem = Item.Load(itemElement, inventory.Owner.Submarine, createNetworkEvent: true);
if (newItem == null) { continue; }
if (!MathUtils.NearlyEqual(newItem.Condition, newItem.MaxCondition) &&
GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
if (!MathUtils.NearlyEqual(newItem.Condition, newItem.MaxCondition))
{
GameMain.NetworkMember.CreateEntityEvent(newItem, new object[] { NetEntityEvent.Type.Status });
}
@@ -192,7 +192,6 @@ namespace Barotrauma.Items.Components
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)]
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.