Elin Modding Docs Doc
Loading...
Searching...
No Matches
Game.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using System.Runtime.Serialization;
5using Newtonsoft.Json;
6using UnityEngine;
7
8// Token: 0x020000A7 RID: 167
9public class Game : EClass
10{
11 // Token: 0x170000F3 RID: 243
12 // (get) Token: 0x06000465 RID: 1125 RVA: 0x0001D76C File Offset: 0x0001B96C
13 public static bool IsWaiting
14 {
15 get
16 {
17 return Game.waitTimer > 0f;
18 }
19 }
20
21 // Token: 0x06000466 RID: 1126 RVA: 0x0001D77A File Offset: 0x0001B97A
22 public new static void Wait(float a, Point p)
23 {
24 if (p != null)
25 {
26 bool isSync = p.IsSync;
27 }
28 }
29
30 // Token: 0x06000467 RID: 1127 RVA: 0x0001D786 File Offset: 0x0001B986
31 public new static void Wait(float a, Card c)
32 {
33 if (c == null || !c.isSynced || c.IsPC)
34 {
35 return;
36 }
37 Game.Wait(a);
38 }
39
40 // Token: 0x06000468 RID: 1128 RVA: 0x0001D7A2 File Offset: 0x0001B9A2
41 public static void Wait(float a)
42 {
43 Game.waitTimer = a * (float)(EClass.core.config.game.waiter * 25) / 100f;
44 }
45
46 // Token: 0x170000F4 RID: 244
47 // (get) Token: 0x06000469 RID: 1129 RVA: 0x0001D7C9 File Offset: 0x0001B9C9
48 public Prologue Prologue
49 {
50 get
51 {
52 return EClass.setting.start.prologues[this.idPrologue];
53 }
54 }
55
56 // Token: 0x170000F5 RID: 245
57 // (get) Token: 0x0600046A RID: 1130 RVA: 0x0001D7E5 File Offset: 0x0001B9E5
58 public GameDifficulty Difficulty
59 {
60 get
61 {
62 return EClass.setting.start.difficulties[this.idDifficulty];
63 }
64 }
65
66 // Token: 0x170000F6 RID: 246
67 // (get) Token: 0x0600046B RID: 1131 RVA: 0x0001D801 File Offset: 0x0001BA01
68 public bool UseGrid
69 {
70 get
71 {
72 return EClass.core.config.game.useGrid;
73 }
74 }
75
76 // Token: 0x170000F7 RID: 247
77 // (get) Token: 0x0600046C RID: 1132 RVA: 0x0001D817 File Offset: 0x0001BA17
78 public bool altUI
79 {
80 get
81 {
82 return EClass.core.config.game.altUI;
83 }
84 }
85
86 // Token: 0x170000F8 RID: 248
87 // (get) Token: 0x0600046D RID: 1133 RVA: 0x0001D82D File Offset: 0x0001BA2D
88 public bool altInv
89 {
90 get
91 {
92 return EClass.core.config.game.altInv;
93 }
94 }
95
96 // Token: 0x170000F9 RID: 249
97 // (get) Token: 0x0600046E RID: 1134 RVA: 0x0001D843 File Offset: 0x0001BA43
98 public bool altCraft
99 {
100 get
101 {
102 return EClass.core.config.game.altCraft;
103 }
104 }
105
106 // Token: 0x170000FA RID: 250
107 // (get) Token: 0x0600046F RID: 1135 RVA: 0x0001D859 File Offset: 0x0001BA59
108 public bool altAbility
109 {
110 get
111 {
112 return EClass.core.config.game.altAbility;
113 }
114 }
115
116 // Token: 0x170000FB RID: 251
117 // (get) Token: 0x06000470 RID: 1136 RVA: 0x0001D86F File Offset: 0x0001BA6F
118 public Zone StartZone
119 {
120 get
121 {
122 return this.spatials.Find(EClass.game.Prologue.idStartZone);
123 }
124 }
125
126 // Token: 0x06000471 RID: 1137 RVA: 0x0001D88C File Offset: 0x0001BA8C
127 public void OnUpdate()
128 {
129 Game.waitTimer -= Time.deltaTime;
130 this.timeSinceStart += Time.deltaTime;
131 this.player.stats.timeElapsed += (double)Time.deltaTime;
132 if (!this.flags.IsWelcomeMessageShown && this.player.stats.timeElapsed > 2.0)
133 {
134 this.flags.IsWelcomeMessageShown = true;
135 }
136 this.updater.FixedUpdate();
137 }
138
139 // Token: 0x06000472 RID: 1138 RVA: 0x0001D918 File Offset: 0x0001BB18
140 public static void Load(string slot)
141 {
142 if (EClass.game != null)
143 {
144 EClass.game.Kill();
145 }
146 Game.OnBeforeInstantiate();
147 EClass.core.game = GameIO.LoadGame(slot);
148 EClass.game.isLoading = true;
149 EClass.game.OnGameInstantiated();
150 EClass.game.OnLoad();
151 EClass.scene.Init(Scene.Mode.StartGame);
152 if (EClass.game.altInv)
153 {
154 SoundManager.ignoreSounds = true;
155 if (EClass.game.player.pref.layerInventory)
156 {
157 EClass.ui.OpenFloatInv(false);
158 }
159 SoundManager.ignoreSounds = true;
160 if (EClass.game.player.pref.layerAbility)
161 {
162 EClass.ui.ToggleAbility(false);
163 }
164 SoundManager.ignoreSounds = false;
165 }
166 EClass.game.isLoading = false;
167 }
168
169 // Token: 0x06000473 RID: 1139 RVA: 0x0001D9E0 File Offset: 0x0001BBE0
170 public void OnLoad()
171 {
172 this.domains.OnLoad();
173 this.religions.OnLoad();
174 this.factions.OnLoad();
175 this.world._OnLoad();
176 this.player.OnLoad();
177 if (EClass.pc.currentZone == null || EClass.pc.currentZone.destryoed)
178 {
179 EClass.pc.party.members.ForEach(delegate(Chara c)
180 {
181 c.currentZone = EClass.pc.homeZone;
182 c.global.transition = new ZoneTransition
183 {
184 state = ZoneTransition.EnterState.Return
185 };
186 });
187 }
188 this.player.zone = EClass.pc.currentZone;
189 EClass.pc.currentZone.lastActive = this.world.date.GetRaw(0);
190 if (this.spatials.Find("somewhere") == null)
191 {
192 SpatialGen.Create("somewhere", this.world.region, true, -99999, -99999, 0);
193 }
194 EClass.pc.homeZone.isKnown = true;
195 EClass.debug.OnLoad();
196 EClass.pc.things.RefreshGridRecursive();
197 foreach (Thing thing in EClass.pc.things.List((Thing t) => t.Num <= 0 || t.isDestroyed, false))
198 {
199 thing.parent.RemoveCard(thing);
200 }
201 foreach (Thing thing2 in EClass.pc.things.List((Thing t) => t.trait is TraitChestMerchant, false))
202 {
203 thing2.Destroy();
204 }
205 foreach (Thing thing3 in EClass.pc.things.List((Thing t) => t.invY == 1 && t.invX == -1, false))
206 {
207 thing3.invY = 0;
208 }
209 foreach (FactionBranch factionBranch in EClass.pc.faction.GetChildren())
210 {
211 foreach (Chara chara in factionBranch.members)
212 {
213 chara.RefreshWorkElements(factionBranch.owner.elements);
214 chara.Refresh(false);
215 }
216 }
217 EClass.pc.angle = this.player.angle;
218 EClass.pc.elements.CheckSkillActions();
219 if (this.cards.listAdv.Count == 0)
220 {
221 this.AddAdventurers();
222 }
223 this.quests.list.ForeachReverse(delegate(Quest q)
224 {
225 if (!(q is QuestRandom))
226 {
227 foreach (Quest quest3 in this.quests.list)
228 {
229 if (q != quest3 && quest3.id == q.id)
230 {
231 this.quests.list.Remove(quest3);
232 break;
233 }
234 }
235 }
236 });
237 this.quests.globalList.ForeachReverse(delegate(Quest q)
238 {
239 if (!(q is QuestRandom))
240 {
241 foreach (Quest quest3 in this.quests.globalList)
242 {
243 if (q != quest3 && quest3.id == q.id)
244 {
245 this.quests.globalList.Remove(quest3);
246 break;
247 }
248 }
249 }
250 });
251 if (this.version.IsBelow(0, 22, 91))
252 {
253 this.<OnLoad>g__TryAddQuestIfActive|65_5("demitas_spellwriter", "into_darkness");
254 }
255 if (this.version.IsBelow(0, 22, 91))
256 {
257 this.<OnLoad>g__TryAddQuest|65_4("into_darkness", "exile_kettle");
258 }
259 if (this.version.IsBelow(0, 22, 86))
260 {
261 Chara chara2 = this.cards.globalCharas.Find("demitas");
262 if (chara2 != null && chara2._works != null && chara2._works.Count > 0)
263 {
264 chara2._works[0] = 51;
265 }
266 }
267 if (this.version.IsBelow(0, 22, 86))
268 {
269 this.<OnLoad>g__TryAddQuest|65_4("farris_tulip", "greatDebt");
270 }
271 if (this.version.IsBelow(0, 22, 86))
272 {
273 this.<OnLoad>g__TryAddQuest|65_4("exile_whisper", "exile_kettle");
274 }
275 if (this.version.IsBelow(0, 22, 85))
276 {
277 this.<OnLoad>g__TryAddQuest|65_4("exile_meet", "pre_debt");
278 }
279 if (this.version.IsBelow(0, 22, 60) && EClass.game.quests.Get<QuestDebt>() != null)
280 {
281 Chara chara3 = this.cards.globalCharas.Find("loytel");
282 string str = "Loytelfix: ";
283 Zone homeZone = chara3.homeZone;
284 Debug.Log(str + ((homeZone != null) ? homeZone.ToString() : null));
285 if (chara3.homeZone == null || !chara3.homeZone.IsPCFaction)
286 {
287 EClass.pc.homeBranch.AddMemeber(chara3);
288 chara3.homeZone = EClass.pc.homeBranch.owner;
289 chara3.RemoveEditorTag(EditorTag.Invulnerable);
290 }
291 }
292 if (this.version.IsBelow(0, 22, 52) && this.quests.completedIDs.Contains("vernis_gold"))
293 {
294 this.quests.Add("pre_debt", "farris");
295 }
296 if (this.quests.completedIDs.Contains("farris_tulip"))
297 {
298 this.quests.globalList.ForeachReverse(delegate(Quest q)
299 {
300 if (q.id == "farris_tulip")
301 {
302 this.quests.globalList.Remove(q);
303 }
304 });
305 }
306 this.quests.list.ForeachReverse(delegate(Quest q)
307 {
308 if (q is QuestDialog && this.quests.completedIDs.Contains(q.id))
309 {
310 this.quests.list.Remove(q);
311 }
312 });
313 if (this.version.IsBelow(0, 22, 20))
314 {
315 foreach (Chara chara4 in this.cards.globalCharas.Values)
316 {
317 chara4.SetBool(18, false);
318 }
319 }
320 if (this.version.IsBelow(0, 22, 22))
321 {
322 if (EClass.pc.faithElements != null)
323 {
324 EClass.pc.faithElements.SetParent(null);
325 }
326 foreach (Element element in EClass.pc.elements.ListElements((Element e) => e.source.categorySub == "god", null))
327 {
328 EClass.pc.SetFeat(element.id, 0, false);
329 }
330 EClass.pc.RefreshFaithElement();
331 }
332 if (this.version.IsBelow(0, 22, 45))
333 {
334 this.player.debt = 20000000;
335 }
336 if (!this.version.Equals(EClass.core.version))
337 {
338 this.player.recipes.OnVersionUpdate();
339 }
340 if (this.cards.container_deposit == null)
341 {
342 this.cards.container_deposit = ThingGen.Create("container_deposit", -1, -1);
343 if (this.player.bankMoney > 0)
344 {
345 this.cards.container_deposit.Add("money", this.player.bankMoney, 1);
346 }
347 }
348 foreach (Quest quest in this.quests.list)
349 {
350 if (quest is QuestSequence && !EClass.sources.quests.map.ContainsKey(quest.idSource))
351 {
352 quest.phase = 0;
353 }
354 }
355 foreach (Quest quest2 in this.quests.globalList)
356 {
357 if (quest2 is QuestSequence && !EClass.sources.quests.map.ContainsKey(quest2.idSource))
358 {
359 quest2.phase = 0;
360 }
361 }
362 }
363
364 // Token: 0x06000474 RID: 1140 RVA: 0x0001E228 File Offset: 0x0001C428
365 public static void Create(string _id = null)
366 {
367 Game.id = (_id ?? GameIO.GetNewId());
368 GameIO.ResetTemp();
369 Game.OnBeforeInstantiate();
370 EClass.core.game = (Game.Instance = new Game());
371 EClass.core.game.OnGameInstantiated();
372 EClass.core.game._Create();
373 }
374
375 // Token: 0x06000475 RID: 1141 RVA: 0x0001E281 File Offset: 0x0001C481
376 public static void OnBeforeInstantiate()
377 {
378 Player.seedHallucination = 0;
379 }
380
381 // Token: 0x06000476 RID: 1142 RVA: 0x0001E28C File Offset: 0x0001C48C
382 public void OnGameInstantiated()
383 {
384 HotItemHeld.taskBuild = null;
385 InvOwner.Trader = (InvOwner.Main = null);
386 LayerDrama.currentQuest = null;
387 BookList.Init();
388 ContentGallery.lastPage = 0;
389 ContentGallery.listMode = false;
390 if (!Application.isEditor || !EClass.debug.enable)
391 {
392 RecipeManager.BuildList();
393 }
394 foreach (Chara chara in this.cards.globalCharas.Values)
395 {
396 if (chara.uid == this.player.uidChara)
397 {
398 this.player.chara = chara;
399 break;
400 }
401 }
402 ActionMode.OnGameInstantiated();
403 EClass.ui.widgets.OnGameInstantiated();
404 EClass.Sound.ResetPlaylist();
405 EClass.core.config.ApplyFPS(true);
406 }
407
408 // Token: 0x06000477 RID: 1143 RVA: 0x0001E374 File Offset: 0x0001C574
409 public void _Create()
410 {
411 this.config.areaHighlight = (this.config.snapFreePos = (this.config.slope = (this.config.highlightAct = (this.config.autoWall = true))));
412 this.config.autoCombat.abortOnAllyDead = true;
413 this.config.autoCombat.abortOnHalfHP = true;
414 this.config.autoCombat.bUseHotBar = true;
415 this.config.autoCombat.bUseInventory = true;
416 this.config.autoCombat.bDontChangeTarget = true;
417 this.config.autoCombat.abortOnKill = true;
418 this.idDifficulty = 1;
419 this.seed = EClass.rnd(10000);
420 Debug.Log("creating game: " + Game.id + " seed:" + this.seed.ToString());
421 this.uniforms.Import("uniforms");
422 this.religions.OnCreateGame();
423 this.factions.OnCreateGame();
424 this.world = (SpatialGen.CreateRecursive("world", null) as World);
425 this.domains.OnCreateGame();
426 foreach (Spatial spatial in this.spatials.map.Values)
427 {
428 spatial.SetMainFaction(this.factions.Find(spatial.source.faction.IsEmpty("wilds")));
429 }
430 this.player.OnCreateGame();
431 this.cards.container_shipping = ThingGen.Create("container_shipping", -1, -1);
432 this.cards.container_deliver = ThingGen.Create("container_delivery", -1, -1);
433 this.cards.container_deposit = ThingGen.Create("container_deposit", -1, -1);
434 this.bp = new GameBlueprint();
435 this.bp.Create();
436 }
437
438 // Token: 0x06000478 RID: 1144 RVA: 0x0001E588 File Offset: 0x0001C788
439 public void StartNewGame()
440 {
441 EClass.pc.homeZone = this.StartZone;
442 EClass.pc.SetGlobal();
443 this.parties.Create(EClass.pc);
444 Prologue prologue = EClass.game.Prologue;
445 CharaGen.Create("fiama", -1).SetGlobal(EClass.game.StartZone, prologue.posFiama.x, prologue.posFiama.y);
446 CharaGen.Create("ashland", -1).SetGlobal(EClass.game.StartZone, prologue.posAsh.x, prologue.posAsh.y);
447 if (LayerTitle.actor)
448 {
449 this.world.date.hour = EClass.game.Prologue.hour;
450 EClass.core.actionsNextFrame.Add(new Action(LayerTitle.KillActor));
451 this.player.zone = (EClass.pc.currentZone = (EClass.pc.homeZone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone)));
452 EClass.pc.global.transition = new ZoneTransition
453 {
454 state = ZoneTransition.EnterState.Exact,
455 x = EClass.game.Prologue.startX,
456 z = EClass.game.Prologue.startZ
457 };
458 EClass.pc.hp = EClass.pc.MaxHP;
459 EClass.pc.mana.Set(EClass.pc.mana.max / 2);
460 EClass.pc.stamina.Set(EClass.pc.stamina.max / 2);
461 EClass.pc.AddCondition<ConFaint>(200, true);
462 }
463 else
464 {
465 EClass.pc.homeZone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone);
466 Zone zone = null;
467 ZoneTransition transition = new ZoneTransition
468 {
469 state = ZoneTransition.EnterState.Auto
470 };
471 Chara c = EClass.game.cards.globalCharas.Find("ashland");
472 switch (EClass.debug.startScene)
473 {
474 case CoreDebug.StartScene.Zone:
475 zone = EClass.game.spatials.Find(EClass.debug.startZone);
476 transition = new ZoneTransition
477 {
478 state = ZoneTransition.EnterState.Exact,
479 x = EClass.game.Prologue.startX,
480 z = EClass.game.Prologue.startZ
481 };
482 break;
483 case CoreDebug.StartScene.Home:
484 case CoreDebug.StartScene.Story_Test:
485 zone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone);
486 transition = new ZoneTransition
487 {
488 state = ZoneTransition.EnterState.Exact,
489 x = EClass.game.Prologue.startX,
490 z = EClass.game.Prologue.startZ
491 };
492 break;
493 case CoreDebug.StartScene.Home_Cave:
494 EClass.game.idPrologue = 2;
495 zone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone);
496 transition = new ZoneTransition
497 {
498 state = ZoneTransition.EnterState.Exact,
499 x = EClass.game.Prologue.startX,
500 z = EClass.game.Prologue.startZ
501 };
502 break;
503 case CoreDebug.StartScene.MeetFarris:
504 {
505 Zone parent = EClass.game.spatials.Find("nymelle");
506 zone = (SpatialGen.Create("nymelle", parent, true, -99999, -99999, 0) as Zone);
507 zone.lv = -2;
508 EClass.game.quests.Start("exploration", c, false);
509 break;
510 }
511 case CoreDebug.StartScene.NymelleBoss:
512 {
513 Zone parent2 = EClass.game.spatials.Find("nymelle");
514 zone = (SpatialGen.Create("nymelle_boss", parent2, true, -99999, -99999, 0) as Zone);
515 zone.lv = -5;
516 EClass.game.quests.Start("exploration", c, false).ChangePhase(2);
517 break;
518 }
519 case CoreDebug.StartScene.AfterNymelle:
520 zone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone);
521 transition = new ZoneTransition
522 {
523 state = ZoneTransition.EnterState.Exact,
524 x = EClass.game.Prologue.startX,
525 z = EClass.game.Prologue.startZ
526 };
527 EClass.game.quests.Start("exploration", c, false).ChangePhase(5);
528 EClass.game.quests.globalList.Add(Quest.Create("sharedContainer", null, null).SetClient(c, false));
529 EClass.game.quests.globalList.Add(Quest.Create("crafter", null, null).SetClient(c, false));
530 EClass.game.quests.globalList.Add(Quest.Create("defense", null, null).SetClient(c, false));
531 break;
532 case CoreDebug.StartScene.Melilith:
533 {
534 Zone parent3 = EClass.game.spatials.Find("cursed_manor");
535 zone = (SpatialGen.Create("cursed_manor_dungeon", parent3, true, -99999, -99999, 0) as Zone);
536 zone.lv = -5;
537 break;
538 }
539 case CoreDebug.StartScene.Tefra:
540 {
541 Zone parent4 = EClass.game.spatials.Find("vernis");
542 zone = (SpatialGen.Create("vernis_mine", parent4, true, -99999, -99999, 0) as Zone);
543 zone.lv = -7;
544 break;
545 }
546 }
547 if (zone != null)
548 {
549 this.player.zone = (EClass.pc.currentZone = (EClass.pc.homeZone = zone));
550 EClass.pc.global.transition = transition;
551 }
552 else
553 {
554 this.player.zone = (EClass.pc.currentZone = EClass.game.spatials.Find(EClass.debug.startZone));
555 EClass.pc.global.transition = new ZoneTransition
556 {
557 state = ZoneTransition.EnterState.Return
558 };
559 }
560 }
561 EClass.pc.homeZone.isKnown = true;
562 this.AddAdventurers();
563 this.player.OnStartNewGame();
564 EClass.scene.Init(Scene.Mode.StartGame);
565 }
566
567 // Token: 0x06000479 RID: 1145 RVA: 0x0001EBF0 File Offset: 0x0001CDF0
568 public void AddAdventurers()
569 {
570 List<Zone> source = this.world.region.ListTowns();
571 string[] array = new string[]
572 {
573 "adv_kiria",
574 "adv_gaki",
575 "adv_wini",
576 "adv_verna",
577 "adv_ivory",
578 "adv_mesherada"
579 };
580 for (int i = 0; i < EClass.setting.balance.numAdv; i++)
581 {
582 Zone zone = source.RandomItem<Zone>();
583 if (zone is Zone_SubTown && EClass.rnd(5) != 0)
584 {
585 i--;
586 }
587 else
588 {
589 if (i >= array.Length && i < array.Length + 2)
590 {
591 CardBlueprint.Set(CardBlueprint.Chara(i * 15, Rarity.Normal));
592 }
593 Chara chara = CharaGen.Create((i < array.Length) ? array[i] : ((EClass.rnd(10) == 0) ? "adv_fairy" : "adv"), -1);
594 chara.SetHomeZone(zone);
595 chara.global.transition = new ZoneTransition
596 {
597 state = ZoneTransition.EnterState.RandomVisit
598 };
599 zone.AddCard(chara);
600 this.cards.listAdv.Add(chara);
601 }
602 }
603 }
604
605 // Token: 0x0600047A RID: 1146 RVA: 0x0001ED08 File Offset: 0x0001CF08
606 public void GotoTitle(bool showDialog = true)
607 {
608 if (showDialog)
609 {
610 Dialog.YesNo("dialog_gotoTitle", delegate
611 {
612 EClass.game.Save(true, delegate
613 {
614 EClass.scene.Init(Scene.Mode.Title);
615 }, false);
616 }, null, "yes", "no");
617 return;
618 }
619 EClass.scene.Init(Scene.Mode.Title);
620 }
621
622 // Token: 0x0600047B RID: 1147 RVA: 0x0001ED59 File Offset: 0x0001CF59
623 public void Quit()
624 {
625 Dialog.YesNo("dialog_quit", delegate
626 {
627 EClass.game.Save(true, delegate
628 {
629 EClass.core.Quit();
630 }, false);
631 }, null, "yes", "no");
632 }
633
634 // Token: 0x0600047C RID: 1148 RVA: 0x0001ED90 File Offset: 0x0001CF90
635 public void Save(bool isAutoSave = false, Action onComplete = null, bool silent = false)
636 {
637 if (EClass.ui.IsDragging)
638 {
639 EClass.ui.EndDrag(true);
640 }
641 if (!isAutoSave && !silent)
642 {
643 SE.WriteJournal();
644 }
645 if (isAutoSave && EClass.debug.ignoreAutoSave)
646 {
647 if (onComplete != null)
648 {
649 onComplete();
650 }
651 return;
652 }
653 if (EClass.core.config.game.backupOnFirstSave && this.saveCount == 0)
654 {
655 GameIO.MakeBackup(Game.id, "_auto");
656 EClass.ui.Say("backupDone", null);
657 }
658 this.countLoadedMaps = 0;
659 this.player.pref.layerInventory = EClass.ui.layerFloat.GetLayer<LayerInventory>(false);
660 if (this.player.pref.layerInventory)
661 {
662 this.player.pref.layerAbility = EClass.ui.layerFloat.GetLayer<LayerAbility>(false);
663 }
664 this.player.pref.layerCraft = EClass.ui.layerFloat.GetLayer<LayerCraftFloat>(false);
665 this.player.angle = EClass.pc.angle;
666 this.version = EClass.core.version;
667 EClass.ui.widgets.UpdateConfigs();
668 this.OnBeforeSave();
669 GameIO.SaveGame();
670 if (!silent)
671 {
672 Msg.Say("saved");
673 }
674 this.saveCount++;
675 if (onComplete != null)
676 {
677 onComplete();
678 }
679 }
680
681 // Token: 0x0600047D RID: 1149 RVA: 0x0001EF04 File Offset: 0x0001D104
682 public void OnBeforeSave()
683 {
684 foreach (Zone zone in this.spatials.Zones)
685 {
686 zone.OnBeforeSave();
687 }
688 this.player.OnBeforeSave();
689 foreach (Spatial spatial in this.spatials.listDestryoed)
690 {
691 spatial.DeleteMapRecursive();
692 }
693 this.spatials.listDestryoed.Clear();
694 }
695
696 // Token: 0x0600047E RID: 1150 RVA: 0x0001EFB8 File Offset: 0x0001D1B8
697 public void Kill()
698 {
699 this.isKilling = true;
700 Debug.Log("Killing Game: IsStarted? " + EClass.core.IsGameStarted.ToString());
701 if (EClass.core.IsGameStarted)
702 {
703 EClass.ui.OnKillGame();
704 EClass.scene.OnKillGame();
705 this.activeZone.OnKillGame();
706 }
707 EClass.core.game = (Game.Instance = null);
708 EClass.Sound.currentPlaylist = null;
709 Window.dictTab.Clear();
710 foreach (Texture2D texture2D in this.loadedTextures)
711 {
712 if (texture2D != null)
713 {
714 UnityEngine.Object.Destroy(texture2D);
715 }
716 }
717 }
718
719 // Token: 0x0600047F RID: 1151 RVA: 0x0001F08C File Offset: 0x0001D28C
720 public void Pause(Action onUnpause = null)
721 {
722 Game.isPaused = true;
723 LayerPause layerPause = EClass.ui.AddLayer<LayerPause>();
724 if (onUnpause != null)
725 {
726 layerPause.SetOnKill(onUnpause);
727 }
728 }
729
730 // Token: 0x06000480 RID: 1152 RVA: 0x0001F0B5 File Offset: 0x0001D2B5
731 [OnSerializing]
732 private void OnSerializing(StreamingContext context)
733 {
734 Debug.Log("#io game OnSerializing");
735 }
736
737 // Token: 0x06000481 RID: 1153 RVA: 0x0001F0C1 File Offset: 0x0001D2C1
738 [OnDeserializing]
739 private void OnDeserializing(StreamingContext context)
740 {
741 Debug.Log("#io game OnDeserializing");
742 Game.Instance = this;
743 }
744
745 // Token: 0x06000483 RID: 1155 RVA: 0x0001F1C8 File Offset: 0x0001D3C8
746 [CompilerGenerated]
747 private void <OnLoad>g__TryAddQuest|65_4(string idQuest, string idReqQuest)
748 {
749 if (this.quests.completedIDs.Contains(idReqQuest) && !this.quests.completedIDs.Contains(idQuest) && this.quests.GetGlobal(idQuest) == null && this.quests.Get(idQuest) == null)
750 {
751 this.quests.Add(idQuest, null);
752 }
753 }
754
755 // Token: 0x06000484 RID: 1156 RVA: 0x0001F228 File Offset: 0x0001D428
756 [CompilerGenerated]
757 private void <OnLoad>g__TryAddQuestIfActive|65_5(string idQuest, string idReqQuest)
758 {
759 if (this.quests.Get(idReqQuest) != null && !this.quests.completedIDs.Contains(idQuest) && this.quests.GetGlobal(idQuest) == null && this.quests.Get(idQuest) == null)
760 {
761 this.quests.Add(idQuest, null);
762 }
763 }
764
765 // Token: 0x040005EA RID: 1514
766 public static Game Instance;
767
768 // Token: 0x040005EB RID: 1515
769 public static float waitTimer;
770
771 // Token: 0x040005EC RID: 1516
772 public static string id;
773
774 // Token: 0x040005ED RID: 1517
775 public static bool isPaused;
776
777 // Token: 0x040005EE RID: 1518
778 [JsonProperty(Order = -90)]
779 public SpatialManager spatials = new SpatialManager();
780
781 // Token: 0x040005EF RID: 1519
782 [JsonProperty(Order = -80)]
783 public CardManager cards = new CardManager();
784
785 // Token: 0x040005F0 RID: 1520
786 [JsonProperty(Order = -100)]
787 public ReligionManager religions = new ReligionManager();
788
789 // Token: 0x040005F1 RID: 1521
790 [JsonProperty(Order = -60)]
791 public FactionManager factions = new FactionManager();
792
793 // Token: 0x040005F2 RID: 1522
794 [JsonProperty(Order = -50)]
795 public DomainManager domains = new DomainManager();
796
797 // Token: 0x040005F3 RID: 1523
798 [JsonProperty]
799 public global::Version version;
800
801 // Token: 0x040005F4 RID: 1524
802 [JsonProperty]
803 public PartyManager parties = new PartyManager();
804
805 // Token: 0x040005F5 RID: 1525
806 [JsonProperty]
807 public new World world;
808
809 // Token: 0x040005F6 RID: 1526
810 [JsonProperty]
811 public new Player player = new Player();
812
813 // Token: 0x040005F7 RID: 1527
814 [JsonProperty]
815 public QuestManager quests = new QuestManager();
816
817 // Token: 0x040005F8 RID: 1528
818 [JsonProperty]
819 public RelationManager relations = new RelationManager();
820
821 // Token: 0x040005F9 RID: 1529
822 [JsonProperty]
823 public MsgLog log = new MsgLog
824 {
825 id = "log"
826 };
827
828 // Token: 0x040005FA RID: 1530
829 [JsonProperty]
830 public PCCUniformManager uniforms = new PCCUniformManager();
831
832 // Token: 0x040005FB RID: 1531
833 [JsonProperty]
834 public TeleportManager teleports = new TeleportManager();
835
836 // Token: 0x040005FC RID: 1532
837 [JsonProperty]
838 public int seed;
839
840 // Token: 0x040005FD RID: 1533
841 [JsonProperty]
842 public int idPrologue;
843
844 // Token: 0x040005FE RID: 1534
845 [JsonProperty]
846 public int idDifficulty;
847
848 // Token: 0x040005FF RID: 1535
849 [JsonProperty]
850 public int dateScratch;
851
852 // Token: 0x04000600 RID: 1536
853 [JsonProperty]
854 public Game.Flags flags = new Game.Flags();
855
856 // Token: 0x04000601 RID: 1537
857 [JsonProperty]
858 public Game.Config config = new Game.Config();
859
860 // Token: 0x04000602 RID: 1538
861 [JsonProperty]
862 public List<Thing> lostThings = new List<Thing>();
863
864 // Token: 0x04000603 RID: 1539
865 public int gameSpeedIndex = 1;
866
867 // Token: 0x04000604 RID: 1540
868 public int lastGameSpeedIndex = 1;
869
870 // Token: 0x04000605 RID: 1541
871 public int sessionMin;
872
873 // Token: 0x04000606 RID: 1542
874 public int countLoadedMaps;
875
876 // Token: 0x04000607 RID: 1543
877 public int saveCount;
878
879 // Token: 0x04000608 RID: 1544
880 public float timeSinceStart;
881
882 // Token: 0x04000609 RID: 1545
883 public bool isLoading;
884
885 // Token: 0x0400060A RID: 1546
886 public bool isKilling;
887
888 // Token: 0x0400060B RID: 1547
889 public GameBlueprint bp;
890
891 // Token: 0x0400060C RID: 1548
892 public GameUpdater updater = new GameUpdater();
893
894 // Token: 0x0400060D RID: 1549
895 public Zone activeZone;
896
897 // Token: 0x0400060E RID: 1550
898 public Zone lastActiveZone;
899
900 // Token: 0x0400060F RID: 1551
901 public Dictionary<string, IGlobalValue> referenceMap = new Dictionary<string, IGlobalValue>();
902
903 // Token: 0x04000610 RID: 1552
904 public HashSet<Texture2D> loadedTextures = new HashSet<Texture2D>();
905
906 // Token: 0x04000611 RID: 1553
907 private float welcomeTimer;
908
909 // Token: 0x020007F2 RID: 2034
910 public class Config : EClass
911 {
912 // Token: 0x1700111F RID: 4383
913 // (get) Token: 0x06003821 RID: 14369 RVA: 0x0012CEDF File Offset: 0x0012B0DF
914 public bool FreePos
915 {
916 get
917 {
918 return Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
919 }
920 }
921
922 // Token: 0x0400224A RID: 8778
923 [JsonProperty]
924 public bool areaHighlight;
925
926 // Token: 0x0400224B RID: 8779
927 [JsonProperty]
928 public bool showRoof;
929
930 // Token: 0x0400224C RID: 8780
931 [JsonProperty]
932 public bool showWall;
933
934 // Token: 0x0400224D RID: 8781
935 [JsonProperty]
936 public bool tilt;
937
938 // Token: 0x0400224E RID: 8782
939 [JsonProperty]
940 public bool tiltRegion;
941
942 // Token: 0x0400224F RID: 8783
943 [JsonProperty]
944 public bool slope;
945
946 // Token: 0x04002250 RID: 8784
947 [JsonProperty]
948 public bool noRoof;
949
950 // Token: 0x04002251 RID: 8785
951 [JsonProperty]
952 public bool freePos;
953
954 // Token: 0x04002252 RID: 8786
955 [JsonProperty]
956 public bool snapFreePos;
957
958 // Token: 0x04002253 RID: 8787
959 [JsonProperty]
960 public bool buildLight;
961
962 // Token: 0x04002254 RID: 8788
963 [JsonProperty]
964 public bool highlightAct;
965
966 // Token: 0x04002255 RID: 8789
967 [JsonProperty]
968 public bool autoWall;
969
970 // Token: 0x04002256 RID: 8790
971 [JsonProperty]
972 public bool showGuideGrid;
973
974 // Token: 0x04002257 RID: 8791
975 [JsonProperty]
976 public bool reverseSnow;
977
978 // Token: 0x04002258 RID: 8792
979 [JsonProperty]
980 public bool autoCollectCard;
981
982 // Token: 0x04002259 RID: 8793
983 [JsonProperty]
984 public bool cheat;
985
986 // Token: 0x0400225A RID: 8794
987 [JsonProperty]
988 public int slopeMod = 50;
989
990 // Token: 0x0400225B RID: 8795
991 [JsonProperty]
992 public int defaultZoom = 100;
993
994 // Token: 0x0400225C RID: 8796
995 [JsonProperty]
996 public int zoomedZoom = 125;
997
998 // Token: 0x0400225D RID: 8797
999 [JsonProperty]
1000 public int regionZoom = 100;
1001
1002 // Token: 0x0400225E RID: 8798
1003 [JsonProperty]
1004 public int tiltPower = 80;
1005
1006 // Token: 0x0400225F RID: 8799
1007 [JsonProperty]
1008 public int tiltPowerRegion = 50;
1009
1010 // Token: 0x04002260 RID: 8800
1011 [JsonProperty]
1012 public int gridIconSize = 100;
1013
1014 // Token: 0x04002261 RID: 8801
1015 [JsonProperty]
1016 public int backDrawAlpha = 10;
1017
1018 // Token: 0x04002262 RID: 8802
1019 [JsonProperty]
1020 public int animeSpeed = 100;
1021
1022 // Token: 0x04002263 RID: 8803
1023 [JsonProperty]
1024 public int lowWallObjAltitude = 2;
1025
1026 // Token: 0x04002264 RID: 8804
1027 [JsonProperty]
1028 public ConfigTactics tactics = new ConfigTactics();
1029
1030 // Token: 0x04002265 RID: 8805
1031 [JsonProperty]
1032 public ConfigAutoCombat autoCombat = new ConfigAutoCombat();
1033
1034 // Token: 0x04002266 RID: 8806
1035 [JsonProperty]
1036 public ConfigPreference preference = new ConfigPreference();
1037 }
1038
1039 // Token: 0x020007F3 RID: 2035
1040 public class Flags : EClass
1041 {
1042 // Token: 0x17001120 RID: 4384
1043 // (get) Token: 0x06003823 RID: 14371 RVA: 0x0012CF7F File Offset: 0x0012B17F
1044 // (set) Token: 0x06003824 RID: 14372 RVA: 0x0012CF8D File Offset: 0x0012B18D
1045 public bool IsWelcomeMessageShown
1046 {
1047 get
1048 {
1049 return this.b1[0];
1050 }
1051 set
1052 {
1053 this.b1[0] = value;
1054 }
1055 }
1056
1057 // Token: 0x06003825 RID: 14373 RVA: 0x0012CF9C File Offset: 0x0012B19C
1058 [OnSerializing]
1059 private void OnSerializing(StreamingContext context)
1060 {
1061 this._b1 = (int)this.b1.Bits;
1062 }
1063
1064 // Token: 0x06003826 RID: 14374 RVA: 0x0012CFAF File Offset: 0x0012B1AF
1065 [OnDeserialized]
1066 private void _OnDeserialized(StreamingContext context)
1067 {
1068 this.b1.Bits = (uint)this._b1;
1069 }
1070
1071 // Token: 0x04002267 RID: 8807
1072 [JsonProperty]
1073 public int _b1;
1074
1075 // Token: 0x04002268 RID: 8808
1076 public BitArray32 b1;
1077 }
1078}
Definition Card.cs:13
Definition Chara.cs:12
Definition Game.cs:10
Definition Msg.cs:7
Definition Point.cs:11
Definition Quest.cs:8
Definition Scene.cs:10
Definition Thing.cs:10
Definition Wait.cs:5
Definition World.cs:6
Definition Zone.cs:14