Elin Decompiled Documentation EA 23.321 Nightly Patch 1
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 Initialize();
14 Dictionary<string, string> dictionary = all[id];
15 StringBuilder stringBuilder = new StringBuilder();
16 bool flag = false;
17 string text2 = "";
18 for (int i = 0; i < text.Length; i++)
19 {
20 if (flag)
21 {
22 if (text[i] == '}')
23 {
24 flag = false;
25 if (dictionary.ContainsKey(text2))
26 {
27 string text3 = dictionary[text2].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
28 stringBuilder.Append(text3.Split(',').RandomItem());
29 }
30 else
31 {
32 stringBuilder.Append(text2);
33 }
34 }
35 else
36 {
37 text2 += text[i];
38 }
39 }
40 else if (text[i] == '{')
41 {
42 text2 = "";
43 flag = true;
44 }
45 else
46 {
47 stringBuilder.Append(text[i]);
48 }
49 }
50 stringBuilder.Replace("…~", "~…");
51 stringBuilder.Replace("…ー", "ー…");
52 return stringBuilder;
53 }
54
55 public string GetToneID(string id, int gender)
56 {
57 Initialize();
58 if (!Lang.isJP)
59 {
60 return id + "|I|YOU";
61 }
62 Dictionary<string, string> dictionary = all[id];
63 string text = dictionary["I"].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
64 string text2 = dictionary["YOU"].Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None).TryGet((gender != 2) ? 1 : 0, 0);
65 string[] array = text.Split(',');
66 string[] array2 = text2.Split(',');
67 return id + "|" + array[rnd(rnd(array.Length) + 1)] + "|" + array2[rnd(rnd(array2.Length) + 1)];
68 static int rnd(int a)
69 {
70 return Rand.rnd(a);
71 }
72 }
73}
Dictionary< string, Dictionary< string, string > > all
Definition: ExcelDataList.cs:8
virtual void Initialize()
Definition: Lang.cs:7
static bool isJP
Definition: Lang.cs:39
Definition: Rand.cs:4
static int rnd(int max)
Definition: Rand.cs:59
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:55