Elin Decompiled Documentation EA 23.321 Nightly Patch 1
Loading...
Searching...
No Matches
TalkDataList.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
6{
7 public List<string> IDs;
8
9 public override int StartIndex => 2;
10
11 public override void OnInitialize()
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 }
22
23 public string GetTalk(string id, string idTopic, bool useDefault = false, bool human = true)
24 {
25 bool flag = false;
26 Dictionary<string, string> row = GetRow(idTopic);
27 if (row == null)
28 {
29 return "";
30 }
31 string text = row.TryGetValue(id);
32 if (text.IsEmpty())
33 {
34 if (!useDefault)
35 {
36 Debug.LogError("id not found:" + id);
37 return "";
38 }
39 text = row.TryGetValue("default");
40 flag = true;
41 }
42 text = text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).RandomItem();
43 if (!human)
44 {
45 if (flag && !text.IsEmpty() && !text.StartsWith("(") && !text.StartsWith("*"))
46 {
47 text = "(" + text + ")";
48 }
49 text = text.Replace("。)", ")");
50 }
51 return text;
52 }
53
54 public string GetRandomID(string tag)
55 {
56 return IDs.RandomItem();
57 }
58}
@ human
List< Dictionary< string, string > > list
Dictionary< string, string > GetRow(string id)
override void OnInitialize()
Definition: TalkDataList.cs:11
string GetTalk(string id, string idTopic, bool useDefault=false, bool human=true)
Definition: TalkDataList.cs:23
List< string > IDs
Definition: TalkDataList.cs:7
string GetRandomID(string tag)
Definition: TalkDataList.cs:54
override int StartIndex
Definition: TalkDataList.cs:9