Decompiled source of Advance GM Blocks v2.0.1

AdvanceGMBlocks.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using AdvanceGMBlocks;
using AdvanceGMBlocksPlugin.SystemMessageExtension;
using BepInEx;
using Bounce.Localization;
using Bounce.Singletons;
using Bounce.Unmanaged;
using DataModel;
using HarmonyLib;
using LordAshes;
using ModdingTales;
using Newtonsoft.Json;
using RadialUI;
using SRF;
using TMPro;
using TaleSpire.GameMaster.Blocks;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RForRotatePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("D20ArmyKnife")]
[assembly: AssemblyProduct("RForRotatePlugin")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace AdvanceGMBlocksPlugin.SystemMessageExtension
{
	public static class SystemMessageCallbackExtension
	{
		private static SystemMessageCallbackField _callbackField;

		public static void AddCallbackInput(SystemMessage instance, string title, string description, GMBlockData.CallbackData callbackData, Action<GMBlockData.CallbackData> onSubmit, Action onAcceptAction = null, Action onCancelAction = null)
		{
			//IL_0040: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)$"_callbackField is null = {(Object)(object)_callbackField == (Object)null}");
			if ((Object)(object)_callbackField == (Object)null)
			{
				Debug.Log((object)"Fetching original folder field and stop All Input Object");
				SystemMessageFolderField value = new Traverse((object)instance).Field("_folderField").GetValue<SystemMessageFolderField>();
				GameObject value2 = new Traverse((object)instance).Field("_stopAllInputObject").GetValue<GameObject>();
				Debug.Log((object)"cloning field");
				GameObject val = Object.Instantiate<GameObject>(((Component)value).gameObject, value2.transform);
				((Object)val).name = "CallbackPanel";
				Debug.Log((object)"removing original component");
				SRFGameObjectExtensions.RemoveComponentIfExists<SystemMessageFolderField>(val);
				Debug.Log((object)"Fetching original folder field");
				_callbackField = val.AddComponent<SystemMessageCallbackField>();
				Debug.Log((object)"Adjust Rect transform size");
				RectTransform component = val.GetComponent<RectTransform>();
				_callbackField.collapsedHeight = component.sizeDelta.y;
				_callbackField.expandedHeight = component.sizeDelta.y + 40f;
				Debug.Log((object)"Initialize");
				_callbackField.Initialize();
			}
			Debug.Log((object)"Open");
			((object)instance).GetType().GetMethod("Open", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, new object[0]);
			Debug.Log((object)"Setup Message");
			_callbackField.SetupMessage(callbackData, onSubmit, onAcceptAction, onCancelAction);
		}
	}
	public class SystemMessageCallbackField : SystemMessagePanel
	{
		internal UiText Title;

		internal UiText Message;

		internal TMP_InputField _Endpoint;

		internal UiDropdown _CallbackType;

		internal TMP_InputField _Payload;

		internal Action<GMBlockData.CallbackData> _onSubmit;

		internal float collapsedHeight;

		internal float expandedHeight;

		private IEnumerator coroutine;

		private void Expand()
		{
			if (((Component)this).gameObject.activeInHierarchy)
			{
				if (coroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(coroutine);
				}
				coroutine = LerpPosition(expand: true);
				((MonoBehaviour)this).StartCoroutine(coroutine);
			}
		}

		private void Collapse()
		{
			if (((Component)this).gameObject.activeInHierarchy)
			{
				if (coroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(coroutine);
				}
				coroutine = LerpPosition(expand: false);
				((MonoBehaviour)this).StartCoroutine(coroutine);
			}
		}

		private IEnumerator LerpPosition(bool expand)
		{
			float targetPosition = (expand ? expandedHeight : collapsedHeight);
			float fromPosition = (expand ? collapsedHeight : expandedHeight);
			float lerpDuration = 0.2f;
			RectTransform rectTransform = ((Component)this).GetComponent<RectTransform>();
			float startValue = rectTransform.sizeDelta.y;
			if (startValue != targetPosition)
			{
				float ratio = Mathf.InverseLerp(collapsedHeight, expandedHeight, startValue);
				if (!expand)
				{
					ratio = 1f - ratio;
				}
				float timeElapsed = ratio * lerpDuration;
				while (timeElapsed < lerpDuration)
				{
					float valueToLerp = Mathf.Lerp(fromPosition, targetPosition, timeElapsed / lerpDuration);
					rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, valueToLerp);
					timeElapsed += Time.deltaTime;
					yield return null;
				}
				rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, targetPosition);
			}
		}

		public void Initialize()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			new Traverse((object)this).Field("_systemMessage").SetValue((object)SimpleSingletonBehaviour<SystemMessage>.Instance);
			Title = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).GetComponent<UiText>();
			Transform child = ((Component)this).transform.GetChild(1);
			Transform child2 = ((Component)this).transform.GetChild(2);
			Message = ((Component)child.GetChild(0)).GetComponent<UiText>();
			_Endpoint = ((Component)child.GetChild(1)).GetComponent<TMP_InputField>();
			_CallbackType = ((Component)child.GetChild(2)).GetComponent<UiDropdown>();
			_Payload = Object.Instantiate<GameObject>(((Component)_Endpoint).gameObject, child).GetComponent<TMP_InputField>();
			Transform transform = ((Component)_Payload).transform;
			transform.position += new Vector3(0f, -75f, 0f);
			((TMP_Text)Message).text = "This is for 3rd party integration/callback";
			((TMP_Text)Title).text = "Set Callback Process";
			((UnityEvent)((Component)child2.GetChild(0)).GetComponent<Button>().onClick).AddListener(new UnityAction(((SystemMessagePanel)this).OnAccept));
			((UnityEvent)((Component)child2.GetChild(1)).GetComponent<Button>().onClick).AddListener(new UnityAction(((SystemMessagePanel)this).OnCancel));
		}

		public void CallbackTypeChanged(int v)
		{
			if (v == 2 || v == 3)
			{
				Expand();
			}
			else
			{
				Collapse();
			}
		}

		public void SetupMessage(GMBlockData.CallbackData callbackData, Action<GMBlockData.CallbackData> onSubmit, Action onAcceptAction = null, Action onCancelAction = null)
		{
			//IL_00d7: 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_00b6: 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)
			Debug.Log((object)"SetActive");
			((Component)this).gameObject.SetActive(true);
			((Component)this).transform.SetAsLastSibling();
			Debug.Log((object)"AddEventActions");
			base.onAccept = onAcceptAction;
			base.onCancel = onCancelAction;
			_onSubmit = onSubmit;
			Debug.Log((object)"Load string Data");
			_Endpoint.text = callbackData.Endpoint;
			_Payload.text = callbackData.Payload;
			Debug.Log((object)"Setup Drown down list");
			SetupStandardDropdownList(callbackData);
			Debug.Log((object)"Resize");
			RectTransform component = ((Component)this).GetComponent<RectTransform>();
			if (callbackData.MethodType == GMBlockData.CallbackType.Put || callbackData.MethodType == GMBlockData.CallbackType.Post)
			{
				component.sizeDelta = new Vector2(component.sizeDelta.x, expandedHeight);
			}
			else
			{
				component.sizeDelta = new Vector2(component.sizeDelta.x, collapsedHeight);
			}
			((Selectable)_Endpoint).Select();
			_Endpoint.ActivateInputField();
		}

		public override void OnAccept()
		{
			base.onAccept?.Invoke();
			_onSubmit?.Invoke(new GMBlockData.CallbackData
			{
				Endpoint = _Endpoint.text,
				Payload = _Payload.text,
				MethodType = (GMBlockData.CallbackType)((TMP_Dropdown)_CallbackType).value
			});
			CloseCallback();
		}

		public override void OnCancel()
		{
			CloseCallback();
		}

		private void CloseCallback()
		{
			_Endpoint.text = string.Empty;
			_Payload.text = string.Empty;
			((SystemMessagePanel)this).Close();
		}

		private void SetupStandardDropdownList(GMBlockData.CallbackData initialData)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			((UnityEventBase)((TMP_Dropdown)_CallbackType).onValueChanged).RemoveAllListeners();
			List<OptionData> list = new List<OptionData>
			{
				new OptionData("Desktop App"),
				new OptionData("HTTP GET"),
				new OptionData("HTTP POST"),
				new OptionData("HTTP PUT"),
				new OptionData("HTTP DELETE")
			};
			((TMP_Dropdown)_CallbackType).ClearOptions();
			((TMP_Dropdown)_CallbackType).AddOptions(list);
			((UnityEvent<int>)(object)((TMP_Dropdown)_CallbackType).onValueChanged).AddListener((UnityAction<int>)CallbackTypeChanged);
			((TMP_Dropdown)_CallbackType).value = (int)initialData.MethodType;
		}
	}
}
namespace AdvanceGMBlocks
{
	[BepInPlugin("org.hollofox.plugins.AdvanceGMBlocksPlugin", "Advance GM Blocks", "0.0.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class AdvanceGMBlocksPlugin : BaseUnityPlugin
	{
		public const string Guid = "org.hollofox.plugins.AdvanceGMBlocksPlugin";

		public const string Version = "0.0.0.0";

		private static readonly Sprite AudioSprite = Image.LoadSprite("file-audio.png", (CacheType)999);

		private static readonly Sprite MixerSprite = Image.LoadSprite("sliders.png", (CacheType)999);

		private static readonly Sprite AtmosphereSprite = Image.LoadSprite("cloud.png", (CacheType)999);

		private static readonly Sprite AmbientSprite = Image.LoadSprite("volume-low.png", (CacheType)999);

		private static readonly Sprite MusicSprite = Image.LoadSprite("music.png", (CacheType)999);

		private static readonly Sprite DayCycleSprite = Image.LoadSprite("sun.png", (CacheType)999);

		private static readonly Sprite FogSprite = Image.LoadSprite("smog.png", (CacheType)999);

		private static readonly Sprite ExposureSprite = Image.LoadSprite("cloud-sun.png", (CacheType)999);

		private static readonly Sprite ImageSprite = Image.LoadSprite("image.png", (CacheType)999);

		private static GMBlockData _currentData;

		internal static string _currentKey;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"In Awake for Advance GM Blocks");
			Debug.Log((object)"Advance GM Blocks Plug-in loaded");
			Harmony val = new Harmony("org.hollofox.plugins.AdvanceGMBlocksPlugin");
			val.PatchAll();
			ModdingUtils.AddPluginToMenuList((BaseUnityPlugin)(object)this, "HolloFoxes'");
			RadialUIPlugin.AddCustomButtonGMBlock("org.hollofox.plugins.AdvanceGMBlocksPlugin", new ItemArgs
			{
				CloseMenuOnActivate = false,
				Title = "Filters",
				Action = OpenFilters
			}, (Func<AtmosphereBlock, bool>)null);
		}

		public void OpenFilters(MapMenuItem mapmenuItem, object obj)
		{
			//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)
			MapMenu val = MapMenuManager.OpenMenu(float3.op_Implicit(GMBlockInteractMenuBoardTool.block.WorldPosition), true);
			string text = AssetDataPlugin.ReadInfo("org.hollofox.plugins.AdvanceGMBlocksPlugin", _currentKey);
			_currentData = (string.IsNullOrEmpty(text) ? new GMBlockData() : JsonConvert.DeserializeObject<GMBlockData>(text));
			val.AddMenuItem((MenuType)3, (Action<MapMenu, object>)AudioBranch, "Audio", "", "", AudioSprite, obj, true, false, 1f);
			val.AddMenuItem((MenuType)3, (Action<MapMenu, object>)MixerBranch, "Mixer", "", "", MixerSprite, obj, true, false, 1f);
			val.AddMenuItem((MenuType)3, (Action<MapMenu, object>)AtmosphereBranch, "Atmosphere", "", "", AtmosphereSprite, obj, true, false, 1f);
			val.AddToggleItem(!string.IsNullOrWhiteSpace(_currentData.Callback.Endpoint), (Action<MapMenuItem, object>)delegate
			{
				SystemMessageCallbackExtension.AddCallbackInput(SimpleSingletonBehaviour<SystemMessage>.Instance, "Set Callback Process", "This is for 3rd party integration/callback", _currentData.Callback, delegate(GMBlockData.CallbackData callbackData)
				{
					_currentData.Callback = callbackData;
					SaveCurrentData();
				});
			}, "Integrated Callback", "", "", "", (Sprite)null, obj, true, 1f);
		}

		private void AudioBranch(MapMenu map, object obj)
		{
			map.AddToggleItem(_currentData.EnabledAudio.Ambient, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAudio.Ambient = !_currentData.EnabledAudio.Ambient;
				SaveCurrentData();
			}, "Ambient", "", "", "", AmbientSprite, obj, true, 1f);
			map.AddToggleItem(_currentData.EnabledAudio.Music, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAudio.Music = !_currentData.EnabledAudio.Music;
				SaveCurrentData();
			}, "Music", "", "", "", MusicSprite, obj, true, 1f);
		}

		private void MixerBranch(MapMenu map, object obj)
		{
			map.AddToggleItem(_currentData.EnabledMixer.Ambient, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledMixer.Ambient = !_currentData.EnabledMixer.Ambient;
				SaveCurrentData();
			}, "Ambient Volume", "", "", "", AmbientSprite, obj, true, 1f);
			map.AddToggleItem(_currentData.EnabledMixer.Music, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledMixer.Music = !_currentData.EnabledMixer.Music;
				SaveCurrentData();
			}, "Music Volume", "", "", "", MusicSprite, obj, true, 1f);
		}

		private void AtmosphereBranch(MapMenu map, object obj)
		{
			map.AddToggleItem(_currentData.EnabledAtmosphere.DayCycle, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAtmosphere.DayCycle = !_currentData.EnabledAtmosphere.DayCycle;
				SaveCurrentData();
			}, "Day Cycle", "", "", "", DayCycleSprite, obj, true, 1f);
			map.AddToggleItem(_currentData.EnabledAtmosphere.Fog, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAtmosphere.Fog = !_currentData.EnabledAtmosphere.Fog;
				SaveCurrentData();
			}, "Fog", "", "", "", FogSprite, obj, true, 1f);
			map.AddToggleItem(_currentData.EnabledAtmosphere.Expose, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAtmosphere.Expose = !_currentData.EnabledAtmosphere.Expose;
				SaveCurrentData();
			}, "Exposure", "", "", "", ExposureSprite, obj, true, 1f);
			map.AddToggleItem(_currentData.EnabledAtmosphere.PostEffects, (Action<MapMenuItem, object>)delegate
			{
				_currentData.EnabledAtmosphere.PostEffects = !_currentData.EnabledAtmosphere.PostEffects;
				SaveCurrentData();
			}, "Post Effects", "", "", "", ImageSprite, obj, true, 1f);
		}

		private void SaveCurrentData()
		{
			string text = JsonConvert.SerializeObject((object)_currentData);
			AssetDataPlugin.SetInfo("org.hollofox.plugins.AdvanceGMBlocksPlugin", _currentKey, text, false);
		}
	}
	public sealed class GMBlockData
	{
		public enum CallbackType
		{
			Process,
			Get,
			Post,
			Put,
			Delete
		}

		public sealed class CallbackData
		{
			public string Endpoint = string.Empty;

			public CallbackType MethodType = CallbackType.Get;

			public string Payload = string.Empty;
		}

		public sealed class Audio
		{
			public bool Ambient = true;

			public bool Music = true;
		}

		public sealed class Mixer
		{
			public bool Ambient = true;

			public bool Music = true;
		}

		public sealed class Atmosphere
		{
			public bool DayCycle = true;

			public bool Fog = true;

			public bool Expose = true;

			public bool PostEffects = true;
		}

		public Audio EnabledAudio = new Audio();

		public Mixer EnabledMixer = new Mixer();

		public Atmosphere EnabledAtmosphere = new Atmosphere();

		public CallbackData Callback = new CallbackData();
	}
}
namespace AdvanceGMBlocks.GMBlockPatches
{
	[HarmonyPatch(typeof(GMBlockButtonAtmosphere), "OnOpenMenu")]
	internal sealed class GMBlockMenuPatchOpen
	{
		internal static void Prefix(ref GMDataBlockBase ____base)
		{
			AdvanceGMBlocksPlugin._currentKey = ((object)(NGuid)(ref ____base.AtmosphereBlock.Id)).ToString();
		}
	}
	[HarmonyPatch(typeof(GMBlockButtonAtmosphere), "OnApply")]
	internal sealed class GMBlockMenuPatch
	{
		internal static bool Prefix(MapMenuItem arg1, object arg2, ref GMDataBlockBase ____base)
		{
			//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_006a: 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_0094: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			AtmosphereData atmosphere = SimpleSingletonBehaviour<AtmosphereManager>.Instance.GetAtmosphere();
			GMDataBlockBase val = ____base;
			string text = AssetDataPlugin.ReadInfo("org.hollofox.plugins.AdvanceGMBlocksPlugin", ((object)(NGuid)(ref val.AtmosphereBlock.Id)).ToString());
			if (string.IsNullOrWhiteSpace(text))
			{
				return true;
			}
			GMBlockData gMBlockData = JsonConvert.DeserializeObject<GMBlockData>(text);
			if (!gMBlockData.EnabledAudio.Ambient)
			{
				val.AtmosphereBlock.Data.ambientMusic = atmosphere.ambientMusic;
			}
			if (!gMBlockData.EnabledAudio.Music)
			{
				val.AtmosphereBlock.Data.music = atmosphere.music;
			}
			if (!gMBlockData.EnabledMixer.Ambient)
			{
				val.AtmosphereBlock.Data.ambientVolume = atmosphere.ambientVolume;
			}
			if (!gMBlockData.EnabledMixer.Music)
			{
				val.AtmosphereBlock.Data.musicVolume = atmosphere.musicVolume;
			}
			if (!gMBlockData.EnabledAtmosphere.DayCycle)
			{
				val.AtmosphereBlock.Data.dayCycle = atmosphere.dayCycle;
				val.AtmosphereBlock.Data.timeOfDay = atmosphere.timeOfDay;
				val.AtmosphereBlock.Data.sunDirection = atmosphere.sunDirection;
			}
			if (!gMBlockData.EnabledAtmosphere.Fog)
			{
				val.AtmosphereBlock.Data.fogMultiplier = atmosphere.fogMultiplier;
			}
			if (!gMBlockData.EnabledAtmosphere.Expose)
			{
				val.AtmosphereBlock.Data.exposure = atmosphere.exposure;
			}
			if (!gMBlockData.EnabledAtmosphere.PostEffects)
			{
				val.AtmosphereBlock.Data.posteffect = atmosphere.posteffect;
				val.AtmosphereBlock.Data.postEffectAmount = atmosphere.postEffectAmount;
			}
			SimpleSingletonBehaviour<AtmosphereManager>.Instance.SetAtmosphere(ref val.AtmosphereBlock.Data, true);
			if (!string.IsNullOrWhiteSpace(gMBlockData.Callback.Endpoint))
			{
				Uri.TryCreate(gMBlockData.Callback.Endpoint, UriKind.Absolute, out Uri result);
				HttpClient val2 = new HttpClient();
				switch (gMBlockData.Callback.MethodType)
				{
				case GMBlockData.CallbackType.Get:
				{
					if (Uri.TryCreate(gMBlockData.Callback.Endpoint, UriKind.Absolute, out Uri result5))
					{
						val2.GetAsync(result5);
					}
					break;
				}
				case GMBlockData.CallbackType.Post:
				{
					if (Uri.TryCreate(gMBlockData.Callback.Endpoint, UriKind.Absolute, out Uri _))
					{
						val2.PostAsync(result, (HttpContent)new StringContent(gMBlockData.Callback.Payload, Encoding.UTF8, "application/json"));
					}
					break;
				}
				case GMBlockData.CallbackType.Put:
				{
					if (Uri.TryCreate(gMBlockData.Callback.Endpoint, UriKind.Absolute, out Uri _))
					{
						val2.PutAsync(result, (HttpContent)new StringContent(gMBlockData.Callback.Payload, Encoding.UTF8, "application/json"));
					}
					break;
				}
				case GMBlockData.CallbackType.Delete:
				{
					if (Uri.TryCreate(gMBlockData.Callback.Endpoint, UriKind.Absolute, out Uri _))
					{
						val2.DeleteAsync(result);
					}
					break;
				}
				case GMBlockData.CallbackType.Process:
					try
					{
						Process.Start(gMBlockData.Callback.Endpoint);
					}
					catch (Exception)
					{
					}
					break;
				}
			}
			return false;
		}
	}
}