protected void ShowScrollViewElements(int marginTop, GUIStyle labelStyle) { DivinityGenerator generator = App.State.Generator; if (!App.State.Generator.IsBuilt) { labelStyle.fontSize = GuiBase.FontSize(16); labelStyle.alignment = TextAnchor.UpperCenter; GuiBase.CreateProgressBar(marginTop, generator.getPercent(), generator.Name, generator.Description + generator.MissingItems, GuiBase.progressBg, GuiBase.progressFgBlue); labelStyle.fontSize = GuiBase.FontSize(18); GUI.Label(new Rect(GuiBase.Width(230f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), string.Empty + generator.Level, labelStyle); GUI.Label(new Rect(GuiBase.Width(330f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), string.Empty + generator.ShadowCloneCount, labelStyle); if (GUI.Button(new Rect(GuiBase.Width(470f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "+")) { generator.AddCloneCount((int)this.ClonesToAdd); } if (GUI.Button(new Rect(GuiBase.Width(540f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "-")) { generator.RemoveCloneCount((int)this.ClonesToAdd); } } else if (!DivinityGeneratorUi.AddIsOpen) { labelStyle.alignment = TextAnchor.UpperCenter; marginTop += 170; labelStyle.fontSize = GuiBase.FontSize(18); labelStyle.fontStyle = FontStyle.Bold; GUI.Label(new Rect(GuiBase.Width(15f), GuiBase.Height((float)marginTop), GuiBase.Width(220f), GuiBase.Height(30f)), "Upgrade"); GUI.Label(new Rect(GuiBase.Width(210f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), "Level", labelStyle); GUI.Label(new Rect(GuiBase.Width(280f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), "Stop At", labelStyle); GUI.Label(new Rect(GuiBase.Width(370f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), "Clones", labelStyle); marginTop += 45; labelStyle.fontStyle = FontStyle.Normal; foreach (GeneratorUpgrade current in generator.Upgrades) { labelStyle.fontSize = GuiBase.FontSize(16); GuiBase.CreateProgressBar(marginTop, current.getPercent(), current.Name, current.Description + current.MissingItems, GuiBase.progressBg, GuiBase.progressFgGreen); labelStyle.fontSize = GuiBase.FontSize(18); GUI.Label(new Rect(GuiBase.Width(210f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), string.Empty + current.Level.CommaFormatted, labelStyle); GUI.Label(new Rect(GuiBase.Width(370f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), string.Empty + current.ShadowCloneCount.CommaFormatted, labelStyle); if (App.CurrentPlattform == Plattform.Android) { GeneratorUpgrade up = current; GUIStyle textField = Gui.ChosenSkin.textField; if (GUI.Button(new Rect(GuiBase.Width(305f), GuiBase.Height((float)marginTop), GuiBase.Width(55f), GuiBase.Height(25f)), up.StopAt + string.Empty, textField)) { base.ShowNumberInput("Stop at for " + up.Name + " " + up.Name, up.StopAt, 2147483647, delegate(CDouble x) { up.StopAt = x.ToInt(); }); } } else { string s = GUI.TextField(new Rect(GuiBase.Width(305f), GuiBase.Height((float)marginTop), GuiBase.Width(55f), GuiBase.Height(25f)), current.StopAt.ToString()); int.TryParse(s, out current.StopAt); if (current.StopAt < 0) { current.StopAt = 0; } } if (GUI.Button(new Rect(GuiBase.Width(500f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "+")) { current.AddCloneCount((int)this.ClonesToAdd); } if (GUI.Button(new Rect(GuiBase.Width(560f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "-")) { current.RemoveCloneCount((int)this.ClonesToAdd); } marginTop += 35; } } else { for (int i = 1; i < App.State.AllCreations.Count; i++) { Creation creation = App.State.AllCreations[i]; labelStyle.fontSize = GuiBase.FontSize(16); GUI.Label(new Rect(GuiBase.Width(30f), GuiBase.Height((float)marginTop), GuiBase.Width(160f), GuiBase.Height(30f)), new GUIContent(creation.Name, "Capacity for one: " + creation.BuyCost.ToGuiText(true)), labelStyle); GUI.Label(new Rect(GuiBase.Width(180f), GuiBase.Height((float)marginTop), GuiBase.Width(160f), GuiBase.Height(30f)), creation.Count.ToGuiText(true), labelStyle); CDouble cDouble = App.State.GameSettings.DivGenCreatiosToAdd; if (cDouble == 0) { cDouble = 10000; } if (cDouble > creation.Count) { cDouble = creation.Count; } CDouble cDouble2 = cDouble * creation.BuyCost; if (cDouble2 > App.State.Generator.FreeCapacity) { cDouble = App.State.Generator.FreeCapacity / creation.BuyCost; cDouble.Value = Math.Floor(cDouble.Value); cDouble2 = cDouble * creation.BuyCost; } GUI.Label(new Rect(GuiBase.Width(325f), GuiBase.Height((float)marginTop), GuiBase.Width(160f), GuiBase.Height(30f)), cDouble2.ToGuiText(true), labelStyle); GUIStyle style = GUI.skin.GetStyle("Button"); style.fontSize = GuiBase.FontSize(16); if (GUI.Button(new Rect(GuiBase.Width(480f), GuiBase.Height((float)marginTop), GuiBase.Width(130f), GuiBase.Height(30f)), cDouble.ToGuiText(true)) && cDouble > 0) { App.State.Generator.FilledCapacity += cDouble2; creation.Count -= cDouble; } marginTop += 35; } } }
private void CalcDivGen(long timeMS, StringBuilder infoBuilder) { if (this.State.Generator.ShadowCloneCount > 0 && !this.State.Generator.IsBuilt) { int num = this.State.Generator.ShadowCloneCount.ToInt(); CDouble cDouble = timeMS * (long)num * (long)this.State.PremiumBoni.MonumentBuildTimeDivider * (100 + this.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100; long value = this.State.Generator.DurationInMS(1) - this.State.Generator.CurrentDuration; if (cDouble >= value) { this.State.Generator.CurrentDuration = 0L; this.State.Generator.IsPaid = false; this.State.Generator.IsBuilt = true; this.State.Clones.RemoveUsedShadowClones(num); this.State.Generator.ShadowCloneCount = 0; infoBuilder.Append("- divinity generator was built\n"); } else { this.State.Generator.CurrentDuration += cDouble.ToLong(); cDouble = 0; } } foreach (GeneratorUpgrade current in this.State.Generator.Upgrades) { if (current.ShadowCloneCount > 0) { int num2 = current.ShadowCloneCount.ToInt(); CDouble cDouble2 = timeMS * (long)num2 * (long)this.State.PremiumBoni.MonumentBuildTimeDivider * (100 + this.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100; int num3 = 0; while (cDouble2 > 0) { if (current.StopAt != 0 && current.StopAt <= current.Level) { this.State.Clones.RemoveUsedShadowClones(current.ShadowCloneCount); current.ShadowCloneCount = 0; cDouble2 = 0; } else { long value2 = current.DurationInMS(1) - current.CurrentDuration; if (cDouble2 >= value2) { cDouble2 -= value2; current.CurrentDuration = 0L; bool flag = false; if (!current.IsPaid) { foreach (CreationCost current2 in current.RequiredCreations) { if (!CreationCost.HasCreations(this.State, current2, this.State.GameSettings.AutoBuyCreationsForMonuments)) { flag = true; current.CurrentDuration = current.DurationInMS(1); cDouble2 = 0; break; } } } if (!flag) { if (!current.IsPaid) { using (List <CreationCost> .Enumerator enumerator3 = current.RequiredCreations.GetEnumerator()) { while (enumerator3.MoveNext()) { CreationCost cost = enumerator3.Current; Creation creation = this.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation.Count -= cost.CountNeeded; } } } else { current.IsPaid = false; } num3++; GeneratorUpgrade expr_3BE = current; expr_3BE.Level = ++expr_3BE.Level; if (this.State.GameSettings.StopDivinityGenBuilding) { this.State.Clones.RemoveUsedShadowClones(current.ShadowCloneCount); current.ShadowCloneCount = 0; current.CurrentDuration = 0L; cDouble2 = 0; } } } else { current.CurrentDuration += cDouble2.ToLong(); cDouble2 = 0; } } } if (num3 > 0) { infoBuilder.Append("- upgrade: ").Append(current.Name).Append(" was built ").Append(num3).Append(" x\n"); } } } infoBuilder.Append("After your break, you feel refreshed and your creation speed is tripled for the next ").Append(Conv.MsToGuiText(this.State.CreatingSpeedBoniDuration, true)).Append("!"); }