13 public static bool IsWaiting
17 return Game.waitTimer > 0f;
22 public new static void Wait(
float a,
Point p)
26 bool isSync = p.IsSync;
31 public new static void Wait(
float a,
Card c)
33 if (c ==
null || !c.isSynced || c.IsPC)
41 public static void Wait(
float a)
43 Game.waitTimer = a * (float)(
EClass.core.config.game.waiter * 25) / 100f;
52 return EClass.setting.start.prologues[this.idPrologue];
62 return EClass.setting.start.difficulties[this.idDifficulty];
72 return EClass.core.config.game.useGrid;
82 return EClass.core.config.game.altUI;
92 return EClass.core.config.game.altInv;
102 return EClass.core.config.game.altCraft;
108 public bool altAbility
112 return EClass.core.config.game.altAbility;
118 public Zone StartZone
122 return this.spatials.Find(
EClass.game.Prologue.idStartZone);
127 public void OnUpdate()
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)
134 this.flags.IsWelcomeMessageShown =
true;
136 this.updater.FixedUpdate();
140 public static void Load(
string slot)
146 Game.OnBeforeInstantiate();
147 EClass.core.game =
GameIO.LoadGame(slot);
148 EClass.game.isLoading =
true;
149 EClass.game.OnGameInstantiated();
154 SoundManager.ignoreSounds =
true;
155 if (
EClass.game.player.pref.layerInventory)
157 EClass.ui.OpenFloatInv(
false);
159 SoundManager.ignoreSounds =
true;
160 if (
EClass.game.player.pref.layerAbility)
162 EClass.ui.ToggleAbility(
false);
164 SoundManager.ignoreSounds =
false;
166 EClass.game.isLoading =
false;
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)
181 c.currentZone =
EClass.pc.homeZone;
184 state = ZoneTransition.EnterState.Return
188 this.player.zone =
EClass.pc.currentZone;
189 EClass.pc.currentZone.lastActive = this.world.date.GetRaw(0);
190 if (this.spatials.Find(
"somewhere") ==
null)
192 SpatialGen.Create(
"somewhere", this.world.region,
true, -99999, -99999, 0);
194 EClass.pc.homeZone.isKnown =
true;
196 EClass.pc.things.RefreshGridRecursive();
197 foreach (
Thing thing
in EClass.pc.things.List((
Thing t) => t.Num <= 0 || t.isDestroyed,
false))
199 thing.parent.RemoveCard(thing);
205 foreach (
Thing thing3
in EClass.pc.things.List((
Thing t) => t.invY == 1 && t.invX == -1,
false))
211 foreach (
Chara chara
in factionBranch.members)
213 chara.RefreshWorkElements(factionBranch.owner.elements);
214 chara.Refresh(
false);
217 EClass.pc.angle = this.player.angle;
218 EClass.pc.elements.CheckSkillActions();
219 if (this.cards.listAdv.Count == 0)
221 this.AddAdventurers();
223 this.quests.list.ForeachReverse(delegate(
Quest q)
227 foreach (
Quest quest3
in this.quests.list)
229 if (q != quest3 && quest3.id == q.id)
231 this.quests.list.Remove(quest3);
237 this.quests.globalList.ForeachReverse(delegate(
Quest q)
241 foreach (
Quest quest3
in this.quests.globalList)
243 if (q != quest3 && quest3.id == q.id)
245 this.quests.globalList.Remove(quest3);
251 if (this.version.IsBelow(0, 22, 91))
253 this.<OnLoad>g__TryAddQuestIfActive|65_5(
"demitas_spellwriter",
"into_darkness");
255 if (this.version.IsBelow(0, 22, 91))
257 this.<OnLoad>g__TryAddQuest|65_4(
"into_darkness",
"exile_kettle");
259 if (this.version.IsBelow(0, 22, 86))
261 Chara chara2 = this.cards.globalCharas.Find(
"demitas");
262 if (chara2 !=
null && chara2._works !=
null && chara2._works.Count > 0)
264 chara2._works[0] = 51;
267 if (this.version.IsBelow(0, 22, 86))
269 this.<OnLoad>g__TryAddQuest|65_4(
"farris_tulip",
"greatDebt");
271 if (this.version.IsBelow(0, 22, 86))
273 this.<OnLoad>g__TryAddQuest|65_4(
"exile_whisper",
"exile_kettle");
275 if (this.version.IsBelow(0, 22, 85))
277 this.<OnLoad>g__TryAddQuest|65_4(
"exile_meet",
"pre_debt");
279 if (this.version.IsBelow(0, 22, 60) &&
EClass.game.quests.Get<
QuestDebt>() !=
null)
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)
287 EClass.pc.homeBranch.AddMemeber(chara3);
288 chara3.homeZone =
EClass.pc.homeBranch.owner;
289 chara3.RemoveEditorTag(EditorTag.Invulnerable);
292 if (this.version.IsBelow(0, 22, 52) &&
this.quests.completedIDs.Contains(
"vernis_gold"))
294 this.quests.Add(
"pre_debt",
"farris");
296 if (this.quests.completedIDs.Contains(
"farris_tulip"))
298 this.quests.globalList.ForeachReverse(delegate(
Quest q)
300 if (q.id ==
"farris_tulip")
302 this.quests.globalList.Remove(q);
306 this.quests.list.ForeachReverse(delegate(
Quest q)
308 if (q is
QuestDialog && this.quests.completedIDs.Contains(q.id))
310 this.quests.list.Remove(q);
313 if (this.version.IsBelow(0, 22, 20))
315 foreach (
Chara chara4
in this.cards.globalCharas.Values)
317 chara4.SetBool(18,
false);
320 if (this.version.IsBelow(0, 22, 22))
322 if (
EClass.pc.faithElements !=
null)
324 EClass.pc.faithElements.SetParent(
null);
326 foreach (
Element element
in EClass.pc.elements.ListElements((
Element e) => e.source.categorySub ==
"god",
null))
328 EClass.pc.SetFeat(element.id, 0,
false);
330 EClass.pc.RefreshFaithElement();
332 if (this.version.IsBelow(0, 22, 45))
334 this.player.debt = 20000000;
336 if (!this.version.Equals(
EClass.core.version))
338 this.player.recipes.OnVersionUpdate();
340 if (this.cards.container_deposit ==
null)
342 this.cards.container_deposit =
ThingGen.Create(
"container_deposit", -1, -1);
343 if (this.player.bankMoney > 0)
345 this.cards.container_deposit.Add(
"money", this.player.bankMoney, 1);
348 foreach (
Quest quest
in this.quests.list)
355 foreach (
Quest quest2
in this.quests.globalList)
365 public static void Create(
string _id =
null)
367 Game.id = (_id ??
GameIO.GetNewId());
369 Game.OnBeforeInstantiate();
370 EClass.core.game = (Game.Instance =
new Game());
371 EClass.core.game.OnGameInstantiated();
372 EClass.core.game._Create();
376 public static void OnBeforeInstantiate()
378 Player.seedHallucination = 0;
382 public void OnGameInstantiated()
384 HotItemHeld.taskBuild =
null;
385 InvOwner.Trader = (InvOwner.Main =
null);
386 LayerDrama.currentQuest =
null;
388 ContentGallery.lastPage = 0;
389 ContentGallery.listMode =
false;
390 if (!Application.isEditor || !
EClass.debug.enable)
394 foreach (
Chara chara
in this.cards.globalCharas.Values)
396 if (chara.uid ==
this.player.uidChara)
398 this.player.chara = chara;
403 EClass.ui.widgets.OnGameInstantiated();
404 EClass.Sound.ResetPlaylist();
405 EClass.core.config.ApplyFPS(
true);
409 public void _Create()
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();
425 this.domains.OnCreateGame();
426 foreach (
Spatial spatial
in this.spatials.map.Values)
428 spatial.SetMainFaction(this.factions.Find(spatial.source.faction.IsEmpty(
"wilds")));
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);
439 public void StartNewGame()
441 EClass.pc.homeZone = this.StartZone;
443 this.parties.Create(
EClass.pc);
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);
449 this.world.date.hour =
EClass.game.Prologue.hour;
451 this.player.zone = (EClass.pc.currentZone = (EClass.pc.homeZone =
EClass.game.spatials.Find(
EClass.game.Prologue.idStartZone)));
455 x =
EClass.game.Prologue.startX,
456 z = EClass.game.Prologue.startZ
458 EClass.pc.hp =
EClass.pc.MaxHP;
465 EClass.pc.homeZone =
EClass.game.spatials.Find(
EClass.game.Prologue.idStartZone);
469 state = ZoneTransition.EnterState.Auto
471 Chara c =
EClass.game.cards.globalCharas.Find(
"ashland");
472 switch (
EClass.debug.startScene)
475 zone =
EClass.game.spatials.Find(
EClass.debug.startZone);
479 x =
EClass.game.Prologue.startX,
480 z = EClass.game.Prologue.startZ
485 zone =
EClass.game.spatials.Find(
EClass.game.Prologue.idStartZone);
489 x =
EClass.game.Prologue.startX,
490 z = EClass.game.Prologue.startZ
494 EClass.game.idPrologue = 2;
495 zone =
EClass.game.spatials.Find(
EClass.game.Prologue.idStartZone);
499 x =
EClass.game.Prologue.startX,
500 z = EClass.game.Prologue.startZ
505 Zone parent =
EClass.game.spatials.Find(
"nymelle");
506 zone = (
SpatialGen.Create(
"nymelle", parent,
true, -99999, -99999, 0) as
Zone);
508 EClass.game.quests.Start(
"exploration", c,
false);
513 Zone parent2 =
EClass.game.spatials.Find(
"nymelle");
514 zone = (
SpatialGen.Create(
"nymelle_boss", parent2,
true, -99999, -99999, 0) as
Zone);
516 EClass.game.quests.Start(
"exploration", c,
false).ChangePhase(2);
520 zone =
EClass.game.spatials.Find(
EClass.game.Prologue.idStartZone);
524 x =
EClass.game.Prologue.startX,
525 z = EClass.game.Prologue.startZ
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));
534 Zone parent3 =
EClass.game.spatials.Find(
"cursed_manor");
535 zone = (
SpatialGen.Create(
"cursed_manor_dungeon", parent3,
true, -99999, -99999, 0) as
Zone);
541 Zone parent4 =
EClass.game.spatials.Find(
"vernis");
542 zone = (
SpatialGen.Create(
"vernis_mine", parent4,
true, -99999, -99999, 0) as
Zone);
549 this.player.zone = (EClass.pc.currentZone = (EClass.pc.homeZone = zone));
550 EClass.pc.global.transition = transition;
554 this.player.zone = (EClass.pc.currentZone =
EClass.game.spatials.Find(
EClass.debug.startZone));
557 state = ZoneTransition.EnterState.Return
561 EClass.pc.homeZone.isKnown =
true;
562 this.AddAdventurers();
563 this.player.OnStartNewGame();
568 public void AddAdventurers()
570 List<Zone> source = this.world.region.ListTowns();
571 string[] array =
new string[]
580 for (
int i = 0; i <
EClass.setting.balance.numAdv; i++)
582 Zone zone = source.RandomItem<
Zone>();
589 if (i >= array.Length && i < array.Length + 2)
593 Chara chara =
CharaGen.Create((i < array.Length) ? array[i] : ((
EClass.rnd(10) == 0) ?
"adv_fairy" :
"adv"), -1);
594 chara.SetHomeZone(zone);
597 state = ZoneTransition.EnterState.RandomVisit
600 this.cards.listAdv.Add(chara);
606 public void GotoTitle(
bool showDialog =
true)
610 Dialog.YesNo(
"dialog_gotoTitle", delegate
612 EClass.game.Save(
true, delegate
616 },
null,
"yes",
"no");
625 Dialog.YesNo(
"dialog_quit", delegate
627 EClass.game.Save(
true, delegate
631 },
null,
"yes",
"no");
635 public void Save(
bool isAutoSave =
false, Action onComplete =
null,
bool silent =
false)
641 if (!isAutoSave && !silent)
645 if (isAutoSave &&
EClass.debug.ignoreAutoSave)
647 if (onComplete !=
null)
653 if (
EClass.core.config.game.backupOnFirstSave &&
this.saveCount == 0)
656 EClass.ui.Say(
"backupDone",
null);
658 this.countLoadedMaps = 0;
660 if (this.player.pref.layerInventory)
665 this.player.angle =
EClass.pc.angle;
666 this.version =
EClass.core.version;
667 EClass.ui.widgets.UpdateConfigs();
675 if (onComplete !=
null)
682 public void OnBeforeSave()
684 foreach (
Zone zone
in this.spatials.Zones)
688 this.player.OnBeforeSave();
689 foreach (
Spatial spatial
in this.spatials.listDestryoed)
691 spatial.DeleteMapRecursive();
693 this.spatials.listDestryoed.Clear();
699 this.isKilling =
true;
700 Debug.Log(
"Killing Game: IsStarted? " +
EClass.core.IsGameStarted.ToString());
701 if (
EClass.core.IsGameStarted)
704 EClass.scene.OnKillGame();
705 this.activeZone.OnKillGame();
707 EClass.core.game = (Game.Instance =
null);
708 EClass.Sound.currentPlaylist =
null;
709 Window.dictTab.Clear();
710 foreach (Texture2D texture2D
in this.loadedTextures)
712 if (texture2D !=
null)
714 UnityEngine.Object.Destroy(texture2D);
720 public void Pause(Action onUnpause =
null)
722 Game.isPaused =
true;
724 if (onUnpause !=
null)
726 layerPause.SetOnKill(onUnpause);
732 private void OnSerializing(StreamingContext context)
734 Debug.Log(
"#io game OnSerializing");
739 private void OnDeserializing(StreamingContext context)
741 Debug.Log(
"#io game OnDeserializing");
742 Game.Instance =
this;
747 private void <OnLoad>g__TryAddQuest|65_4(
string idQuest,
string idReqQuest)
749 if (this.quests.completedIDs.Contains(idReqQuest) && !
this.quests.completedIDs.Contains(idQuest) &&
this.quests.GetGlobal(idQuest) ==
null &&
this.quests.Get(idQuest) ==
null)
751 this.quests.Add(idQuest,
null);
757 private void <OnLoad>g__TryAddQuestIfActive|65_5(
string idQuest,
string idReqQuest)
759 if (this.quests.Get(idReqQuest) !=
null && !
this.quests.completedIDs.Contains(idQuest) &&
this.quests.GetGlobal(idQuest) ==
null &&
this.quests.Get(idQuest) ==
null)
761 this.quests.Add(idQuest,
null);
766 public static Game Instance;
769 public static float waitTimer;
772 public static string id;
775 public static bool isPaused;
778 [JsonProperty(Order = -90)]
782 [JsonProperty(Order = -80)]
786 [JsonProperty(Order = -100)]
790 [JsonProperty(Order = -60)]
794 [JsonProperty(Order = -50)]
799 public global::Version version;
807 public new World world;
830 public PCCUniformManager uniforms =
new PCCUniformManager();
842 public int idPrologue;
846 public int idDifficulty;
850 public int dateScratch;
862 public List<Thing> lostThings =
new List<Thing>();
865 public int gameSpeedIndex = 1;
868 public int lastGameSpeedIndex = 1;
871 public int sessionMin;
874 public int countLoadedMaps;
877 public int saveCount;
880 public float timeSinceStart;
883 public bool isLoading;
886 public bool isKilling;
895 public Zone activeZone;
898 public Zone lastActiveZone;
901 public Dictionary<string, IGlobalValue> referenceMap =
new Dictionary<string, IGlobalValue>();
904 public HashSet<Texture2D> loadedTextures =
new HashSet<Texture2D>();
907 private float welcomeTimer;
918 return Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
924 public bool areaHighlight;
928 public bool showRoof;
932 public bool showWall;
940 public bool tiltRegion;
956 public bool snapFreePos;
960 public bool buildLight;
964 public bool highlightAct;
968 public bool autoWall;
972 public bool showGuideGrid;
976 public bool reverseSnow;
980 public bool autoCollectCard;
988 public int slopeMod = 50;
992 public int defaultZoom = 100;
996 public int zoomedZoom = 125;
1000 public int regionZoom = 100;
1004 public int tiltPower = 80;
1008 public int tiltPowerRegion = 50;
1012 public int gridIconSize = 100;
1016 public int backDrawAlpha = 10;
1020 public int animeSpeed = 100;
1024 public int lowWallObjAltitude = 2;
1045 public bool IsWelcomeMessageShown
1059 private void OnSerializing(StreamingContext context)
1061 this._b1 = (int)this.b1.Bits;
1066 private void _OnDeserialized(StreamingContext context)
1068 this.b1.Bits = (uint)this._b1;
1076 public BitArray32 b1;