I want to override LanguageWorker.PostProcessed() method and write the code:
In the XML, I write next:
But when I run the game, it crushed. Help me.
Code Select
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine; // Always needed
using Verse; // RimWorld universal objects are here (like 'Building')
namespace MorphTranslate
{
public class LanguageWorker_Morph : LanguageWorker
{
public override string PostProcessed(string str)
{
if (str.NullOrEmpty())
{
throw new ArgumentException();
}
str = str + "test";
//str = base.PostProcessed(str);
return str;
}
public override string WithDefiniteArticle(string str)
{
return str;
}
public override string WithIndefiniteArticle(string str)
{
return str;
}
}
}
In the XML, I write next:
Code Select
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<ThingDef>
<defName>MorphTranslate</defName>
<category>Building</category>
<menuHidden>true</menuHidden>
<label>MorphTranslate_LanguageWorker</label>
<thingClass>MorphTranslate.LanguageWorker_Morph</thingClass>
<inspectorTabs>
<li>MorphTranslate.LanguageWorker_Morph</li>
</inspectorTabs>
</ThingDef>
</ThingDefs>
But when I run the game, it crushed. Help me.