using System;
using System.Xml;
using Cpp2IlInjected;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace MTAssets.UltimateLODSystem
{
	// Token: 0x020005ED RID: 1517
	[Token(Token = "0x20005ED")]
	public class RuntimeScanDemo : MonoBehaviour
	{
		// Token: 0x06002FC7 RID: 12231 RVA: 0x0006596C File Offset: 0x00063B6C
		[Token(Token = "0x6002FC7")]
		[Address(RVA = "0x4305D0", Offset = "0x42F3D0", VA = "0x1804305D0")]
		private void Start()
		{
			UnityEvent onDoneScan = this.ulodOfScene.onDoneScan;
			UnityAction unityAction = delegate
			{
				this.scanStatus.text = "Scan Done! Showing LOD Demo";
				this.cameraAnimator.SetBool("runLoop", true);
				this.buttonObj.SetActive(true);
			};
			onDoneScan.AddListener(unityAction);
			UnityEvent onUndoScan = this.ulodOfScene.onUndoScan;
			UnityAction unityAction2 = delegate
			{
				this.scanStatus.text = "No Scan Performed Yet";
				Animator animator = this.cameraAnimator;
				int num = 0;
				animator.SetBool("runLoop", num != 0);
				this.buttonObj.SetActive(true);
			};
			onUndoScan.AddListener(unityAction2);
		}

		// Token: 0x06002FC8 RID: 12232 RVA: 0x000659C0 File Offset: 0x00063BC0
		[Token(Token = "0x6002FC8")]
		[Address(RVA = "0x4307E0", Offset = "0x42F5E0", VA = "0x1804307E0")]
		private void Update()
		{
			if (this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				this.buttonText.text = "Undo Current Scan And Delete Generated LODs";
			}
			if (!this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				bool dtdValidation = ((IDtdParserAdapterWithValidation)this.buttonText).DtdValidation;
				return;
			}
		}

		// Token: 0x06002FC9 RID: 12233 RVA: 0x00065A0C File Offset: 0x00063C0C
		[Token(Token = "0x6002FC9")]
		[Address(RVA = "0x4304C0", Offset = "0x42F2C0", VA = "0x1804304C0")]
		public void StartUndoScan()
		{
			if (this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				this.scanStatus.text = "Undoing Scan...";
				GameObject gameObject = this.buttonObj;
				int num = 0;
				gameObject.SetActive(num != 0);
				this.ulodOfScene.UndoCurrentScanWorkingAndDeleteGeneratedMeshes(true, true);
				return;
			}
			if (!this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				this.scanStatus.text = "Scanning...";
				GameObject gameObject2 = this.buttonObj;
				int num2 = 0;
				gameObject2.SetActive(num2 != 0);
				this.ulodOfScene.ScanAllMeshesAndGenerateLodsGroups();
				return;
			}
		}

		// Token: 0x06002FCA RID: 12234 RVA: 0x00065A98 File Offset: 0x00063C98
		[Token(Token = "0x6002FCA")]
		[Address(RVA = "0x3088F0", Offset = "0x3076F0", VA = "0x1803088F0")]
		public RuntimeScanDemo()
		{
		}

		// Token: 0x04003A0B RID: 14859
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003A0B")]
		public UltimateLevelOfDetail ulodOfScene;

		// Token: 0x04003A0C RID: 14860
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003A0C")]
		public Text buttonText;

		// Token: 0x04003A0D RID: 14861
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003A0D")]
		public GameObject buttonObj;

		// Token: 0x04003A0E RID: 14862
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4003A0E")]
		public Text scanStatus;

		// Token: 0x04003A0F RID: 14863
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4003A0F")]
		public Animator cameraAnimator;
	}
}
