mirror of
https://github.com/Xevion/RimWorld_ResearchWhatever.git
synced 2025-12-15 08:13:04 -06:00
1.1
This commit is contained in:
38
Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs
Normal file
38
Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Verse.Sound;
|
||||
|
||||
namespace ResearchWhatever.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ResearchManager), "FinishProject")]
|
||||
public static class ResearchManager_FinishProject_ResearchWhateverPatch
|
||||
{
|
||||
public static void Prefix(ResearchManager __instance, ref bool doCompletionDialog)
|
||||
{
|
||||
if (doCompletionDialog)
|
||||
{
|
||||
var comp = Current.Game.GetComponent<ResearchWhateverGameComp>();
|
||||
if (comp.NotifyMode == ResearchWhateverNotifyMode.rwnDefault)
|
||||
return;
|
||||
|
||||
doCompletionDialog = false;
|
||||
|
||||
var currentProj = __instance.GetProject();
|
||||
switch (comp.NotifyMode)
|
||||
{
|
||||
case ResearchWhateverNotifyMode.rwnLetter:
|
||||
Find.LetterStack.ReceiveLetter("ResearchFinished".Translate(currentProj.LabelCap), currentProj.description, LetterDefOf.PositiveEvent, null, null, null, null, null);
|
||||
break;
|
||||
case ResearchWhateverNotifyMode.rwnNotice:
|
||||
Messages.Message("ResearchFinished".Translate(currentProj.LabelCap).CapitalizeFirst(), MessageTypeDefOf.SilentInput);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user