Description:
Avoid creating duplicate dialogs.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r471:917513506adf -

@@ -15,6 +15,7
15 using Encompass;
15 using Encompass;
16 using TraceryNet;
16 using TraceryNet;
17 using Ink.Runtime;
17 using Ink.Runtime;
18 using JM.LinqFaster;
18
19
19
20
20 namespace isometricparkfna.Spawners {
21 namespace isometricparkfna.Spawners {
@@ -68,11 +69,15
68
69
69 protected override void Spawn(in SpawnDialogMessage message)
70 protected override void Spawn(in SpawnDialogMessage message)
70 {
71 {
71 Logging.Spy(this.Story.currentChoices.Count(), "Count");
72 Logging.Info(String.Format("Count: {0}", this.Story.currentChoices.Count()));
72 Logging.Spy(this.Story.canContinue, "CanContinue");
73 Logging.Info(String.Format("Cancontinue: {0}", this.Story.canContinue));
73
74
74 var index = 0;
75 var index = 0;
76 var path = message.Path;
75
77
78 var matching_dialog_entites = ReadEntities<DialogComponent>()
79 .SelectWhereF(e => GetComponent<DialogComponent>(e),
80 e => e.StartingKnot == path);
76 //If there are no existing dialog:
81 //If there are no existing dialog:
77 if(ReadEntities<DialogComponent>().Length == 0
82 if(ReadEntities<DialogComponent>().Length == 0
78 && this.Story.currentChoices.Count() == 0
83 && this.Story.currentChoices.Count() == 0
@@ -91,6 +96,7
91
96
92
97
93 AddComponent(newDialog, new DialogComponent {
98 AddComponent(newDialog, new DialogComponent {
99 StartingKnot = message.Path,
94 Knot = message.Path,
100 Knot = message.Path,
95 CurrentDialog = this.Grammar.Flatten(dialog),
101 CurrentDialog = this.Grammar.Flatten(dialog),
96 CurrentSpeaker = this.Grammar.Flatten(speaker).Trim(),
102 CurrentSpeaker = this.Grammar.Flatten(speaker).Trim(),
@@ -114,12 +120,14
114 Logging.Success("Spawned new dialog.");
120 Logging.Success("Spawned new dialog.");
115 SendMessage(new GameRateMessage { paused = true });
121 SendMessage(new GameRateMessage { paused = true });
116 }
122 }
117 else
123 else if (matching_dialog_entites.Length == 0)
124
118 {
125 {
119
126
120 Logging.Debug("Creating new Dialog without hydrating.");
127 Logging.Debug("Creating new Dialog without hydrating.");
121 var newDialog = CreateEntity();
128 var newDialog = CreateEntity();
122 AddComponent(newDialog, new DialogComponent {
129 AddComponent(newDialog, new DialogComponent {
130 StartingKnot = message.Path,
123 Knot = message.Path
131 Knot = message.Path
124 });
132 });
125 AddComponent(newDialog, new WindowTypeComponent {
133 AddComponent(newDialog, new WindowTypeComponent {
You need to be logged in to leave comments. Login now