Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TalkDataList Class Reference
Inheritance diagram for TalkDataList:
ExcelDataList

Public Member Functions

override void OnInitialize ()
 
string GetTalk (string id, string idTopic, bool useDefault=false, bool human=true)
 
string GetRandomID (string tag)
 
- Public Member Functions inherited from ExcelDataList
void Reload ()
 
virtual void Initialize ()
 
virtual void OnInitialize ()
 
Dictionary< string, string > GetRow (string id)
 

Public Attributes

List< string > IDs
 
- Public Attributes inherited from ExcelDataList
List< ExcelDataitems = new List<ExcelData>(0)
 
Dictionary< string, Dictionary< string, string > > all = new Dictionary<string, Dictionary<string, string>>()
 
List< Dictionary< string, string > > list = new List<Dictionary<string, string>>()
 

Properties

override int StartIndex [get]
 
- Properties inherited from ExcelDataList
virtual int StartIndex [get]
 

Additional Inherited Members

- Protected Attributes inherited from ExcelDataList
bool initialized
 

Detailed Description

Definition at line 5 of file TalkDataList.cs.

Member Function Documentation

◆ GetRandomID()

string TalkDataList.GetRandomID ( string  tag)
inline

Definition at line 59 of file TalkDataList.cs.

60 {
61 return IDs.RandomItem();
62 }
List< string > IDs
Definition: TalkDataList.cs:7

References IDs.

Referenced by Card.SetRandomTalk().

◆ GetTalk()

string TalkDataList.GetTalk ( string  id,
string  idTopic,
bool  useDefault = false,
bool  human = true 
)
inline

Definition at line 23 of file TalkDataList.cs.

24 {
25 if (!initialized)
26 {
27 Initialize();
28 }
29 bool flag = false;
30 Dictionary<string, string> dictionary = all.TryGetValue(idTopic);
31 if (dictionary == null)
32 {
33 Debug.LogError("idTopic not found:" + idTopic);
34 return "";
35 }
36 string text = dictionary.TryGetValue(id);
37 if (text.IsEmpty())
38 {
39 if (!useDefault)
40 {
41 Debug.LogError("id not found:" + id);
42 return "";
43 }
44 text = dictionary.TryGetValue("default");
45 flag = true;
46 }
47 text = text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).RandomItem();
48 if (!human)
49 {
50 if (flag && !text.IsEmpty() && !text.StartsWith("(") && !text.StartsWith("*"))
51 {
52 text = "(" + text + ")";
53 }
54 text = text.Replace("。)", ")");
55 }
56 return text;
57 }
Dictionary< string, Dictionary< string, string > > all
Definition: ExcelDataList.cs:8
virtual void Initialize()

References ExcelDataList.all, Debug, human, ExcelDataList.Initialize(), and ExcelDataList.initialized.

Referenced by Person.GetDramaTitle(), and Card.GetTalkText().

◆ OnInitialize()

override void TalkDataList.OnInitialize ( )
inlinevirtual

Reimplemented from ExcelDataList.

Definition at line 11 of file TalkDataList.cs.

12 {
13 IDs = new List<string>();
14 foreach (string key in list[0].Keys)
15 {
16 if (key != "id" && key != "path")
17 {
18 IDs.Add(key);
19 }
20 }
21 }
List< Dictionary< string, string > > list

References IDs, and ExcelDataList.list.

Member Data Documentation

◆ IDs

List<string> TalkDataList.IDs

Definition at line 7 of file TalkDataList.cs.

Referenced by GetRandomID(), and OnInitialize().

Property Documentation

◆ StartIndex

override int TalkDataList.StartIndex
get

Definition at line 9 of file TalkDataList.cs.


The documentation for this class was generated from the following file: