public static void SignalPassOutMany(this Quest quest, Action action = null, string inSignal = null, IEnumerable <string> outSignals = null) { QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = inSignal ?? QuestGen.slate.Get <string>("inSignal"); if (action != null) { string innerNodeInSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted"); QuestGenUtility.RunInner(action, innerNodeInSignal); } if (outSignals != null) { foreach (string outSignal in outSignals) { questPart_PassOutMany.outSignals.Add(outSignal); } } quest.AddPart(questPart_PassOutMany); }
protected override void RunInt() { Slate slate = QuestGen.slate; switch (((outSignals.GetValue(slate) != null) ? outSignals.GetValue(slate).Count() : 0) + ((node != null) ? 1 : 0)) { case 0: return; case 1: { QuestPart_Pass questPart_Pass = new QuestPart_Pass(); questPart_Pass.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)); if (node != null) { questPart_Pass.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted"); QuestGenUtility.RunInnerNode(node, questPart_Pass.outSignal); } else { questPart_Pass.outSignal = QuestGenUtility.HardcodedSignalWithQuestID(outSignals.GetValue(slate).First()); } questPart_Pass.signalListenMode = (signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly); QuestGen.quest.AddPart(questPart_Pass); return; } } QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)); if (node != null) { string text = QuestGen.GenerateNewSignal("OuterNodeCompleted"); questPart_PassOutMany.outSignals.Add(text); QuestGenUtility.RunInnerNode(node, text); } foreach (string item in outSignals.GetValue(slate)) { questPart_PassOutMany.outSignals.Add(QuestGenUtility.HardcodedSignalWithQuestID(item)); } questPart_PassOutMany.signalListenMode = (signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly); QuestGen.quest.AddPart(questPart_PassOutMany); }
public static void Signal(this Quest quest, string inSignal = null, Action action = null, IEnumerable <string> outSignals = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { _ = QuestGen.slate; switch ((outSignals?.Count() ?? 0) + ((action != null) ? 1 : 0)) { case 0: return; case 1: { QuestPart_Pass questPart_Pass = new QuestPart_Pass(); questPart_Pass.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal); if (action != null) { questPart_Pass.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted"); QuestGenUtility.RunInner(action, questPart_Pass.outSignal); } else { questPart_Pass.outSignal = QuestGenUtility.HardcodedSignalWithQuestID(outSignals.First()); } questPart_Pass.signalListenMode = signalListenMode; quest.AddPart(questPart_Pass); return; } } QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal); if (action != null) { string text = QuestGen.GenerateNewSignal("OuterNodeCompleted"); questPart_PassOutMany.outSignals.Add(text); QuestGenUtility.RunInner(action, text); } foreach (string outSignal in outSignals) { questPart_PassOutMany.outSignals.Add(QuestGenUtility.HardcodedSignalWithQuestID(outSignal)); } questPart_PassOutMany.signalListenMode = signalListenMode; quest.AddPart(questPart_PassOutMany); }
public static void SendSignals(this Quest quest, IEnumerable <string> outSignals, string outSignalsFormat = "", int outSignalsFormattedCount = 0) { _ = QuestGen.slate; IEnumerable <string> enumerable = Enumerable.Empty <string>(); if (outSignals != null) { enumerable = enumerable.Concat(outSignals); } if (outSignalsFormattedCount > 0) { for (int i = 0; i < outSignalsFormattedCount; i++) { enumerable = enumerable.Concat(Gen.YieldSingle(outSignalsFormat.Formatted(i.Named("INDEX")).ToString())); } } if (enumerable.EnumerableNullOrEmpty()) { return; } if (enumerable.Count() == 1) { QuestPart_Pass questPart_Pass = new QuestPart_Pass(); questPart_Pass.inSignal = QuestGen.slate.Get <string>("inSignal"); questPart_Pass.outSignal = QuestGenUtility.HardcodedSignalWithQuestID(enumerable.First()); QuestGen.quest.AddPart(questPart_Pass); return; } QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = QuestGen.slate.Get <string>("inSignal"); foreach (string item in enumerable) { questPart_PassOutMany.outSignals.Add(QuestGenUtility.HardcodedSignalWithQuestID(item)); } QuestGen.quest.AddPart(questPart_PassOutMany); }
protected override void RunInt() { Slate slate = QuestGen.slate; IEnumerable <string> enumerable = Enumerable.Empty <string>(); if (outSignals.GetValue(slate) != null) { enumerable = enumerable.Concat(outSignals.GetValue(slate)); } if (outSignalsFormattedCount.GetValue(slate) > 0) { for (int i = 0; i < outSignalsFormattedCount.GetValue(slate); i++) { enumerable = enumerable.Concat(Gen.YieldSingle(outSignalsFormat.GetValue(slate).Formatted(i.Named("INDEX")).ToString())); } } if (!enumerable.EnumerableNullOrEmpty()) { if (enumerable.Count() == 1) { QuestPart_Pass questPart_Pass = new QuestPart_Pass(); questPart_Pass.inSignal = QuestGen.slate.Get <string>("inSignal"); questPart_Pass.outSignal = QuestGenUtility.HardcodedSignalWithQuestID(enumerable.First()); QuestGen.quest.AddPart(questPart_Pass); } else { QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = QuestGen.slate.Get <string>("inSignal"); foreach (string item in enumerable) { questPart_PassOutMany.outSignals.Add(QuestGenUtility.HardcodedSignalWithQuestID(item)); } QuestGen.quest.AddPart(questPart_PassOutMany); } } }