Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ToneDataList.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Text;
4
6{
7 public override void OnInitialize()
8 {
9 }
10
11 public StringBuilder ApplyTone(string id, ref string text, int gender)
12 {
13 if (!initialized)
14 {
15 Initialize();
16 }
17 Dictionary<string, string> dictionary = all[id];
18 StringBuilder stringBuilder = new StringBuilder();
19 bool flag = false;
20 string text2 = "";
21 for (int i = 0; i < text.Length; i++)
22 {
23 if (flag)
24 {
25 if (text[i] == '}')
26 {
27 flag = false;
28 if (dictionary.ContainsKey(text2))
29 {
30 string text3 = dictionary[text2].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
31 stringBuilder.Append(text3.Split(',').RandomItem());
32 }
33 else
34 {
35 stringBuilder.Append(text2);
36 }
37 }
38 else
39 {
40 text2 += text[i];
41 }
42 }
43 else if (text[i] == '{')
44 {
45 text2 = "";
46 flag = true;
47 }
48 else
49 {
50 stringBuilder.Append(text[i]);
51 }
52 }
53 stringBuilder.Replace("…~", "~…");
54 stringBuilder.Replace("…ー", "ー…");
55 return stringBuilder;
56 }
57
58 public string GetToneID(string id, int gender)
59 {
60 if (!initialized)
61 {
62 Initialize();
63 }
64 if (!Lang.isJP)
65 {
66 return id + "|I|YOU";
67 }
68 Dictionary<string, string> dictionary = all[id];
69 string text = dictionary["I"].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
70 string text2 = dictionary["YOU"].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
71 string[] array = text.Split(',');
72 string[] array2 = text2.Split(',');
73 return id + "|" + array[rnd(rnd(array.Length) + 1)] + "|" + array2[rnd(rnd(array2.Length) + 1)];
74 static int rnd(int a)
75 {
76 return Rand.rnd(a);
77 }
78 }
79}
Dictionary< string, Dictionary< string, string > > all
Definition: ExcelDataList.cs:8
virtual void Initialize()
Definition: Lang.cs:6
static bool isJP
Definition: Lang.cs:38
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:52
StringBuilder ApplyTone(string id, ref string text, int gender)
Definition: ToneDataList.cs:11
override void OnInitialize()
Definition: ToneDataList.cs:7
string GetToneID(string id, int gender)
Definition: ToneDataList.cs:58