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 ChefsKiss v1.0.1
ChefsKiss.dll
Decompiled a day 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.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("JotunnModStub")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JotunnModStub")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] namespace CookingQTE; public static class BiomeArt { private class Runner : MonoBehaviour { } private struct FrameRef { public string Video; public double Sec; public float Y; } public const string DefaultFrames = "Cayir=blackforest:41; KaraOrman=blackforest:50.5; Bataklik=swamp:40; Dag=mountains:40; Ova=mistlands:41.5; Sisli=mistlands:88.5; Kul=ashlands:25; DerinKuzey=deepnorth:30"; private const int GrabW = 640; private const int GrabH = 360; private const int OutW = 320; private const int OutH = 180; private const int PixelW = 112; public const float Aspect = 1.7777778f; private const float SeekTimeout = 5f; public static readonly Color Tint = new Color(1f, 1f, 1f, 0.55f); private static readonly Dictionary<Biome, Sprite> _sprites = new Dictionary<Biome, Sprite>(); private static readonly HashSet<Biome> _failed = new HashSet<Biome>(); private static bool _busy; private static bool _hooked; private static bool _sceneHooked; private static Component _vp; private static RenderTexture _rt; private static Texture2D _full; private static Runner _runner; private static void Abort() { if (!_busy && (Object)(object)_vp == (Object)null && (Object)(object)_rt == (Object)null) { return; } try { if ((Object)(object)_runner != (Object)null) { ((MonoBehaviour)_runner).StopAllCoroutines(); } } catch { } try { if ((Object)(object)_vp != (Object)null) { Call(_vp, "Stop"); Set(_vp, "targetTexture", null); Set(_vp, "clip", null); Object.Destroy((Object)(object)_vp); } } catch { } _vp = null; try { if ((Object)(object)_rt != (Object)null) { _rt.Release(); Object.Destroy((Object)(object)_rt); } } catch { } _rt = null; try { if ((Object)(object)_full != (Object)null) { Object.Destroy((Object)(object)_full); } } catch { } _full = null; _busy = false; } public static Sprite Get(Biome b) { if (_sprites.TryGetValue(b, out var value) && (Object)(object)value != (Object)null) { return value; } if (!_busy && !_failed.Contains(b)) { Begin(); } return null; } public static bool Failed(Biome b) { return _failed.Contains(b); } public static void Begin() { //IL_007e: 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_0089: Expected O, but got Unknown if (Plugin.BiomeArtOn != null && !Plugin.BiomeArtOn.Value) { return; } Hook(); if (_busy || (Object)(object)Player.m_localPlayer == (Object)null) { return; } List<Biome> list = Parse().Keys.Where((Biome b) => !_sprites.ContainsKey(b) && !_failed.Contains(b)).ToList(); if (list.Count == 0) { return; } if ((Object)(object)_runner == (Object)null) { GameObject val = new GameObject("CookingQTE_BiomeArt"); Object.DontDestroyOnLoad((Object)val); _runner = val.AddComponent<Runner>(); } if (!_sceneHooked) { _sceneHooked = true; SceneManager.activeSceneChanged += delegate { Abort(); }; } _busy = true; ((MonoBehaviour)_runner).StartCoroutine(Grab(list)); } private static void Hook() { if (!_hooked) { _hooked = true; EventHandler eventHandler = delegate { Clear(); }; if (Plugin.BiomeArtFrames != null) { Plugin.BiomeArtFrames.SettingChanged += eventHandler; } if (Plugin.BiomeArtPixel != null) { Plugin.BiomeArtPixel.SettingChanged += eventHandler; } } } private static void Clear() { foreach (Sprite value in _sprites.Values) { if ((Object)(object)value != (Object)null) { if ((Object)(object)value.texture != (Object)null) { Object.Destroy((Object)(object)value.texture); } Object.Destroy((Object)(object)value); } } _sprites.Clear(); _failed.Clear(); } private static Dictionary<Biome, FrameRef> Parse() { Dictionary<Biome, FrameRef> dictionary = new Dictionary<Biome, FrameRef>(); string[] array = (((Plugin.BiomeArtFrames != null) ? Plugin.BiomeArtFrames.Value : "Cayir=blackforest:41; KaraOrman=blackforest:50.5; Bataklik=swamp:40; Dag=mountains:40; Ova=mistlands:41.5; Sisli=mistlands:88.5; Kul=ashlands:25; DerinKuzey=deepnorth:30") ?? "").Split(';', ','); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '=' }); if (array2.Length != 2) { continue; } Biome key; try { key = (Biome)Enum.Parse(typeof(Biome), array2[0].Trim(), ignoreCase: true); } catch { continue; } string[] array3 = array2[1].Trim().Split(new char[1] { ':' }); if (array3.Length >= 2 && double.TryParse(array3[1].Trim().Replace("sn", ""), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { float result2 = 0.5f; if (array3.Length >= 3) { float.TryParse(array3[2].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out result2); } dictionary[key] = new FrameRef { Video = array3[0].Trim().ToLowerInvariant(), Sec = result, Y = Mathf.Clamp01(result2) }; } } return dictionary; } private static Type T(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(name); if (type != null) { return type; } } return null; } private static void Set(object o, string prop, object value) { PropertyInfo property = o.GetType().GetProperty(prop, BindingFlags.Instance | BindingFlags.Public); if (!(property == null) && property.CanWrite) { if (value is string value2 && property.PropertyType.IsEnum) { value = Enum.Parse(property.PropertyType, value2); } property.SetValue(o, value, null); } } private static T2 Get<T2>(object o, string prop) { PropertyInfo property = o.GetType().GetProperty(prop, BindingFlags.Instance | BindingFlags.Public); if (property == null) { return default(T2); } try { return (T2)Convert.ChangeType(property.GetValue(o, null), typeof(T2)); } catch { return default(T2); } } private static void Call(object o, string method) { MethodInfo method2 = o.GetType().GetMethod(method, BindingFlags.Instance | BindingFlags.Public, null, Type.EmptyTypes, null); if (method2 != null) { method2.Invoke(o, null); } } private static IEnumerator Grab(List<Biome> want) { Dictionary<Biome, FrameRef> map = Parse(); Type type = T("UnityEngine.Video.VideoClip"); Type vpType = T("UnityEngine.Video.VideoPlayer"); if (type == null || vpType == null) { foreach (Biome item in want) { _failed.Add(item); } _busy = false; Logger.LogWarning((object)"[ChefsKiss] Biyom görseli: video modülü yok, biyom adları yazı olarak kalır."); yield break; } Object[] clips = Resources.FindObjectsOfTypeAll(type); RenderTexture val = new RenderTexture(640, 360, 0, (RenderTextureFormat)0); _rt = val; RenderTexture rt = val; rt.Create(); Texture2D val2 = new Texture2D(640, 360, (TextureFormat)3, false); _full = val2; Texture2D full = val2; bool pixel = Plugin.BiomeArtPixel == null || Plugin.BiomeArtPixel.Value; foreach (Biome b in want) { if (!map.TryGetValue(b, out var f)) { continue; } Object val3 = ((IEnumerable<Object>)clips).FirstOrDefault((Func<Object, bool>)((Object c) => c != (Object)null && c.name.ToLowerInvariant() == f.Video)); if (val3 == (Object)null) { _failed.Add(b); Logger.LogWarning((object)("[ChefsKiss] Biyom görseli: video yok: " + f.Video)); continue; } Component vp = (_vp = ((Component)_runner).gameObject.AddComponent(vpType)); bool flag = true; try { Set(vp, "playOnAwake", false); Set(vp, "source", "VideoClip"); Set(vp, "clip", val3); Set(vp, "renderMode", "RenderTexture"); Set(vp, "targetTexture", rt); Set(vp, "audioOutputMode", "None"); Set(vp, "isLooping", false); Set(vp, "skipOnDrop", false); Call(vp, "Prepare"); } catch (Exception ex) { Logger.LogWarning((object)("[ChefsKiss] Biyom görseli hazırlanamadı: " + ex.Message)); flag = false; } if (!flag) { _failed.Add(b); Object.Destroy((Object)(object)vp); _vp = null; continue; } float w = 0f; while (!Get<bool>(vp, "isPrepared") && w < 10f) { w += Time.unscaledDeltaTime; yield return null; } double num = Get<double>(vp, "length"); double t = ((num > 1.0) ? Math.Min(f.Sec, num - 0.5) : f.Sec); try { Set(vp, "time", t); Call(vp, "Play"); } catch { } w = 0f; int frames = 0; while (w < 5f) { w += Time.unscaledDeltaTime; frames++; double num2 = Get<double>(vp, "time"); if (frames >= 3 && num2 >= t - 0.05 && num2 < t + 1.5) { break; } yield return null; } try { Call(vp, "Pause"); } catch { } yield return null; yield return null; try { RenderTexture active = RenderTexture.active; RenderTexture.active = rt; full.ReadPixels(new Rect(0f, 0f, 640f, 360f), 0, 0); full.Apply(); RenderTexture.active = active; _sprites[b] = MakeSprite(full, f.Y, pixel); } catch (Exception ex2) { _failed.Add(b); Logger.LogWarning((object)("[ChefsKiss] Biyom görseli okunamadı: " + ex2.Message)); } try { Call(vp, "Stop"); } catch { } Object.Destroy((Object)(object)vp); _vp = null; yield return null; if (!((Object)(object)Player.m_localPlayer == (Object)null)) { continue; } Abort(); yield break; } rt.Release(); Object.Destroy((Object)(object)rt); Object.Destroy((Object)(object)full); _rt = null; _full = null; _busy = false; Log.Info("[ChefsKiss] Biyom görselleri hazır: " + _sprites.Count); } private static Sprite MakeSprite(Texture2D src, float y, bool pixel) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) float num = 1.7777778f; int width = ((Texture)src).width; int height = ((Texture)src).height; int num2 = 0; int num3 = (pixel ? 112 : 320); int num4 = Mathf.Max(8, Mathf.RoundToInt((float)num3 / num)); Texture2D val = new Texture2D(num3, num4, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[num3 * num4]; for (int i = 0; i < num4; i++) { for (int j = 0; j < num3; j++) { if (pixel) { int num5 = j * width / num3; int num6 = Mathf.Max(num5 + 1, (j + 1) * width / num3); int num7 = num2 + i * height / num4; int num8 = Mathf.Max(num7 + 1, num2 + (i + 1) * height / num4); Color val2 = Color.black; int num9 = 0; for (int k = num7; k < num8; k += 2) { for (int l = num5; l < num6; l += 2) { val2 += src.GetPixel(l, k); num9++; } } array[i * num3 + j] = ((num9 > 0) ? (val2 / (float)num9) : Color.black); } else { array[i * num3 + j] = src.GetPixelBilinear(((float)j + 0.5f) / (float)num3, ((float)num2 + ((float)i + 0.5f) * (float)height / (float)num4) / (float)((Texture)src).height); } array[i * num3 + j].a = 1f; } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)(!pixel); ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num3, (float)num4), new Vector2(0.5f, 0.5f)); } } public class BiomeArtSlot : MonoBehaviour { public Biome Biome; public Image Art; public Text Label; private Color _labelColor; private bool _hasColor; private void ShowLabel(bool on) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) if (!((Object)(object)Label == (Object)null)) { if (!_hasColor) { _labelColor = ((Graphic)Label).color; _hasColor = true; } ((Graphic)Label).color = (Color)(on ? _labelColor : new Color(_labelColor.r, _labelColor.g, _labelColor.b, 0f)); } } private void Update() { if ((Object)(object)Art == (Object)null) { ((Behaviour)this).enabled = false; return; } Sprite val = BiomeArt.Get(Biome); if ((Object)(object)val == (Object)null) { if (((Behaviour)Art).enabled) { ((Behaviour)Art).enabled = false; ShowLabel(on: true); } return; } if ((Object)(object)Art.sprite != (Object)(object)val) { Art.sprite = val; } if (!((Behaviour)Art).enabled) { ((Behaviour)Art).enabled = true; ShowLabel(on: false); } } } [DefaultExecutionOrder(30000)] public class BlowFireController : MonoBehaviour { private struct BlowRig { public float Stand; public CamRig Cam; } private const float PuffPower = 0.075f; private const float PuffCooldown = 0.16f; private const float HeatMin = 0.12f; private const float HeatIdeal = 0.4f; private const float AboveCookFactor = 0.6f; private const float PerfectBurn = 0.25f; private const float FlareBoost = 0.35f; private const float FlareRise = 1.4f; private const float StandFromStation = 1.1f; private static readonly CamRig SitRig = new CamRig(0.9f, 1.3f, 1.65f); private const float CamBlendTime = 0.6f; private const float SitRetry = 0.5f; private const int SitRetryMax = 4; private const float FireMin = 0.55f; private const float FireMax = 1.6f; internal const int BreathCount = 24; internal const float BreathSpeed = 1.9f; internal static readonly Color BreathColor = new Color(0.95f, 0.95f, 0.93f, 0.8f); private const float PuffGlow = 0.6f; private const float FireClickRadius = 150f; private const float RingAlpha = 0.45f; private const float RingScale = 0.8f; private const float SmokeEvery = 0.35f; private static readonly Color SparkColor = new Color(1f, 0.72f, 0.3f, 1f); private static readonly Color SmokeColor = new Color(0.45f, 0.43f, 0.4f, 0.45f); internal static readonly Color BrownColor = new Color(0.45f, 0.26f, 0.12f, 1f); internal static readonly Color CharColor = new Color(0.16f, 0.12f, 0.1f, 1f); private const float DemoPuffEvery = 0.5f; private static BlowFireController _instance; private CookingStation _station; private Player _player; private List<ItemConversion> _recipes; private ItemConversion _recipe; private Fireplace _fire; private GameObject _canvasRoot; private RectTransform _canvasRT; private CraftingMenu _menu; private GameObject _gameRoot; private RectTransform _cookFill; private RectTransform _burnFill; private RectTransform _barRoot; private RectTransform _fireRing; private Image _fireRingImg; private Image _cookImg; private Image _burnIcon; private Image[] _flames; private const float BurnBarH = 10f; private const float BurnBarY = -16f; private const int FlameCount = 8; private bool _overFire; private float _glow; private Text _statusText; private CountdownOverlay _countdown; private WorldView _view; private bool _sat; private float _sitCheckT; private int _sitRetries; private int _slot = -1; private readonly List<int> _slots = new List<int>(); private int _claim; private bool _rawTaken; private bool _started; private bool _finishing; private bool _inputBlocked; private bool _cleaned; private bool _failed; private float _heat; private float _cook; private float _burn; private float _time; private float _inBand; private float _flareT; private float _nextFlare; private float _flareLeft; private float _lastPuff; private float _demoT; private float _smokeT; private int _puffs; private ParticleSystem _breath; private ParticleSystem _sparks; private readonly List<ParticleSystem> _fireSystems = new List<ParticleSystem>(); private readonly List<float> _fireSize = new List<float>(); private readonly List<float> _fireRate = new List<float>(); private readonly List<Light> _fireLights = new List<Light>(); private readonly List<float> _lightIntensity = new List<float>(); private MaterialPropertyBlock _mpb; private string _emote = "sit"; private const float KneelBack = 0.35f; private Transform[] _leanBones; private float _leanW; private float _puffKick; private static readonly float[] LeanAngles = new float[4] { 8f, 10f, 10f, 14f }; private static readonly float[] KickAngles = new float[4] { 0f, 3f, 8f, 10f }; private const float LeanFadeIn = 0.8f; private const float KickTime = 0.28f; private const float HeadYawMax = 40f; private int _poseMode = -1; private Quaternion[] _leanBase; private Quaternion[] _leanWritten; private CapeGuard _cape; private bool[] _leanHas; private static Texture2D _dotTex; private GhostHand _ghostHand; private float _ghostPress; private static float Decay => Easy.F(Tier.Speed(0.2f), 0.02f); private static float BandHalf => Easy.F(Tier.Tol(0.11f), 0.45f); private static float CookTime => Easy.F(7f, 1.5f); private static float BurnRate => Easy.F(0.8f, 0f); private static float TimeLimit => Easy.F(Tier.Time(25f), 120f); private static float FlareEvery => Easy.F(Tier.Time(3.5f), 9999f); internal static bool IsOpen => (Object)(object)_instance != (Object)null; private Vector3 MeatPos { get { //IL_0037: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_station != (Object)null) || _slot < 0 || _slot >= _station.m_slots.Length) { return ((Component)_station).transform.position + Vector3.up; } return _station.m_slots[_slot].position; } } private Vector3 FirePos { get { //IL_0034: 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_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) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_fire != (Object)null)) { return MeatPos - Vector3.up * 0.6f; } return ((Component)_fire).transform.position + Vector3.up * 0.25f; } } private string Pose { get { if (Plugin.BlowPose == null) { return "DizCokEgil"; } return Plugin.BlowPose.Value; } } private float LeanScale { get { if (Plugin.BlowLean == null) { return 1f; } return Plugin.BlowLean.Value; } } private bool PoseInUpdate { get { if (_poseMode < 0 && (Object)(object)_player != (Object)null) { Animator componentInChildren = ((Component)_player).GetComponentInChildren<Animator>(); _poseMode = (PlayerAnim.UpdatesInPhysics(componentInChildren) ? 1 : 0); Log.Info("[ChefsKiss] Üfleme eğilmesi: " + ((_poseMode == 1) ? "Update" : "LateUpdate")); } return _poseMode == 1; } } public static void Show(CookingStation station, Player player, List<ItemConversion> recipes) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance != (Object)null) { Object.Destroy((Object)(object)((Component)_instance).gameObject); } _instance = new GameObject("CookingQTE_BlowFire").AddComponent<BlowFireController>(); _instance.Init(station, player, recipes); } private void Init(CookingStation station, Player player, List<ItemConversion> recipes) { _station = station; _claim = NetSync.Claim((Component)(object)station); _player = player; _recipes = recipes; _fire = CauldronScene.FindNearbyFire((Component)(object)station); GUIManager.BlockInput(true); _inputBlocked = true; BuildCanvas(); BuildMenu(); } private void BuildCanvas() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0088: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) _canvasRoot = new GameObject("Canvas", new Type[1] { typeof(RectTransform) }); _canvasRoot.transform.SetParent(((Component)this).transform, false); _canvasRT = (RectTransform)_canvasRoot.transform; Canvas obj = _canvasRoot.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 500; CanvasScaler obj2 = _canvasRoot.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); _canvasRoot.AddComponent<GraphicRaycaster>(); if ((Object)(object)EventSystem.current == (Object)null) { GameObject val = new GameObject("CookingQTE_EventSystem"); val.transform.SetParent(((Component)this).transform, false); val.AddComponent<EventSystem>(); val.AddComponent<StandaloneInputModule>(); } } private void BuildMenu() { List<CraftingMenuEntry> list = new List<CraftingMenuEntry>(); int num = Mathf.Min(FreeSlots(_station).Count, (Plugin.StationBatch != null) ? Plugin.StationBatch.Value : 5); foreach (ItemConversion recipe in _recipes) { int num2 = IngredientSource.Available(_player, recipe.m_from, 1); int num3 = ((num <= 0) ? 1 : (Easy.NoCost ? num : IngredientSource.MaxBatch(_player, recipe.m_from, num))); CraftingMenuEntry craftingMenuEntry = new CraftingMenuEntry { Name = Localization.instance.Localize(recipe.m_to.m_itemData.m_shared.m_name), Icon = UIFactory.GetItemIcon(recipe.m_to), Enabled = (num2 >= 1 || Easy.NoCost), Result = recipe.m_to, Difficulty = Tier.ColoredLabel(Tier.ForItemOrDefault(recipe.m_from)), Tag = recipe }; craftingMenuEntry.MaxBatch = Mathf.Max(1, num3); craftingMenuEntry.Requirements.Add(new CraftingRequirement { Item = recipe.m_from, Need = 1, Have = Mathf.Max(num2, num3) }); list.Add(craftingMenuEntry); } Piece component = ((Component)_station).GetComponent<Piece>(); _menu = CraftingMenu.Create(_canvasRoot.transform, Localization.instance.Localize(_station.m_name), null, L.T("menu.cook"), list, ((Object)(object)component != (Object)null) ? component.m_icon : null); _menu.OnCraft = delegate(CraftingMenuEntry e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown try { OnRecipeChosen((ItemConversion)e.Tag, (_menu == null) ? 1 : _menu.Quantity); } catch (Exception e2) { Fail(e2); } }; _menu.OnCancel = Close; _menu.Root.SetActive(false); ((MonoBehaviour)this).StartCoroutine(Safety.Guard(PlaceMenuNextFrame(), Fail)); } private IEnumerator PlaceMenuNextFrame() { yield return null; if (_menu != null && !((Object)(object)_menu.Root == (Object)null)) { _menu.Place(_canvasRT); _menu.Root.SetActive(true); } } private void OnRecipeChosen(ItemConversion recipe, int quantity) { if (((Humanoid)_player).GetInventory().GetItem(recipe.m_from.m_itemData.m_shared.m_name, -1, false) == null && !IngredientSource.Has((Humanoid)(object)_player, recipe.m_from, 1) && !Easy.NoCost) { ((Character)_player).Message((MessageType)2, "$msg_missingrequirement", 0, (Sprite)null, false); return; } List<int> list = FreeSlots(_station); if (list.Count == 0) { ((Character)_player).Message((MessageType)2, L.T("blowfire.no_free_slot_station"), 0, (Sprite)null, false); return; } int num = Mathf.Min(list.Count, Mathf.Max(1, quantity)); int num2 = (Easy.NoCost ? num : Mathf.Max(1, IngredientSource.MaxBatch(_player, recipe.m_from, num))); _slots.Clear(); for (int i = 0; i < num2 && i < list.Count; i++) { _slots.Add(list[i]); } _slot = _slots[0]; if (!Easy.NoCost && IngredientSource.Take(_player, recipe.m_from, _slots.Count)) { _rawTaken = true; Pending.Set(_player, recipe.m_from, _slots.Count); } _recipe = recipe; if (_menu != null) { _menu.Destroy(); } _menu = null; Tier.BeginItem(recipe.m_from); ApplySlotVisual(); NetSync.SetMeat(((Object)((Component)recipe.m_from).gameObject).name, _slot, SlotMask()); PlaceView(); BuildEffects(); BuildGameArea(); ResetGame(); ((MonoBehaviour)this).StartCoroutine(Safety.Guard(Run(), Fail)); } internal static List<int> FreeSlots(CookingStation st) { List<int> list = new List<int>(); try { ZNetView value = Traverse.Create((object)st).Field("m_nview").GetValue<ZNetView>(); ZDO val = (((Object)(object)value != (Object)null && value.IsValid()) ? value.GetZDO() : null); if (val != null) { for (int i = 0; i < st.m_slots.Length; i++) { if (val.GetString("slot" + i, "") == "") { list.Add(i); } } return list; } } catch { } int freeSlot = st.GetFreeSlot(); if (freeSlot >= 0) { list.Add(freeSlot); } return list; } private int SlotMask() { int num = 0; foreach (int slot in _slots) { num |= 1 << slot; } return num; } private void PlaceView() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_007f: 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) _view = WorldView.Create(_player); SitDown(); Vector3 look = Vector3.Lerp(MeatPos, FirePos, 0.35f); BlowRig blowRig = ReadCamRig(); float standDistance = blowRig.Stand + ((Pose == "DizCokEgil") ? 0.35f : 0f); _view.PlaceAt(((Component)_station).transform.position, standDistance, look, blowRig.Cam, blowRig.Cam, FrontAxis(), 1, (Component)_station, (Component)_fire); _view.SetAnimation(0); NetSync.Begin(1, FirePos, (Pose == "Oturma") ? 0f : LeanScale); } private Vector3 FrontAxis() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_007c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)_station).transform.right; Transform[] slots = _station.m_slots; if (slots != null && slots.Length >= 2 && (Object)(object)slots[0] != (Object)null && (Object)(object)slots[^1] != (Object)null) { Vector3 val2 = slots[^1].position - slots[0].position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { val = ((Vector3)(ref val2)).normalized; } } val.y = 0f; Vector3 val3 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); Vector3 val4 = ((Component)_player).transform.position - ((Component)_station).transform.position; val4.y = 0f; if (Vector3.Dot(val3, val4) < 0f) { val3 = -val3; } return val3; } private static BlowRig ReadCamRig() { BlowRig result = new BlowRig { Stand = 1.1f, Cam = SitRig }; string text = ((Plugin.StationCamera != null) ? Plugin.StationCamera.Value : ""); if (string.IsNullOrEmpty(text)) { return result; } string[] array = text.Split(new char[2] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries); CultureInfo invariantCulture = CultureInfo.InvariantCulture; if (array.Length >= 4 && float.TryParse(array[0].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result2) && float.TryParse(array[1].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result3) && float.TryParse(array[2].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result4) && float.TryParse(array[3].Replace(',', '.'), NumberStyles.Float, invariantCulture, out var result5)) { result.Stand = Mathf.Clamp(result2, 0.6f, 3f); result.Cam = new CamRig(result3, result4, result5); } return result; } private bool Posed() { if (_emote == "sit") { return PlayerAnim.IsSitting(_player); } try { MethodInfo methodInfo = AccessTools.Method(((object)_player).GetType(), "InEmote", (Type[])null, (Type[])null); return methodInfo != null && methodInfo.GetParameters().Length == 0 && (bool)methodInfo.Invoke(_player, null); } catch { return false; } } private void SitDown() { if (!((Object)(object)_player == (Object)null) && !_sat) { _emote = ((Pose == "DizCokEgil") ? "kneel" : "sit"); if (!Posed()) { PlayerAnim.Call(_player, "StartEmote", _emote, false); } _sat = true; _sitCheckT = 0.5f; _sitRetries = 0; } } private void KeepSitting(float dt) { if (!_sat || (Object)(object)_player == (Object)null) { return; } if (_sitRetries >= 4) { if (_emote == "kneel") { Log.Info("[ChefsKiss] Üflemede diz çökme hareketi tutmadı, oturuluyor"); _emote = "sit"; _sitRetries = 0; } return; } _sitCheckT -= dt; if (!(_sitCheckT > 0f)) { _sitCheckT = 0.5f; if (!Posed()) { _sitRetries++; PlayerAnim.Call(_player, "StartEmote", _emote, false); } } } private void FindLeanBones() { if (_leanBones != null || (Object)(object)_player == (Object)null) { return; } _leanBones = (Transform[])(object)new Transform[4]; Animator componentInChildren = ((Component)_player).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.isHuman) { _leanBones[0] = componentInChildren.GetBoneTransform((HumanBodyBones)7); _leanBones[1] = componentInChildren.GetBoneTransform((HumanBodyBones)8); _leanBones[2] = componentInChildren.GetBoneTransform((HumanBodyBones)9); _leanBones[3] = componentInChildren.GetBoneTransform((HumanBodyBones)10); } string[] array = new string[4] { "Spine", "Spine1", "Neck", "Head" }; Transform[] componentsInChildren; for (int i = 0; i < 4; i++) { if (!((Object)(object)_leanBones[i] == (Object)null)) { continue; } componentsInChildren = ((Component)_player).GetComponentsInChildren<Transform>(); foreach (Transform val in componentsInChildren) { if (((Object)val).name == array[i]) { _leanBones[i] = val; break; } } } int num = 0; componentsInChildren = _leanBones; for (int j = 0; j < componentsInChildren.Length; j++) { if ((Object)(object)componentsInChildren[j] != (Object)null) { num++; } } Log.Info("[ChefsKiss] Üfleme eğilmesi: " + num + "/4 kemik bulundu"); } private void LateUpdate() { if (!PoseInUpdate) { LeanSafe(); } } private void LeanSafe() { try { ApplyLean(); } catch (Exception ex) { Logger.LogWarning((object)("[ChefsKiss] Eğilme kapandı: " + ex.Message)); _leanBones = (Transform[])(object)new Transform[4]; } } private void ApplyLean() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) if (_cleaned || _recipe == null || (Object)(object)_player == (Object)null || !_sat || Pose == "Oturma") { return; } FindLeanBones(); if (_cape == null) { _cape = new CapeGuard((Character)(object)_player); } _cape.Tick(); float deltaTime = Time.deltaTime; _leanW = Mathf.MoveTowards(_leanW, 1f, deltaTime / 0.8f); _puffKick = Mathf.Max(0f, _puffKick - deltaTime / 0.28f); float num = Mathf.Sin(_puffKick * (float)Math.PI); Vector3 right = ((Component)_player).transform.right; Vector3 val = FirePos - ((Component)_player).transform.position; val.y = 0f; float num2 = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? Mathf.Clamp(Vector3.SignedAngle(((Component)_player).transform.forward, val, Vector3.up), -40f, 40f) : 0f); float num3 = _leanW * LeanScale; if (_leanBase == null) { _leanBase = (Quaternion[])(object)new Quaternion[4]; _leanWritten = (Quaternion[])(object)new Quaternion[4]; _leanHas = new bool[4]; } for (int i = 0; i < 4; i++) { Transform val2 = _leanBones[i]; if (!((Object)(object)val2 == (Object)null)) { if (_leanHas[i] && SameRot(val2.localRotation, _leanWritten[i])) { val2.localRotation = _leanBase[i]; } _leanBase[i] = val2.localRotation; } } for (int j = 0; j < 4; j++) { Transform val3 = _leanBones[j]; if (!((Object)(object)val3 == (Object)null)) { float num4 = (LeanAngles[j] + KickAngles[j] * num) * num3; val3.rotation = Quaternion.AngleAxis(num4, right) * val3.rotation; if (j >= 2) { val3.rotation = Quaternion.AngleAxis(num2 * 0.5f * num3, Vector3.up) * val3.rotation; } } } for (int k = 0; k < 4; k++) { Transform val4 = _leanBones[k]; if (!((Object)(object)val4 == (Object)null)) { _leanWritten[k] = val4.localRotation; _leanHas[k] = true; } } } private static bool SameRot(Quaternion a, Quaternion b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Mathf.Abs(Quaternion.Dot(a, b)) > 0.999999f; } private void LetGo() { try { StandUp(); } catch { } try { if (_cape != null) { _cape.Undo(); } } catch { } if ((Object)(object)_view != (Object)null) { try { _view.Release(); } catch { } _view = null; } try { NetSync.End(); } catch { } if (_inputBlocked) { Safety.ReleaseInput(); _inputBlocked = false; } } private void StandUp() { if (_sat) { _sat = false; if ((Object)(object)_player != (Object)null) { PlayerAnim.Call(_player, "StopEmote"); } } } private void ApplySlotVisual() { if ((Object)(object)_station == (Object)null || _slot < 0 || _recipe == null) { return; } foreach (int slot in _slots) { _station.SetSlotVisual(slot, ((Object)((Component)_recipe.m_from).gameObject).name, true, (Status)0); } } private void TintMeat() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_004b: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_002b: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_station == (Object)null || _slot < 0) { return; } if (_mpb == null) { _mpb = new MaterialPropertyBlock(); } Color val = Color.Lerp(Color.white, BrownColor, Mathf.Clamp01(_cook) * 0.75f); val = Color.Lerp(val, CharColor, Mathf.Clamp01(_burn) * 0.85f); foreach (int slot in _slots) { Renderer[] componentsInChildren = ((Component)_station.m_slots[slot]).GetComponentsInChildren<Renderer>(); foreach (Renderer val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && !(val2 is ParticleSystemRenderer)) { val2.GetPropertyBlock(_mpb); _mpb.SetColor("_Color", val); val2.SetPropertyBlock(_mpb); } } } } private void BuildEffects() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) Texture2D tex = SoftDot(); _breath = MakeParticles("CookingQTE_Breath", tex); _sparks = MakeParticles("CookingQTE_Sparks", tex); if ((Object)(object)_fire == (Object)null) { return; } ParticleSystem[] componentsInChildren = ((Component)_fire).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant(); if (!text.Contains("smoke") && !text.Contains("steam") && !text.Contains("dust")) { _fireSystems.Add(val); List<float> fireSize = _fireSize; MainModule main = val.main; fireSize.Add(((MainModule)(ref main)).startSizeMultiplier); List<float> fireRate = _fireRate; EmissionModule emission = val.emission; fireRate.Add(((EmissionModule)(ref emission)).rateOverTimeMultiplier); } } } Light[] componentsInChildren2 = ((Component)_fire).GetComponentsInChildren<Light>(true); foreach (Light val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { _fireLights.Add(val2); _lightIntensity.Add(val2.intensity); } } } private void ApplyFire() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Lerp(0.55f, 1.6f, Mathf.Clamp01(_heat)); for (int i = 0; i < _fireSystems.Count; i++) { ParticleSystem val = _fireSystems[i]; if (!((Object)(object)val == (Object)null)) { MainModule main = val.main; ((MainModule)(ref main)).startSizeMultiplier = _fireSize[i] * Mathf.Lerp(0.75f, 1.45f, Mathf.InverseLerp(0.55f, 1.6f, num)); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = _fireRate[i] * Mathf.Lerp(0.6f, 1.3f, Mathf.InverseLerp(0.55f, 1.6f, num)); } } _glow = Mathf.Max(0f, _glow - Time.deltaTime * 3f); for (int j = 0; j < _fireLights.Count; j++) { if ((Object)(object)_fireLights[j] != (Object)null) { _fireLights[j].intensity = _lightIntensity[j] * (Mathf.Lerp(0.7f, 1.5f, Mathf.Clamp01(_heat)) + _glow * 0.6f); } } } private void RestoreFire() { //IL_001b: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _fireSystems.Count; i++) { ParticleSystem val = _fireSystems[i]; if (!((Object)(object)val == (Object)null)) { MainModule main = val.main; ((MainModule)(ref main)).startSizeMultiplier = _fireSize[i]; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = _fireRate[i]; } } for (int j = 0; j < _fireLights.Count; j++) { if ((Object)(object)_fireLights[j] != (Object)null) { _fireLights[j].intensity = _lightIntensity[j]; } } _fireSystems.Clear(); _fireLights.Clear(); } internal static ParticleSystem MakeParticles(string name, Texture2D tex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_00a0: 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_00b1: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d1: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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) //IL_015d: Expected O, but got Unknown GameObject val = new GameObject(name); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 400; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = false; SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.5f, 1f, 1.6f)); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); Shader val4 = Shader.Find("Sprites/Default"); if ((Object)(object)val4 != (Object)null) { ((Renderer)component).material = new Material(val4) { mainTexture = (Texture)(object)tex }; } val2.Play(); return val2; } internal static Texture2D SoftDot() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_dotTex != (Object)null) { return _dotTex; } _dotTex = new Texture2D(16, 16, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { float num = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(8f, 8f)) / 8f; _dotTex.SetPixel(j, i, new Color(1f, 1f, 1f, (num < 0.55f) ? 1f : ((num < 0.85f) ? 0.55f : 0f))); } } _dotTex.Apply(); return _dotTex; } private void Puff(bool real) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_004d: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b9: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00cf: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_breath == (Object)null) && !((Object)(object)_player == (Object)null)) { Vector3 val = ((Component)_player).transform.position + Vector3.up * 1f; try { val = ((Character)_player).GetHeadPoint(); } catch { } Vector3 val2 = FirePos - val; Vector3 val3 = val2; val3.y = 0f; Vector3 val4 = val + ((((Vector3)(ref val3)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val3)).normalized : ((Component)_player).transform.forward) * 0.14f - Vector3.up * 0.07f; Vector3 val5 = FirePos - val4; val2 = ((Vector3)(ref val5)).normalized; for (int i = 0; i < 24; i++) { EmitParams val6 = default(EmitParams); ((EmitParams)(ref val6)).position = val4 + Random.insideUnitSphere * 0.02f; ((EmitParams)(ref val6)).velocity = (val2 + Random.insideUnitSphere * 0.18f) * 1.9f * Random.Range(0.75f, 1.2f); ((EmitParams)(ref val6)).startSize = Random.Range(0.08f, 0.14f); ((EmitParams)(ref val6)).startLifetime = Random.Range(0.5f, 0.8f); ((EmitParams)(ref val6)).startColor = Color32.op_Implicit(BreathColor); EmitParams val7 = val6; _breath.Emit(val7, 1); } if (real) { SparkBurst(3, 1f); _glow = 1f; } PlayPuffSound(real ? 1f : 0.35f); } } private bool MouseOverFire(Camera cam, out Vector2 fireUI) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0066: 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_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0054: Unknown result type (might be due to invalid IL or missing references) fireUI = new Vector2(0f, -120f); if ((Object)(object)cam == (Object)null) { return true; } Vector3 val = cam.WorldToScreenPoint(FirePos); if (val.z <= 0f) { return true; } Vector2 val2 = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(_canvasRT, Vector2.op_Implicit(val), (Camera)null, ref val2)) { fireUI = val2; } float num = (float)Screen.width / 1920f; Vector2 val3 = Vector2.op_Implicit(Input.mousePosition) - Vector2.op_Implicit(val); val3.y *= 2f; return ((Vector2)(ref val3)).magnitude <= 150f * num; } private void PlayPuffSound(float volume) { Sfx.Play(SfxKind.Puff, volume, 0.15f); } private void SparkBurst(int count, float power) { //IL_0018: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_00a8: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_sparks == (Object)null)) { for (int i = 0; i < count; i++) { EmitParams val = default(EmitParams); ((EmitParams)(ref val)).position = FirePos + Random.insideUnitSphere * 0.12f; ((EmitParams)(ref val)).velocity = new Vector3(Random.Range(-0.4f, 0.4f), Random.Range(0.9f, 1.8f) * power, Random.Range(-0.4f, 0.4f)); ((EmitParams)(ref val)).startSize = Random.Range(0.02f, 0.04f); ((EmitParams)(ref val)).startLifetime = Random.Range(0.4f, 0.8f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(SparkColor); EmitParams val2 = val; _sparks.Emit(val2, 1); } } } private void SmokeWisp() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_breath == (Object)null)) { EmitParams val = default(EmitParams); ((EmitParams)(ref val)).position = FirePos + Random.insideUnitSphere * 0.08f; ((EmitParams)(ref val)).velocity = new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(0.35f, 0.6f), Random.Range(-0.1f, 0.1f)); ((EmitParams)(ref val)).startSize = Random.Range(0.08f, 0.14f); ((EmitParams)(ref val)).startLifetime = Random.Range(1.2f, 1.8f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(SmokeColor); EmitParams val2 = val; _breath.Emit(val2, 1); } } private void BuildGameArea() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0080: 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_009e: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031e: 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_035c: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) _gameRoot = new GameObject("GameRoot", new Type[1] { typeof(RectTransform) }); _gameRoot.transform.SetParent(_canvasRoot.transform, false); UIFactory.CreateText(_gameRoot.transform, "<b><color=#FFA13C>" + Localization.instance.Localize(_recipe.m_to.m_itemData.m_shared.m_name) + "</color></b>", 26, (TextAnchor)4, Color.white, new Vector2(0f, 470f), new Vector2(700f, 40f)); GameObject val = UIFactory.CreateImage(_gameRoot.transform, Color.white, new Vector2(300f, 180f) * 0.8f, Vector2.zero); _fireRingImg = val.GetComponent<Image>(); _fireRingImg.sprite = OvenUIController.RingSprite; ((Graphic)_fireRingImg).raycastTarget = false; _fireRing = (RectTransform)val.transform; GameObject val2 = new GameObject("CookBar", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(_gameRoot.transform, false); _barRoot = (RectTransform)val2.transform; GameObject val3 = UIFactory.CreateImage((Transform)(object)_barRoot, UIFactory.PanelColor, new Vector2(160f, 12f), Vector2.zero); UIFactory.StyleTrack(val3); _cookFill = Left(UIFactory.CreateImage(val3.transform, new Color(0.91f, 0.77f, 0.42f, 1f), new Vector2(0f, 8f), Vector2.zero)); _cookImg = ((Component)_cookFill).GetComponent<Image>(); ((Graphic)UIFactory.CreateIcon((Transform)(object)_barRoot, UIFactory.GetItemIcon(_recipe.m_from), new Vector2(34f, 34f), new Vector2(-100f, 0f))).raycastTarget = false; GameObject val4 = UIFactory.CreateImage((Transform)(object)_barRoot, new Color(0f, 0f, 0f, 0.6f), new Vector2(160f, 10f), new Vector2(0f, -16f)); UIFactory.StyleTrack(val4); _burnFill = Left(UIFactory.CreateImage(val4.transform, new Color(0.89f, 0.34f, 0.29f, 1f), new Vector2(0f, 6f), Vector2.zero)); _burnIcon = PixelArt.Img((Transform)(object)_barRoot, PixelArt.Flame, Color.white, new Vector2(18f, 24f), new Vector2(-94f, -14f)); ((Graphic)_burnIcon).raycastTarget = false; _flames = (Image[])(object)new Image[8]; for (int i = 0; i < 8; i++) { _flames[i] = PixelArt.Img((Transform)(object)_barRoot, PixelArt.Flame, Color.white, new Vector2(12f, 16f), Vector2.zero); ((Graphic)_flames[i]).raycastTarget = false; } _statusText = UIFactory.CreateText(_gameRoot.transform, "", 40, (TextAnchor)4, Color.white, new Vector2(0f, 400f), new Vector2(700f, 60f)); _statusText.fontStyle = (FontStyle)1; UpdateUI(); } private static RectTransform Left(GameObject go) { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0035: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown RectTransform val = (RectTransform)go.transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0f, 0.5f); val.anchoredPosition = new Vector2(2f, 0f); ((Graphic)go.GetComponent<Image>()).raycastTarget = false; return val; } private void UpdateUI() { //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_009c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_gameRoot == (Object)null) { return; } Camera val = Camera.main; if ((Object)(object)val == (Object)null && (Object)(object)GameCamera.instance != (Object)null) { val = ((Component)GameCamera.instance).GetComponent<Camera>(); } Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 60f); if ((Object)(object)val != (Object)null) { Vector3 val3 = val.WorldToScreenPoint(MeatPos); Vector2 val4 = default(Vector2); if (val3.z > 0f && RectTransformUtility.ScreenPointToLocalPointInRectangle(_canvasRT, Vector2.op_Implicit(val3), (Camera)null, ref val4)) { val2 = val4; } } _barRoot.anchoredPosition = val2 + new Vector2(0f, 90f); _overFire = MouseOverFire(val, out var fireUI); _fireRing.anchoredPosition = fireUI; bool flag = !_started || _overFire; if (((Behaviour)_fireRingImg).enabled != flag) { ((Behaviour)_fireRingImg).enabled = flag; } float num = 0.8f + 0.2f * Mathf.Sin(Time.unscaledTime * 4f); ((Graphic)_fireRingImg).color = new Color(1f, 0.9f, 0.6f, (_started ? 0.45f : 0.315f) * num); float num2 = 0.4f - BandHalf; float num3 = 0.4f + BandHalf; if (_heat > num3) { ((Graphic)_cookImg).color = Color.Lerp(new Color(0.95f, 0.45f, 0.2f), new Color(1f, 0.2f, 0.15f), 0.5f + 0.5f * Mathf.Sin(Time.time * 18f)); } else if (_heat >= num2) { ((Graphic)_cookImg).color = Color.Lerp(new Color(0.91f, 0.77f, 0.42f), new Color(1f, 0.95f, 0.6f), 0.5f + 0.5f * Mathf.Sin(Time.time * 6f)); } else { ((Graphic)_cookImg).color = new Color(0.55f, 0.5f, 0.42f); } _cookFill.sizeDelta = new Vector2(156f * Mathf.Clamp01(_cook), 8f); _burnFill.sizeDelta = new Vector2(156f * Mathf.Clamp01(_burn), 6f); float num4 = Mathf.Clamp01(_burn); for (int i = 0; i < _flames.Length; i++) { float num5 = ((float)i + 0.5f) / (float)_flames.Length; bool flag2 = num4 > 0.001f && num5 <= num4 + 0.5f / (float)_flames.Length; Image val5 = _flames[i]; ((Component)val5).gameObject.SetActive(flag2); if (flag2) { float num6 = Mathf.Sin(Time.time * 17f + (float)i * 2.3f); float num7 = (0.8f + 0.5f * num4) * (1f + 0.18f * num6); ((Graphic)val5).rectTransform.anchoredPosition = new Vector2(-78f + 156f * num5, -11f + 7f * num7); ((Transform)((Graphic)val5).rectTransform).localScale = new Vector3(1f + 0.1f * num6, num7, 1f); } } ((Graphic)_burnIcon).color = Color.Lerp(new Color(1f, 1f, 1f, 0.45f), Color.white, (num4 > 0.001f) ? (0.6f + 0.4f * Mathf.Abs(Mathf.Sin(Time.time * 8f))) : 0f); } private void ResetGame() { _heat = 0.3f; _cook = (_burn = (_time = (_inBand = (_flareT = (_flareLeft = 0f))))); _puffs = 0; _lastPuff = -10f; ScheduleFlare(); } private void ScheduleFlare() { _nextFlare = FlareEvery * Random.Range(0.6f, 1.4f); } private IEnumerator Run() { yield return (object)new WaitForSeconds(0.6f); _countdown = new CountdownOverlay(_canvasRoot.transform, Vector2.zero); yield return _countdown.Run(3); ResetGame(); _started = true; } private void TickGame(float dt) { _time += dt; if (Input.GetMouseButtonDown(0) && _overFire && _time - _lastPuff >= 0.16f) { _lastPuff = _time; _heat = Mathf.Min(1f, _heat + 0.075f); _puffs++; Puff(real: true); _puffKick = 1f; NetSync.Pulse(); } _heat = Mathf.Max(0.12f, _heat - Decay * dt); _flareT += dt; if (_flareT >= _nextFlare) { _flareT = 0f; _flareLeft = 0.35f; ScheduleFlare(); SparkBurst(14, 1.6f); } if (_flareLeft > 0f) { float num = Mathf.Min(_flareLeft, 1.4f * dt); _heat = Mathf.Min(1f, _heat + num); _flareLeft -= num; } float num2 = 0.4f - BandHalf; float num3 = 0.4f + BandHalf; if (_heat >= num2 && _heat <= num3) { _cook += dt / CookTime; _inBand += dt; Sfx.Play(SfxKind.Sizzle, 0.3f); } else if (_heat > num3) { _cook += dt / CookTime * 0.6f; _burn += (_heat - num3) / Mathf.Max(0.01f, 1f - num3) * BurnRate * dt; Sfx.Play(SfxKind.Sizzle, 0.7f); } else { _smokeT -= dt; if (_smokeT <= 0f) { _smokeT = 0.35f; SmokeWisp(); } } if (_burn >= 1f) { Finish(MinigameResult.Burnt, raw: false); } else if (_cook >= 1f) { Finish((_burn < 0.25f) ? MinigameResult.Perfect : MinigameResult.Success, raw: false); } else if (_time >= TimeLimit) { Finish(MinigameResult.Burnt, raw: true); } } private void DemoTick(float dt) { //IL_008d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown _demoT -= dt; _ghostPress -= dt; if (_demoT <= 0f) { _demoT = 0.5f; Puff(real: false); _ghostPress = 0.14f; } if (GhostHand.Enabled && (Object)(object)_fireRing != (Object)null) { if (_ghostHand == null) { _ghostHand = new GhostHand(_canvasRoot.transform); } _ghostHand.Set((RectTransform)_gameRoot.transform, _fireRing.anchoredPosition + new Vector2(10f, 6f), _ghostPress > 0f); _ghostHand.SetHint(L.T("blowfire.blow_fire")); } _heat = Mathf.Lerp(_heat, 0.4f + Mathf.Sin(Time.time * 2f) * BandHalf * 0.5f, Mathf.Clamp01(dt * 2f)); } private void Finish(MinigameResult result, bool raw) { if (!_finishing) { _finishing = true; Pending.Clear(_player); ((MonoBehaviour)this).StartCoroutine(Safety.Guard(FinishRoutine(result, raw), Fail)); } } private IEnumerator FinishRoutine(MinigameResult result, bool raw) { LetGo(); Biome b = Biomes.OfItem(_recipe.m_from); Sprite itemIcon = UIFactory.GetItemIcon(_recipe.m_from); if (_countdown != null) { _countdown.Hide(); } _gameRoot.SetActive(false); bool flag = !raw && result == MinigameResult.Burnt && Mastery.NoBurn(b); if (raw || flag) { ResultShowcase.Show(itemIcon, raw ? L.T("blowfire.undercooked_ingredients_refunded") : L.T("blowfire.not_burned_ingredients_refunded"), ShowcaseTier.Refund, (Color?)new Color(1f, 1f, 1f, 0.5f)); if (flag) { Mastery.TellSaved(b); } RefundRaw(); yield return (object)new WaitForSeconds(1.4f); Close(); yield break; } bool flag2 = result == MinigameResult.Perfect && Mastery.HalfBack(b); switch (result) { case MinigameResult.Perfect: ResultShowcase.Show(_recipe.m_to, CauldronRecipes.KissAmount(_slots.Count, _slots.Count), ShowcaseTier.Perfect); break; case MinigameResult.Success: ResultShowcase.Show(_recipe.m_to, _slots.Count, ShowcaseTier.Good); break; default: ResultShowcase.ShowPrefab(CookingMinigameManager.GetBurntItemName(_station), _slots.Count, ShowcaseTier.Burnt); break; } if ((Object)(object)_station != (Object)null && _slot >= 0) { Vector3 meatPos = MeatPos; if (result == MinigameResult.Burnt) { _station.m_overcookedEffect.Create(meatPos, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } else { _station.m_doneEffect.Create(meatPos, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } } if (result != MinigameResult.Burnt) { Mastery.OnCooked(b, UIFactory.GetItemIcon(_recipe.m_to), result == MinigameResult.Perfect); if (flag2) { Mastery.GiveHalfBack(_player, b, (IList<KeyValuePair<ItemDrop, int>>)new List<KeyValuePair<ItemDrop, int>> { new KeyValuePair<ItemDrop, int>(_recipe.m_from, _slots.Count) }); } ((Character)_player).RaiseSkill((SkillType)105, 1f); } yield return (object)new WaitForSeconds(1.4f); ClearSlot(); CookingMinigameManager.Instance.OnMinigameCompleteBatch(_station, new List<int>(_slots), _player, _recipe, result); _rawTaken = false; Close(); } private void RefundRaw() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!_rawTaken) { return; } _rawTaken = false; Pending.Clear(_player); string name = ((Object)((Component)_recipe.m_from).gameObject).name; ClearSlot(); if (!((Object)(object)_station != (Object)null)) { return; } foreach (int slot in _slots) { _station.SpawnItem(name, slot, ((Component)_player).transform.position, false); } } private void ClearSlot() { if ((Object)(object)_station == (Object)null || _slot < 0) { return; } foreach (int slot in _slots) { try { _station.SetSlotVisual(slot, "", false, (Status)0); } catch { } } } private void Update() { try { UpdateSafe(); } catch (Exception e) { Fail(e); return; } if (PoseInUpdate) { LeanSafe(); } } private void UpdateSafe() { if (_cleaned) { return; } if (PlayerAnim.Gone(_player)) { Close(); return; } if ((Safety.CancelPressed || Safety.TooFar(_player, (Component)(object)_station) || (_countdown != null && _countdown.TimedOut)) && !_finishing) { if (_recipe == null) { Close(); } else if (!_started) { RefundRaw(); Close(); } else { Finish(MinigameResult.Burnt, raw: false); } return; } if (_menu != null) { _menu.Tick(); } if (_recipe == null) { return; } float deltaTime = Time.deltaTime; if (!_finishing) { KeepSitting(deltaTime); ApplySlotVisual(); if (!_started && _countdown != null && _countdown.Waiting) { DemoTick(deltaTime); } else if (_ghostHand != null && _ghostHand.Visible) { _ghostHand.Hide(); } if (_started) { TickGame(deltaTime); } ApplyFire(); TintMeat(); NetSync.SetCook(_cook, _burn); UpdateUI(); } } private void Fail(Exception e) { if (_failed) { return; } _failed = true; Safety.LogError("Ocakta üfleme", e); try { RefundRaw(); } catch { } try { Close(); } catch { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Close() { Cleanup(); Object.Destroy((Object)(object)((Component)this).gameObject); } private void Cleanup() { if (_cleaned) { return; } _cleaned = true; ((MonoBehaviour)this).StopAllCoroutines(); try { if (_rawTaken) { RefundRaw(); } } catch { } try { ClearSlot(); } catch { } try { RestoreFire(); } catch { } if ((Object)(object)_breath != (Object)null) { Object.Destroy((Object)(object)((Component)_breath).gameObject, 2f); } if ((Object)(object)_sparks != (Object)null) { Object.Destroy((Object)(object)((Component)_sparks).gameObject, 2f); } _breath = (_sparks = null); if (_menu != null) { _menu.Destroy(); } _menu = null; if ((Object)(object)_canvasRoot != (Object)null) { Object.Destroy((Object)(object)_canvasRoot); } try { NetSync.End(); NetSync.Release(_claim); } catch { } try { StandUp(); } catch { } try { if (_cape != null) { _cape.Undo(); } } catch { } if ((Object)(object)_view != (Object)null) { _view.Release(); } _view = null; if (_inputBlocked) { Safety.ReleaseInput(); _inputBlocked = false; } } private void OnDestroy() { Cleanup(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } public class CauldronAssembleStep : IMinigameStep, IGhostDemo { private class TrayItem { public CauldronStepDef Def; public bool InPot; public float Shake; public RectTransform Rect; public Vector2 Home; public float HoverK = 1f; public StudioProp Prop; public Vector3 HomeCenter; public Vector3 BaseScale; public bool Returning; public float ReturnT; } private class Faller { public StudioProp Prop; public RectTransform Icon; public Vector3 From; public Vector3 To; public Vector2 From2; public Vector2 To2; public float T; public Quaternion Rot0; public Vector3 Scale0; public Sprite BurstIcon; } private class Drop { public RectTransform Rect; public Image Img; public Vector2 Vel; public float Life; public float MaxLife; } private const int MaxMistakes = 1; private const float CameraPitch = 70f; private const float RingOuter = 1.5f; private const float ViewMargin = 1.25f; private const float CameraBlend = 0.6f; private const float DropZoneScale = 1.35f; private const float FallTime = 0.4f; private const float TrayLengthFactor = 3f; private const float TrayLift = 0.9f; private const int TrayMaxRows = 3; private const float CarrotBoost = 1.6f; private const float BarleyBoost = 1.9f; private const float ItemFill = 0.7f; private const float DragLift = 0.9f; private const float ReturnSpeed = 12f; private const float AreaSize = 380f; private const float AreaSize3DTray = 420f; private const float AreaY = 0f; private const float TrayX = -440f; private const float TrayY = -110f; private const float IconSize = 64f; private const float StripIcon = 38f; private static readonly Color SplashColor = new Color(0.78f, 0.58f, 0.22f, 1f); private const float HoverScale = 1.35f; private const float HoverSpeed = 14f; private const float HoverLabelGap = 14f; private static Sprite _discSprite; private readonly Studio _studio; private readonly CauldronScene _scene; private readonly List<CauldronStepDef> _order; private readonly Sprite _cauldron2D; private bool _use3D; private bool _tray3D; private float _areaSize = 380f; private Vector3 _mouth; private float _potRadius; private StudioProp _trayProp; private Bounds _trayBounds; private readonly List<Renderer> _hiddenAbove = new List<Renderer>(); private GameObject _root; private RectTransform _rootRT; private ResultMarks _marks; private Image _dropZone; private Vector2 _center; private float _ax = 100f; private float _by = 100f; private readonly List<TrayItem> _tray = new List<TrayItem>(); private readonly List<Image> _stripSlots = new List<Image>(); private readonly List<Text> _stripMarks = new List<Text>(); private readonly List<Faller> _fallers = new List<Faller>(); private readonly List<Drop> _drops = new List<Drop>(); private Text _info; private Text _message; private Text _hoverLabel; private HudBar _clock; private TrayItem _hover; private bool _running; private bool _finished; private bool _success; private int _next; private int _mistakes; private float _score; private float _timeLeft = TimeLimit; private float _lastLeft = TimeLimit; private float _messageT; private float _shakeT; private float _endDelay = -1f; private TrayItem _drag; private Vector2 _mouse; private TrayItem _ghostItem; private static float TimeLimit => Easy.F(Tier.Time(12f), 120f); private static float GoldPace => Tier.Time(2.2f); private float StripY => 0f - _areaSize / 2f - 22f; public bool IsFinished => _finished; public bool Succeeded { get { if (_finished) { return _success; } return false; } } public float Points => _score; public float MaxPoints => _order.Count; private static Sprite DiscSprite { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_discSprite != (Object)null) { return _discSprite; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; float num = 32f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num)); val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(num - num2))); } } val.Apply(); _discSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); return _discSprite; } } public CauldronAssembleStep(List<CauldronStepDef> order, Studio studio, CauldronScene scene, Sprite cauldron2D) { _order = order ?? new List<CauldronStepDef>(); _studio = studio; _scene = scene; _cauldron2D = cauldron2D; } public void Build(Transform parent) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_0292: 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_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) _root = new GameObject("CauldronAssembleStep", new Type[1] { typeof(RectTransform) }); _root.transform.SetParent(parent, false); _rootRT = (RectTransform)_root.transform; List<CauldronStepDef> list = new List<CauldronStepDef>(_order); for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); CauldronStepDef value = list[num]; list[num] = list[index]; list[index] = value; } _use3D = _studio != null && _scene != null; if (_use3D) { _scene.SetVisible(visible: true); _mouth = _scene.MouthCenter; _potRadius = Mathf.Max(0.05f, _scene.MouthRadius); _tray3D = Setup3DTray(list); _areaSize = (_tray3D ? 420f : 380f); _studio.SetArea(new Vector2(_areaSize, _areaSize), new Vector2(0f, 0f)); _studio.SetShot(_tray3D ? MakeTrayShot() : MakePotShot(), 0.6f); _studio.Show(); HideAboveMouth(); UpdateEllipse(); } else { ((Graphic)UIFactory.CreateIcon(_root.transform, _cauldron2D, new Vector2(380f, 380f), new Vector2(0f, 0f))).raycastTarget = false; _center = new Vector2(0f, 0f); _ax = (_by = 114.00001f); } GameObject val = UIFactory.CreateImage(_root.transform, new Color(1f, 1f, 1f, 0.08f), new Vector2(_ax * 2f * 1.35f, _by * 2f * 1.35f), _center); _dropZone = val.GetComponent<Image>(); _dropZone.sprite = DiscSprite; ((Graphic)_dropZone).raycastTarget = false; if (_tray3D) { Vector2 val2 = _studio.WorldToUI(new Vector3(((Bounds)(ref _trayBounds)).center.x, ((Bounds)(ref _trayBounds)).max.y, ((Bounds)(ref _trayBounds)).max.z)); UIFactory.CreateText(_root.transform, L.T("cauldronassemble.prepared_ingredients"), 16, (TextAnchor)4, new Color(1f, 1f, 1f, 0.85f), val2 + new Vector2(0f, 22f), new Vector2(240f, 24f)); } else { Build2DTray(list); } float num2 = (float)_order.Count * 50f - 12f; for (int i = 0; i < _order.Count; i++) { float num3 = (0f - num2) / 2f + 19f + (float)i * 50f; UIFactory.StyleSlot(UIFactory.CreateImage(_root.transform, new Color(0f, 0f, 0f, 0.45f), new Vector2(44f, 44f), new Vector2(num3, StripY))); Image item = UIFactory.CreateIcon(_root.transform, null, new Vector2(38f, 38f), new Vector2(num3, StripY)); _stripSlots.Add(item); _stripMarks.Add(UIFactory.CreateText(_root.transform, "", 16, (TextAnchor)4, new Color(1f, 1f, 1f, 0.6f), new Vector2(num3, StripY), new Vector2(48f, 24f))); } _info = UIFactory.CreateText(_root.transform, "", 20, (TextAnchor)4, Color.white, new Vector2(0f, StripY - 33f), new Vector2(480f, 30f)); _clock = new HudBar(_root.transform, new Vector2(0f, 0f + _areaSize / 2f + 18f), 300f, 12f, HudBar.GoodFill).AddClock(); _message = UIFactory.CreateText(_root.transform, "", 22, (TextAnchor)4, Color.white, new Vector2(0f, 0f + _areaSize / 2f - 20f), new Vector2(480f, 30f)); _message.fontStyle = (FontStyle)1; EnsureHoverLabel(); UpdateInfo(); } private void Build2DTray(List<CauldronStepDef> shuffled) { //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_003d: 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_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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) UIFactory.AddOutline(UIFactory.CreateImage(_root.transform, new Color(0.42f, 0.3f, 0.18f, 0.85f), new Vector2(280f, 190f), new Vector2(-440f, -110f)), UIFactory.BorderColor); UIFactory.CreateText(_root.transform, L.T("cauldronassemble.prepared_ingredients"), 16, (TextAnchor)4, new Color(1f, 1f, 1f, 0.8f), new Vector2(-440f, -30f), new Vector2(260f, 24f)); int num = Mathf.Min(3, Mathf.Max(1, shuffled.Count)); for (int i = 0; i < shuffled.Count; i++) { int num2 = i / num; int num3 = i % num; int num4 = Mathf.Min(num, shuffled.Count - num2 * num); float num5 = -440f + ((float)num3 - (float)(num4 - 1) * 0.5f) * 80f; float num6 = -80f - (float)num2 * 78f; Image val = UIFactory.CreateIcon(_root.transform, shuffled[i].Icon, new Vector2(64f, 64f), new Vector2(num5, num6)); if ((Object)(object)shuffled[i].Icon == (Object)null) { ((Graphic)val).color = new Color(0.8f, 0.6f, 0.3f, 1f); } _tray.Add(new TrayItem { Def = shuffled[i], Rect = (RectTransform)((Component)val).transform, Home = new Vector2(num5, num6) }); } } private bool Setup3DTray(List<CauldronStepDef> shuffled) { //IL_0037: 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_0046: 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) //IL_0050: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) GameObject val = FindTrayPrefab(); if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"[ChefsKiss] Servis tepsisi bulunamadı, tepsi 2D olacak"); return false; } float size = _potRadius * 3f; _trayProp = _studio.AddPrefab(val, _studio.ToLocal(_mouth + Vector3.up * 2f), Quaternion.identity, "ServingTray"); if (_trayProp == null) { return false; } if (!LayFlatAndFit(_trayProp, size)) { return RemoveTrayAndFail(); } Bounds bounds = _trayProp.GetBounds(); if (((Bounds)(ref bounds)).size.x > ((Bounds)(ref bounds)).size.z) { _trayProp.Root.transform.rotation = Quaternion.Euler(0f, 90f, 0f) * _trayProp.Root.transform.rotation; } bounds = _trayProp.GetBounds(); Vector3 point = _mouth + new Vector3(0f - (_potRadius * 1.5f + ((Bounds)(ref bounds)).size.x * 0.5f + _potRadius * 0.2f), (0f - _potRadius) * 0.1f + _potRadius * 0.9f, 0f); SetBottomCenter(_trayProp, point); _trayBounds = _trayProp.GetBounds(); Log.Info("[ChefsKiss] Servis tepsisi stüdyoya kondu: " + ((Object)val).name); int count = shuffled.Count; int num = ((count <= 3) ? 1 : 2); int num2 = Mathf.CeilToInt((float)count / (float)num); float num3 = ((Bounds)(ref _trayBounds)).size.x / (float)num; float num4 = ((Bounds)(ref _trayBounds)).size.z / (float)num2; float num5 = ((Bounds)(ref _trayBounds)).min.y + ((Bounds)(ref _trayBounds)).size.y * 0.4f; for (int i = 0; i < count; i++) { CauldronStepDef cauldronStepDef = shuffled[i]; if ((Object)(object)cauldronStepDef.Ingredient == (Object)null) { return RemoveTrayAndFail(); } int num6 = i / num; int num7 = i % num; int num8 = Mathf.Min(num, count - num6 * num); float num9 = ((Bounds)(ref _trayBounds)).center.x + ((float)num7 - (float)(num8 - 1) * 0.5f) * num3; float num10 = ((Bounds)(ref _trayBounds)).max.z - ((float)num6 + 0.5f) * num4; StudioProp studioProp = _studio.AddPrefab(CauldronRecipes.GetModelPrefab(cauldronStepDef), _studio.ToLocal(new Vector3(num9, num5 + 1f, num10)), Quaternion.identity, "TrayItem"); if (studioProp == null || !LayFlatAndFit(studioProp, Mathf.Min(num3, num4) * 0.7f * SizeBoost(cauldronStepDef))) { if (studioProp != null) { _studio.RemoveProp(studioProp); } return RemoveTrayAndFail(); } SetBottomCenter(studioProp, new Vector3(num9, num5, num10)); List<TrayItem> tray = _tray; TrayItem obj = new TrayItem { Def = cauldronStepDef, Prop = studioProp }; Bounds bounds2 = studioProp.GetBounds(); obj.HomeCenter = ((Bounds)(ref bounds2)).center; obj.BaseScale = studioProp.Root.transform.localScale; tray.Add(obj); } return true; } private static float SizeBoost(CauldronStepDef def) { if (def == null || (Object)(object)def.Ingredient == (Object)null) {