暂存
This commit is contained in:
68
Source/WulaFallenEmpire/EventSystem/Letter_EventChoice.cs
Normal file
68
Source/WulaFallenEmpire/EventSystem/Letter_EventChoice.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using RimWorld;
|
||||
using RimWorld.QuestGen;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class Letter_EventChoice : ChoiceLetter
|
||||
{
|
||||
// These fields are now inherited from the base Letter class
|
||||
// public string letterLabel;
|
||||
// public string letterTitle;
|
||||
// public string letterText;
|
||||
public List<QuestNode_Root_EventLetter.Option> options;
|
||||
public new Quest quest;
|
||||
|
||||
public override IEnumerable<DiaOption> Choices
|
||||
{
|
||||
get
|
||||
{
|
||||
if (options.NullOrEmpty())
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var optionDef in options)
|
||||
{
|
||||
var currentOption = optionDef;
|
||||
Action choiceAction = delegate
|
||||
{
|
||||
if (!currentOption.effects.NullOrEmpty())
|
||||
{
|
||||
foreach (var effect in currentOption.effects)
|
||||
{
|
||||
effect.Execute(null);
|
||||
}
|
||||
}
|
||||
if (quest != null && !quest.hidden && !quest.Historical)
|
||||
{
|
||||
quest.End(QuestEndOutcome.Success);
|
||||
}
|
||||
Find.LetterStack.RemoveLetter(this);
|
||||
};
|
||||
|
||||
var diaOption = new DiaOption(currentOption.label)
|
||||
{
|
||||
action = choiceAction,
|
||||
resolveTree = true
|
||||
};
|
||||
yield return diaOption;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDismissWithRightClick => false;
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
base.ExposeData();
|
||||
// Scribe_Values.Look(ref letterLabel, "letterLabel"); // Now uses base.label
|
||||
// Scribe_Values.Look(ref letterTitle, "letterTitle"); // Now uses base.title
|
||||
// Scribe_Values.Look(ref letterText, "letterText"); // Now uses base.text
|
||||
Scribe_Collections.Look(ref options, "options", LookMode.Deep);
|
||||
Scribe_References.Look(ref quest, "quest");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user