Show / Hide Table of Contents

Class FallbackTextProvider

Base class that allows derived implementations to only override certain text functionality, while having the another implementation as a "fallback" for the cases it's not interested in For mods, this usually means taking the previous DaggerfallUnity.Instance.TextProvider as the fallback, then replacing the game's text provider with their own implementation based on FallbackTextProvider

Ex:

class MyModTextProvider : FallbackTextProvider { public string GetSkillName(DFCareer.Skills skill) { if(skill == DFCareer.Skills.Mercantile) return "Commerce"; else return FallbackProvider.GetSkillName(skill); } }

public void Awake() { DaggerfallUnity.Instance.TextProvider = new MyModProvider(DaggerfallUnity.Instance.TextProvider); }

This pattern allows multiple mods to add their own functionality to the text provider without conflicting

Inheritance
Object
FallbackTextProvider
Implements
ITextProvider
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public abstract class FallbackTextProvider : ITextProvider

Constructors

| Improve this Doc View Source

FallbackTextProvider(ITextProvider)

Declaration
public FallbackTextProvider(ITextProvider Fallback)
Parameters
Type Name Description
ITextProvider Fallback

Properties

| Improve this Doc View Source

FallbackProvider

Declaration
protected ITextProvider FallbackProvider { get; }
Property Value
Type Description
ITextProvider

Methods

| Improve this Doc View Source

CreateTokens(TextFile.Formatting, String[])

Creates a custom token array.

Declaration
public virtual TextFile.Token[] CreateTokens(TextFile.Formatting formatting, params string[] lines)
Parameters
Type Name Description
TextFile.Formatting formatting

Formatting of each line.

String[] lines

All text lines.

Returns
Type Description
TextFile.Token[]

Token array.

| Improve this Doc View Source

EnableLocalizedStringDebug(Boolean)

Enable or disable verbose localized string debug in player log.

Declaration
public virtual void EnableLocalizedStringDebug(bool enable)
Parameters
Type Name Description
Boolean enable

True to enable, false to disable.

| Improve this Doc View Source

GetAbbreviatedStatName(DFCareer.Stats)

Gets abbreviated text for stat name.

Declaration
public virtual string GetAbbreviatedStatName(DFCareer.Stats stat)
Parameters
Type Name Description
DFCareer.Stats stat

Stat.

Returns
Type Description
String

Abbreviated text for this stat.

| Improve this Doc View Source

GetArmorMaterialName(ArmorMaterialTypes)

Gets name of armor material type.

Declaration
public virtual string GetArmorMaterialName(ArmorMaterialTypes material)
Parameters
Type Name Description
ArmorMaterialTypes material

Material type of armor.

Returns
Type Description
String

String for armor material name.

| Improve this Doc View Source

GetCustomEnemyName(Int32)

Gets the name associated with a custom enemy id (ie: not defined in MobileTypes). Returns null if the enemy id is unknown.

Declaration
public virtual string GetCustomEnemyName(int enemyId)
Parameters
Type Name Description
Int32 enemyId

Custom enemy id

Returns
Type Description
String

Name if the enemy id is known, null otherwise

| Improve this Doc View Source

GetLocalizedString(String, String, out String)

Attempts to read a localized string from a named table collection.

Declaration
public virtual bool GetLocalizedString(string collection, string id, out string result)
Parameters
Type Name Description
String collection

Name of table collection.

String id

ID of string to get.

String result

Localized string result or null/empty.

Returns
Type Description
Boolean

True if string found, otherwise false.

| Improve this Doc View Source

GetRandomText(Int32)

Gets random string from separated token array. Example would be flavour text variants when finding dungeon exterior.

Declaration
public virtual string GetRandomText(int id)
Parameters
Type Name Description
Int32 id

Text resource ID.

Returns
Type Description
String

String randomly selected from variants.

| Improve this Doc View Source

GetRandomTokens(Int32, Boolean)

Gets tokens from a randomly selected subrecord.

Declaration
public virtual TextFile.Token[] GetRandomTokens(int id, bool dfRand = false)
Parameters
Type Name Description
Int32 id

Text resource ID.

Boolean dfRand

Use Daggerfall rand() for random selection.

Returns
Type Description
TextFile.Token[]

Text resource tokens.

| Improve this Doc View Source

GetRSCTokens(Int32)

Gets tokens from a TEXT.RSC record.

Declaration
public virtual TextFile.Token[] GetRSCTokens(int id)
Parameters
Type Name Description
Int32 id

Text resource ID.

Returns
Type Description
TextFile.Token[]

Text resource tokens.

| Improve this Doc View Source

GetRSCTokens(String)

Gets tokens from RSC localization table with custom string ID and conversion back to RSC tokens. Does not support fallback to classic TEXT.RSC. Record key must exist in RSC localization table.

Declaration
public virtual TextFile.Token[] GetRSCTokens(string id)
Parameters
Type Name Description
String id

String table key.

Returns
Type Description
TextFile.Token[]

Text resource tokens.

| Improve this Doc View Source

GetSkillName(DFCareer.Skills)

Gets text for skill name.

Declaration
public virtual string GetSkillName(DFCareer.Skills skill)
Parameters
Type Name Description
DFCareer.Skills skill

Skill.

Returns
Type Description
String

Text for this skill.

| Improve this Doc View Source

GetSkillSummary(DFCareer.Skills, Int32)

Gets text to be shown in the Skill summary popup

Declaration
public virtual TextFile.Token[] GetSkillSummary(DFCareer.Skills skill, int startPosition)
Parameters
Type Name Description
DFCareer.Skills skill

Skill.s

Int32 startPosition

Position in pixel of the first positioning token

Returns
Type Description
TextFile.Token[]

Tokens for the skill.

| Improve this Doc View Source

GetStatDescriptionTextID(DFCareer.Stats)

Gets text resource ID of stat description.

Declaration
public virtual int GetStatDescriptionTextID(DFCareer.Stats stat)
Parameters
Type Name Description
DFCareer.Stats stat

Stat.

Returns
Type Description
Int32

Text resource ID.

| Improve this Doc View Source

GetStatName(DFCareer.Stats)

Gets text for stat name.

Declaration
public virtual string GetStatName(DFCareer.Stats stat)
Parameters
Type Name Description
DFCareer.Stats stat

Stat.

Returns
Type Description
String

Text for this stat.

| Improve this Doc View Source

GetText(Int32)

Gets string from token array.

Declaration
public virtual string GetText(int id)
Parameters
Type Name Description
Int32 id

Text resource ID.

Returns
Type Description
String

String from text resource.

| Improve this Doc View Source

GetWeaponMaterialName(WeaponMaterialTypes)

Gets name of weapon material type.

Declaration
public virtual string GetWeaponMaterialName(WeaponMaterialTypes material)
Parameters
Type Name Description
WeaponMaterialTypes material

Material type of weapon.

Returns
Type Description
String

String for weapon material name.

Implements

ITextProvider
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX