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

namespace MTAssets.UltimateLODSystem
{
	// Token: 0x02000645 RID: 1605
	[Token(Token = "0x2000645")]
	public class RuntimeScanDemo : MonoBehaviour
	{
		// Token: 0x06003290 RID: 12944 RVA: 0x0006CC3C File Offset: 0x0006AE3C
		[Token(Token = "0x6003290")]
		[Address(RVA = "0x50A950", Offset = "0x509950", VA = "0x18050A950")]
		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: 0x06003291 RID: 12945 RVA: 0x0006CC90 File Offset: 0x0006AE90
		[Token(Token = "0x6003291")]
		[Address(RVA = "0x50AB60", Offset = "0x509B60", VA = "0x18050AB60")]
		private void Update()
		{
			if (this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				this.buttonText.text = "Undo Current Scan And Delete Generated LODs";
			}
			if (!this.ulodOfScene.isMeshesCurrentScannedAndLodsWorkingInThisComponent())
			{
				((ICanvasElement)this.buttonText).GraphicUpdateComplete();
				return;
			}
		}

		// Token: 0x06003292 RID: 12946 RVA: 0x0006CCDC File Offset: 0x0006AEDC
		[Token(Token = "0x6003292")]
		[Address(RVA = "0x50A840", Offset = "0x509840", VA = "0x18050A840")]
		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: 0x06003293 RID: 12947 RVA: 0x0006CD68 File Offset: 0x0006AF68
		[Token(Token = "0x6003293")]
		[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
		public RuntimeScanDemo()
		{
		}

		// Token: 0x04003CF5 RID: 15605
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x4003CF5")]
		public UltimateLevelOfDetail ulodOfScene;

		// Token: 0x04003CF6 RID: 15606
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x4003CF6")]
		public Text buttonText;

		// Token: 0x04003CF7 RID: 15607
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x4003CF7")]
		public GameObject buttonObj;

		// Token: 0x04003CF8 RID: 15608
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4003CF8")]
		public Text scanStatus;

		// Token: 0x04003CF9 RID: 15609
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x4003CF9")]
		public Animator cameraAnimator;
	}
}
