GuiBase Display_SetParent(string guiTypeName, Transform parentTrans, JSONNode pParams) { GuiBase guiBase = null; if (_showGuiEntityList.TryGetValue(guiTypeName, out guiBase)) { if (parentTrans == guiBase.transform.parent) { return(guiBase); } else { guiBase.transform.parent = parentTrans; guiBase.transform.localPosition = Vector3.zero; guiBase.transform.localRotation = Quaternion.identity; guiBase.transform.localScale = Vector3.one; guiBase.SetParameter(pParams); UIAnchor anchortmp = guiBase.GetComponent <UIAnchor>(); if (anchortmp) { anchortmp.uiCamera = parentTrans.GetComponent <Camera>(); } return(guiBase); } } return(guiBase); }
void IGUI.GUIEvent(GUI_event guiEvent) { print($"WindowID: {guiEvent.WindowID}\n" + $"GroupID: {guiEvent.GroupID}\n" + $"ItemID: {guiEvent.ItemID}\n" + $"MouseButton: {guiEvent.MouseButton}"); switch (guiEvent.WindowID) { case 1: switch (guiEvent.GroupID) { case 1: switch (guiEvent.ItemID) { case 1: ScrollGroup.Add(new GUI_content(10, GUI_Item_Type.NORMALBUTTON, "new", null, new GUI_textColor(), textAlign: TextAnchor.MiddleLeft)); GuiBase.SetGroupLabel(1, 3, "próba"); GuiBase.RefreshGroup(1, 3); break; } break; case 3: switch (guiEvent.ItemID) { case 7: print($"Slider: {guiEvent.Value}"); break; } break; case 4: switch (guiEvent.ItemID) { case (int)BaseButtonIDs.BUTTON_ON_OFF: print("On/Off pressed!"); break; case (int)BaseButtonIDs.BUTTON_MARK: print("Mark pressed!"); break; case (int)BaseButtonIDs.BUTTON_COPY: print("Copy pressed!"); break; case (int)BaseButtonIDs.BUTTON_PASTE: print("Paste pressed!"); break; case (int)BaseButtonIDs.BUTTON_DESTROY: print("Destroy pressed!"); break; } break; } break; } }
/// <summary> /// Enables or disables a control. /// </summary> /// <param name="control">Control.</param> /// <param name="targetState">If set to <c>true</c> target state.</param> public void EnableDisableControl(GuiBase control, bool targetState) { if (control != null) { EnableDisableControl(control.gameObject, targetState); } }
private void SetAllUserItems(object returnValue) { Kongregate.m_Items = returnValue.ToString(); string[] array = (!string.IsNullOrEmpty(Kongregate.m_Items)) ? Kongregate.m_Items.Split(new char[] { ',' }) : new string[0]; if (array.Length == 0) { return; } StringBuilder stringBuilder = new StringBuilder("You got your bought items back:\n"); int num = 1; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string itemId = array2[i]; stringBuilder.Append(num + ". " + App.State.PremiumBoni.GetItemNameAndAddItem(itemId, Purchase.None)).Append("\n"); num++; } string value = stringBuilder.ToString(); if (!string.IsNullOrEmpty(value)) { GuiBase.ShowBigMessage(stringBuilder.ToString()); } }
public FormMain() { InitializeComponent(); //_dispatchDr = Dispatcher.CurrentDispatcher; mainB = new GuiBase(this); if (SessionInfo.FullScreen) { mainB.VideoInit(true); tabLowDev.Dispose(); lblVlcNotify.Dispose(); lblEvent.Dispose(); //GC.WaitForFullGCComplete(); } else { mainB.InitGuiControls(); mainB.InitGuiDeviceInfo(); mainB.InitGuiRecord(); mainB.DeviceTextBoxesUpdate(false); mainB.AddFormEvents(); mainB.VideoInit(false); } FormClosing += FormMain_FormClosing; }
protected override bool OnFrameStarted(object source, FrameEventArgs e) { bool result = base.OnFrameStarted(source, e); GuiBase.OnFrameStarted(); debugText = "Role Playing Game Demo"; ShowOverlay(gameState); switch (gameState) { case GameStates.Menu: { break; } case GameStates.Game: { break; } default: { break; } } return(result); }
private static void debugAssert(GuiBase newGui) { if (newGui == null) { throw new Exception("Null was passed while trying to open a GUI!"); } }
public void FinishUUC(GameState state) { if (this.TypeEnum == Creation.CreationType.Universe && state.Statistic.HasStartedUniverseChallenge && this.count > 0) { state.Statistic.HasStartedUniverseChallenge = false; if (state.Statistic.FastestUUCallenge <= 0 || state.Statistic.FastestUUCallenge > state.Statistic.TimeAfterUUCStarted) { state.Statistic.FastestUUCallenge = state.Statistic.TimeAfterUUCStarted; Leaderboards.SubmitStat(LeaderBoardType.FastestUUCallenge, (int)(state.Statistic.FastestUUCallenge.ToLong() / 1000L), false); } state.Statistic.TimeAfterUUCStarted = 0; Statistic expr_C6 = state.Statistic; expr_C6.UniverseChallengesFinished = ++expr_C6.UniverseChallengesFinished; if (state.HomePlanet.UpgradeLevel < 50) { Planet expr_F8 = state.HomePlanet; expr_F8.UpgradeLevel = ++expr_F8.UpgradeLevel; GuiBase.ShowToast("Ultimate Universe Challenge finished! Your Planet level increased by 1."); } else { GuiBase.ShowToast("Ultimate Universe Challenge finished! But your Planet level is already maxed."); } } }
static void SetUIElementPosition(GuiBase obj, float height, float width, Vector2 anchorPos) { if (obj.GetComponent <RectTransform>() != null) { SetUIElementPosition(obj.GetComponent <RectTransform>(), height, width, anchorPos); } }
public static void guiBootstrap() { GuiManager.currentGui = new Stack <GuiBase>(); GuiManager.paused = References.list.guiPausedObject; GuiManager.unitStats = References.list.guiUnitStatsObject; GuiManager.campaignSelect = References.list.guiCampaignSelect; }
private static GuiBase func(GuiBase newGui) { GuiManager.currentGui.Push(newGui); newGui.gameObject.SetActive(true); return(newGui); }
/// <summary> /// Opens the passed gui, closing any previously open ones. /// </summary> public static GuiBase openGui(GuiBase newGui) { debugAssert(newGui); GuiManager.closeTopGui(); return(func(newGui)); }
private void SetAdCompleted(object returnValue) { App.AdOpened = false; State2 expr_10 = App.State.Ext; expr_10.AdPoints = ++expr_10.AdPoints; App.State.Ext.AdsWatched++; App.State.Ext.TotalAdsWatched++; GuiBase.ShowToast("Thank you, you received 1 Ad point!"); }
public static GameState LoadGameState(string filename) { if (App.CurrentPlattform == Plattform.Steam) { if (string.IsNullOrEmpty(filename)) { return null; } string str = Application.dataPath + "\\Saves\\"; if (!"ManualSave.txt".Equals(filename)) { str = Application.persistentDataPath + "\\ItRtG_Steam_\\"; } if (!filename.Contains(".txt")) { filename += ".txt"; } string text = str + filename; GameState gameState = Storage.FromCompressedString(Storage.LoadFile(text)); if (gameState == null || (gameState.Clones.Count == 0 && gameState.Statistic.HighestGodDefeated == 0)) { text = Application.persistentDataPath + "\\ItRtG_Steam_\\" + filename; gameState = Storage.FromCompressedString(Storage.LoadFile(text)); } if (gameState == null || (gameState.Clones.Count == 0 && gameState.Statistic.HighestGodDefeated == 0)) { text = Application.dataPath + "\\Saves\\" + filename; gameState = Storage.FromCompressedString(Storage.LoadFile(text)); } Log.Info("Game loaded from: " + text); if (App.State != null && !App.State.SteamId.Equals(gameState.SteamId) && App.State.KongUserIdLong == 0L) { Log.Error("This save is not a valid save!"); GuiBase.ShowToast("This save is not a valid save!"); Storage.SaveGameState(gameState, "SaveWrongSteamId"); return null; } if (string.IsNullOrEmpty(gameState.SteamId) && !filename.Equals("AutoSave.txt")) { Log.Error("This save is not a valid save!"); GuiBase.ShowToast("This save is not a valid save!"); Storage.SaveGameState(gameState, "SaveInvalidSteamId"); return null; } return gameState; } else { if (PlayerPrefs.HasKey(filename)) { return Storage.FromCompressedString(PlayerPrefs.GetString(filename)); } return null; } }
/// <summary> /// Closes the top level GUI. /// </summary> public static void closeTopGui() { if (GuiManager.currentGui.Count != 0) { GuiBase gui = GuiManager.currentGui.Pop(); if (gui != null) { gui.gameObject.SetActive(false); } } }
public static void CheckBaalPower(Action <bool> result) { if (App.State.HomePlanet.BaalPower > 3 && App.State.PremiumBoni.PetFoodAfterRebirth) { GuiBase.ShowDialog("Are you sure?", "You still have " + App.State.HomePlanet.BaalPower + " baal power left.", delegate { result(true); }, delegate { result(false); }, "Yes", "No", false, false); } else { result(true); } }
public void AddNeededClones() { this.RemoveAllClones(); CDouble clonesNeeded = this.ClonesNeeded; CDouble availableClones = App.State.GetAvailableClones(false); if (availableClones >= clonesNeeded) { App.State.Clones.UseShadowClones(clonesNeeded); this.ShadowClones += clonesNeeded; this.ShouldUpdateText = true; } else { GuiBase.ShowToast("You need " + clonesNeeded.GuiText + " clones!"); } }
private static void CheckPets(Action <bool> result) { foreach (Pet current in App.State.Ext.AllPets) { if (current.CanFeed && current.IsUnlocked) { GuiBase.ShowDialog("Are you sure?", "Your pets are hungry!", delegate { result(true); }, delegate { result(false); }, "Yes", "No", false, false); return; } } result(true); }
private void SetUserItems(object returnValue) { Kongregate.m_Items = returnValue.ToString(); string[] array = (!string.IsNullOrEmpty(Kongregate.m_Items)) ? Kongregate.m_Items.Split(new char[] { ',' }) : new string[0]; StringBuilder stringBuilder = new StringBuilder(); int num = 1; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string arg = array2[i]; stringBuilder.Append(num + ". " + arg).Append("\n"); num++; } string text = string.Empty; if (array.Length > App.State.PremiumBoni.TotalItemsBought) { text = App.State.PremiumBoni.GetItemNameAndAddItem(App.State.PremiumBoni.ItemToPurchase, Purchase.None); } App.State.PremiumBoni.TotalItemsBought = array.Length; Kongregate.IsWaitingForPurchase = false; if (!string.IsNullOrEmpty(text)) { App.SaveGameState(); GuiBase.ShowBigMessage("Thank you for your purchase!\n" + text); } else { int num2 = App.State.KredProblems.Check(); if (num2 > 0) { GuiBase.ShowBigMessage("Thank you for your purchase!\nYou received " + num2 + " god power."); } } }
public static string SaveGameState(GameState state, string filename) { if (string.IsNullOrEmpty(filename)) { filename = "AutoSave"; } string text = Storage.ToCompressedString(state); try { if (App.CurrentPlattform == Plattform.Steam) { if (!filename.EndsWith(".txt")) { filename += ".txt"; } string text2 = Application.dataPath + "\\Saves\\"; if (!"ManualSave.txt".Equals(filename)) { text2 = Application.persistentDataPath + "\\ItRtG_Steam_\\"; } if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); } Log.Info("Game saved to: " + text2 + filename); File.WriteAllText(text2 + filename, text); } else { PlayerPrefs.SetString(filename, text); PlayerPrefs.Save(); } } catch (IOException ex) { GuiBase.ShowBigMessage("Failed so save the game!\n" + ex.StackTrace); } return text; }
public Crystal Upgrade(GameState state, CDouble moduleLevel, CDouble count) { if (count > this.Count) { count = this.Count; } int num = this.UpgradeChance(state, moduleLevel, false).ToInt(); CDouble crystalsAfterUpgrade = this.GetCrystalsAfterUpgrade(state, moduleLevel, count); this.Count -= count; this.Count.Round(); if (crystalsAfterUpgrade == 0) { GuiBase.ShowToast("You failed to upgrade any crystal!"); } return(new Crystal { Type = this.Type, Count = crystalsAfterUpgrade, Level = this.Level + 1 }); }
public void GetAttacked(CDouble attackPower, long millisecs) { int value = UnityEngine.Random.Range(1, 100); CDouble cDouble = new CDouble(); if (value <= App.State.Crits.CriticalPercent(App.State.GameSettings.TBSEyesIsMirrored)) { attackPower = attackPower * App.State.Crits.CriticalDamage / 100; cDouble = attackPower / 5000 * millisecs; } else { cDouble = (attackPower - this.Defense) / 5000 * millisecs; } this.DamageSec = cDouble * 33; if (cDouble > 0) { this.CurrentHealth -= cDouble; } if (this.CurrentHealth <= 0) { if (App.State.Statistic.HighestGodDefeated < this.Level + 28) { App.State.Statistic.HighestGodDefeated = this.Level + 28; } App.State.PremiumBoni.GodPower++; App.State.HomePlanet.BaalPower += this.Level; GuiBase.ShowToast("Your god power is increased by 1, you also received " + this.Level + " Baal Power!"); App.State.PremiumBoni.CheckIfGPIsAdjusted(); this.IsFighting = false; GodUi.EnableCreating(); Statistic expr_1AF = App.State.Statistic; expr_1AF.TotalGodsDefeated = ++expr_1AF.TotalGodsDefeated; Leaderboards.SubmitStat(LeaderBoardType.GodsDefeated, App.State.Statistic.TotalGodsDefeated.ToInt(), false); Leaderboards.SubmitStat(LeaderBoardType.HighestGodDefeated, App.State.Statistic.HighestGodDefeated.ToInt(), false); this.IncreaseLevel(); } Log.Info("CurrentHealth: " + this.CurrentHealth); }
public static void CheckCampaigns(Action <bool> result) { bool flag = false; foreach (PetCampaign current in App.State.Ext.AllCampaigns) { if (current.TotalDuration > 0) { GuiBase.ShowDialog("Are you sure?", "There are still pet campaigns running.", delegate { result(true); }, delegate { result(false); }, "Yes", "No", false, false); flag = true; } } if (!flag) { result(true); } }
private void SetAdAbandoned(object returnValue) { App.AdOpened = false; GuiBase.ShowToast("The Ad was canceled, so sorry no reward."); }
void OnGUI() { //Controls switching between Mouselook and interaction and sets the cursor icon if (Conversation.InConversation == true) { playerUW.XAxis.enabled = false; playerUW.YAxis.enabled = false; playerUW.MouseLookEnabled = false; Cursor.lockState = CursorLockMode.None; CursorPosition.center = Event.current.mousePosition; GUI.DrawTexture(CursorPosition, playerUW.CursorIcon); playerUW.MouseLookCursor.mainTexture = playerUW.CursorIconBlank; } else { if (Event.current.Equals(Event.KeyboardEvent("f"))) { //Toggle full screen. if (FullScreen == true) { FullScreen = false; //chains.EnableDisableControl("main_window",true); anchor.side = UIAnchor.Side.Left; anchor.relativeOffset = new Vector2(0.43f, 0.13f); stretch.relativeSize = new Vector2(0.55f, 0.57f); playerUW.playerCam.rect = new Rect(0.163f, 0.335f, 0.54f, 0.572f); playerUW.playerHud.main_window.enabled = true; playerUW.playerHud.compass.MoveControlOffset(+0.1f, 0.0f); for (int i = 0; i <= playerUW.playerHud.compass.NorthIndicators.GetUpperBound(0); i++) { GuiBase cn = playerUW.playerHud.compass.NorthIndicators[i].GetComponent <GuiBase>(); if (cn != null) { cn.MoveControlOffset(+0.1f, 0.0f); } } } else { FullScreen = true; //chains.EnableDisableControl("main_window",false); anchor.side = UIAnchor.Side.Center; anchor.relativeOffset = new Vector2(0.0f, 0.0f); stretch.relativeSize = new Vector2(1.0f, 1.0f); playerUW.playerCam.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); playerUW.playerHud.main_window.enabled = false; playerUW.playerHud.compass.MoveControlOffset(-0.1f, 0.0f); for (int i = 0; i <= playerUW.playerHud.compass.NorthIndicators.GetUpperBound(0); i++) { GuiBase cn = playerUW.playerHud.compass.NorthIndicators[i].GetComponent <GuiBase>(); if (cn != null) { cn.MoveControlOffset(-0.1f, 0.0f); } } } } if (Event.current.Equals(Event.KeyboardEvent("e"))) { if (playerUW.MouseLookEnabled == false) { playerUW.YAxis.enabled = true; playerUW.XAxis.enabled = true; playerUW.MouseLookEnabled = true; Cursor.lockState = CursorLockMode.Locked; } else { playerUW.XAxis.enabled = false; playerUW.YAxis.enabled = false; playerUW.MouseLookEnabled = false; Cursor.lockState = CursorLockMode.None; } } if (playerUW.MouseLookEnabled == true) { playerUW.MouseLookCursor.mainTexture = playerUW.CursorIcon; } else { CursorPosition.center = Event.current.mousePosition; GUI.DrawTexture(CursorPosition, playerUW.CursorIcon); playerUW.MouseLookCursor.mainTexture = playerUW.CursorIconBlank; } } }
public new void UpdateDuration(long ms) { foreach (GeneratorUpgrade current in this.Upgrades) { current.UpdateDuration(ms); } CDouble leftSide = 0; int num = 0; if (this.IsBuilt && this.ShadowCloneCount > 0) { Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Stone); if (creation != null) { CDouble rightSide = ms * (long)App.State.ClonesDifGenMod / 20L; CDouble cDouble = this.ShadowCloneCount * rightSide; if (creation.Count < cDouble) { cDouble = creation.Count; } CDouble cDouble2 = this.Capacity - this.FilledCapacity; CDouble cDouble3 = cDouble * creation.BuyCost; if (cDouble3 > cDouble2) { leftSide = cDouble3 - cDouble2; cDouble3 = cDouble2; } if (leftSide > 0) { cDouble -= leftSide / creation.BuyCost; num = (leftSide / 962500000).ToInt(); } this.FilledCapacity += cDouble3; creation.Count -= cDouble; } } if (this.FilledCapacity > 0) { CDouble cDouble4 = this.ConvertSec * ms / 1000; if (this.FilledCapacity > cDouble4) { this.FilledCapacity -= cDouble4; } else { cDouble4 = this.FilledCapacity; this.FilledCapacity = 0; } CDouble cDouble5 = cDouble4 * this.DivinityEachCapacity; this.DivinitySec = cDouble5 * 1000 / ms; if (num > 400) { num = 400; } cDouble5 = cDouble5 * (num + 100) / 100; this.DivinitySecWithWorker = cDouble5 * 1000 / ms; if (App.State.PremiumBoni.CrystalBonusDivinity > 0) { cDouble5 = cDouble5 * (100 + App.State.PremiumBoni.CrystalBonusDivinity) / 100; this.DivinitySecWithWorkerCrystal = cDouble5 * 1000 / ms; } App.State.Money += cDouble5; } else { this.DivinitySecWithWorker = 0; this.DivinitySec = 0; } if (this.ShadowCloneCount == 0 || this.IsBuilt) { return; } if (!this.IsPaid) { bool flag = false; StringBuilder stringBuilder = new StringBuilder("You still need:\n"); using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (!CreationCost.HasCreations(App.State, cost, App.State.GameSettings.AutoBuyCreationsForDivGen)) { flag = true; stringBuilder.Append(creation2.Name).Append(" x ").Append((cost.CountNeeded - creation2.Count).ToGuiText(true)).Append("\n"); } } } if (flag) { stringBuilder.Append("to build ").Append(this.Name).ToString(); if (!App.State.GameSettings.StickyClones) { GuiBase.ShowToast(stringBuilder.ToString()); App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } else { this.MissingItems = "\n\n" + stringBuilder.ToString(); } return; } using (List <CreationCost> .Enumerator enumerator3 = this.RequiredCreations.GetEnumerator()) { while (enumerator3.MoveNext()) { CreationCost cost = enumerator3.Current; Creation creation3 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation3.Count -= cost.CountNeeded; } } this.IsPaid = true; } this.MissingItems = string.Empty; this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong(); Log.Info(string.Concat(new object[] { this.Name, ", Duration: ", this.CurrentDuration, " / ", this.DurationInMS(1) })); if (this.CurrentDuration > this.DurationInMS(1)) { this.IsPaid = false; this.CurrentDuration = 0L; this.IsBuilt = true; App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } }
void IGUI.ShowMainWindow() { GuiBase.EnableWindow(1); }
public static void CheckRebirth(Action <bool> result, bool showDefaultDialog = true) { foreach (Creation current in App.State.AllCreations) { if (current.TypeEnum == Creation.CreationType.Light && !current.GodToDefeat.IsDefeated) { GuiBase.ShowToast("You need to defeat " + current.GodToDefeat.Name + " first to be able to rebirth!"); result(false); return; } } if (App.State.Statistic.HasStartedArtyChallenge && App.State.Statistic.RebirthsAfterUAC > 5) { GuiBase.ShowDialog("Are you sure?", "If you rebirth now, you will cancel your Arty challenge without getting any rewards!", delegate { result(true); }, delegate { result(false); }, "Yes", "No", false, false); } else { App.CheckCampaigns(delegate(bool campaign) { if (campaign) { App.CheckBaalPower(delegate(bool baalpower) { if (baalpower) { App.CheckPets(delegate(bool pets) { if (pets) { if (showDefaultDialog) { GuiBase.ShowDialog("Are you sure?", "This will overwrite your current multiplier, even if your stats after rebirthing are lower.", delegate { result(true); }, delegate { result(false); }, "Yes", "No", false, false); } else { result(true); } } else { result(false); } }); } else { result(false); } }); } }); } }
private void UBAttack(bool playerSecondAttack) { if (playerSecondAttack) { return; } int num = UnityEngine.Random.Range(0, 100); if (this.Being.DamageReduction < 75 && num > 80) { this.Being.DamageReduction += 10; this.InfoText = this.InfoText + "\n" + this.Being.Name + " concentrated his power. His damage reduction increased by 10%"; } else if (this.Being.HPPercent < 15 && num > 67) { this.Being.HPPercent += 10; this.InfoText = this.InfoText + "\n" + this.Being.Name + " healed himself for 10% of his hp."; } else if (num > 85 && !this.Being.PowerUp) { this.Being.PowerUp = true; this.InfoText = this.InfoText + "\n" + this.Being.Name + " concentrated his power."; } else { string text = this.Being.SkillName1; CDouble rightSide = 1; if (num > 50) { if (num > 80) { rightSide = 2.5; text = this.Being.SkillName3; } else { rightSide = 1.5; text = this.Being.SkillName2; } } if (this.Being.PowerUp) { rightSide = 2; this.Being.PowerUp = false; } CDouble cDouble = this.Being.BaseCloneDamage / 100 * (100 - this.DamageReduction) * rightSide; cDouble = (double)UnityEngine.Random.Range((float)cDouble.ToInt() * 0.9f, (float)cDouble.ToInt() * 1.1f); CDouble cDouble2 = this.Being.BaseDamage / 100 * (100 - this.DamageReduction) * rightSide; if (!this.DamageReflect) { if (num < this.DodgeChance) { CDouble cDouble3 = 5 * (100 - this.Being.DamageReduction) / 100; if (this.DoubleUp) { cDouble3 *= 2; this.DoubleUp = false; } this.DodgeChance = 0; this.CounterChance = 0; cDouble3 = cDouble3 * this.Damage / 100; cDouble3 = (double)UnityEngine.Random.Range((float)cDouble3.ToInt() * 0.9f, (float)cDouble3.ToInt() * 1.1f); this.Being.HPPercent -= cDouble3; this.InfoText = string.Concat(new string[] { this.InfoText, "\n", this.Being.Name, " used ", text, " and you dodged the attack! \nYou countered for ", cDouble3.ToGuiText(true) }); } else { if (cDouble > App.State.HomePlanet.ShadowCloneCount) { cDouble = App.State.HomePlanet.ShadowCloneCount; cDouble2 *= 2; } else { cDouble2 *= 0.5; } App.State.HomePlanet.ShadowCloneCount -= cDouble.ToInt(); App.State.Clones.RemoveUsedShadowClones(cDouble.ToInt()); App.State.Clones.Count -= cDouble.ToInt(); App.State.Clones.TotalClonesKilled += cDouble.ToInt(); App.State.Statistic.TotalShadowClonesDied += cDouble; this.PlayerHp -= App.State.MaxHealth * cDouble2 / 100; this.InfoText = string.Concat(new string[] { this.InfoText, "\n", this.Being.Name, " used ", text, " and killed ", cDouble.ToGuiText(true), " of your clones!\nYou also lost ", cDouble2.ToGuiText(true), " % of your hp." }); } } else { cDouble2 = cDouble2 * (100 - this.Being.DamageReduction) / 250; if (cDouble2 > 5) { cDouble2 = 5; } this.Being.HPPercent -= cDouble2; this.DamageReflect = false; this.InfoText = string.Concat(new string[] { this.InfoText, "\n", this.Being.Name, " used ", text, " but the damage is reflected back!\n", this.Being.Name, " took ", cDouble2.ToGuiText(true), " % damage." }); } } if (this.PlayerHp <= 0 || App.State.HomePlanet.ShadowCloneCount <= 0) { App.State.CurrentHealth = 0; GuiBase.ShowToast("You lost the fight!"); this.IsFighting = false; } if (this.Being.HPPercent <= 0) { this.Being.IsDefeated = true; this.Being.isCreating = false; this.Being.TimesDefeated++; CDouble multiplier = this.Being.GetMultiplier(App.State.HomePlanet.UBMultiplier); App.State.HomePlanet.UBMultiplier += multiplier; App.State.PremiumBoni.GodPower += this.Being.Tier * 10; App.State.HomePlanet.TotalGainedGodPower += this.Being.Tier * 10; GuiBase.ShowToast(string.Concat(new object[] { "You won the fight and earned ", this.Being.Tier * 10, " God Power!\nYour planet multiplier also increased by ", multiplier.ToGuiText(true) })); if (this.Being.Tier < 5) { App.State.HomePlanet.UltimateBeingsV2[this.Being.Tier].IsAvailable = true; } App.State.PremiumBoni.CheckGP = true; this.IsFighting = false; HeroImage.SetTitle(); } }
internal static void Rebirth() { Monument monument3 = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == Monument.MonumentType.black_hole); if (monument3 != null && monument3.Upgrade.Level > 0) { int num = monument3.Upgrade.Level.ToInt(); if (num > 50) { num = 50; } App.State.PremiumBoni.GodPower += num; App.State.Statistic.GPFromBlackHoleUpgrade += num; GuiBase.ShowBigMessage("You received " + num + " God Power from your black hole upgrades!"); } if (App.State.Statistic.HasStartedNoRbChallenge) { GuiBase.ShowToast("Because of your rebirth, you lost your No Rebirth Challenge!"); App.State.Statistic.HasStartedNoRbChallenge = false; } App.State.Statistic.Last5RebirthTimes.Add(App.State.Statistic.TimePlayedSinceRebirth); if (App.State.Statistic.Last5RebirthTimes.Count > 5) { App.State.Statistic.Last5RebirthTimes.RemoveAt(0); } bool shouldSubmitScore = App.State.ShouldSubmitScore; CDouble cDouble = App.State.Statistic.ApplyTimeMulti(App.State.Multiplier.RebirthMulti * App.State.Statistic.StatisticRebirthMultiplier); if (App.State.Statistic.AvgTimeLastRebirths() < 900 || App.State.Statistic.RandomDividerLastRebirth < 1) { App.State.Statistic.CalcuRandomDivider(); } else { App.State.Statistic.RandomDividerLastRebirth = 1; } bool flag = false; foreach (Creation current in App.State.AllCreations) { if (current.GodToDefeat.IsDefeated) { App.State.Statistic.GodDefeatedBeforeRebirth = current.GodToDefeat.Name; if (current.TypeEnum == Creation.CreationType.Universe) { flag = true; } } } if (flag) { App.State.Statistic.GodDefeatedBeforeRebirth = "P. Baal v " + (App.State.PrinnyBaal.Level - 1); } string base64String = App.State.Statistic.Serialize(); CDouble cDouble2 = App.State.Ext.AfkGame.ExpMulti; CDouble cDouble3 = App.State.Ext.AfkGame.Power.Level / 10000000; if (cDouble3 > 1) { cDouble3 = 1; } cDouble2 += cDouble3; CDouble achievementMultiPhysical = App.State.Multiplier.MultiBoniPhysicalRebirth * cDouble; CDouble achievementMultiMystic = App.State.Multiplier.MultiBoniMysticRebirth * cDouble; CDouble achievementMultiBattle = App.State.Multiplier.MultiBoniBattleRebirth * cDouble; CDouble achievementMultiCreating = App.State.Multiplier.MultiBoniCreatingRebirth * cDouble; int maxShadowClonesRebirth = App.State.Clones.MaxShadowClonesRebirth; int absoluteMaximum = App.State.Clones.AbsoluteMaximum; Premium premiumBoni = App.State.PremiumBoni; AvatarOptions avatar = App.State.Avatar; List <Monument> allMonuments = App.State.AllMonuments; List <GeneratorUpgrade> upgrades = App.State.Generator.Upgrades; PlayerKredProblems kredProblems = App.State.KredProblems; Planet homePlanet = App.State.HomePlanet; long creatingSpeedBoniDuration = App.State.CreatingSpeedBoniDuration; string avatarName = App.State.AvatarName; List <float> randomValues = App.State.Ext.RandomValues; int currentRandomNumber = App.State.Ext.CurrentRandomNumber; Critical crits = App.State.Crits; crits.Eyes = crits.Eyes * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; crits.Feet = crits.Feet * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; crits.Mouth = crits.Mouth * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; crits.Tail = crits.Tail * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; crits.Wings = crits.Wings * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; crits.EyesNoMirror = crits.EyesNoMirror * App.State.PremiumBoni.TbsProgressAfterRebirth / 100; List <Creation> allCreations = App.State.AllCreations; Settings gameSettings = App.State.GameSettings; string kongUserId = App.State.KongUserId; string kongUserName = App.State.KongUserName; string steamId = App.State.SteamId; string steamName = App.State.SteamName; string androidId = App.State.AndroidId; string androidName = App.State.AndroidName; bool isSocialDialogShown = App.State.IsSocialDialogShown; List <Skill> allSkills = App.State.AllSkills; List <Pet> allPets = App.State.Ext.AllPets; foreach (Pet current2 in allPets) { current2.FeedTimer = 43200000L; current2.Exp = 0; current2.Level = 1; current2.ShadowCloneCount = 0; current2.CloneBattle = 1; current2.CloneMystic = 1; current2.ClonePhysical = 1; current2.CalculateValues(); } State2 ext = App.State.Ext; List <Might> allMights = App.State.AllMights; long timeStampGameClosed = App.State.TimeStampGameClosed; long timeStampGameClosedOfflineMS = App.State.TimeStampGameClosedOfflineMS; CDouble cDouble4 = 0; foreach (Crystal current3 in App.State.Ext.Factory.EquippedCrystals) { CDouble cDouble5 = current3.Level; if (current3.Type == ModuleType.Ultimate) { cDouble5 *= 2; } if (current3.Type == ModuleType.God) { cDouble5 *= 3; } cDouble4 += cDouble5; } App.State = new GameState(true, App.State.Statistic.AchievementChallengesFinished.ToInt()); App.State.GameSettings.AutofillDefenders = false; App.State.TimeStampGameClosed = timeStampGameClosed; App.State.TimeStampGameClosedOfflineMS = timeStampGameClosedOfflineMS; App.State.Ext.AfkGame.InitExpCost(); App.State.Ext.SteamCurrency = ext.SteamCurrency; App.State.Ext.SteamCountry = ext.SteamCountry; App.State.Ext.TimeSinceSteam = ext.TimeSinceSteam; App.State.Ext.AdPoints = ext.AdPoints; App.State.Ext.AdsWatched = ext.AdsWatched; App.State.Ext.TotalAdsWatched = ext.TotalAdsWatched; App.State.Ext.ImportedSaveFromKongToSteam = ext.ImportedSaveFromKongToSteam; App.State.Ext.KongConvertId = ext.KongConvertId; App.State.Ext.TwitterClicked = ext.TwitterClicked; App.State.Ext.FacebookClicked = ext.FacebookClicked; App.State.Ext.PetIdInAvatar = ext.PetIdInAvatar; App.State.Ext.Lucky = ext.Lucky; App.State.Ext.RateDialogShown = ext.RateDialogShown; App.State.Ext.PetStonesSpent = ext.PetStonesSpent; App.State.Ext.AfkGame.ExpMulti = cDouble2; App.State.KongUserId = kongUserId; App.State.KongUserName = kongUserName; App.State.SteamId = steamId; App.State.SteamName = steamName; App.State.AndroidId = androidId; App.State.AndroidName = androidName; App.State.IsTutorialShown = true; App.State.IsGuestMsgShown = true; App.State.IsSocialDialogShown = isSocialDialogShown; App.State.Multiplier.AchievementMultiPhysical = achievementMultiPhysical; App.State.Multiplier.AchievementMultiMystic = achievementMultiMystic; App.State.Multiplier.AchievementMultiBattle = achievementMultiBattle; App.State.Multiplier.AchievementMultiCreating = achievementMultiCreating; App.State.Clones.MaxShadowClones = maxShadowClonesRebirth; App.State.Clones.AbsoluteMaximum = absoluteMaximum; App.State.Multiplier.GodMultiFromRebirth = cDouble; App.State.Statistic = Statistic.FromString(base64String); Statistic expr_981 = App.State.Statistic; expr_981.TotalRebirths = ++expr_981.TotalRebirths; App.State.Statistic.TimePlayedSinceRebirth = 0L; App.State.Statistic.BlackHoleGPTimer = 0; App.State.Ext.AfkGame.Exp = App.State.Statistic.TotalRebirths * 30 * App.State.Ext.AfkGame.ExpMulti; App.State.AddMultisFromGod(); App.State.KredProblems = kredProblems; App.State.Crits = crits; App.State.CreatingSpeedBoniDuration = creatingSpeedBoniDuration; int num2 = App.State.Statistic.TotalShadowClonesCreated.ToInt() / 1000; if (num2 > 950) { num2 = 950; } App.State.CloneAttackDivider = 1000 - num2; int num3 = App.State.Statistic.TotalShadowClonesDied.ToInt() / 500; if (num3 > 950) { num3 = 950; } App.State.CloneDefenseDivider = 1000 - num3; App.State.CloneHealthDivider = 1000 - num3; App.State.InitAchievementNames(); App.State.PremiumBoni = premiumBoni; App.State.PremiumBoni.ChakraPillV2InUse = false; App.State.PremiumBoni.GodlyLiquidV2InUse = false; App.State.PremiumBoni.TotalMightIsUnlocked = false; App.State.PremiumBoni.CrystalGPTimeCurrent = 0; App.State.PremiumBoni.CrystalPower += cDouble4; App.State.ShouldSubmitScore = shouldSubmitScore; App.State.GameSettings = gameSettings; App.State.GameSettings.AutoBuyCreations = false; App.State.Avatar = avatar; App.State.Ext.RandomValues = randomValues; App.State.Ext.CurrentRandomNumber = currentRandomNumber; using (List <Creation> .Enumerator enumerator4 = App.State.AllCreations.GetEnumerator()) { while (enumerator4.MoveNext()) { Creation creation = enumerator4.Current; Creation creation3 = allCreations.FirstOrDefault((Creation x) => x.TypeEnum == creation.TypeEnum); if (creation3 != null) { creation.GodToDefeat.IsDefeatedForFirstTime = creation3.GodToDefeat.IsDefeatedForFirstTime; creation.GodToDefeat.IsDefeatedPetChallenge = creation3.GodToDefeat.IsDefeatedPetChallenge; creation.NextAtCount = creation3.NextAtCount; creation.AutoBuy = creation3.AutoBuy; } } } using (List <Skill> .Enumerator enumerator5 = App.State.AllSkills.GetEnumerator()) { while (enumerator5.MoveNext()) { Skill element = enumerator5.Current; Skill skill = allSkills.FirstOrDefault((Skill x) => x.EnumValue == element.EnumValue); if (skill != null) { element.Extension.KeyPress = skill.Extension.KeyPress; element.Extension.UsageCount = skill.Extension.UsageCount; } } } using (List <Monument> .Enumerator enumerator6 = App.State.AllMonuments.GetEnumerator()) { while (enumerator6.MoveNext()) { Monument monument = enumerator6.Current; Monument monument2 = allMonuments.FirstOrDefault((Monument x) => x.TypeEnum == monument.TypeEnum); if (monument2 != null) { monument.StopAtString = monument2.StopAtString; monument.Upgrade.StopAtString = monument2.Upgrade.StopAtString; } } } using (List <GeneratorUpgrade> .Enumerator enumerator7 = App.State.Generator.Upgrades.GetEnumerator()) { while (enumerator7.MoveNext()) { GeneratorUpgrade divGenUpgrade = enumerator7.Current; GeneratorUpgrade generatorUpgrade = upgrades.FirstOrDefault((GeneratorUpgrade x) => x.type == divGenUpgrade.type); if (generatorUpgrade != null) { divGenUpgrade.StopAt = generatorUpgrade.StopAt; } } } using (List <Might> .Enumerator enumerator8 = App.State.AllMights.GetEnumerator()) { while (enumerator8.MoveNext()) { Might might = enumerator8.Current; Might might2 = allMights.FirstOrDefault((Might x) => x.TypeEnum == might.TypeEnum); if (might2 != null) { might.NextAt = might2.NextAt; } } } App.State.Ext.PetPowerMultiCampaigns = ext.PetPowerMultiCampaigns; App.State.Ext.PetPowerMultiGods = ext.PetPowerMultiGods; App.State.Ext.PetStones = ext.PetStones; App.State.Ext.AllCampaigns = ext.AllCampaigns; foreach (PetCampaign current4 in App.State.Ext.AllCampaigns) { current4.Cancel(); } App.State.AvatarName = avatarName; App.State.HomePlanet.IsCreated = homePlanet.IsCreated; App.State.HomePlanet.UpgradeLevel = homePlanet.UpgradeLevel; App.State.HomePlanet.UltimateBeings = UltimateBeing.Initial; App.State.HomePlanet.UltimateBeingsV2 = UltimateBeingV2.Initial; App.State.HomePlanet.UpgradeLevelArtyChallenge = homePlanet.UpgradeLevelArtyChallenge; if (App.State.Statistic.UltimateBaalChallengesFinished > 0 || App.State.Statistic.ArtyChallengesFinished > 0) { App.State.HomePlanet.UltimateBeingsV2[0].IsAvailable = true; App.State.HomePlanet.UltimateBeingsV2[0].TimesDefeated = homePlanet.UltimateBeingsV2[0].TimesDefeated; App.State.HomePlanet.UltimateBeingsV2[1].TimesDefeated = homePlanet.UltimateBeingsV2[1].TimesDefeated; App.State.HomePlanet.UltimateBeingsV2[2].TimesDefeated = homePlanet.UltimateBeingsV2[2].TimesDefeated; App.State.HomePlanet.UltimateBeingsV2[3].TimesDefeated = homePlanet.UltimateBeingsV2[3].TimesDefeated; App.State.HomePlanet.UltimateBeingsV2[4].TimesDefeated = homePlanet.UltimateBeingsV2[4].TimesDefeated; } App.State.HomePlanet.InitUBMultipliers(); App.State.HomePlanet.TotalGainedGodPower = homePlanet.TotalGainedGodPower; using (List <UltimateBeing> .Enumerator enumerator10 = App.State.HomePlanet.UltimateBeings.GetEnumerator()) { while (enumerator10.MoveNext()) { UltimateBeing being = enumerator10.Current; UltimateBeing ultimateBeing = homePlanet.UltimateBeings.FirstOrDefault((UltimateBeing x) => x.Tier == being.Tier); being.IsAvailable = ultimateBeing.IsAvailable; being.ComeBack(); being.HPPercent = 0.0; } } App.State.GameSettings.AutoBuyCreations = false; App.State.GameSettings.AutoBuyCreationsForMonumentsBeforeRebirth = App.State.GameSettings.AutoBuyCreationsForMonuments; App.State.GameSettings.AutoBuyCreationsForMonuments = false; foreach (UltimateBeingV2 current5 in App.State.HomePlanet.UltimateBeingsV2) { current5.IsDefeated = false; } App.State.Ext.AllPets = allPets; if (App.State.PremiumBoni.PetFoodAfterRebirth) { App.State.Ext.PunyFood = ext.PunyFood; App.State.Ext.MightyFood = ext.MightyFood; App.State.Ext.StrongFood = ext.StrongFood; } App.State.Ext.Chocolate = ext.Chocolate; App.State.Statistic.CalculateTotalPetGrowth(App.State.Ext.AllPets); App.SaveGameState(); Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone); App.State.GameSettings.LastCreation = creation2; if (creation2 != null) { creation2.IsActive = true; } if (App.State.Statistic.HasStartedUltimateBaalChallenge && App.State.Statistic.CountRebirthsInUBC) { Statistic expr_133F = App.State.Statistic; expr_133F.RebirthsAfterUBC = ++expr_133F.RebirthsAfterUBC; } if (App.State.Statistic.HasStartedArtyChallenge) { Statistic expr_136D = App.State.Statistic; expr_136D.RebirthsAfterUAC = ++expr_136D.RebirthsAfterUAC; if (App.State.Statistic.RebirthsAfterUAC > 5) { App.State.Statistic.HasStartedArtyChallenge = false; App.State.Statistic.RebirthsAfterUAC = 0; App.State.Statistic.TimeAfterUACStarted = 0; App.State.HomePlanet.IsCreated = true; if (App.State.HomePlanet.UpgradeLevelArtyChallenge > App.State.HomePlanet.UpgradeLevel) { App.State.HomePlanet.UpgradeLevel = App.State.HomePlanet.UpgradeLevelArtyChallenge; } if (App.State.Statistic.UniverseChallengesFinished > 0 && App.State.HomePlanet.UpgradeLevel < App.State.Statistic.UniverseChallengesFinished + 5) { App.State.HomePlanet.UpgradeLevel = App.State.Statistic.UniverseChallengesFinished + 5; } App.State.HomePlanet.UpgradeLevelArtyChallenge = 0; foreach (UltimateBeing current6 in App.State.HomePlanet.UltimateBeings) { if (current6.Tier <= App.State.HomePlanet.UpgradeLevel) { current6.IsAvailable = true; } } Premium premiumBoni2 = App.State.PremiumBoni; App.State.PremiumBoni = Premium.FromString(App.State.Statistic.PremiumStatsBeforeUBCChallenge); App.State.PremiumBoni.AddPremiumAfterChallenge(premiumBoni2); App.State.Statistic.PremiumStatsBeforeUBCChallenge = string.Empty; App.State.Statistic.HighestGodInUAC = 0; App.State.Clones.AbsoluteMaximum = App.State.Statistic.AbsoluteMaxClonesBeforeUBCChallenge.ToInt(); App.State.Clones.MaxShadowClones = App.State.Statistic.MaxClonesBeforeUBCChallenge.ToInt(); string[] array = App.State.Statistic.SkillUsageCountBeforeUAC.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { int num4 = 0; int.TryParse(array[i], out num4); if (App.State.AllSkills.Count > i) { App.State.AllSkills[i].Extension.UsageCount += (long)num4; } } App.State.Statistic.SkillUsageCountBeforeUAC = string.Empty; App.State.PremiumBoni.CheckIfGPIsAdjusted(); App.SaveGameState(); GuiBase.ShowToast("Your Challenge failed! You received back the God Power and God Power upgrades you had before the challenge."); } } Leaderboards.SubmitStat(LeaderBoardType.Rebirths, App.State.Statistic.TotalRebirths.ToInt(), false); SpecialFightUi.SortSkills(); TBSUi.Reset(); PlanetUi.Instance.Reset(); if (!App.State.Statistic.HasStartedUltimateBaalChallenge && !App.State.Statistic.HasStartedArtyChallenge && App.State.Statistic.HighestGodDefeated > 3 && !App.State.IsSocialDialogShown) { MainUi.ShowSocialDialog = true; } MainUi.Instance.Init(true); }