Faction Test 100.4.0.0
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Barotrauma.Tutorials;
|
||||
using Segment = Barotrauma.ObjectiveManager.Segment;
|
||||
|
||||
namespace Barotrauma;
|
||||
|
||||
partial class CheckObjectiveAction : BinaryOptionAction
|
||||
{
|
||||
public enum CheckType
|
||||
{
|
||||
Added,
|
||||
Completed
|
||||
}
|
||||
|
||||
[Serialize(CheckType.Completed, IsPropertySaveable.Yes)]
|
||||
public CheckType Type { get; set; }
|
||||
|
||||
[Serialize("", IsPropertySaveable.Yes)]
|
||||
public Identifier Identifier { get; set; }
|
||||
|
||||
partial void DetermineSuccessProjSpecific(ref bool success)
|
||||
{
|
||||
success = false;
|
||||
if (Identifier.IsEmpty)
|
||||
{
|
||||
success = ObjectiveManager.AllActiveObjectivesCompleted();
|
||||
}
|
||||
else if (ObjectiveManager.GetObjective(Identifier) is Segment segment)
|
||||
{
|
||||
success = Type switch
|
||||
{
|
||||
CheckType.Added => true,
|
||||
CheckType.Completed => segment.IsCompleted,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,10 @@ namespace Barotrauma
|
||||
AlwaysOverrideCursor = true
|
||||
};
|
||||
|
||||
LocalizedString translatedText = TextManager.ParseInputTypes(TextManager.Get(text)).Fallback(text);
|
||||
LocalizedString translatedText = speaker?.DisplayName is not null ?
|
||||
TextManager.GetWithVariable(text, "[speakername]", speaker?.DisplayName) :
|
||||
TextManager.Get(text);
|
||||
translatedText = TextManager.ParseInputTypes(translatedText).Fallback(text);
|
||||
|
||||
if (speaker?.Info != null && drawChathead)
|
||||
{
|
||||
|
||||
@@ -11,11 +11,13 @@ partial class MessageBoxAction : EventAction
|
||||
if (Type == ActionType.Create || Type == ActionType.ConnectObjective)
|
||||
{
|
||||
CreateMessageBox();
|
||||
if (!ObjectiveTag.IsEmpty && GameMain.GameSession?.GameMode is TutorialMode tutorialMode)
|
||||
if (!ObjectiveTag.IsEmpty)
|
||||
{
|
||||
Identifier id = Identifier.IfEmpty(Text);
|
||||
var segment = Tutorial.Segment.CreateMessageBoxSegment(id, ObjectiveTag, CreateMessageBox);
|
||||
tutorialMode.Tutorial?.TriggerTutorialSegment(segment, connectObjective: Type == ActionType.ConnectObjective);
|
||||
var segment = ObjectiveManager.Segment.CreateMessageBoxSegment(id, ObjectiveTag, CreateMessageBox);
|
||||
segment.CanBeCompleted = ObjectiveCanBeCompleted;
|
||||
segment.ParentId = ParentObjectiveId;
|
||||
ObjectiveManager.TriggerTutorialSegment(segment, connectObjective: Type == ActionType.ConnectObjective);
|
||||
}
|
||||
}
|
||||
else if (Type == ActionType.Close)
|
||||
|
||||
+23
-30
@@ -1,50 +1,43 @@
|
||||
using Barotrauma.Tutorials;
|
||||
|
||||
namespace Barotrauma;
|
||||
|
||||
partial class TutorialSegmentAction : EventAction
|
||||
{
|
||||
private Tutorial.Segment segment;
|
||||
private ObjectiveManager.Segment segment;
|
||||
|
||||
partial void UpdateProjSpecific()
|
||||
{
|
||||
// Only need to create the segment when it's being triggered (otherwise the tutorial already has the segment instance)
|
||||
if (Type == SegmentActionType.Trigger)
|
||||
{
|
||||
segment = Tutorial.Segment.CreateInfoBoxSegment(Identifier, ObjectiveTag, AutoPlayVideo ? Tutorials.AutoPlayVideo.Yes : Tutorials.AutoPlayVideo.No,
|
||||
new Tutorial.Segment.Text(TextTag, Width, Height, Anchor.Center),
|
||||
new Tutorial.Segment.Video(VideoFile, TextTag, Width, Height));
|
||||
segment = ObjectiveManager.Segment.CreateInfoBoxSegment(Identifier, ObjectiveTag, AutoPlayVideo ? Tutorials.AutoPlayVideo.Yes : Tutorials.AutoPlayVideo.No,
|
||||
new ObjectiveManager.Segment.Text(TextTag, Width, Height, Anchor.Center),
|
||||
new ObjectiveManager.Segment.Video(VideoFile, TextTag, Width, Height));
|
||||
}
|
||||
else if (Type == SegmentActionType.Add)
|
||||
{
|
||||
segment = Tutorial.Segment.CreateObjectiveSegment(Identifier, !ObjectiveTag.IsEmpty ? ObjectiveTag : Identifier);
|
||||
segment = ObjectiveManager.Segment.CreateObjectiveSegment(Identifier, !ObjectiveTag.IsEmpty ? ObjectiveTag : Identifier);
|
||||
}
|
||||
if (GameMain.GameSession?.GameMode is TutorialMode tutorialMode)
|
||||
if (segment is not null)
|
||||
{
|
||||
if (tutorialMode.Tutorial is Tutorial tutorial)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case SegmentActionType.Trigger:
|
||||
case SegmentActionType.Add:
|
||||
tutorial.TriggerTutorialSegment(segment);
|
||||
break;
|
||||
case SegmentActionType.Complete:
|
||||
tutorial.CompleteTutorialSegment(Identifier);
|
||||
break;
|
||||
case SegmentActionType.Remove:
|
||||
tutorial.RemoveTutorialSegment(Identifier);
|
||||
break;
|
||||
case SegmentActionType.CompleteAndRemove:
|
||||
tutorial.CompleteTutorialSegment(Identifier);
|
||||
tutorial.RemoveTutorialSegment(Identifier);
|
||||
break;
|
||||
}
|
||||
}
|
||||
segment.CanBeCompleted = CanBeCompleted;
|
||||
segment.ParentId = ParentObjectiveId;
|
||||
}
|
||||
else
|
||||
switch (Type)
|
||||
{
|
||||
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\": attempting to use TutorialSegmentAction during a non-Tutorial game mode!");
|
||||
case SegmentActionType.Trigger:
|
||||
case SegmentActionType.Add:
|
||||
ObjectiveManager.TriggerTutorialSegment(segment);
|
||||
break;
|
||||
case SegmentActionType.Complete:
|
||||
ObjectiveManager.CompleteTutorialSegment(Identifier);
|
||||
break;
|
||||
case SegmentActionType.Remove:
|
||||
ObjectiveManager.RemoveTutorialSegment(Identifier);
|
||||
break;
|
||||
case SegmentActionType.CompleteAndRemove:
|
||||
ObjectiveManager.CompleteTutorialSegment(Identifier);
|
||||
ObjectiveManager.RemoveTutorialSegment(Identifier);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user