Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Msg.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
3
4public class Msg : EClass
5{
7
9
11
12 public static bool alwaysVisible;
13
14 public static bool ignoreAll;
15
17
19
21
22 public static void SetColor()
23 {
25 }
26
27 public static void SetColor(Color color)
28 {
29 currentColor = color;
30 }
31
32 public static void SetColor(string id)
33 {
35 }
36
37 public static string GetRawText(string idLang, string ref1, string ref2 = null, string ref3 = null, string ref4 = null)
38 {
39 thirdPerson1.Set(ref1);
40 thirdPerson2.Set(ref2);
41 return GameLang.Parse(GetGameText(idLang), IsThirdPerson(ref1), ref1, ref2, ref3, ref4);
42 }
43
44 public static string GetRawText(string idLang, Card c1, Card c2, string ref1 = null, string ref2 = null)
45 {
46 thirdPerson1.Set(c1);
47 thirdPerson2.Set(c2);
48 return GameLang.Parse(GetGameText(idLang), IsThirdPerson(c1), GetName(c1), GetName(c2), ref1, ref2);
49 }
50
51 public static string GetRawText(string idLang, Card c1, string ref1 = null, string ref2 = null, string ref3 = null)
52 {
53 thirdPerson1.Set(c1);
54 thirdPerson2.Set(ref1);
55 return GameLang.Parse(GetGameText(idLang), IsThirdPerson(c1), GetName(c1), ref1, ref2, ref3);
56 }
57
58 public static string Say(string idLang, string ref1, string ref2 = null, string ref3 = null, string ref4 = null)
59 {
60 thirdPerson1.Set(ref1);
61 thirdPerson2.Set(ref2);
62 return SayRaw(GameLang.Parse(GetGameText(idLang), IsThirdPerson(ref1), ref1, ref2, ref3, ref4));
63 }
64
65 public static string Say(string idLang, Card c1, Card c2, string ref1 = null, string ref2 = null)
66 {
67 thirdPerson1.Set(c1);
68 thirdPerson2.Set(c2);
69 return SayRaw(GameLang.Parse(GetGameText(idLang), IsThirdPerson(c1), GetName(c1), GetName(c2), ref1, ref2));
70 }
71
72 public static string Say(string idLang, Card c1, string ref1 = null, string ref2 = null, string ref3 = null)
73 {
74 thirdPerson1.Set(c1);
75 thirdPerson2.Set(ref1);
76 return SayRaw(GameLang.Parse(GetGameText(idLang), IsThirdPerson(c1), GetName(c1), ref1, ref2, ref3));
77 }
78
79 public static string Say(string idLang, Card c1, int i, string ref1 = null)
80 {
81 thirdPerson1.Set(c1);
82 thirdPerson2.Set(ref1);
83 return SayRaw(GameLang.Parse(GetGameText(idLang), IsThirdPerson(i), GetName(c1), i.ToString() ?? "", ref1));
84 }
85
86 public static string Say(string idLang, int i, string ref1 = null, string ref2 = null)
87 {
88 return SayRaw(GameLang.Parse(GetGameText(idLang), IsThirdPerson(i), ref1, ref2));
89 }
90
91 public static string Say(string idLang)
92 {
93 return SayRaw(GetGameText(idLang));
94 }
95
96 public static string SayNothingHappen()
97 {
98 return Say("nothingHappens");
99 }
100
101 public static string SayCannotUseHere()
102 {
103 return Say("cannot_use_here");
104 }
105
106 public static void SayGod(string s, Card owner = null)
107 {
109 Say(s.Bracket());
110 owner?.SayRaw("@1" + s);
111 }
112
113 public static string SayRaw(string text)
114 {
115 if (ignoreAll)
116 {
118 return "";
119 }
120 ToUpperFirst(text);
121 if ((bool)feed)
122 {
123 feed.System(text);
124 }
125 if ((bool)mainText)
126 {
128 }
130 alwaysVisible = false;
131 EClass.game.log.Add(text);
132 return text;
133 }
134
135 public static void Append(Sprite sprite)
136 {
137 mainText.Append(sprite);
138 }
139
140 public static void AquireItem(string itemName)
141 {
142 Say("getItem", itemName ?? "");
143 }
144
145 public static void Nerun(string lang, string idPortrait = "UN_nerun")
146 {
147 string text = GameLang.Convert(lang.lang());
148 if ((bool)feed)
149 {
150 feed.Nerun(text, idPortrait);
151 }
152 else if ((bool)mainText)
153 {
154 mainText.Append(text.Bracket(1), colors.Talk);
155 }
156 }
157
158 public static void SayHomeMember(string lang)
159 {
160 string text = GameLang.Convert(lang.lang());
161 if ((bool)feed)
162 {
163 feed.Nerun(text);
164 }
165 else if ((bool)mainText)
166 {
167 mainText.Append(text.Bracket(1), colors.Talk);
168 }
169 }
170
171 public static void SayPic(Card c, string lang)
172 {
173 if (c != null)
174 {
175 string text = GameLang.Convert(lang.lang());
176 if ((bool)feed)
177 {
178 feed.SayRaw(c, text);
179 }
180 else if ((bool)mainText)
181 {
182 mainText.Append(text.Bracket(1), colors.Talk);
183 }
184 }
185 }
186
187 public static void SayPic(string idPortrait, string lang, string _idPop = null)
188 {
189 string text = GameLang.Convert(lang.lang());
190 if ((bool)feed)
191 {
192 feed.SayRaw(idPortrait, text, _idPop);
193 }
194 else if ((bool)mainText)
195 {
196 mainText.Append(text.Bracket(1), colors.Talk);
197 }
198 }
199
200 public static PopItem Talk(Card c, string id)
201 {
202 PopItem result = null;
203 if (c == null)
204 {
205 return null;
206 }
207 string text = GameLang.Convert(c.GetTalkText(id, stripPun: true));
208 if ((bool)feed && c != null)
209 {
210 result = feed.SayRaw(c, text);
211 }
212 else if ((bool)mainText)
213 {
214 mainText.Append(text.Bracket(1), colors.Talk);
215 }
216 return result;
217 }
218
219 public static PopItem TalkHomeMemeber(string id)
220 {
221 Chara chara = null;
222 if (EClass.Branch != null)
223 {
224 for (int i = 0; i < 99; i++)
225 {
226 chara = EClass.Branch.members.RandomItem();
227 if (chara != EClass.pc)
228 {
229 break;
230 }
231 }
232 }
233 if (chara == null)
234 {
235 chara = EClass.pc;
236 }
237 return Talk(chara, id);
238 }
239
240 public static PopItem TalkMaid(string id)
241 {
242 foreach (Chara chara in EClass._map.charas)
243 {
244 if (chara.uid == EClass.Branch?.uidMaid)
245 {
246 return Talk(chara, id);
247 }
248 }
249 return TalkHomeMemeber(id);
250 }
251
252 public static string GetGameText(string idLang)
253 {
254 LangGame.Row row = EClass.core.sources.langGame.map.TryGetValue(idLang);
255 if (row == null)
256 {
257 return idLang.lang();
258 }
259 if (!row.effect.IsEmpty() && row.effect == "destroy")
260 {
262 }
263 if (!row.color.IsEmpty())
264 {
266 }
267 if (!row.sound.IsEmpty())
268 {
269 EClass.Sound.Play(row.sound);
270 }
271 return row.GetText("text").Split(Environment.NewLine.ToCharArray()).RandomItem();
272 }
273
274 public static string GetName(Card c)
275 {
276 if (c == null)
277 {
278 return "null";
279 }
280 if (c.IsPC)
281 {
282 return "you".lang();
283 }
284 if (!alwaysVisible && (EClass.pc.isBlind || !EClass.pc.CanSee(c)) && c.parent == EClass._zone)
285 {
286 return (c.isChara ? "someone" : "something").lang();
287 }
288 return c.Name;
289 }
290
291 public static bool IsThirdPerson(Card c)
292 {
293 if (c == null)
294 {
295 return false;
296 }
297 if (c.IsPC || c.Num > 1)
298 {
299 return false;
300 }
301 return true;
302 }
303
304 public static bool IsThirdPerson(string n)
305 {
306 if (!int.TryParse(n, out var result))
307 {
308 return false;
309 }
310 return IsThirdPerson(result);
311 }
312
313 public static bool IsThirdPerson(int i)
314 {
315 return i <= 1;
316 }
317
318 public static void NewLine()
319 {
320 if ((bool)mainText)
321 {
323 }
324 }
325
326 public unsafe static void ToUpperFirst(string str)
327 {
328 if (str != null)
329 {
330 fixed (char* ptr = str)
331 {
332 *ptr = char.ToUpper(*ptr);
333 }
334 }
335 }
336}
Definition: Card.cs:11
string Name
Definition: Card.cs:2013
ICardParent parent
Definition: Card.cs:51
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
Definition: Card.cs:6073
int uid
Definition: Card.cs:118
virtual bool IsPC
Definition: Card.cs:2019
virtual bool isChara
Definition: Card.cs:1959
int Num
Definition: Card.cs:154
Definition: Chara.cs:10
bool CanSee(Card c)
Definition: Chara.cs:1027
bool isBlind
Definition: Chara.cs:125
MsgColors msgColors
Definition: CoreRef.cs:393
CoreRef refs
Definition: Core.cs:51
SourceManager sources
Definition: Core.cs:33
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static FactionBranch Branch
Definition: EClass.cs:22
static Chara pc
Definition: EClass.cs:14
static SoundManager Sound
Definition: EClass.cs:46
List< Chara > members
static string Convert(string text)
Definition: GameLang.cs:106
static string Parse(string text, bool thirdPerson, string val1, string val2=null, string val3=null, string val4=null)
Definition: GameLang.cs:123
MsgLog log
Definition: Game.cs:185
string sound
Definition: LangGame.cs:16
string color
Definition: LangGame.cs:12
string effect
Definition: LangGame.cs:18
List< Chara > charas
Definition: Map.cs:81
UD_String_Color colors
Definition: MsgColors.cs:23
Color Talk
Definition: MsgColors.cs:7
Color Default
Definition: MsgColors.cs:5
Color TalkGod
Definition: MsgColors.cs:9
void Add(Data data)
Definition: MsgLog.cs:53
Definition: Msg.cs:5
static bool IsThirdPerson(Card c)
Definition: Msg.cs:291
static string Say(string idLang, int i, string ref1=null, string ref2=null)
Definition: Msg.cs:86
static bool IsThirdPerson(int i)
Definition: Msg.cs:313
static string Say(string idLang)
Definition: Msg.cs:91
static PopItem TalkHomeMemeber(string id)
Definition: Msg.cs:219
static void NewLine()
Definition: Msg.cs:318
static void SayGod(string s, Card owner=null)
Definition: Msg.cs:106
static void AquireItem(string itemName)
Definition: Msg.cs:140
static WidgetFeed feed
Definition: Msg.cs:18
static PopItem Talk(Card c, string id)
Definition: Msg.cs:200
static string GetRawText(string idLang, Card c1, string ref1=null, string ref2=null, string ref3=null)
Definition: Msg.cs:51
static void Append(Sprite sprite)
Definition: Msg.cs:135
static Color currentColor
Definition: Msg.cs:10
static bool alwaysVisible
Definition: Msg.cs:12
static string GetGameText(string idLang)
Definition: Msg.cs:252
static void SayHomeMember(string lang)
Definition: Msg.cs:158
static string Say(string idLang, Card c1, string ref1=null, string ref2=null, string ref3=null)
Definition: Msg.cs:72
static PopItem TalkMaid(string id)
Definition: Msg.cs:240
static bool ignoreAll
Definition: Msg.cs:14
static MsgColors colors
Definition: Msg.cs:20
static ThirstPersonInfo thirdPerson2
Definition: Msg.cs:8
static string GetRawText(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:37
static unsafe void ToUpperFirst(string str)
Definition: Msg.cs:326
static string GetRawText(string idLang, Card c1, Card c2, string ref1=null, string ref2=null)
Definition: Msg.cs:44
static void SetColor(string id)
Definition: Msg.cs:32
static void SayPic(Card c, string lang)
Definition: Msg.cs:171
static string Say(string idLang, Card c1, Card c2, string ref1=null, string ref2=null)
Definition: Msg.cs:65
static string SayRaw(string text)
Definition: Msg.cs:113
static void SayPic(string idPortrait, string lang, string _idPop=null)
Definition: Msg.cs:187
static bool IsThirdPerson(string n)
Definition: Msg.cs:304
static string SayCannotUseHere()
Definition: Msg.cs:101
static WidgetMainText mainText
Definition: Msg.cs:16
static ThirstPersonInfo thirdPerson1
Definition: Msg.cs:6
static void SetColor(Color color)
Definition: Msg.cs:27
static void Nerun(string lang, string idPortrait="UN_nerun")
Definition: Msg.cs:145
static string Say(string idLang, Card c1, int i, string ref1=null)
Definition: Msg.cs:79
static string SayNothingHappen()
Definition: Msg.cs:96
static string GetName(Card c)
Definition: Msg.cs:274
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
static void SetColor()
Definition: Msg.cs:22
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:553
LangGame langGame
void Set(string n)
void System(string text)
Definition: WidgetFeed.cs:98
PopItem SayRaw(Card c, string text)
Definition: WidgetFeed.cs:81
void Nerun(string text, string idPortrait="UN_nerun")
Definition: WidgetFeed.cs:93
static WidgetFeed Instance
Definition: WidgetFeed.cs:14
static WidgetMainText Instance
void Append(string s, Point pos=null)
Sprite spriteDestroy