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