Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Vines and Wine v0.6.0
Winemaking.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using MagicaCloth2; using Microsoft.CodeAnalysis; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; using Winemaking.Core; using Winemaking.Features.Blindness; using Winemaking.Features.Fermentation; using Winemaking.Features.Grapes; using Winemaking.Features.JokeWines; using Winemaking.Features.Planting; using Winemaking.Features.Press; using Winemaking.Features.ShamanDrop; using Winemaking.Features.SpecialWines; using Winemaking.Features.Spoilage; using Winemaking.Features.TailwindSail; using Winemaking.Features.WildVines; using Winemaking.Features.WinemakerTable; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("WinemakingTestHarness")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("Winemaking")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+60df1337c826d804563f90941c2242e27f252704")] [assembly: AssemblyProduct("Winemaking")] [assembly: AssemblyTitle("Winemaking")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Winemaking { [BepInPlugin("printeromg.winemaking", "Vines and Wine", "0.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class WinemakingPlugin : BaseUnityPlugin { public const string PluginGuid = "printeromg.winemaking"; public const string PluginName = "Vines and Wine"; public const string PluginVersion = "0.6.0"; internal static ManualLogSource Log; private List<Feature> _features; private void Awake() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _features = (from t in typeof(WinemakingPlugin).Assembly.GetTypes() where typeof(Feature).IsAssignableFrom(t) && !t.IsAbstract select (Feature)Activator.CreateInstance(t) into f orderby f.Order select f).ToList(); SyncedConfig.Hook(((BaseUnityPlugin)this).Config); Harmony harmony = new Harmony("printeromg.winemaking"); foreach (Feature feature in _features) { feature.BindConfig(((BaseUnityPlugin)this).Config); feature.Patch(harmony); } Texts.Register(_features); PrefabManager.OnVanillaPrefabsAvailable += RegisterPrefabs; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Vines and Wine 0.6.0 loaded: " + string.Join(", ", _features.Select((Feature f) => f.GetType().Name)))); } private void RegisterPrefabs() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterPrefabs; Fruit.Freeze(); WineRecipe.Freeze(); foreach (Feature feature in _features) { feature.RegisterPrefabs(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"registered {GrapeVariety.All.Count} grape varieties: items, cuttings, wild vines"); } } } namespace Winemaking.Features.WinemakerTable { internal static class BookArt { private static Sprite _parchment; private static Sprite _leather; private static Sprite _white; private static AudioClip _flip; private static Sprite _leatherLight; private static Sprite _wash; private static Sprite _lozenge; private static Sprite _fadeDown; private static readonly Dictionary<string, Sprite> Ribbons = new Dictionary<string, Sprite>(); private const int WashEdge = 16; private const int RibbonDetail = 2; public static Sprite Parchment { get { if (!((Object)(object)_parchment != (Object)null)) { return _parchment = MakeParchment(512, 600); } return _parchment; } } public static Sprite Leather { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_leather != (Object)null)) { return _leather = MakeLeather(256, new Color(0.36f, 0.19f, 0.12f)); } return _leather; } } public static Sprite LeatherLight { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_leatherLight != (Object)null)) { return _leatherLight = MakeLeather(128, new Color(0.86f, 0.84f, 0.82f)); } return _leatherLight; } } public static Sprite White { get { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_white == (Object)null) { Texture2D val = new Texture2D(4, 4, (TextureFormat)4, false) { name = "winemaking_book_white" }; Color32[] array = (Color32[])(object)new Color32[16]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } val.SetPixels32(array); val.Apply(); _white = Sprite.Create(val, new Rect(0f, 0f, 4f, 4f), new Vector2(0.5f, 0.5f)); } return _white; } } public static AudioClip Flip { get { if (!((Object)(object)_flip != (Object)null)) { return _flip = MakeFlip(); } return _flip; } } public static Sprite Wash { get { if (!((Object)(object)_wash != (Object)null)) { return _wash = MakeWash(256, 64); } return _wash; } } public static Sprite Lozenge { get { if (!((Object)(object)_lozenge != (Object)null)) { return _lozenge = MakeLozenge(32); } return _lozenge; } } public static Sprite FadeDown { get { if (!((Object)(object)_fadeDown != (Object)null)) { return _fadeDown = MakeFadeDown(4, 32); } return _fadeDown; } } private static Sprite MakeWash(int w, int h) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false) { name = "winemaking_book_wash", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num = ((float)j + 0.5f) / (float)w; float num2 = ((float)i + 0.5f) / (float)h; float num3 = Mathf.SmoothStep(0f, 1f, ((float)j + 0.5f) / 16f) * Mathf.SmoothStep(0f, 1f, ((float)(w - j) - 0.5f) / 16f); float num4 = Mathf.SmoothStep(0f, 1f, num2 / 0.24f) * Mathf.SmoothStep(0f, 1f, (1f - num2) / 0.24f); float num5 = Mathf.PerlinNoise(num * 9f + 3.1f, num2 * 2.5f + 7.7f) * 0.6f + Mathf.PerlinNoise(num * 29f + 1.3f, num2 * 7f) * 0.4f; array[i * w + j] = Color32.op_Implicit(new Color(1f, 1f, 1f, Mathf.Clamp01(num3 * num4 * (0.78f + 0.34f * num5)))); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)w, (float)h), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(16f, 0f, 16f, 0f)); } private static Sprite MakeLozenge(int s) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(s, s, (TextureFormat)4, false) { name = "winemaking_book_lozenge", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[s * s]; for (int i = 0; i < s; i++) { for (int j = 0; j < s; j++) { float num = ((float)j + 0.5f) / (float)s * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)s * 2f - 1f; float num3 = Mathf.Abs(num) / 0.7f + Mathf.Abs(num2) / 0.96f; array[i * s + j] = Color32.op_Implicit(new Color(1f, 1f, 1f, Mathf.Clamp01((1f - num3) * (float)s * 0.3f))); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)s, (float)s), new Vector2(0.5f, 0.5f)); } private static Sprite MakeFadeDown(int w, int h) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false) { name = "winemaking_book_fade", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[w * h]; for (int i = 0; i < h; i++) { float num = ((float)i + 0.5f) / (float)h; for (int j = 0; j < w; j++) { array[i * w + j] = Color32.op_Implicit(new Color(1f, 1f, 1f, num * num)); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)w, (float)h), new Vector2(0.5f, 0.5f)); } public static Sprite Ribbon(float w, float h, float notch, Color body, Color edge, float edgeInset, float edgeWidth = 0.7f) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) string key = $"ribbon {w} {h} {notch} {body} {edge} {edgeInset} {edgeWidth}"; if (Ribbons.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } int num = Mathf.CeilToInt(w * 2f); int num2 = Mathf.CeilToInt(h * 2f); Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false) { name = "winemaking_book_ribbon", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[num * num2]; float num3 = 2f * notch / w; float num4 = Mathf.Sqrt(1f + num3 * num3); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num5 = ((float)j + 0.5f) / 2f; float num6 = ((float)i + 0.5f) / 2f; float a = Mathf.Clamp01(0.5f - RibbonSdf(num5, num6, w, h, notch) * 2f); float num7 = num5 / w; float num8 = 0.8f + 0.3f * Mathf.Exp(0f - Sq((num7 - 0.36f) / 0.2f)); float num9 = 0.7f + 0.3f * Mathf.SmoothStep(0f, 1f, Mathf.Min(num7, 1f - num7) / 0.14f); float num10 = 1f + 0.07f * Mathf.Sin(num6 * (float)Math.PI); float num11 = 1f + 0.03f * Mathf.Sin(num5 * (float)Math.PI * 1.4f); float num12 = 0.9f + 0.18f * Mathf.PerlinNoise(num6 / h * 4f + 11.3f, num7 * 1.6f + 2.2f); Color val2 = body * (num8 * num9 * num10 * num11 * num12); float num13 = Mathf.Min(num5, w - num5); float num14 = 1f - Mathf.Clamp01(Mathf.Abs(num13 - edgeInset) / edgeWidth); val2 = Color.Lerp(val2, edge * (0.85f + 0.25f * num8 * num10), num14 * 0.9f); float num15 = (num3 * Mathf.Min(num5, w - num5) - num6) / num4; val2 *= 0.78f + 0.22f * Mathf.Clamp01((0f - num15) / 2.5f); val2.a = a; array[i * num + j] = Color32.op_Implicit(val2); } } val.SetPixels32(array); val.Apply(); return Ribbons[key] = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f)); } public static Sprite RibbonShadow(float w, float h, float notch, float pad, float blur) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) string key = $"shadow {w} {h} {notch} {pad} {blur}"; if (Ribbons.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } int num = Mathf.CeilToInt((w + 2f * pad) * 2f); int num2 = Mathf.CeilToInt((h + 2f * pad) * 2f); Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false) { name = "winemaking_book_ribbon_shadow", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[num * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num3 = RibbonSdf(((float)j + 0.5f) / 2f - pad, ((float)i + 0.5f) / 2f - pad, w, h, notch); array[i * num + j] = Color32.op_Implicit(new Color(1f, 1f, 1f, 1f - Mathf.SmoothStep(0f, 1f, (num3 + blur) / (2f * blur)))); } } val.SetPixels32(array); val.Apply(); return Ribbons[key] = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f)); } private static float RibbonSdf(float x, float y, float w, float h, float notch) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f - x, x - w); float num2 = Mathf.Max(0f - y, y - h); float num3; if (!(num > 0f) && !(num2 > 0f)) { num3 = Mathf.Max(num, num2); } else { Vector2 val = new Vector2(Mathf.Max(num, 0f), Mathf.Max(num2, 0f)); num3 = ((Vector2)(ref val)).magnitude; } float num4 = 2f * notch / w; float num5 = (num4 * Mathf.Min(x, w - x) - y) / Mathf.Sqrt(1f + num4 * num4); return Mathf.Max(num3, num5); } private static float Sq(float x) { return x * x; } private static Sprite MakeParchment(int w, int h) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false) { name = "winemaking_book_parchment", wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[w * h]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.92f, 0.85f, 0.68f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.62f, 0.47f, 0.28f); Random random = new Random(1007); Vector3[] array2 = (Vector3[])(object)new Vector3[6]; for (int i = 0; i < array2.Length; i++) { array2[i] = new Vector3((float)random.NextDouble() * (float)w, (float)random.NextDouble() * (float)h, 20f + (float)random.NextDouble() * 70f); } for (int j = 0; j < h; j++) { for (int k = 0; k < w; k++) { float num = (float)k / (float)w; float num2 = (float)j / (float)h; float num3 = (Mathf.PerlinNoise(num * 6f, num2 * 7f) * 0.55f + Mathf.PerlinNoise(num * 23f + 5f, num2 * 27f + 3f) * 0.3f + Mathf.PerlinNoise(num * 90f, num2 * 80f) * 0.15f - 0.5f) * 0.16f; float num4 = Mathf.Min(Mathf.Min(num, 1f - num) * 1.2f, Mathf.Min(num2, 1f - num2)); float num5 = 1f - Mathf.SmoothStep(0f, 0.12f, num4); float num6 = 0f; Vector3[] array3 = array2; foreach (Vector3 val4 in array3) { float num7 = Vector2.Distance(new Vector2((float)k, (float)j), new Vector2(val4.x, val4.y)) / val4.z; num6 += ((num7 < 1f) ? ((1f - num7) * (1f - num7) * 0.1f) : 0f); } Color val5 = Color.Lerp(val2, val3, Mathf.Clamp01(num5 * 0.55f + num6 + Mathf.Max(0f, 0f - num3) * 0.8f)); val5 *= 1f + num3 * 0.5f; val5.a = 1f; array[j * w + k] = Color32.op_Implicit(val5); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)w, (float)h), new Vector2(0.5f, 0.5f)); } private static Sprite MakeLeather(int size, Color baseColor) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false) { name = "winemaking_book_leather", wrapMode = (TextureWrapMode)0 }; Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (float)j / (float)size; float num2 = (float)i / (float)size; float num3 = Mathf.PerlinNoise(num * 40f, num2 * 40f) * 0.6f + Mathf.PerlinNoise(num * 9f + 2f, num2 * 9f + 7f) * 0.4f; Color val2 = baseColor * (0.82f + num3 * 0.36f); val2.a = 1f; array[i * size + j] = Color32.op_Implicit(val2); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f)); } private static AudioClip MakeFlip() { int num = 7938; float[] array = new float[num]; Random random = new Random(4242); float num2 = 0f; float num3 = 0f; for (int i = 0; i < num; i++) { float t = (float)i / 22050f; float num4 = Bump(t, 0.035f, 0.025f) * 0.45f + Bump(t, 0.17f, 0.075f) + Bump(t, 0.27f, 0.03f) * 0.25f; float num5 = (float)(random.NextDouble() * 2.0 - 1.0); num2 += (num5 - num2) * 0.45f; num3 += (num2 - num3) * 0.06f; array[i] = (num2 - num3) * num4 * 0.9f; } AudioClip val = AudioClip.Create("winemaking_book_flip", num, 1, 22050, false); typeof(AudioClip).GetMethod("SetData", new Type[2] { typeof(float[]), typeof(int) })?.Invoke(val, new object[2] { array, 0 }); return val; } private static float Bump(float t, float center, float width) { float num = (t - center) / width; return Mathf.Exp((0f - num) * num); } } internal enum PageKind { Title, Contents, Craft, Wine, Blank } internal sealed class BookPage { public PageKind Kind; public int Number; public int Chapter; public string CraftId; public WineLore Wine; public override string ToString() { return $"{Number}:{Kind}:{CraftId ?? Wine?.Id}"; } } internal static class BookPages { public const int CraftChapter = -1; public static List<BookPage> Build() { List<BookPage> list = new List<BookPage> { new BookPage { Kind = PageKind.Title }, new BookPage { Kind = PageKind.Contents } }; list.AddRange(Lore.CraftPages.Select((string id) => new BookPage { Kind = PageKind.Craft, CraftId = id, Chapter = -1 })); list.AddRange(Lore.Wines.Select((WineLore w) => new BookPage { Kind = PageKind.Wine, Wine = w, Chapter = w.Chapter })); if (list.Count % 2 == 1) { list.Add(new BookPage { Kind = PageKind.Blank }); } for (int num = 0; num < list.Count; num++) { list[num].Number = num + 1; } return list; } public static List<KeyValuePair<int, List<WineLore>>> WineChapters() { return (from w in Lore.Wines group w by w.Chapter into g orderby g.Key select new KeyValuePair<int, List<WineLore>>(g.Key, g.ToList())).ToList(); } public static string ChapterToken(int chapter) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) switch (chapter) { case -1: return "$winemaking_book_craft"; case 100: return "$winemaking_book_other_mods"; default: return ""; case 1: case 2: case 3: case 4: case 5: case 6: case 7: return Lore.BiomeToken(Lore.BiomeOfTier(chapter)); } } } internal sealed class BookUi : MonoBehaviour { private const float BookW = 1560f; private const float BookH = 900f; private const float PageW = 740f; private const float PageH = 852f; private const float PadX = 46f; private const float PadTop = 30f; private const float PadBottom = 58f; private const float ContentW = 648f; private const float BodyTop = 44f; private const float BodyBottom = 764f; private static readonly Color Ink = new Color(0.2f, 0.13f, 0.08f); private static readonly Color HeadInk = new Color(0.36f, 0.11f, 0.06f); private static readonly Color Muted = new Color(0.42f, 0.34f, 0.26f); private static readonly Color Grey = new Color(0.5f, 0.47f, 0.43f); private static readonly Color Accent = new Color(0.55f, 0.16f, 0.1f); private static readonly Color GreyPage = new Color(0.86f, 0.85f, 0.83f); private static readonly Color FadedInk = new Color(0.42f, 0.34f, 0.26f, 0.7f); private static BookUi _instance; private static readonly Dictionary<ZDOID, int> LastSpread = new Dictionary<ZDOID, int>(); private WinemakerTable _table; private List<BookPage> _pages = new List<BookPage>(); private int _spread; private int _openedFrame; private int _closedFrame = -10; private bool _unblockPending; private TableBook _renderedBook; private string _renderedJournal; private string _renderedLanguage; private bool _renderedWaiting; private float _maxDistance = 6f; private Vector2 _fitSize; private int _textInputFrame = -10; internal const float MinDistance = 6f; internal const float WheelStep = 0.1f; internal const float WheelPause = 0.15f; internal const float WheelIdle = 0.3f; private float _wheelAcc; private float _wheelFlip = -1E+09f; private float _wheelSeen = -1E+09f; private GameObject _root; private RectTransform _book; private RectTransform[] _pageContent = (RectTransform[])(object)new RectTransform[2]; private Image[] _pageImage = (Image[])(object)new Image[2]; private CanvasGroup _fade; private float _fadeStart = -1f; private AudioSource _audio; private Button _prev; private Button _next; private TMP_FontAsset _font; private TMP_FontAsset _bold; private TMP_Text _hint; private Button _bookmark; private readonly List<Selectable> _focusables = new List<Selectable>(); private readonly List<Button> _links = new List<Button>(); private bool _hintPad; internal static bool ForceGamepad; internal readonly List<Button> TitleButtons = new List<Button>(); internal readonly List<int> OverflowPages = new List<int>(); internal readonly List<int> CompactPages = new List<int>(); private const float NoticeShow = 3.5f; private const float NoticeFade = 0.6f; private RectTransform _notice; private TMP_Text _noticeText; private CanvasGroup _noticeGroup; private float _noticeStart = -100f; private const float RibbonW = 34f; private const float RibbonNotch = 13f; private const float RibbonDrop = 210f; private const float RibbonSlide = 22f; private const float RibbonHidden = 26f; private const float RibbonPad = 9f; private const float RibbonBlur = 3.5f; private const float GlowPad = 16f; private const float GlowBlur = 7f; private static readonly Color RibbonBody = new Color(0.52f, 0.09f, 0.12f); private static readonly Color RibbonEdge = new Color(0.78f, 0.3f, 0.3f); private static readonly Color RibbonBodyLit = new Color(0.68f, 0.14f, 0.14f); private static readonly Color RibbonEdgeLit = new Color(1f, 0.84f, 0.5f); private static readonly Color RibbonGlow = new Color(1f, 0.74f, 0.32f); private static readonly Color BandWine = new Color(0.56f, 0.13f, 0.1f); private const float LinkBandAlpha = 0.34f; private const float ButtonBandAlpha = 0.48f; private const float LinkBandLeft = 22f; private const float LinkBandRight = 16f; private const float LinkBandPadY = 6f; private static readonly Color LinkInkOn = new Color(0.12f, 0.05f, 0.03f); internal const float MarginMin = 13f; private TMP_Text _measure; internal static bool Pad { get { if (!ForceGamepad) { return ZInput.IsGamepadActive(); } return true; } } internal static BookUi Current { get { if (!((Object)(object)_instance != (Object)null) || !((Object)(object)_instance._root != (Object)null) || !_instance._root.activeSelf) { return null; } return _instance; } } internal static bool IsOpen => (Object)(object)Current != (Object)null; internal static bool Guarding { get { if (!IsOpen) { if ((Object)(object)_instance != (Object)null) { return Time.frameCount - _instance._closedFrame <= 1; } return false; } return true; } } internal int Spread => _spread; internal int SpreadCount => _pages.Count / 2; internal IReadOnlyList<BookPage> Pages => _pages; internal Button Bookmark => _bookmark; internal IReadOnlyList<Selectable> Focusables => _focusables; internal IReadOnlyList<Button> Links => _links; internal static GameObject Selected { get { if (!((Object)(object)EventSystem.current != (Object)null)) { return null; } return EventSystem.current.currentSelectedGameObject; } } internal string HintText { get { if (!((Object)(object)_hint != (Object)null)) { return ""; } return _hint.text; } } internal float MaxDistance => _maxDistance; internal string NoticeText { get { if (!((Object)(object)_notice != (Object)null) || !((Component)_notice).gameObject.activeSelf) { return ""; } return _noticeText.text; } } internal float Scale { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_book != (Object)null)) { return 0f; } return ((Transform)_book).localScale.x; } } internal string VisibleText { get { if (!((Object)(object)_root == (Object)null)) { return string.Join("\n", from t in ((Component)_book).GetComponentsInChildren<TMP_Text>() select t.text); } return ""; } } internal void ResetWheel() { _wheelAcc = 0f; _wheelFlip = (_wheelSeen = -1E+09f); } public static void Open(WinemakerTable table) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)table == (Object)null) && !GUIManager.IsHeadless() && !((Object)(object)GUIManager.CustomGUIFront == (Object)null)) { if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("WinemakingBook", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(GUIManager.CustomGUIFront.transform, false); _instance = val.AddComponent<BookUi>(); _instance.Build(); } _instance.Show(table); } } public static void Close() { _instance?.Hide(); } public static void Notify(WinemakerTable table, string text) { if ((Object)(object)Current != (Object)null && (Object)(object)_instance._table == (Object)(object)table && !string.IsNullOrEmpty(text)) { _instance.ShowNotice(Localization.instance.Localize(text)); } } public static void Refresh(WinemakerTable table) { if ((Object)(object)Current != (Object)null && (Object)(object)_instance._table == (Object)(object)table) { _instance.Render(animate: false); } } private void Show(WinemakerTable table) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (_root.activeSelf && (Object)(object)_table == (Object)(object)table) { return; } bool activeSelf = _root.activeSelf; _table = table; _pages = BookPages.Build(); _spread = (LastSpread.TryGetValue(table.Id, out var value) ? Mathf.Clamp(value, 0, SpreadCount - 1) : 0); _openedFrame = Time.frameCount; Player localPlayer = Player.m_localPlayer; _maxDistance = (((Object)(object)localPlayer != (Object)null) ? Mathf.Max(6f, Vector3.Distance(((Component)localPlayer).transform.position, ((Component)table).transform.position) + 1f) : 6f); ResetWheel(); ClearSelection(); _root.SetActive(true); FitToScreen(); if (!activeSelf) { if (_unblockPending) { _unblockPending = false; } else { GUIManager.BlockInput(true); } } Render(animate: true); PlayFlip(); WinemakingPlugin.Log.LogInfo((object)$"book: opened (spread {_spread + 1}/{SpreadCount}, {_table.Book.Recipes.Count} recipes, {_table.Book.Notes.Count} notes, {_table.Book.Books.Count} recipe books)"); } private void Hide() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_root == (Object)null) && _root.activeSelf) { if ((Object)(object)_table != (Object)null && _table.IsValid) { LastSpread[_table.Id] = _spread; } ClearSelection(); RectTransform notice = _notice; if (notice != null) { ((Component)notice).gameObject.SetActive(false); } _root.SetActive(false); _table = null; _closedFrame = Time.frameCount; _unblockPending = true; } } private void LateUpdate() { if (_unblockPending && ((Object)(object)_root == (Object)null || !_root.activeSelf)) { _unblockPending = false; GUIManager.BlockInput(false); } } private void OnDestroy() { if (((Object)(object)_root != (Object)null && _root.activeSelf) || _unblockPending) { GUIManager.BlockInput(false); } if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private void Update() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root == (Object)null || !_root.activeSelf) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)_table == (Object)null || !_table.IsValid || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)_table).transform.position) > _maxDistance || Menu.IsVisible()) { Hide(); return; } UpdateFade(); UpdateNotice(); if (CanvasSize() != _fitSize) { FitToScreen(); } if (Time.frameCount == _openedFrame) { return; } if (Console.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus())) { _textInputFrame = Time.frameCount; } if (Time.frameCount - _textInputFrame > 1) { if (ZInput.GetKeyDown((KeyCode)27, true) || ZInput.GetButtonDown("Use") || ZInput.GetButtonDown("Inventory") || ZInput.GetButtonDown("JoyButtonB")) { Hide(); return; } if (ZInput.GetKeyDown((KeyCode)278, true) || ZInput.GetButtonDown("JoyButtonY")) { GoToContents(); } int num = Wheel(ZInput.GetMouseScrollWheel(), Time.unscaledTime); if (ZInput.GetButtonDown("Left") || ZInput.GetKeyDown((KeyCode)276, true) || ZInput.GetButtonDown("JoyTabLeft") || num < 0) { Turn(-1); } else if (ZInput.GetButtonDown("Right") || ZInput.GetKeyDown((KeyCode)275, true) || ZInput.GetButtonDown("JoyTabRight") || num > 0) { Turn(1); } } if (_table.Book != _renderedBook || WineJournal.Raw(localPlayer) != _renderedJournal || Localization.instance.GetSelectedLanguage() != _renderedLanguage || _table.Waiting != _renderedWaiting) { Render(animate: false); } UpdatePad(); } internal int Wheel(float delta, float now) { if (delta == 0f) { return 0; } if (now - _wheelSeen > 0.3f || (_wheelAcc != 0f && Mathf.Sign(delta) != Mathf.Sign(_wheelAcc))) { _wheelAcc = 0f; } _wheelSeen = now; if (now - _wheelFlip < 0.15f) { _wheelAcc = 0f; return 0; } _wheelAcc += delta; if (Mathf.Abs(_wheelAcc) < 0.1f) { return 0; } int result = ((!(_wheelAcc > 0f)) ? 1 : (-1)); _wheelAcc = 0f; _wheelFlip = now; return result; } private void ClearSelection() { GameObject selected = Selected; if ((Object)(object)selected != (Object)null && selected.transform.IsChildOf(((Component)this).transform)) { EventSystem.current.SetSelectedGameObject((GameObject)null); } } private string FocusKey(GameObject go) { if ((Object)(object)go == (Object)null) { return null; } if ((Object)(object)go == (Object)(object)((Component)_bookmark).gameObject) { return "bookmark"; } int num = TitleButtons.FindIndex((Button b) => (Object)(object)b != (Object)null && (Object)(object)((Component)b).gameObject == (Object)(object)go); if (num >= 0) { return "button" + num; } num = _links.FindIndex((Button b) => (Object)(object)b != (Object)null && (Object)(object)((Component)b).gameObject == (Object)(object)go); if (num < 0) { return null; } return "link" + num; } private Selectable FromFocusKey(string key) { if (key == null) { return null; } if (key == "bookmark") { return (Selectable)(object)_bookmark; } if (key.StartsWith("button") && int.TryParse(key.Substring(6), out var result) && result < TitleButtons.Count) { return (Selectable)(object)TitleButtons[result]; } if (key.StartsWith("link") && int.TryParse(key.Substring(4), out var result2) && result2 < _links.Count) { return (Selectable)(object)_links[result2]; } return null; } private void UpdatePad() { bool pad = Pad; if (pad != _hintPad) { UpdateHint(); } if (pad && Time.frameCount > _openedFrame && !ZInput.GetButton("JoyButtonA")) { GameObject sel = Selected; if ((Object)(object)sel == (Object)null || !_focusables.Any((Selectable f) => (Object)(object)f != (Object)null && (Object)(object)((Component)f).gameObject == (Object)(object)sel)) { SelectDefault(); } } } internal void SelectDefault() { Selectable val = ((IEnumerable<Selectable>)_focusables).FirstOrDefault((Func<Selectable, bool>)((Selectable f) => (Object)(object)f != (Object)null && f.IsInteractable())); if ((Object)(object)val != (Object)null && (Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val).gameObject); } } internal void GoToContents() { GoToPage(1); } private void UpdateHint() { _hintPad = Pad; _hint.text = (_hintPad ? L("$winemaking_book_hint_pad", Key("JoyTabLeft") + "/" + Key("JoyTabRight"), Key("JoyButtonY"), Key("JoyButtonA"), Key("JoyButtonB")) : L("$winemaking_book_hint", Key("Left"), Key("Right"))); } private static string Key(string binding) { return Localization.instance.GetBoundKeyString(binding, false); } internal void Turn(int delta) { int num = Mathf.Clamp(_spread + delta, 0, SpreadCount - 1); if (num != _spread) { _spread = num; Render(animate: true); PlayFlip(); } } internal void GoToPage(int number) { int num = Mathf.Clamp((number - 1) / 2, 0, SpreadCount - 1); if (num != _spread) { _spread = num; Render(animate: true); PlayFlip(); } } private void PlayFlip() { if (!((Object)(object)_audio == (Object)null)) { _audio.outputAudioMixerGroup = WineAudio.SfxGroup; _audio.pitch = Random.Range(0.92f, 1.08f); _audio.PlayOneShot(BookArt.Flip, 0.7f); } } private void BuildNotice() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) _notice = Rect("notice", (Transform)(object)_book); RectTransform notice = _notice; RectTransform notice2 = _notice; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0f); notice2.anchorMax = val; notice.anchorMin = val; _notice.pivot = new Vector2(0.5f, 0f); _notice.anchoredPosition = new Vector2(0f, 70f); Image obj = ((Component)_notice).gameObject.AddComponent<Image>(); obj.sprite = BookArt.Wash; obj.type = (Type)1; ((Graphic)obj).color = new Color(0.12f, 0.06f, 0.04f, 0.88f); ((Graphic)obj).raycastTarget = false; _noticeGroup = ((Component)_notice).gameObject.AddComponent<CanvasGroup>(); _noticeGroup.blocksRaycasts = false; _noticeGroup.interactable = false; _noticeText = Text(_notice, "", 20f, new Color(0.98f, 0.92f, 0.8f), (FontStyles)0, (TextAlignmentOptions)514); _noticeText.rectTransform.anchorMin = Vector2.zero; _noticeText.rectTransform.anchorMax = Vector2.one; _noticeText.rectTransform.offsetMin = new Vector2(34f, 14f); _noticeText.rectTransform.offsetMax = new Vector2(-34f, -14f); ((Component)_notice).gameObject.SetActive(false); } private void ShowNotice(string text) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) _noticeText.text = text; Vector2 preferredValues = _noticeText.GetPreferredValues(text, 752f, 0f); _notice.sizeDelta = new Vector2(Mathf.Min(820f, preferredValues.x + 68f), preferredValues.y + 28f); ((Transform)_notice).SetAsLastSibling(); ((Component)_notice).gameObject.SetActive(true); _noticeGroup.alpha = 1f; _noticeStart = Time.unscaledTime; } private void UpdateNotice() { if (!((Object)(object)_notice == (Object)null) && ((Component)_notice).gameObject.activeSelf) { float num = Time.unscaledTime - _noticeStart; _noticeGroup.alpha = ((num < 3.5f) ? 1f : Mathf.Clamp01(1f - (num - 3.5f) / 0.6f)); if (num >= 4.1f) { ((Component)_notice).gameObject.SetActive(false); } } } private void UpdateFade() { if (!(_fadeStart < 0f)) { float num = Mathf.Clamp01((Time.unscaledTime - _fadeStart) / 0.18f); _fade.alpha = num; if (num >= 1f) { _fadeStart = -1f; } } } private void Build() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Expected O, but got Unknown //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Expected O, but got Unknown //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)this).transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; RectTransform val2 = Rect("root", ((Component)this).transform); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; _root = ((Component)val2).gameObject; Image obj = _root.AddComponent<Image>(); obj.sprite = BookArt.White; ((Graphic)obj).color = new Color(0f, 0f, 0f, 0.55f); _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); _audio.playOnAwake = false; _audio.spatialBlend = 0f; TMP_Text val3 = (((Object)(object)InventoryGui.instance != (Object)null) ? InventoryGui.instance.m_recipeDecription : null); TMP_Text val4 = (((Object)(object)InventoryGui.instance != (Object)null) ? InventoryGui.instance.m_recipeName : null); _font = (((Object)(object)val3 != (Object)null) ? val3.font : TMP_Settings.defaultFontAsset); _bold = (((Object)(object)val4 != (Object)null) ? val4.font : _font); ManualLogSource log = WinemakingPlugin.Log; string[] obj2 = new string[5] { "book: fonts '", null, null, null, null }; TMP_FontAsset font = _font; obj2[1] = ((font != null) ? ((Object)font).name : null); obj2[2] = "', '"; TMP_FontAsset bold = _bold; obj2[3] = ((bold != null) ? ((Object)bold).name : null); obj2[4] = "'"; log.LogInfo((object)string.Concat(obj2)); _book = Rect("book", _root.transform); RectTransform book = _book; RectTransform book2 = _book; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); book2.anchorMax = val5; book.anchorMin = val5; _book.pivot = new Vector2(0.5f, 0.5f); _book.sizeDelta = new Vector2(1560f, 900f); Image obj3 = ((Component)_book).gameObject.AddComponent<Image>(); obj3.sprite = BookArt.Leather; obj3.type = (Type)2; ((Graphic)obj3).color = new Color(0.95f, 0.85f, 0.8f); RectTransform val6 = Rect("spread", (Transform)(object)_book); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); val6.anchorMax = val5; val6.anchorMin = val5; val6.sizeDelta = new Vector2(1560f, 900f); _fade = ((Component)val6).gameObject.AddComponent<CanvasGroup>(); for (int i = 0; i < 2; i++) { RectTransform val7 = Rect((i == 0) ? "page_left" : "page_right", (Transform)(object)val6); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); val7.anchorMax = val5; val7.anchorMin = val5; val7.sizeDelta = new Vector2(740f, 852f); val7.anchoredPosition = new Vector2((i == 0) ? (-374f) : 374f, 0f); _pageImage[i] = ((Component)val7).gameObject.AddComponent<Image>(); _pageImage[i].sprite = BookArt.Parchment; ((Component)val7).gameObject.AddComponent<RectMask2D>(); RectTransform val8 = Rect("content", (Transform)(object)val7); ((Vector2)(ref val5))..ctor(0f, 1f); val8.anchorMax = val5; val8.anchorMin = val5; val8.pivot = new Vector2(0f, 1f); val8.sizeDelta = new Vector2(648f, 764f); val8.anchoredPosition = new Vector2(46f, -30f); _pageContent[i] = val8; } Image obj4 = ((Component)Rect("gutter", (Transform)(object)val6)).gameObject.AddComponent<Image>(); obj4.sprite = BookArt.White; ((Graphic)obj4).color = new Color(0.18f, 0.1f, 0.05f, 0.45f); ((RectTransform)((Component)obj4).transform).sizeDelta = new Vector2(10f, 852f); _prev = ArrowButton(val6, "←", new Vector2(-710f, -392f), (UnityAction)delegate { Turn(-1); }); _next = ArrowButton(val6, "→", new Vector2(710f, -392f), (UnityAction)delegate { Turn(1); }); _hint = Text(_book, "", 16f, new Color(0.88f, 0.8f, 0.66f), (FontStyles)0, (TextAlignmentOptions)258); RectTransform rectTransform = _hint.rectTransform; RectTransform rectTransform2 = _hint.rectTransform; ((Vector2)(ref val5))..ctor(0.5f, 0f); rectTransform2.anchorMax = val5; rectTransform.anchorMin = val5; _hint.rectTransform.pivot = new Vector2(0.5f, 1f); _hint.rectTransform.sizeDelta = new Vector2(1560f, 30f); _hint.rectTransform.anchoredPosition = new Vector2(0f, -8f); Button obj5 = ArrowButton(_book, "×", new Vector2(756f, 428f), new UnityAction(Hide)); TMP_Text componentInChildren = ((Component)obj5).GetComponentInChildren<TMP_Text>(); componentInChildren.fontSize = 34f; ((Graphic)componentInChildren).color = new Color(0.92f, 0.84f, 0.68f); Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj5).navigation = navigation; BuildBookmark(); BuildNotice(); _root.SetActive(false); } private void BuildBookmark() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Expected O, but got Unknown //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) float num = 24f; float num2 = 34f; float num3 = 13f; float num4 = num + 210f; float num5 = num4 + 26f; float num6 = Mathf.Max(9f, 16f) + 6f; RectTransform val = Rect("bookmark", (Transform)(object)_book); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 1f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0.5f, 1f); val.anchoredPosition = Vector2.zero; val.sizeDelta = new Vector2(num2 + 2f * num6, num4 + 22f + num6); RectTransform val3 = Rect("bookmark_clip", (Transform)(object)val); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val2 = (val3.offsetMin = (val3.offsetMax = Vector2.zero)); ((Component)val3).gameObject.AddComponent<RectMask2D>(); Image glow = TopImage(val3, "ribbon_glow", BookArt.RibbonShadow(num2, num5, num3, 16f, 7f), num2 + 32f, num5 + 32f); Image shadow = TopImage(val3, "ribbon_shadow", BookArt.RibbonShadow(num2, num5, num3, 9f, 3.5f), num2 + 18f, num5 + 18f); Image ribbon = TopImage(val3, "ribbon", BookArt.Ribbon(num2, num5, num3, RibbonBody, RibbonEdge, 3f), num2, num5); ((Graphic)ribbon).raycastTarget = true; RectTransform val5 = Rect("ribbon_lit", (Transform)(object)((Graphic)ribbon).rectTransform); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val2 = (val5.offsetMin = (val5.offsetMax = Vector2.zero)); Image lit = ((Component)val5).gameObject.AddComponent<Image>(); lit.sprite = BookArt.Ribbon(num2, num5, num3, RibbonBodyLit, RibbonEdgeLit, 2.6f, 1.15f); ((Graphic)lit).raycastTarget = false; ((Graphic)TopImage(val3, "ribbon_fold", BookArt.FadeDown, num2, 12f)).color = new Color(0.08f, 0.03f, 0.02f, 0.5f); Color labelRest = new Color(0.93f, 0.8f, 0.58f); Color labelOn = new Color(1f, 0.96f, 0.84f); List<TMP_Text> labels = new List<TMP_Text>(); for (int i = 0; i < 2; i++) { TMP_Text val7 = Text(((Graphic)ribbon).rectTransform, "", 15f, (Color)((i == 0) ? new Color(0.16f, 0.02f, 0.03f, 0.8f) : labelRest), (FontStyles)1, (TextAlignmentOptions)514); val7.fontStyle = (FontStyles)17; val7.characterSpacing = 6f; val7.textWrappingMode = (TextWrappingModes)0; ((Object)val7).name = ((i == 0) ? "bookmark_label_shadow" : "bookmark_label"); RectTransform rectTransform = val7.rectTransform; ((Vector2)(ref val2))..ctor(0.5f, 1f); rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(num4 - num - num3, num2); ((Transform)rectTransform).localRotation = Quaternion.Euler(0f, 0f, -90f); rectTransform.anchoredPosition = new Vector2((i == 0) ? 1f : 0f, 0f - (26f + num + (num4 - num - num3) * 0.5f) - ((i == 0) ? 1.2f : 0f)); if (i == 1) { labels.Add(val7); } } _bookmark = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)_bookmark).targetGraphic = (Graphic)(object)ribbon; ((Selectable)_bookmark).transition = (Transition)0; Button bookmark = _bookmark; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Selectable)bookmark).navigation = navigation; ((UnityEvent)_bookmark.onClick).AddListener(new UnityAction(GoToContents)); Color rest = new Color(0.86f, 0.86f, 0.86f); BookFocus bookFocus = ((Component)val).gameObject.AddComponent<BookFocus>(); bookFocus.Target = (Selectable)(object)_bookmark; bookFocus.Duration = 0.15f; bookFocus.Apply = delegate(float k) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) float num7 = Mathf.SmoothStep(0f, 1f, k); float num8 = 26f - 22f * num7; ((Graphic)ribbon).rectTransform.anchoredPosition = new Vector2(0f, num8); ((Graphic)ribbon).color = Color.Lerp(rest, Color.white, num7); ((Graphic)lit).color = new Color(1f, 1f, 1f, num7); ((Graphic)glow).rectTransform.anchoredPosition = new Vector2(0f, num8 + 16f); ((Graphic)glow).color = new Color(RibbonGlow.r, RibbonGlow.g, RibbonGlow.b, 0.7f * num7); ((Graphic)shadow).rectTransform.anchoredPosition = new Vector2(2.5f + 3.5f * num7, num8 + 9f - (3.5f + 4.5f * num7)); ((Graphic)shadow).color = new Color(0.1f, 0.05f, 0.02f, 0.34f + 0.22f * num7); foreach (TMP_Text item in labels) { ((Graphic)item).color = Color.Lerp(labelRest, labelOn, num7); } }; bookFocus.Apply(0f); } private static Image TopImage(RectTransform parent, string name, Sprite sprite, float w, float h) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Rect(name, (Transform)(object)parent); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 1f); obj.anchorMax = val; obj.anchorMin = val; obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(w, h); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); obj2.sprite = sprite; ((Graphic)obj2).raycastTarget = false; return obj2; } private static Image Band(RectTransform parent, string name, float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Image obj = Img(parent, BookArt.Wash, Color.clear, x, y, w, h, preserveAspect: false); obj.type = (Type)1; ((Object)obj).name = name; return obj; } private static Image Mark(RectTransform parent, string name, float cx, float cy) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Image obj = Img(parent, BookArt.Lozenge, Color.clear, cx - 5f, cy - 6f, 10f, 12f, preserveAspect: false); ((Object)obj).name = name; return obj; } private static Vector2 CanvasSize() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GUIManager.CustomGUIFront != (Object)null)) { return Vector2.zero; } Rect rect = ((RectTransform)GUIManager.CustomGUIFront.transform).rect; return ((Rect)(ref rect)).size; } private void FitToScreen() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) _fitSize = CanvasSize(); float num = Mathf.Min(_fitSize.x / 1640f, _fitSize.y / 990f); ((Transform)_book).localScale = Vector3.one * Mathf.Clamp(num, 0.4f, 2f); } private Button ArrowButton(RectTransform parent, string glyph, Vector2 pos, UnityAction onClick) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect("button_" + glyph, (Transform)(object)parent); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.sizeDelta = new Vector2(56f, 44f); val.anchoredPosition = pos; Image obj = ((Component)val).gameObject.AddComponent<Image>(); obj.sprite = BookArt.White; ((Graphic)obj).color = new Color(1f, 1f, 1f, 0f); Button obj2 = ((Component)val).gameObject.AddComponent<Button>(); RectTransform obj3 = Rect("label", (Transform)(object)val); obj3.anchorMin = Vector2.zero; obj3.anchorMax = Vector2.one; val2 = (obj3.offsetMin = (obj3.offsetMax = Vector2.zero)); TMP_Text val4 = (TMP_Text)(object)((Component)obj3).gameObject.AddComponent<TextMeshProUGUI>(); val4.font = _bold; val4.fontSize = 30f; val4.alignment = (TextAlignmentOptions)514; val4.text = glyph; ((Graphic)val4).color = HeadInk; ((Graphic)val4).raycastTarget = false; ((Selectable)obj2).targetGraphic = (Graphic)(object)val4; ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 0.55f, 0.35f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.7f, 0.4f, 0.3f); ((ColorBlock)(ref colors)).disabledColor = new Color(1f, 1f, 1f, 0.25f); ((Selectable)obj2).colors = colors; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj2).navigation = navigation; ((UnityEvent)obj2.onClick).AddListener(onClick); return obj2; } private void Render(bool animate) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_table == (Object)null) { return; } _renderedBook = _table.Book; _renderedJournal = WineJournal.Raw(Player.m_localPlayer); _renderedLanguage = Localization.instance.GetSelectedLanguage(); _renderedWaiting = _table.Waiting; UpdateHint(); GameObject selected = Selected; string key = (((Object)(object)selected != (Object)null && selected.transform.IsChildOf(((Component)this).transform)) ? FocusKey(selected) : null); ClearSelection(); TitleButtons.Clear(); _links.Clear(); OverflowPages.Clear(); CompactPages.Clear(); for (int i = 0; i < 2; i++) { RectTransform val = _pageContent[i]; for (int num = ((Transform)val).childCount - 1; num >= 0; num--) { GameObject gameObject = ((Component)((Transform)val).GetChild(num)).gameObject; gameObject.SetActive(false); Object.Destroy((Object)(object)gameObject); } ((Transform)val).DetachChildren(); int num2 = _spread * 2 + i; BookPage bookPage = ((num2 < _pages.Count) ? _pages[num2] : null); ((Graphic)_pageImage[i]).color = Color.white; if (bookPage == null) { continue; } DrawPage(val, bookPage, i == 0); float num3 = 0f; foreach (RectTransform item in (Transform)val) { RectTransform val2 = item; num3 = Mathf.Max(num3, 0f - val2.anchoredPosition.y + val2.sizeDelta.y); } if (num3 > 766f) { OverflowPages.Add(bookPage.Number); } } ((Selectable)_prev).interactable = _spread > 0; ((Selectable)_next).interactable = _spread < SpreadCount - 1; ((Component)_bookmark).gameObject.SetActive(_spread > 0); TMP_Text[] componentsInChildren = ((Component)_bookmark).GetComponentsInChildren<TMP_Text>(true); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].text = L("$winemaking_book_contents"); } SetupNavigation(); if (Pad && Time.frameCount > _openedFrame && !ZInput.GetButton("JoyButtonA")) { Selectable val3 = FromFocusKey(key); if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.activeInHierarchy && val3.IsInteractable() && _focusables.Contains(val3)) { EventSystem.current.SetSelectedGameObject(((Component)val3).gameObject); } else { SelectDefault(); } } if (animate) { _fade.alpha = 0f; _fadeStart = Time.unscaledTime; } else { _fade.alpha = 1f; } } private void SetupNavigation() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) _focusables.Clear(); if (_spread == 0) { List<Selectable> list = TitleButtons.Where((Button b) => ((Selectable)b).interactable).Cast<Selectable>().ToList(); List<Selectable> list2 = _links.Cast<Selectable>().ToList(); Chain(list, list2); Chain(list2, list); _focusables.AddRange(list); _focusables.AddRange(list2); } else { Button bookmark = _bookmark; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Selectable)bookmark).navigation = navigation; _focusables.Add((Selectable)(object)_bookmark); } } private static void Chain(List<Selectable> col, List<Selectable> other) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) int i; for (i = 0; i < col.Count; i++) { Selectable val = ((other.Count > 0) ? other.OrderBy((Selectable o) => Mathf.Abs(((Component)o).transform.position.y - ((Component)col[i]).transform.position.y)).First() : null); bool flag = other.Count == 0 || ((Component)col[i]).transform.position.x < ((Component)other[0]).transform.position.x; Selectable obj = col[i]; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = ((i > 0) ? col[i - 1] : null); ((Navigation)(ref navigation)).selectOnDown = ((i < col.Count - 1) ? col[i + 1] : null); ((Navigation)(ref navigation)).selectOnRight = (flag ? val : null); ((Navigation)(ref navigation)).selectOnLeft = (flag ? null : val); obj.navigation = navigation; } } private void DrawPage(RectTransform c, BookPage page, bool left) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (page.Chapter != 0) { string text = L(BookPages.ChapterToken(page.Chapter)); Label(c, text, 17f, Muted, (FontStyles)2, (TextAlignmentOptions)(left ? 257 : 260), 0f, 0f, 648f); } if (page.Kind != PageKind.Blank) { Label(c, page.Number.ToString(), 17f, Muted, (FontStyles)0, (TextAlignmentOptions)(left ? 260 : 257), 0f, 0f, 648f); } int pageIndex = ((!left) ? 1 : 0); switch (page.Kind) { case PageKind.Title: DrawTitle(c); break; case PageKind.Contents: DrawContents(c); break; case PageKind.Craft: DrawCraft(c, page.CraftId, pageIndex); break; case PageKind.Wine: { int childCount = ((Transform)c).childCount; if (DrawWine(c, page.Wine, pageIndex, compact: false) < 13f) { for (int num = ((Transform)c).childCount - 1; num >= childCount; num--) { GameObject gameObject = ((Component)((Transform)c).GetChild(num)).gameObject; gameObject.SetActive(false); gameObject.transform.SetParent((Transform)null, false); Object.Destroy((Object)(object)gameObject); } DrawWine(c, page.Wine, pageIndex, compact: true); CompactPages.Add(page.Number); } break; } } } private void DrawTitle(RectTransform c) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) Player p = Player.m_localPlayer; TableBook b = _table.Book; float num = 30f; num += Label(c, L("$winemaking_book_title"), 40f, HeadInk, (FontStyles)1, (TextAlignmentOptions)258, 0f, num, 648f).preferredHeight + 10f; int num2 = Lore.CraftPages.Count((string id) => b.HasCraftPage(id)); int num3 = Lore.Wines.Count((WineLore w) => b.ShowsEpigraph(w)); int num4 = Lore.Wines.Count((WineLore w) => w.EpigraphToken != null); int num5 = Lore.Wines.Sum((WineLore w) => w.Notes.Count((LoreNote n) => b.Notes.ContainsKey(n.Id))); int num6 = Lore.Wines.Sum((WineLore w) => w.Notes.Count); string text = L("$winemaking_book_stats", Lore.WineCount.ToString(), Lore.KnownWines(p).Count().ToString(), Lore.Wines.Count((WineLore w) => b.Recipes.ContainsKey(w.Id)).ToString(), num2.ToString(), Lore.CraftPageCount.ToString(), num3.ToString(), num4.ToString(), num5.ToString(), num6.ToString()); num += Label(c, text, 17f, Ink, (FontStyles)0, (TextAlignmentOptions)258, 0f, num, 648f).preferredHeight + 26f; foreach (KeyValuePair<int, List<WineLore>> item in BookPages.WineChapters()) { int num7 = item.Value.Count((WineLore w) => b.Recipes.ContainsKey(w.Id)); int num8 = item.Value.Count((WineLore w) => Lore.Knows(p, w)); Label(c, L(BookPages.ChapterToken(item.Key)), 18f, Ink, (FontStyles)0, (TextAlignmentOptions)257, 0f, num, 250f); Bar(c, 250f, num + 6f, 250f, 14f, (item.Value.Count > 0) ? ((float)num7 / (float)item.Value.Count) : 0f, (item.Value.Count > 0) ? ((float)num8 / (float)item.Value.Count) : 0f); Label(c, L("$winemaking_book_bar", num7.ToString(), item.Value.Count.ToString()), 16f, Muted, (FontStyles)0, (TextAlignmentOptions)260, 0f, num + 1f, 648f); num += 32f; } num += 30f; int count = _table.NewForBook(p).Count; int count2 = _table.NewForPlayer(p).Count; int count3 = _table.Insertable(p).Count; AddButton(c, L("$winemaking_book_btn_write") + ((count > 0) ? $" (+{count})" : ""), num, count > 0 && !_table.WaitingWrite, delegate { _table.WriteMyRecipes(Player.m_localPlayer); }); num += 62f; AddButton(c, L("$winemaking_book_btn_read") + ((count2 > 0) ? (" (" + New(count2) + ")") : ""), num, count2 > 0, delegate { _table.ReadBook(Player.m_localPlayer); Render(animate: false); }); num += 62f; AddButton(c, L("$winemaking_book_btn_insert") + ((count3 > 0) ? $" ({count3})" : ""), num, count3 > 0 && !_table.WaitingInsert, delegate { _table.InsertNotes(Player.m_localPlayer); }); } private static string New(int n) { if (!Fmt.Russian || !(Fmt.RuPlural(n, "1", "2", "5") == "1")) { return L("$winemaking_book_new", n.ToString()); } return L("$winemaking_book_new_one", n.ToString()); } private void Bar(RectTransform c, float x, float y, float w, float h, float fill, float known) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Img(c, BookArt.White, new Color(0.55f, 0.45f, 0.32f, 0.35f), x, y, w, h, preserveAspect: false); if (fill > 0f) { Img(c, BookArt.White, new Color(0.5f, 0.12f, 0.12f, 0.85f), x, y, w * Mathf.Clamp01(fill), h, preserveAspect: false); } if (known > 0f) { Img(c, BookArt.White, new Color(0.8f, 0.55f, 0.15f, 0.95f), x, y + h + 2f, w * Mathf.Clamp01(known), 3f, preserveAspect: false); } } private void AddButton(RectTransform c, string text, float y, bool enabled, Action onClick) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GUIManager.Instance.CreateButton(text, (Transform)(object)c, new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, 440f, 48f); RectTransform val2 = (RectTransform)val.transform; val2.pivot = new Vector2(0.5f, 1f); val2.anchoredPosition = new Vector2(324f, 0f - y); Button component = val.GetComponent<Button>(); ((Selectable)component).interactable = enabled; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component).navigation = navigation; ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { onClick(); }); Image band = Band(c, "button_band", 62f, y - 12f, 524f, 72f); ((Component)band).transform.SetSiblingIndex(val.transform.GetSiblingIndex()); Image markL = Mark(c, "button_mark", 85f, y + 24f); Image markR = Mark(c, "button_mark", 563f, y + 24f); BookFocus bookFocus = val.AddComponent<BookFocus>(); bookFocus.Target = (Selectable)(object)component; bookFocus.Apply = delegate(float k) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) ((Graphic)band).color = new Color(BandWine.r, BandWine.g, BandWine.b, 0.48f * k); Image obj = markL; Image obj2 = markR; Color color = default(Color); ((Color)(ref color))..ctor(Accent.r, Accent.g, Accent.b, k); ((Graphic)obj2).color = color; ((Graphic)obj).color = color; }; Text componentInChildren = val.GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.fontSize = 19; if (!enabled) { ((Graphic)componentInChildren).color = new Color(0.62f, 0.58f, 0.52f); } } TitleButtons.Add(component); } private void DrawContents(RectTransform c) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; TableBook book = _table.Book; RectTransform val = Rect("link_marks", (Transform)(object)c); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; Vector2 offsetMin = (val.offsetMax = Vector2.zero); val.offsetMin = offsetMin; float num = 30f; num += Label(c, L("$winemaking_book_contents"), 30f, HeadInk, (FontStyles)1, (TextAlignmentOptions)258, 0f, num, 648f).preferredHeight + 14f; List<KeyValuePair<int, List<WineLore>>> list = BookPages.WineChapters(); int num2 = 1 + list.Count + list.Sum((KeyValuePair<int, List<WineLore>> keyValuePair) => keyValuePair.Value.Count); float num3 = Mathf.Clamp((764f - num) / (float)num2, 14f, 24f); float num4 = Mathf.Clamp(num3 * 0.72f, 11f, 17f); int number = _pages.First((BookPage pg) => pg.Kind == PageKind.Craft).Number; Link(c, val, L("$winemaking_book_craft"), number, 0f, num, num3, num4 + 1f, Ink, (FontStyles)1); num += num3; foreach (KeyValuePair<int, List<WineLore>> ch in list) { int number2 = _pages.First((BookPage pg) => pg.Kind == PageKind.Wine && pg.Wine == ch.Value[0]).Number; Link(c, val, L(BookPages.ChapterToken(ch.Key)), number2, 0f, num, num3, num4 + 1f, Ink, (FontStyles)1); num += num3; foreach (WineLore w in ch.Value) { int number3 = _pages.First((BookPage pg) => pg.Wine == w).Number; bool flag = book.Recipes.ContainsKey(w.Id) || Lore.Knows(localPlayer, w); Link(c, val, flag ? L(w.Recipe.NameToken) : L("$winemaking_book_unknown"), number3, 26f, num, num3, num4, flag ? Ink : Grey, (FontStyles)0); num += num3; } } } private void Link(RectTransform c, RectTransform marks, string text, int page, float x, float y, float h, float size, Color color, FontStyles style) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect("link", (Transform)(object)c); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0f, 1f); val.sizeDelta = new Vector2(648f - x, h); val.anchoredPosition = new Vector2(x, 0f - y); Image val3 = ((Component)val).gameObject.AddComponent<Image>(); val3.sprite = BookArt.White; ((Graphic)val3).color = new Color(1f, 1f, 1f, 0f); Button val4 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val4).targetGraphic = (Graphic)(object)val3; ((Selectable)val4).transition = (Transition)0; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val4).navigation = navigation; ((UnityEvent)val4.onClick).AddListener((UnityAction)delegate { GoToPage(page); }); _links.Add(val4); Image band = Band(marks, "link_band", x - 22f, y - 6f, 648f - x + 22f + 16f, h + 12f); Image mark = Mark(marks, "link_mark", x - 11f, y + h * 0.5f); TMP_Text left = Text(val, text, size, color, style, (TextAlignmentOptions)4097); ((Object)left).name = "contents_line"; left.rectTransform.anchorMin = Vector2.zero; left.rectTransform.anchorMax = Vector2.one; val2 = (left.rectTransform.offsetMin = (left.rectTransform.offsetMax = Vector2.zero)); TMP_Text right = Text(val, page.ToString(), size, Muted, (FontStyles)0, (TextAlignmentOptions)4100); right.rectTransform.anchorMin = Vector2.zero; right.rectTransform.anchorMax = Vector2.one; val2 = (right.rectTransform.offsetMin = (right.rectTransform.offsetMax = Vector2.zero)); Color nameOn = Color.Lerp(color, LinkInkOn, 0.6f); BookFocus bookFocus = ((Component)val).gameObject.AddComponent<BookFocus>(); bookFocus.Target = (Selectable)(object)val4; bookFocus.Apply = delegate(float k) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((Graphic)band).color = new Color(BandWine.r, BandWine.g, BandWine.b, 0.34f * k); ((Graphic)mark).color = new Color(Accent.r, Accent.g, Accent.b, k); ((Graphic)left).color = Color.Lerp(color, nameOn, k); ((Graphic)right).color = Color.Lerp(Muted, Ink, k); }; } private void DrawCraft(RectTransform c, string id, int pageIndex) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) TableBook book = _table.Book; LoreNote loreNote = Lore.Note(id); bool flag = book.HasCraftPage(id); string text = ((id == "craft.book") ? L("$winemaking_craft_title_book") : ((loreNote != null) ? L(loreNote.TitleToken) : id)); string text2 = (id.StartsWith("craft.") ? id.Substring("craft.".Length) : null); float num = 44f; if (!flag) { ((Graphic)_pageImage[pageIndex]).color = GreyPage; } List<Sprite> list = CraftIcons((loreNote != null) ? loreNote.Topic : text2); float num2 = 0f; foreach (Sprite item in list) { Img(c, item, (Color)(flag ? Color.white : new Color(0.25f, 0.23f, 0.21f, 0.5f)), num2, num, 56f, 56f); num2 += 62f; } float y = num + ((list.Count > 0) ? 6f : 0f); Label(c, text, 28f, flag ? HeadInk : Grey, (FontStyles)1, (TextAlignmentOptions)257, num2 + 8f, y, 648f - num2 - 8f); num += ((list.Count > 0) ? 70f : 44f); if (!flag) { if (loreNote != null) { num += Label(c, L("$winemaking_book_note_lies", L(Lore.BiomeToken(loreNote.Biome))), 21f, Muted, (FontStyles)0, (TextAlignmentOptions)257, 0f, num, 648f).preferredHeight + 12f; } Label(c, L("$winemaking_book_note_missing"), 18f, Grey, (FontStyles)2, (TextAlignmentOptions)257, 0f, num, 648f); return; } string text3 = L((id == "craft.book") ? "$winemaking_craft_text_book" : loreNote.TextToken); List<string> list2 = ((id == "craft.book") ? CraftShort.Lines("book") : CraftShort.Lines(loreNote)); for (float num3 = 21f; num3 >= 12f; num3 -= 1f) { float small = num3 - 3f; if (Measure(text3, num3, 648f) + 32f + list2.Sum((string l) => Measure("• " + l, small, 648f)) + (float)list2.Count * 3f <= 764f - num || num3 <= 12f) { num += Named(Label(c, text3, num3, Ink, (FontStyles)0, (TextAlignmentOptions)257, 0f, num, 648f), "craft_text").preferredHeight + 14f; if (list2.Count <= 0) { break; } ((Object)Img(c, BookArt.White, new Color(0.42f, 0.3f, 0.2f, 0.55f), 0f, num, 648f, 1.5f, preserveAspect: false)).name = "rules_line"; num += 12f; { foreach (string item2 in list2) { num += Named(Label(c, "• " + Paper(item2), small, Muted, (FontStyles)0, (TextAlignmentOptions)257, 0f, num, 648f), "craft_rule").preferredHeight + 3f; } break; } } } } private static List<Sprite> CraftIcons(string topic) { List<Sprite> list = new List<Sprite>(); switch (topic) { case "book": PieceIcon("Winemaking_WinemakerTable"); break; case "light": Item(GrapeVariety.Light.GrapePrefab); Item(GrapeVariety.Light.CuttingPrefab); break; case "dark": Item(GrapeVariety.Dark.GrapePrefab); Item(GrapeVariety.Dark.CuttingPrefab); break; case "sun": Item(GrapeVariety.Sun.GrapePrefab); Item(GrapeVariety.Sun.CuttingPrefab); break; case "vineberry": Item("Vineberry"); break; case "berries": Item("Raspberry"); Item("Blueberries"); Item("Cloudberry"); break; case "planting": PieceIcon("Winemaking_Trellis"); Item("Cultivator"); break; case "press": PieceIcon("Winemaking_GrapePress"); Item("Winemaking_MustVessel"); break; case "blends": Item(GrapeVariety.Light.GrapePrefab); Item(GrapeVariety.Dark.GrapePrefab); Item(GrapeVariety.Sun.GrapePrefab); break; case "additives": PieceIcon("Winemaking_GrapePress"); break; case "ferment": PieceIcon("Winemaking_FermentBarrel"); Item("Winemaking_MustVessel"); break; case "aging": PieceIcon("Winemaking_AgingBarrel"); break; case "tasting": { Sprite val = WineItems.Icon(10); if ((Object)(object)val != (Object)null) { list.Add(val); } break; } } return list; void Item(string prefab) { ObjectDB instance = ObjectDB.instance; object obj; if (instance == null) { obj = null; } else { GameObject itemPrefab = instance.GetItemPrefab(prefab); if (itemPrefab == null) { obj = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); obj = ((component != null) ? component.m_itemData.GetIcon() : null); } } Sprite val2 = (Sprite)obj; if ((Object)(object)val2 != (Object)null) { list.Add(val2); } } void PieceIcon(string prefab) { ZNetScene instance = ZNetScene.instance; object obj; if (instance == null) { obj = null; } else { GameObject prefab2 = instance.GetPrefab(prefab); obj = ((prefab2 == null) ? null : prefab2.GetComponent<Piece>()?.m_icon); } Sprite val2 = (Sprite)obj; if ((Object)(object)val2 != (Object)null) { list.Add(val2); } } } private float DrawWine(RectTransform c, WineLore w, int pageIndex, bool compact) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) float num = (compact ? 2f : 0f); float num2 = (compact ? 32f : 38f); float num3 = (compact ? 30f : 34f); Player localPlayer = Player.m_localPlayer; TableBook book = _table.Book; TableBook.Entry value; bool flag = book.Recipes.TryGetValue(w.Id, out value); bool flag2 = Lore.Knows(localPlayer, w); bool flag3 = flag || flag2; if (!flag3) { ((Graphic)_pageImage[pageIndex]).color = GreyPage; } float num4 = 44f; Sprite sprite = WineItems.Icon(WineColor.Index(w.Counts)); Img(c, sprite, (Color)(flag3 ? Color.white : new Color(0.22f, 0.2f, 0.18f, 0.55f)), 0f, num4, 100f, 100f); float num5 = 116f; float num6 = num4 + 4f; if (flag3) { num6 += Label(c, L(w.Recipe.NameToken), 32f, HeadInk, (FontStyles)1, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight + 2f; num6 += Label(c, L(LoreTooltip.KindToken(w)), 19f, Muted, (FontStyles)2, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight + 4f; if (flag && !flag2) { num6 += Label(c, L("$winemaking_book_mark_read"), 18f, Accent, (FontStyles)1, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight; } else if (!flag && flag2) { num6 += Label(c, L("$winemaking_book_mark_write"), 18f, Accent, (FontStyles)1, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight; } } else { num6 += Label(c, L("$winemaking_book_unknown"), 32f, Grey, (FontStyles)1, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight + 6f; if ((int)w.Biome != 0) { num6 += Label(c, L("$winemaking_book_opens", L(Lore.BiomeToken(w.Biome))), 22f, Muted, (FontStyles)0, (TextAlignmentOptions)257, num5, num6, 648f - num5).preferredHeight; } } num4 = Mathf.Max(num4 + 108f, num6 + 10f); if (flag3) { if (book.ShowsEpigraph(w)) { num4 += Label(c, L(w.EpigraphToken), 19f - num, Ink, (FontStyles)2, (TextAlignmentOptions)257, 0f, num4, 648f).preferredHeight + 8f - num; } else if (w.EpigraphToken != null) { num4 += Label(c, L("$winemaking_book_epigraph_missing"), 17f - num, FadedInk, (FontStyles)2, (TextAlignmentOptions)257, 0f, num4, 648f).preferredHeight + 8f - num; } if (w.Recipe.Kind == WineKind.Special || w.Recipe.Kind == WineKind.Joke || w.Recipe.External) { num4 += Label(c, L(w.Recipe.DescToken), 17f - num, Muted, (FontStyles)0, (TextAlignmentOptions)257, 0f, num4,