Decompiled source of TerminalDesktop v0.6.2

TerminalDesktop.dll

Decompiled 10 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using JetBrains.Annotations;
using Newtonsoft.Json;
using TMPro;
using TerminalApi;
using TerminalApi.Events;
using TerminalDesktopMod.Extentions;
using TerminalDesktopMod.Sync;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		MonoScriptData result = default(MonoScriptData);
		result.FilePathsData = new byte[2702]
		{
			0, 0, 0, 1, 0, 0, 0, 58, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 68,
			101, 115, 107, 116, 111, 112, 83, 116, 111, 114,
			97, 103, 101, 46, 99, 115, 0, 0, 0, 2,
			0, 0, 0, 75, 92, 65, 115, 115, 101, 116,
			115, 92, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			92, 65, 115, 115, 101, 116, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 69, 120, 116, 101, 110,
			115, 105, 111, 110, 115, 92, 68, 101, 115, 107,
			116, 111, 112, 83, 97, 118, 101, 69, 120, 116,
			101, 110, 115, 105, 111, 110, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 72, 92, 65, 115,
			115, 101, 116, 115, 92, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 92, 65, 115, 115, 101, 116, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 69, 120,
			116, 101, 110, 115, 105, 111, 110, 115, 92, 84,
			101, 114, 109, 105, 110, 97, 108, 69, 120, 116,
			101, 110, 115, 105, 111, 110, 46, 99, 115, 0,
			0, 0, 2, 0, 0, 0, 58, 92, 65, 115,
			115, 101, 116, 115, 92, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 92, 65, 115, 115, 101, 116, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 70, 108,
			97, 115, 104, 68, 114, 105, 118, 101, 80, 114,
			111, 112, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 60, 92, 65, 115, 115, 101, 116, 115,
			92, 84, 101, 114, 109, 105, 110, 97, 108, 68,
			101, 115, 107, 116, 111, 112, 77, 111, 100, 92,
			65, 115, 115, 101, 116, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 73, 99, 111, 110, 115, 92,
			67, 97, 109, 101, 114, 97, 73, 99, 111, 110,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			60, 92, 65, 115, 115, 101, 116, 115, 92, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 92, 65, 115,
			115, 101, 116, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 73, 99, 111, 110, 115, 92, 68, 101,
			99, 111, 100, 101, 73, 99, 111, 110, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 65, 92,
			65, 115, 115, 101, 116, 115, 92, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 92, 65, 115, 115, 101,
			116, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			73, 99, 111, 110, 115, 92, 68, 101, 115, 107,
			116, 111, 112, 73, 99, 111, 110, 66, 97, 115,
			101, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 58, 92, 65, 115, 115, 101, 116, 115, 92,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 92, 65,
			115, 115, 101, 116, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 73, 99, 111, 110, 115, 92, 77,
			105, 110, 101, 73, 99, 111, 110, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 62, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 73,
			99, 111, 110, 115, 92, 83, 101, 116, 116, 105,
			110, 103, 115, 73, 99, 111, 110, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 62, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 73,
			99, 111, 110, 115, 92, 84, 101, 114, 109, 105,
			110, 97, 108, 73, 99, 111, 110, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 58, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 73,
			99, 111, 110, 115, 92, 84, 101, 115, 116, 73,
			99, 111, 110, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 60, 92, 65, 115, 115, 101, 116,
			115, 92, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			92, 65, 115, 115, 101, 116, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 73, 99, 111, 110, 115,
			92, 87, 97, 108, 107, 105, 101, 73, 99, 111,
			110, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 48, 92, 65, 115, 115, 101, 116, 115, 92,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 92, 65,
			115, 115, 101, 116, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 77, 97, 105, 110, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 69, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 80,
			97, 116, 99, 104, 101, 115, 92, 68, 101, 108,
			101, 116, 101, 66, 117, 116, 116, 111, 110, 80,
			97, 116, 99, 104, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 75, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 80, 97, 116, 99,
			104, 101, 115, 92, 71, 97, 109, 101, 78, 101,
			116, 119, 111, 114, 107, 77, 97, 110, 97, 103,
			101, 114, 80, 97, 116, 99, 104, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 67, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 80,
			97, 116, 99, 104, 101, 115, 92, 72, 85, 68,
			77, 97, 110, 97, 103, 101, 114, 80, 97, 116,
			99, 104, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 77, 92, 65, 115, 115, 101, 116, 115,
			92, 84, 101, 114, 109, 105, 110, 97, 108, 68,
			101, 115, 107, 116, 111, 112, 77, 111, 100, 92,
			65, 115, 115, 101, 116, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 80, 97, 116, 99, 104, 101,
			115, 92, 77, 97, 110, 117, 97, 108, 67, 97,
			109, 101, 114, 97, 82, 101, 110, 100, 101, 114,
			101, 114, 80, 97, 116, 99, 104, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 69, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 80,
			97, 116, 99, 104, 101, 115, 92, 82, 111, 117,
			110, 100, 77, 97, 110, 97, 103, 101, 114, 80,
			97, 116, 99, 104, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 69, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 80, 97, 116, 99,
			104, 101, 115, 92, 83, 116, 97, 114, 116, 79,
			102, 82, 111, 117, 110, 100, 80, 97, 116, 99,
			104, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 65, 92, 65, 115, 115, 101, 116, 115, 92,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 92, 65,
			115, 115, 101, 116, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 80, 97, 116, 99, 104, 101, 115,
			92, 84, 101, 114, 109, 105, 110, 97, 108, 80,
			97, 116, 99, 104, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 63, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 80, 97, 116, 99,
			104, 101, 115, 92, 87, 97, 108, 107, 105, 101,
			80, 97, 116, 99, 104, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 61, 92, 65, 115, 115,
			101, 116, 115, 92, 84, 101, 114, 109, 105, 110,
			97, 108, 68, 101, 115, 107, 116, 111, 112, 77,
			111, 100, 92, 65, 115, 115, 101, 116, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 82, 101, 102,
			101, 114, 101, 110, 99, 101, 115, 83, 116, 111,
			114, 97, 103, 101, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 66, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 97, 110, 97, 103, 101, 114, 46, 99,
			115, 0, 0, 0, 2, 0, 0, 0, 51, 92,
			65, 115, 115, 101, 116, 115, 92, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 92, 65, 115, 115, 101,
			116, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			85, 115, 98, 80, 111, 114, 116, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 64, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 87,
			105, 110, 100, 111, 119, 115, 92, 67, 97, 109,
			101, 114, 97, 87, 105, 110, 100, 111, 119, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 64,
			92, 65, 115, 115, 101, 116, 115, 92, 84, 101,
			114, 109, 105, 110, 97, 108, 68, 101, 115, 107,
			116, 111, 112, 77, 111, 100, 92, 65, 115, 115,
			101, 116, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 87, 105, 110, 100, 111, 119, 115, 92, 68,
			101, 99, 111, 100, 101, 87, 105, 110, 100, 111,
			119, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 69, 92, 65, 115, 115, 101, 116, 115, 92,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 92, 65,
			115, 115, 101, 116, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 87, 105, 110, 100, 111, 119, 115,
			92, 68, 101, 115, 107, 116, 111, 112, 87, 105,
			110, 100, 111, 119, 66, 97, 115, 101, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 71, 92,
			65, 115, 115, 101, 116, 115, 92, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 92, 65, 115, 115, 101,
			116, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			87, 105, 110, 100, 111, 119, 115, 92, 69, 118,
			101, 110, 116, 115, 92, 67, 97, 109, 101, 114,
			97, 69, 118, 101, 110, 116, 115, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 69, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 87,
			105, 110, 100, 111, 119, 115, 92, 69, 118, 101,
			110, 116, 115, 92, 77, 105, 110, 101, 69, 118,
			101, 110, 116, 115, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 73, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 87, 105, 110, 100,
			111, 119, 115, 92, 69, 118, 101, 110, 116, 115,
			92, 84, 101, 114, 109, 105, 110, 97, 108, 69,
			118, 101, 110, 116, 115, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 71, 92, 65, 115, 115,
			101, 116, 115, 92, 84, 101, 114, 109, 105, 110,
			97, 108, 68, 101, 115, 107, 116, 111, 112, 77,
			111, 100, 92, 65, 115, 115, 101, 116, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 87, 105, 110,
			100, 111, 119, 115, 92, 69, 118, 101, 110, 116,
			115, 92, 87, 105, 110, 100, 111, 119, 69, 118,
			101, 110, 116, 115, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 68, 92, 65, 115, 115, 101,
			116, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 92, 65, 115, 115, 101, 116, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 87, 105, 110, 100,
			111, 119, 115, 92, 72, 97, 99, 107, 65, 116,
			116, 97, 99, 107, 87, 105, 110, 100, 111, 119,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			62, 92, 65, 115, 115, 101, 116, 115, 92, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 92, 65, 115,
			115, 101, 116, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 87, 105, 110, 100, 111, 119, 115, 92,
			77, 105, 110, 101, 87, 105, 110, 100, 111, 119,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			70, 92, 65, 115, 115, 101, 116, 115, 92, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 92, 65, 115,
			115, 101, 116, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 87, 105, 110, 100, 111, 119, 115, 92,
			78, 111, 116, 105, 102, 105, 99, 97, 116, 105,
			111, 110, 87, 105, 110, 100, 111, 119, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 67, 92,
			65, 115, 115, 101, 116, 115, 92, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 92, 65, 115, 115, 101,
			116, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			87, 105, 110, 100, 111, 119, 115, 92, 83, 121,
			110, 99, 92, 87, 105, 110, 100, 111, 119, 83,
			121, 110, 99, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 66, 92, 65, 115, 115, 101, 116,
			115, 92, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			92, 65, 115, 115, 101, 116, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 87, 105, 110, 100, 111,
			119, 115, 92, 84, 101, 114, 109, 105, 110, 97,
			108, 87, 105, 110, 100, 111, 119, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 64, 92, 65,
			115, 115, 101, 116, 115, 92, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 92, 65, 115, 115, 101, 116,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 87,
			105, 110, 100, 111, 119, 115, 92, 87, 97, 108,
			107, 105, 101, 87, 105, 110, 100, 111, 119, 46,
			99, 115
		};
		result.TypesData = new byte[1564]
		{
			0, 0, 0, 0, 33, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 68, 101, 115, 107, 116, 111,
			112, 83, 116, 111, 114, 97, 103, 101, 0, 0,
			0, 0, 54, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 46, 69, 120, 116, 101, 110, 116, 105, 111,
			110, 115, 124, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 83, 97,
			118, 101, 77, 111, 100, 101, 108, 0, 0, 0,
			0, 50, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			46, 69, 120, 116, 101, 110, 116, 105, 111, 110,
			115, 124, 68, 101, 115, 107, 116, 111, 112, 83,
			97, 118, 101, 69, 120, 116, 101, 110, 115, 105,
			111, 110, 0, 0, 0, 0, 47, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 46, 69, 120, 116, 101,
			110, 116, 105, 111, 110, 115, 124, 84, 101, 114,
			109, 105, 110, 97, 108, 69, 120, 116, 101, 110,
			115, 105, 111, 110, 0, 0, 0, 0, 38, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 124, 70, 108,
			97, 115, 104, 68, 114, 105, 118, 101, 83, 97,
			118, 101, 77, 111, 100, 101, 108, 0, 0, 0,
			0, 33, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 70, 108, 97, 115, 104, 68, 114, 105, 118,
			101, 80, 114, 111, 112, 0, 0, 0, 0, 29,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 124, 67,
			97, 109, 101, 114, 97, 73, 99, 111, 110, 0,
			0, 0, 0, 29, 84, 101, 114, 109, 105, 110,
			97, 108, 68, 101, 115, 107, 116, 111, 112, 77,
			111, 100, 124, 68, 101, 99, 111, 100, 101, 73,
			99, 111, 110, 0, 0, 0, 0, 34, 84, 101,
			114, 109, 105, 110, 97, 108, 68, 101, 115, 107,
			116, 111, 112, 77, 111, 100, 124, 68, 101, 115,
			107, 116, 111, 112, 73, 99, 111, 110, 66, 97,
			115, 101, 0, 0, 0, 0, 27, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 124, 77, 105, 110, 101,
			73, 99, 111, 110, 0, 0, 0, 0, 31, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 124, 83, 101,
			116, 116, 105, 110, 103, 115, 73, 99, 111, 110,
			0, 0, 0, 0, 31, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 84, 101, 114, 109, 105, 110,
			97, 108, 73, 99, 111, 110, 0, 0, 0, 0,
			27, 84, 101, 114, 109, 105, 110, 97, 108, 68,
			101, 115, 107, 116, 111, 112, 77, 111, 100, 124,
			84, 101, 115, 116, 73, 99, 111, 110, 0, 0,
			0, 0, 29, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 124, 87, 97, 108, 107, 105, 101, 73, 99,
			111, 110, 0, 0, 0, 0, 23, 84, 101, 114,
			109, 105, 110, 97, 108, 68, 101, 115, 107, 116,
			111, 112, 77, 111, 100, 124, 77, 97, 105, 110,
			0, 0, 0, 0, 36, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 68, 101, 108, 101, 116, 101,
			66, 117, 116, 116, 111, 110, 80, 97, 116, 99,
			104, 0, 0, 0, 0, 42, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 124, 71, 97, 109, 101, 78,
			101, 116, 119, 111, 114, 107, 77, 97, 110, 97,
			103, 101, 114, 80, 97, 116, 99, 104, 0, 0,
			0, 0, 34, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 124, 72, 85, 68, 77, 97, 110, 97, 103,
			101, 114, 80, 97, 116, 99, 104, 0, 0, 0,
			0, 44, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 77, 97, 110, 117, 97, 108, 67, 97, 109,
			101, 114, 97, 82, 101, 110, 100, 101, 114, 101,
			114, 80, 97, 116, 99, 104, 0, 0, 0, 0,
			36, 84, 101, 114, 109, 105, 110, 97, 108, 68,
			101, 115, 107, 116, 111, 112, 77, 111, 100, 124,
			82, 111, 117, 110, 100, 77, 97, 110, 97, 103,
			101, 114, 80, 97, 116, 99, 104, 0, 0, 0,
			0, 36, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 83, 116, 97, 114, 116, 79, 102, 82, 111,
			117, 110, 100, 80, 97, 116, 99, 104, 0, 0,
			0, 0, 32, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 124, 84, 101, 114, 109, 105, 110, 97, 108,
			80, 97, 116, 99, 104, 0, 0, 0, 0, 30,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 124, 87,
			97, 108, 107, 105, 101, 80, 97, 116, 99, 104,
			0, 0, 0, 0, 36, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 82, 101, 102, 101, 114, 101,
			110, 99, 101, 115, 83, 116, 111, 114, 97, 103,
			101, 0, 0, 0, 0, 41, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 124, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 97, 110, 97, 103, 101, 114, 0, 0, 0,
			0, 35, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 85, 115, 98, 80, 111, 114, 116, 83, 97,
			118, 101, 77, 111, 100, 101, 108, 0, 0, 0,
			0, 26, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 85, 115, 98, 80, 111, 114, 116, 0, 0,
			0, 0, 31, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 124, 67, 97, 109, 101, 114, 97, 87, 105,
			110, 100, 111, 119, 0, 0, 0, 0, 31, 84,
			101, 114, 109, 105, 110, 97, 108, 68, 101, 115,
			107, 116, 111, 112, 77, 111, 100, 124, 68, 101,
			99, 111, 100, 101, 87, 105, 110, 100, 111, 119,
			0, 0, 0, 0, 36, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 68, 101, 115, 107, 116, 111,
			112, 87, 105, 110, 100, 111, 119, 66, 97, 115,
			101, 0, 0, 0, 0, 31, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 124, 67, 97, 109, 101, 114,
			97, 69, 118, 101, 110, 116, 115, 0, 0, 0,
			0, 29, 84, 101, 114, 109, 105, 110, 97, 108,
			68, 101, 115, 107, 116, 111, 112, 77, 111, 100,
			124, 77, 105, 110, 101, 69, 118, 101, 110, 116,
			115, 0, 0, 0, 0, 33, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 124, 84, 101, 114, 109, 105,
			110, 97, 108, 69, 118, 101, 110, 116, 115, 0,
			0, 0, 0, 31, 84, 101, 114, 109, 105, 110,
			97, 108, 68, 101, 115, 107, 116, 111, 112, 77,
			111, 100, 124, 87, 105, 110, 100, 111, 119, 69,
			118, 101, 110, 116, 115, 0, 0, 0, 0, 35,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 124, 72,
			97, 99, 107, 65, 116, 116, 97, 99, 107, 87,
			105, 110, 100, 111, 119, 0, 0, 0, 0, 29,
			84, 101, 114, 109, 105, 110, 97, 108, 68, 101,
			115, 107, 116, 111, 112, 77, 111, 100, 124, 77,
			105, 110, 101, 87, 105, 110, 100, 111, 119, 0,
			0, 0, 0, 37, 84, 101, 114, 109, 105, 110,
			97, 108, 68, 101, 115, 107, 116, 111, 112, 77,
			111, 100, 124, 78, 111, 116, 105, 102, 105, 99,
			97, 116, 105, 111, 110, 87, 105, 110, 100, 111,
			119, 0, 0, 0, 0, 34, 84, 101, 114, 109,
			105, 110, 97, 108, 68, 101, 115, 107, 116, 111,
			112, 77, 111, 100, 46, 83, 121, 110, 99, 124,
			87, 105, 110, 100, 111, 119, 83, 121, 110, 99,
			0, 0, 0, 0, 33, 84, 101, 114, 109, 105,
			110, 97, 108, 68, 101, 115, 107, 116, 111, 112,
			77, 111, 100, 124, 84, 101, 114, 109, 105, 110,
			97, 108, 87, 105, 110, 100, 111, 119, 0, 0,
			0, 0, 31, 84, 101, 114, 109, 105, 110, 97,
			108, 68, 101, 115, 107, 116, 111, 112, 77, 111,
			100, 124, 87, 97, 108, 107, 105, 101, 87, 105,
			110, 100, 111, 119
		};
		result.TotalFiles = 37;
		result.TotalTypes = 40;
		result.IsEditorOnly = false;
		return result;
	}
}
namespace TerminalDesktopMod
{
	public static class DesktopStorage
	{
		public delegate void TerminalNodeChangedEventHandler(Terminal sender, TerminalNode newNode);

		public static TerminalDesktopSaveModel TerminalDesktopSaveModel { get; set; } = new TerminalDesktopSaveModel();


		public static GameObject UsbFlashPort { get; set; }

		public static GameObject DesktopPrefab { get; set; }

		public static Item FlashDriveItem { get; set; }

		public static TerminalNode ComputerPowerUpgrade { get; set; }

		public static List<Item> SpawnableScraps { get; private set; } = new List<Item>();


		public static List<DesktopIconBase> IconsPrefabs { get; private set; } = new List<DesktopIconBase>();


		public static Dictionary<string, DesktopWindowBase> WindowsPrefabs { get; private set; } = new Dictionary<string, DesktopWindowBase>();


		public static event TerminalNodeChangedEventHandler TerminalNodeChangeEvent;

		public static void AddIcon(DesktopIconBase desktopIconBase)
		{
			IconsPrefabs.Add(desktopIconBase);
			Main.Log.LogInfo((object)("Desktop added icon:" + ((Object)desktopIconBase).name));
		}

		public static void AddWindow(DesktopWindowBase desktopWindowBase)
		{
			WindowsPrefabs.Add(((object)desktopWindowBase).GetType().FullName, desktopWindowBase);
			Main.Log.LogInfo((object)("Desktop added window:" + ((Object)desktopWindowBase).name));
		}

		[CanBeNull]
		public static DesktopWindowBase GetWindowByType(string desktopWindowType)
		{
			if (!WindowsPrefabs.TryGetValue(desktopWindowType, out var value))
			{
				return null;
			}
			return value;
		}

		public static void InvokeChangeTerminalNode(Terminal terminal, TerminalNode node)
		{
			DesktopStorage.TerminalNodeChangeEvent?.Invoke(terminal, node);
		}

		public static void ClearTerminalNodeEvent()
		{
			DesktopStorage.TerminalNodeChangeEvent = null;
		}
	}
	[Serializable]
	public class FlashDriveSaveModel
	{
		public int DecodeLevel { get; set; }
	}
	public class FlashDriveProp : PhysicsProp
	{
		public static UnityEvent<FlashDriveProp> FlashLoadedEvent = new UnityEvent<FlashDriveProp>();

		private int _flashIndex;

		public UsbPort UsbPort { get; set; }

		public int FlashIndex
		{
			get
			{
				if (_flashIndex == 0)
				{
					_flashIndex = Random.Range(-2147483647, int.MaxValue);
				}
				return _flashIndex;
			}
			private set
			{
				_flashIndex = value;
			}
		}

		public NetworkVariable<int> DecodeLevel { get; set; } = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		private ScanNodeProperties ScanNodeProperties { get; set; }

		private void Awake()
		{
			ScanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
		}

		public override int GetItemDataToSave()
		{
			Dictionary<int, string> flashSaves = DesktopStorage.TerminalDesktopSaveModel.FlashSaves;
			if (flashSaves.TryGetValue(FlashIndex, out var _))
			{
				flashSaves[FlashIndex] = GetSaveData();
			}
			else
			{
				DesktopStorage.TerminalDesktopSaveModel.FlashSaves.Add(FlashIndex, GetSaveData());
			}
			return FlashIndex;
		}

		public override void LoadItemSaveData(int saveData)
		{
			FlashIndex = saveData;
			((GrabbableObject)this).isInFactory = false;
			FlashLoadedEvent.Invoke(this);
			if (DesktopStorage.TerminalDesktopSaveModel.FlashSaves.TryGetValue(FlashIndex, out var value))
			{
				LoadData(value);
				Main.Log.LogInfo((object)$"load flash {saveData}");
			}
		}

		public override void GrabItem()
		{
			if (UsbPort != null)
			{
				UsbPort.PulledFlash();
				UsbPort = null;
			}
		}

		public virtual string GetSaveData()
		{
			return JsonConvert.SerializeObject((object)new FlashDriveSaveModel
			{
				DecodeLevel = DecodeLevel.Value
			});
		}

		public virtual void LoadData(string data)
		{
			FlashDriveSaveModel flashDriveSaveModel = JsonConvert.DeserializeObject<FlashDriveSaveModel>(data);
			DecodeLevel.Value = flashDriveSaveModel.DecodeLevel;
		}

		public virtual void UpdateScrapValue(int value)
		{
			((GrabbableObject)this).scrapValue = ((GrabbableObject)this).scrapValue + value;
			ScanNodeProperties.scrapValue = ((GrabbableObject)this).scrapValue;
			ScanNodeProperties.subText = $"Value: {((GrabbableObject)this).scrapValue}";
		}

		public virtual void UpdateDecodeLevel(int value)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				DecodeLevel.Value = value;
			}
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
			if (UsbPort != null)
			{
				UsbPort.PulledFlash();
				UsbPort = null;
			}
		}

		protected override void __initializeVariables()
		{
			if (DecodeLevel == null)
			{
				throw new Exception("FlashDriveProp.<DecodeLevel>k__BackingField cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)DecodeLevel).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DecodeLevel, "DecodeLevel");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)DecodeLevel);
			((PhysicsProp)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "FlashDriveProp";
		}
	}
	public class CameraIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowPrefab;

		public override void Click()
		{
			base.Click();
			if (TerminalDesktopManager.Instance.GetFreeEnergy() <= 0)
			{
				TerminalDesktopManager.Instance.AddNotificationWindow("not enough energy to open the window");
			}
			else
			{
				TerminalDesktopManager.Instance.AddWindow(WindowPrefab);
			}
		}
	}
	public class DecodeIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowPrefab;

		public override void Click()
		{
			if (!TerminalDesktopManager.Instance.DesktopWindows.Any((DesktopWindowBase win) => win is DecodeWindow))
			{
				base.Click();
				TerminalDesktopManager.Instance.AddWindow(WindowPrefab);
			}
		}
	}
	public class DesktopIconBase : MonoBehaviour
	{
		public Vector2 DesktopNormalizedPosition;

		public UnityEvent ClickEvent { get; set; } = new UnityEvent();


		private RectTransform CanvasRectTransform { get; set; }

		private Image Image { get; set; }

		protected virtual void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			CanvasRectTransform = (RectTransform)((Component)((Component)this).GetComponentInParent<Canvas>()).transform;
			Image = ((Component)this).GetComponentInParent<Image>();
		}

		protected virtual void Start()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ChangePosition(DesktopNormalizedPosition);
		}

		public virtual void Click()
		{
			ClickEvent.Invoke();
		}

		public virtual void ChangePosition(float xNormalized, float yNormalized)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			ChangePosition(new Vector2(xNormalized, yNormalized));
		}

		public virtual void ChangePosition(Vector2 newNormalizedPos)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			Transform transform = ((Component)this).transform;
			Transform obj = ((transform is RectTransform) ? transform : null);
			Vector2 anchoredPosition = CanvasRectTransform.sizeDelta * newNormalizedPos;
			anchoredPosition.y *= -1f;
			((RectTransform)obj).anchoredPosition = anchoredPosition;
		}

		public virtual void ChangeIconSprite(Sprite iconSprite)
		{
			Image.sprite = iconSprite;
		}
	}
	public class MineIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowPrefab;

		public override void Click()
		{
			if (!TerminalDesktopManager.Instance.DesktopWindows.Any((DesktopWindowBase win) => win is MineWindow))
			{
				base.Click();
				TerminalDesktopManager.Instance.AddWindow(WindowPrefab);
			}
		}
	}
	public class SettingsIcon : DesktopIconBase
	{
		private bool UseStaticCamera { get; set; } = true;


		public Camera DynamicEventUICamera { get; private set; }

		public Camera StaticEventUICamera { get; private set; }

		public Transform StaticCameraPos { get; private set; }

		public Camera StaticCamera { get; private set; }

		private bool PreviousLocalVisorStatus { get; set; }

		protected override void Start()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			base.Start();
			Transform val = ((Component)TerminalDesktopManager.Instance).transform.Find("CameraContainer");
			StaticCameraPos = val.Find("TerminalStaticCamera");
			StaticEventUICamera = ((Component)val.Find("TerminalStaticCameraEvent")).GetComponent<Camera>();
			StaticEventUICamera.targetTexture = null;
			StaticEventUICamera.depth = 10f;
			StaticEventUICamera.clearFlags = (CameraClearFlags)3;
			((Component)StaticEventUICamera).gameObject.SetActive(false);
			Events.TerminalBeganUsing += new TerminalEventHandler(OnTerminalBeganUsing);
			TerminalDesktopManager.Instance.TerminalExitEvent.AddListener(new UnityAction(OnTerminalExitedUsing));
		}

		private void FixedUpdate()
		{
			if (!UseStaticCamera)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				DynamicEventUICamera.fieldOfView = localPlayerController.gameplayCamera.fieldOfView;
			}
		}

		public override void Click()
		{
			base.Click();
			UseStaticCamera = !UseStaticCamera;
			SwitchCamera();
		}

		private void OnTerminalBeganUsing(object sender, TerminalEventArgs e)
		{
			SwitchCamera();
		}

		private void SwitchCamera()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (UseStaticCamera)
			{
				if (StaticCamera == null)
				{
					CreateStaticCamera();
				}
				((Component)StaticCamera).gameObject.SetActive(true);
				TerminalDesktopManager.Instance.CanvasDesktop.worldCamera = StaticEventUICamera;
				StaticCamera.depth = 50f;
				PreviousLocalVisorStatus = ((Component)localPlayerController.localVisor.GetChild(0)).gameObject.activeSelf;
				((Component)localPlayerController.localVisor.GetChild(0)).gameObject.SetActive(false);
				localPlayerController.isClimbingLadder = false;
				localPlayerController.ladderCameraHorizontal = 0f;
			}
			else
			{
				StaticCamera.depth = -20f;
				if (DynamicEventUICamera == null)
				{
					CreateDynamicEventCamera();
				}
				((Component)StaticCamera).gameObject.SetActive(false);
				TerminalDesktopManager.Instance.CanvasDesktop.worldCamera = DynamicEventUICamera;
				((Component)localPlayerController.localVisor.GetChild(0)).gameObject.SetActive(PreviousLocalVisorStatus);
				localPlayerController.isClimbingLadder = true;
			}
		}

		private void OnTerminalExitedUsing()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			TerminalDesktopManager.Instance.CanvasDesktop.worldCamera = null;
			if (UseStaticCamera)
			{
				StaticCamera.depth = -20f;
				((Component)localPlayerController.localVisor.GetChild(0)).gameObject.SetActive(PreviousLocalVisorStatus);
				((Component)StaticCamera).gameObject.SetActive(false);
			}
			localPlayerController.isClimbingLadder = false;
			localPlayerController.ladderCameraHorizontal = 0f;
			((Component)localPlayerController.gameplayCamera).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
		}

		private void CreateDynamicEventCamera()
		{
			//IL_002d: 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)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			GameObject val = Object.Instantiate<GameObject>(((Component)localPlayerController.gameplayCamera).gameObject, ((Component)localPlayerController.gameplayCamera).transform);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			Object.Destroy((Object)(object)val.GetComponent<AudioListener>());
			DynamicEventUICamera = val.GetComponent<Camera>();
			DynamicEventUICamera.targetTexture = null;
			DynamicEventUICamera.depth = 10f;
			DynamicEventUICamera.clearFlags = (CameraClearFlags)3;
			val.SetActive(false);
			((Texture)ReferencesStorage.Terminal.playerScreenTexHighRes).width = DynamicEventUICamera.pixelWidth;
			((Texture)ReferencesStorage.Terminal.playerScreenTexHighRes).height = DynamicEventUICamera.pixelHeight;
		}

		private void CreateStaticCamera()
		{
			//IL_0026: 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)
			GameObject val = Object.Instantiate<GameObject>(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject, StaticCameraPos);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			Object.Destroy((Object)(object)val.GetComponent<AudioListener>());
			StaticCamera = val.GetComponent<Camera>();
			StaticCamera.targetTexture = ReferencesStorage.Terminal.playerScreenTexHighRes;
			StaticCamera.depth = -5f;
			StaticCamera.clearFlags = (CameraClearFlags)3;
			StaticCamera.fieldOfView = 58f;
			StaticEventUICamera.fieldOfView = StaticCamera.fieldOfView - 2f;
			val.SetActive(false);
			((Texture)ReferencesStorage.Terminal.playerScreenTexHighRes).width = StaticCamera.pixelWidth;
			((Texture)ReferencesStorage.Terminal.playerScreenTexHighRes).height = StaticCamera.pixelHeight;
			((Component)GameNetworkManager.Instance.localPlayerController.playerBodyAnimator).gameObject.SetActive(false);
			((Component)GameNetworkManager.Instance.localPlayerController.playerBodyAnimator).gameObject.SetActive(true);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Events.TerminalBeganUsing -= new TerminalEventHandler(OnTerminalBeganUsing);
		}
	}
	public class TerminalIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowPrefab;

		public override void Click()
		{
			if (!TerminalDesktopManager.Instance.DesktopWindows.Any((DesktopWindowBase win) => win is TerminalWindow))
			{
				base.Click();
				TerminalDesktopManager.Instance.AddWindow(WindowPrefab);
			}
		}
	}
	public class TestIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowBase;

		public override void Click()
		{
		}

		private void Call(DesktopWindowBase win)
		{
			if (win is HackAttackWindow hackAttackWindow)
			{
				hackAttackWindow.Init(Random.Range(2, 5));
				TerminalDesktopManager.Instance.WindowAddedEvent.RemoveListener((UnityAction<DesktopWindowBase>)Call);
			}
		}
	}
	public class WalkieIcon : DesktopIconBase
	{
		public DesktopWindowBase WindowPrefab;

		public override void Click()
		{
			if (!TerminalDesktopManager.Instance.DesktopWindows.Any((DesktopWindowBase win) => win is WalkieWindow))
			{
				base.Click();
				TerminalDesktopManager.Instance.AddWindow(WindowPrefab);
			}
		}
	}
	[BepInPlugin("wijes.desktop.terminal", "Terminal Desktop", "0.6.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public const string ModGUID = "wijes.desktop.terminal";

		public const string ModName = "Terminal Desktop";

		public const string ModVersion = "0.6.0";

		internal static ManualLogSource Log;

		private readonly Harmony harmony = new Harmony("wijes.desktop.terminal");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Terminal Desktop is loading! v 0.6.0");
			string text = Paths.PluginPath + "/wijes-TerminalDesktop-0.6.0/terminaldesktop.bundle";
			if (!Directory.Exists(Paths.PluginPath + "/wijes-TerminalDesktop-0.6.0"))
			{
				text = Paths.PluginPath + "/wijes-TerminalDesktop/terminaldesktop.bundle";
			}
			AssetBundle val = AssetBundle.LoadFromFile(text);
			LoadFlashItem(val);
			GameObject val2 = val.LoadAsset<GameObject>("Desktop");
			GenerateRpc(val2);
			DesktopStorage.DesktopPrefab = val2;
			LoadUsbPortObject(val);
			LoadDesktopIcons(val);
			LoadDesktopWindows(val);
			harmony.PatchAll();
			GenerateTerminalCommand();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Terminal Desktop is loaded! v 0.6.0");
		}

		private void LoadFlashItem(AssetBundle assetBundle)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			Item val2 = (DesktopStorage.FlashDriveItem = assetBundle.LoadAsset<Item>("FlashDrive"));
			Renderer component = val2.spawnPrefab.GetComponent<Renderer>();
			Texture2D mainTexture = assetBundle.LoadAsset<Texture2D>("FlashDriveAlbedo");
			component.material = new Material(Shader.Find("HDRP/Lit"));
			((Component)component).tag = "PhysicsProp";
			component.material.mainTexture = (Texture)(object)mainTexture;
			DesktopStorage.SpawnableScraps.Add(val2);
		}

		private void LoadUsbPortObject(AssetBundle assetBundle)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_005b: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = assetBundle.LoadAsset<GameObject>("UsbPort");
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>();
			foreach (Renderer val2 in componentsInChildren)
			{
				List<Material> list = new List<Material>();
				for (int j = 0; j < val2.materials.Count(); j++)
				{
					Color color = val2.materials[j].color;
					Texture mainTexture = val2.materials[j].mainTexture;
					Material val3 = new Material(Shader.Find("HDRP/Lit"));
					val3.mainTexture = mainTexture;
					val3.color = color;
					list.Add(val3);
				}
				val2.SetMaterials(list);
				((Component)val2).tag = "InteractTrigger";
				((Component)val2).gameObject.layer = LayerMask.NameToLayer("InteractableObject");
			}
			DesktopStorage.UsbFlashPort = val;
			GenerateRpc(val);
		}

		private void LoadDesktopIcons(AssetBundle assetBundle)
		{
			foreach (GameObject item in from x in assetBundle.LoadAllAssets<GameObject>()
				where Object.op_Implicit((Object)(object)x.GetComponent<DesktopIconBase>())
				select x)
			{
				DesktopIconBase component = item.GetComponent<DesktopIconBase>();
				if (component != null && ((Object)component).name != "DesktopIcon")
				{
					DesktopStorage.AddIcon(component);
				}
			}
		}

		private void LoadDesktopWindows(AssetBundle assetBundle)
		{
			foreach (GameObject item in from x in assetBundle.LoadAllAssets<GameObject>()
				where Object.op_Implicit((Object)(object)x.GetComponent<DesktopWindowBase>())
				select x)
			{
				DesktopWindowBase component = item.GetComponent<DesktopWindowBase>();
				if (component != null)
				{
					DesktopStorage.AddWindow(component);
				}
			}
		}

		private void GenerateTerminalCommand()
		{
			TerminalNode val = TerminalApi.CreateTerminalNode("Computer improved! \n Your new balance is [playerCredits].\n", true, "");
			val.creatureName = "upgrade computer";
			TerminalKeyword val2 = TerminalApi.CreateTerminalKeyword("upgrade", true, (TerminalNode)null);
			TerminalKeyword val3 = TerminalApi.CreateTerminalKeyword("computer", false, (TerminalNode)null);
			TerminalApi.AddTerminalKeyword(val3.defaultVerb = TerminalExtenstionMethods.AddCompatibleNoun(val2, val3, val));
			TerminalApi.AddTerminalKeyword(val3);
			DesktopStorage.ComputerPowerUpgrade = val;
		}

		private void GenerateRpc(GameObject gameObject)
		{
			NetworkBehaviour[] componentsInChildren = gameObject.GetComponentsInChildren<NetworkBehaviour>();
			if (componentsInChildren == null)
			{
				return;
			}
			NetworkBehaviour[] array = componentsInChildren;
			for (int i = 0; i < array.Length; i++)
			{
				MethodInfo[] methods = ((object)array[i]).GetType().GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if ((object)methodInfo.DeclaringType != null && methodInfo.DeclaringType.Namespace != null && methodInfo.DeclaringType.Namespace.Contains("TerminalDesktopMod") && methodInfo.GetParameters().Length == 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(DeleteFileButton))]
	public static class DeleteButtonPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("DeleteFile")]
		private static void DeleteFile(DeleteFileButton __instance)
		{
			string path = Path.Combine(Application.persistentDataPath, $"TD_{__instance.fileToDelete}.json");
			if (File.Exists(path))
			{
				File.Delete(path);
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	public static class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			NetworkManager.Singleton.AddNetworkPrefab(DesktopStorage.DesktopPrefab);
			NetworkManager.Singleton.AddNetworkPrefab(DesktopStorage.UsbFlashPort);
			foreach (Item spawnableScrap in DesktopStorage.SpawnableScraps)
			{
				NetworkManager.Singleton.AddNetworkPrefab(spawnableScrap.spawnPrefab);
			}
		}

		[HarmonyPatch("SaveGame")]
		[HarmonyPrefix]
		private static void PrefixSaveGame(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame)
			{
				DesktopStorage.TerminalDesktopSaveModel = new TerminalDesktopSaveModel();
				if (WalkieWindow.TerminalWalkieTalkie != null && !((object)WalkieWindow.TerminalWalkieTalkie).Equals((object?)null))
				{
					((Component)WalkieWindow.TerminalWalkieTalkie).gameObject.SetActive(false);
				}
			}
		}

		[HarmonyPatch("SaveGame")]
		[HarmonyPostfix]
		private static void PostfixSaveGame(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame)
			{
				TerminalDesktopManager.Instance.SaveDesktop();
				if (WalkieWindow.TerminalWalkieTalkie != null && !((object)WalkieWindow.TerminalWalkieTalkie).Equals((object?)null))
				{
					((Component)WalkieWindow.TerminalWalkieTalkie).gameObject.SetActive(true);
				}
			}
		}

		[HarmonyPatch("ResetSavedGameValues")]
		[HarmonyPrefix]
		private static void ResetSavedGameValues(GameNetworkManager __instance)
		{
			TerminalDesktopManager.Instance.StartReset();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public static class HUDManagerPatch
	{
		[HarmonyPatch("SetClock")]
		[HarmonyPostfix]
		private static void StartPatch(ref string __result)
		{
			ReferencesStorage.DayTime = __result;
		}
	}
	[HarmonyPatch(typeof(ManualCameraRenderer))]
	public static class ManualCameraRendererPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Start(ref ManualCameraRenderer __instance)
		{
			if (((Object)((Component)__instance).gameObject).name == "CameraMonitorScript")
			{
				ReferencesStorage.ManualCameraRenderer = __instance;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public static class RoundManagerPatch
	{
		[HarmonyPatch("SpawnScrapInLevel")]
		[HarmonyPrefix]
		public static void SpawnScrapInLevel(ref RoundManager __instance)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			SelectableLevel currentLevel = __instance.currentLevel;
			foreach (Item scrap in DesktopStorage.SpawnableScraps)
			{
				if (currentLevel.spawnableScrap.Count((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrap) == 0)
				{
					currentLevel.spawnableScrap.Add(new SpawnableItemWithRarity
					{
						spawnableItem = scrap,
						rarity = 70
					});
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class StartOfRoundPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void Awake(ref StartOfRound __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			foreach (Item scrap in DesktopStorage.SpawnableScraps)
			{
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					if (val.spawnableScrap.Count((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrap) == 0)
					{
						val.spawnableScrap.Add(new SpawnableItemWithRarity
						{
							spawnableItem = scrap,
							rarity = 70
						});
					}
				}
				if (!__instance.allItemsList.itemsList.Contains(scrap))
				{
					__instance.allItemsList.itemsList.Add(scrap);
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void Start(ref StartOfRound __instance)
		{
			WalkieTalkie.allWalkieTalkies.Clear();
			FlashDriveProp.FlashLoadedEvent = new UnityEvent<FlashDriveProp>();
			UsbPort.UsbPortChangeEvent = new UnityEvent<UsbPort>();
			DesktopStorage.ClearTerminalNodeEvent();
			if (((NetworkBehaviour)__instance).IsServer)
			{
				string text = GameNetworkManager.Instance.saveFileNum.ToString();
				string path = Path.Combine(Application.persistentDataPath, "TD_" + text + ".json");
				DesktopStorage.TerminalDesktopSaveModel = new TerminalDesktopSaveModel();
				if (File.Exists(path))
				{
					DesktopStorage.TerminalDesktopSaveModel = JsonConvert.DeserializeObject<TerminalDesktopSaveModel>(File.ReadAllText(path));
				}
				Object.Instantiate<GameObject>(DesktopStorage.DesktopPrefab).GetComponent<NetworkObject>().Spawn(false);
				NetworkObject component = Object.Instantiate<GameObject>(DesktopStorage.UsbFlashPort).GetComponent<NetworkObject>();
				component.Spawn(false);
				((Component)component).GetComponentInChildren<UsbPort>().LoadPortById(1);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public static class TerminalPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void Awake(ref Terminal __instance)
		{
			ReferencesStorage.Terminal = __instance;
		}

		[HarmonyPatch("LoadNewNode")]
		[HarmonyPrefix]
		public static void LoadNewNode(ref Terminal __instance, ref TerminalNode node)
		{
			DesktopStorage.InvokeChangeTerminalNode(__instance, node);
		}

		[HarmonyPatch("RotateShipDecorSelection")]
		[HarmonyPostfix]
		public static void RotateShipDecorSelection(ref Terminal __instance)
		{
			__instance.ShipDecorSelection.Add(DesktopStorage.ComputerPowerUpgrade);
		}
	}
	[HarmonyPatch(typeof(WalkieTalkie))]
	public static class WalkiePatch
	{
		[HarmonyPatch("OnDisable")]
		[HarmonyPrefix]
		public static bool OnDisable(ref WalkieTalkie __instance)
		{
			if (WalkieWindow.TerminalWalkieTalkie == null || ((object)WalkieWindow.TerminalWalkieTalkie).Equals((object?)null))
			{
				return true;
			}
			if ((Object)(object)WalkieWindow.TerminalWalkieTalkie == (Object)(object)__instance)
			{
				return false;
			}
			return true;
		}
	}
	public static class ReferencesStorage
	{
		public static string DayTime { get; set; }

		public static ManualCameraRenderer ManualCameraRenderer { get; set; }

		public static Terminal Terminal { get; set; }
	}
	public class TerminalDesktopManager : NetworkBehaviour
	{
		public List<UsbPort> UsbPorts = new List<UsbPort>();

		[SerializeField]
		private Transform IconsParent;

		[SerializeField]
		private Transform WindowsParent;

		[SerializeField]
		private Transform CollapsedWindowParent;

		[SerializeField]
		private GameObject CollapsedWindowPrefab;

		[SerializeField]
		private TextMeshProUGUI TimeText;

		[SerializeField]
		private TextMeshProUGUI PowerText;

		public static TerminalDesktopManager Instance { get; set; }

		public List<DesktopIconBase> DesktopIcons { get; set; } = new List<DesktopIconBase>();


		public List<DesktopWindowBase> DesktopWindows { get; set; } = new List<DesktopWindowBase>();


		public Dictionary<GameObject, DesktopWindowBase> CollapsedWindows { get; set; } = new Dictionary<GameObject, DesktopWindowBase>();


		public UnityEvent<DesktopWindowBase> WindowAddedEvent { get; set; } = new UnityEvent<DesktopWindowBase>();


		public UnityEvent TerminalExitEvent { get; set; } = new UnityEvent();


		public Canvas CanvasDesktop { get; private set; }

		public bool IsUsingTerminal { get; private set; }

		private Terminal Terminal { get; set; }

		private NetworkVariable<int> UseEnergy { get; set; } = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		private NetworkVariable<int> MaxEnergy { get; set; } = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		private int BaseUpgradeCost { get; set; } = 75;


		private int WindowCounter { get; set; }

		private void Awake()
		{
			Instance = this;
		}

		private void Start()
		{
			//IL_003d: 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_006c: 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_0087: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			Terminal = ReferencesStorage.Terminal;
			((Component)this).transform.parent = ((Component)Terminal.terminalUIScreen).transform.parent;
			CanvasDesktop = ((Component)this).GetComponentInChildren<Canvas>();
			((Component)this).transform.localScale = Vector3.one;
			((Component)this).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			((Component)this).transform.localPosition = Vector3.zero;
			Events.TerminalBeganUsing += new TerminalEventHandler(OnBeganUsing);
			TerminalExitEvent.AddListener(new UnityAction(OnExitedUsing));
			NetworkVariable<int> maxEnergy = MaxEnergy;
			maxEnergy.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)maxEnergy.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnMaxEnergyValueChanged));
			DesktopStorage.TerminalNodeChangeEvent += DesktopStorageOnTerminalNodeChangeEvent;
			DesktopStorage.ComputerPowerUpgrade.itemCost = BaseUpgradeCost * MaxEnergy.Value;
			foreach (DesktopIconBase iconsPrefab in DesktopStorage.IconsPrefabs)
			{
				AddIcon(iconsPrefab);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				this.LoadDesktop();
			}
			if (((NetworkBehaviour)this).IsClient && !((NetworkBehaviour)this).IsHost)
			{
				((MonoBehaviour)this).StartCoroutine(WaitInitPlayer());
			}
		}

		private void OnMaxEnergyValueChanged(int previousValue, int newValue)
		{
			DesktopStorage.ComputerPowerUpgrade.itemCost = BaseUpgradeCost * newValue;
		}

		private void DesktopStorageOnTerminalNodeChangeEvent(Terminal sender, TerminalNode newNode)
		{
			if (!((Object)(object)newNode != (Object)(object)DesktopStorage.ComputerPowerUpgrade))
			{
				if (ReferencesStorage.Terminal.groupCredits < newNode.itemCost)
				{
					newNode.displayText = "you could not afford these item";
					return;
				}
				newNode.displayText = "Computer improved! \n Your new balance is [playerCredits].\n";
				ReferencesStorage.Terminal.ChangeCredits(-newNode.itemCost);
				SetMaxEnergy(MaxEnergy.Value + 1);
			}
		}

		private IEnumerator WaitInitPlayer()
		{
			while (GameNetworkManager.Instance.localPlayerController == null)
			{
				yield return (object)new WaitForSeconds(1f);
			}
			yield return (object)new WaitForSeconds(1f);
			GetSyncWindowsServerRpc();
		}

		private void FixedUpdate()
		{
			if (!((NetworkBehaviour)this).IsSpawned)
			{
				return;
			}
			((TMP_Text)TimeText).text = ((ReferencesStorage.DayTime == null) ? "??:??" : ReferencesStorage.DayTime);
			((TMP_Text)PowerText).text = $"{UseEnergy.Value} / {MaxEnergy.Value}";
			if (IsUsingTerminal)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				localPlayerController.isClimbingLadder = true;
				if (!localPlayerController.inTerminalMenu)
				{
					TerminalExitEvent.Invoke();
				}
			}
		}

		public void AddIcon(DesktopIconBase iconBasePrefab)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			DesktopIconBase component = Object.Instantiate<GameObject>(((Component)iconBasePrefab).gameObject, IconsParent).GetComponent<DesktopIconBase>();
			component.ChangePosition(component.DesktopNormalizedPosition);
			DesktopIcons.Add(component);
		}

		public int GetUseEnergy()
		{
			return UseEnergy.Value;
		}

		public int GetMaxEnergy()
		{
			return MaxEnergy.Value;
		}

		public int GetFreeEnergy()
		{
			return MaxEnergy.Value - UseEnergy.Value;
		}

		public void ChangeUseEnergy(int count)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				NetworkVariable<int> useEnergy = UseEnergy;
				useEnergy.Value += count;
			}
		}

		public void SetUseEnergy(int count)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				UseEnergy.Value = count;
			}
		}

		public void SetMaxEnergy(int count)
		{
			SetMaxEnergyServerRpc(count);
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetMaxEnergyServerRpc(int count)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(482236400u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, count);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 482236400u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					MaxEnergy.Value = count;
				}
			}
		}

		private void OnBeganUsing(object sender, TerminalEventArgs e)
		{
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			IsUsingTerminal = true;
			InputAction obj = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false);
			if (obj != null)
			{
				obj.Disable();
			}
		}

		private void OnExitedUsing()
		{
			IsUsingTerminal = false;
			Cursor.visible = false;
			Cursor.lockState = (CursorLockMode)1;
			InputAction obj = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false);
			if (obj != null)
			{
				obj.Enable();
			}
		}

		private void ForceExitedTerminal()
		{
			InputAction obj = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false);
			if (obj != null)
			{
				obj.Enable();
			}
		}

		public void CollapseWindow(DesktopWindowBase windowBase)
		{
			GameObject val = Object.Instantiate<GameObject>(CollapsedWindowPrefab, CollapsedWindowParent);
			val.GetComponent<Image>().sprite = windowBase.CollapseSprite;
			CollapsedWindows.Add(val, windowBase);
			val.SetActive(true);
		}

		public void ExpandWindow(GameObject collapsedIcon)
		{
			if (CollapsedWindows.TryGetValue(collapsedIcon, out var value))
			{
				UpdateWindow(value, new WindowSync
				{
					ChangeCollapsed = true,
					IsCollapsed = false
				});
			}
		}

		public void ExpandWindow(DesktopWindowBase window)
		{
			GameObject key = CollapsedWindows.FirstOrDefault((KeyValuePair<GameObject, DesktopWindowBase> x) => (Object)(object)x.Value == (Object)(object)window).Key;
			if (key != null)
			{
				CollapsedWindows.Remove(key);
				Object.Destroy((Object)(object)key);
			}
		}

		public DesktopWindowBase GetWindowByIndex(int windowIndex)
		{
			return DesktopWindows.FirstOrDefault((DesktopWindowBase x) => x.WindowIndex == windowIndex);
		}

		public void AddNotificationWindow(string notification)
		{
			DesktopWindowBase windowByType = DesktopStorage.GetWindowByType(typeof(NotificationWindow).FullName);
			if (windowByType == null)
			{
				Main.Log.LogError((object)"Not found notification window");
				return;
			}
			NotificationWindow component = Object.Instantiate<GameObject>(((Component)windowByType).gameObject, WindowsParent).GetComponent<NotificationWindow>();
			component.WindowIndex = -1;
			component.SetText(notification);
		}

		public void AddWindow(DesktopWindowBase windowBasePrefab)
		{
			AddWindowServerRpc(((object)windowBasePrefab).GetType().FullName);
		}

		[ServerRpc(RequireOwnership = false)]
		private void AddWindowServerRpc(string windowType)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_008e: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3506602511u, val, (RpcDelivery)0);
				bool flag = windowType != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(windowType, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3506602511u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				WindowCounter++;
				AddWindowClientRpc(WindowCounter, windowType);
			}
		}

		[ClientRpc]
		private void AddWindowClientRpc(int winIndex, string windowType, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0095: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1529086400u, clientRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, winIndex);
				bool flag = windowType != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(windowType, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1529086400u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				DesktopWindowBase windowByType = DesktopStorage.GetWindowByType(windowType);
				if (windowByType == null)
				{
					Main.Log.LogError((object)("Not found " + windowType + " window"));
					return;
				}
				DesktopWindowBase component = Object.Instantiate<GameObject>(((Component)windowByType).gameObject, WindowsParent).GetComponent<DesktopWindowBase>();
				component.WindowIndex = winIndex;
				DesktopWindows.Add(component);
				WindowAddedEvent.Invoke(component);
			}
		}

		public void CloseWindow(DesktopWindowBase windowBase)
		{
			CloseWindowServerRpc(windowBase.WindowIndex);
		}

		[ServerRpc(RequireOwnership = false)]
		private void CloseWindowServerRpc(int winIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(547301171u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, winIndex);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 547301171u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					CloseWindowClientRpc(winIndex);
				}
			}
		}

		[ClientRpc]
		private void CloseWindowClientRpc(int windowIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(510893985u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, windowIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 510893985u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			DesktopWindowBase window = GetWindowByIndex(windowIndex);
			if (window == null)
			{
				Main.Log.LogError((object)$"Not found {windowIndex} window");
				return;
			}
			DesktopWindows.Remove(window);
			GameObject key = CollapsedWindows.FirstOrDefault((KeyValuePair<GameObject, DesktopWindowBase> x) => (Object)(object)x.Value == (Object)(object)window).Key;
			if (key != null)
			{
				CollapsedWindows.Remove(key);
				Object.Destroy((Object)(object)key);
			}
			window.CloseWindow();
			Object.Destroy((Object)(object)((Component)window).gameObject);
		}

		public void UpdateWindow(DesktopWindowBase window, WindowSync windowSync)
		{
			UpdateWindowServerRpc(window.WindowIndex, windowSync);
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdateWindowServerRpc(int indexWindow, WindowSync windowSync)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0095: 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_00d4: 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_00bf: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1363074004u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, indexWindow);
				bool flag = windowSync != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<WindowSync>(ref windowSync, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1363074004u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (GetWindowByIndex(indexWindow) == null)
				{
					Main.Log.LogError((object)$"Not found {indexWindow} window");
				}
				else
				{
					UpdateWindowClientRpc(indexWindow, windowSync);
				}
			}
		}

		[ClientRpc]
		private void UpdateWindowClientRpc(int indexWindow, WindowSync windowSync, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0095: 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_00d4: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(434189457u, clientRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, indexWindow);
				bool flag = windowSync != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<WindowSync>(ref windowSync, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 434189457u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				DesktopWindowBase windowByIndex = GetWindowByIndex(indexWindow);
				if (windowByIndex == null)
				{
					Main.Log.LogError((object)$"Not found {indexWindow} window");
				}
				else
				{
					windowByIndex.WindowSync(windowSync);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void GetSyncWindowsServerRpc(ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4271948650u, serverRpcParams, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 4271948650u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			ulong senderClientId = serverRpcParams.Receive.SenderClientId;
			ClientRpcParams val2 = default(ClientRpcParams);
			val2.Send = new ClientRpcSendParams
			{
				TargetClientIds = new ulong[1] { senderClientId }
			};
			ClientRpcParams clientRpcParams = val2;
			foreach (DesktopWindowBase desktopWindow in DesktopWindows)
			{
				AddWindowClientRpc(desktopWindow.WindowIndex, ((object)desktopWindow).GetType().FullName, clientRpcParams);
			}
			foreach (DesktopWindowBase desktopWindow2 in DesktopWindows)
			{
				UpdateWindowClientRpc(desktopWindow2.WindowIndex, desktopWindow2.GetFullWindowSync(), clientRpcParams);
			}
		}

		public override void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Events.TerminalBeganUsing -= new TerminalEventHandler(OnBeganUsing);
			DesktopStorage.TerminalNodeChangeEvent -= DesktopStorageOnTerminalNodeChangeEvent;
			WalkieWindow.ManagerDestroyed();
			TerminalWindow.ManagerDestroyed();
			ForceExitedTerminal();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChangeObjectOwnerServerRpc(NetworkObjectReference netObjRef, ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0083: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(403763237u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 403763237u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
				{
					val3.RemoveOwnership();
					val3.ChangeOwnership(clientId);
				}
			}
		}

		public void StartReset()
		{
			ResetServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void ResetServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1554722835u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1554722835u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ResetClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ResetClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1478555575u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1478555575u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					this.ResetDesktop();
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (UseEnergy == null)
			{
				throw new Exception("TerminalDesktopManager.<UseEnergy>k__BackingField cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)UseEnergy).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)UseEnergy, "UseEnergy");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)UseEnergy);
			if (MaxEnergy == null)
			{
				throw new Exception("TerminalDesktopManager.<MaxEnergy>k__BackingField cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)MaxEnergy).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)MaxEnergy, "MaxEnergy");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)MaxEnergy);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_TerminalDesktopManager()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(482236400u, new RpcReceiveHandler(__rpc_handler_482236400));
			NetworkManager.__rpc_func_table.Add(3506602511u, new RpcReceiveHandler(__rpc_handler_3506602511));
			NetworkManager.__rpc_func_table.Add(1529086400u, new RpcReceiveHandler(__rpc_handler_1529086400));
			NetworkManager.__rpc_func_table.Add(547301171u, new RpcReceiveHandler(__rpc_handler_547301171));
			NetworkManager.__rpc_func_table.Add(510893985u, new RpcReceiveHandler(__rpc_handler_510893985));
			NetworkManager.__rpc_func_table.Add(1363074004u, new RpcReceiveHandler(__rpc_handler_1363074004));
			NetworkManager.__rpc_func_table.Add(434189457u, new RpcReceiveHandler(__rpc_handler_434189457));
			NetworkManager.__rpc_func_table.Add(4271948650u, new RpcReceiveHandler(__rpc_handler_4271948650));
			NetworkManager.__rpc_func_table.Add(403763237u, new RpcReceiveHandler(__rpc_handler_403763237));
			NetworkManager.__rpc_func_table.Add(1554722835u, new RpcReceiveHandler(__rpc_handler_1554722835));
			NetworkManager.__rpc_func_table.Add(1478555575u, new RpcReceiveHandler(__rpc_handler_1478555575));
		}

		private static void __rpc_handler_482236400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int maxEnergyServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref maxEnergyServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).SetMaxEnergyServerRpc(maxEnergyServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3506602511(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0061: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string windowType = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref windowType, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).AddWindowServerRpc(windowType);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1529086400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: 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_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int winIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref winIndex);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string windowType = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref windowType, false);
				}
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TerminalDesktopManager)(object)target).AddWindowClientRpc(winIndex, windowType, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_547301171(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int winIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref winIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).CloseWindowServerRpc(winIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_510893985(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int windowIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref windowIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TerminalDesktopManager)(object)target).CloseWindowClientRpc(windowIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1363074004(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int indexWindow = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref indexWindow);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				WindowSync windowSync = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<WindowSync>(ref windowSync, default(ForNetworkSerializable));
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).UpdateWindowServerRpc(indexWindow, windowSync);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_434189457(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0085: 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_0065: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int indexWindow = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref indexWindow);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				WindowSync windowSync = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<WindowSync>(ref windowSync, default(ForNetworkSerializable));
				}
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TerminalDesktopManager)(object)target).UpdateWindowClientRpc(indexWindow, windowSync, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4271948650(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).GetSyncWindowsServerRpc(server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_403763237(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_003e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).ChangeObjectOwnerServerRpc(netObjRef, clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1554722835(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TerminalDesktopManager)(object)target).ResetServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1478555575(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TerminalDesktopManager)(object)target).ResetClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TerminalDesktopManager";
		}
	}
	public class UsbPortSaveModel
	{
		public int FlashInUsbIndex { get; set; }
	}
	public class UsbPort : NetworkBehaviour
	{
		public static UnityEvent<UsbPort> UsbPortChangeEvent = new UnityEvent<UsbPort>();

		public NetworkObject parentTo;

		public Vector3 OffsetFlash;

		public InteractTrigger triggerScript;

		public NetworkVariable<int> FlashInUsbIndex { get; set; } = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		public NetworkVariable<int> PortId { get; set; } = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		public FlashDriveProp FlashInUsb { get; set; }

		private void Awake()
		{
			FlashDriveProp.FlashLoadedEvent.AddListener((UnityAction<FlashDriveProp>)LoadFlash);
		}

		public override void OnNetworkSpawn()
		{
		}

		private void Start()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			TerminalDesktopManager.Instance.UsbPorts.Add(this);
			Terminal terminal = ReferencesStorage.Terminal;
			((Component)this).transform.parent.parent = ((Component)terminal.terminalUIScreen).transform.parent;
			((Component)this).transform.parent.localRotation = Quaternion.Euler(0f, 0f, 0f);
			((Component)this).transform.parent.localPosition = Vector3.zero;
			((Component)this).transform.parent.localScale = Vector3.one;
		}

		protected virtual void FixedUpdate()
		{
			//IL_0034: 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)
			//IL_003f: 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_004c: 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)
			if (GameNetworkManager.Instance != null && GameNetworkManager.Instance.localPlayerController != null)
			{
				triggerScript.interactable = IsHoldFlash();
				if (FlashInUsb != null)
				{
					Vector3 val = ((Component)this).transform.localPosition + OffsetFlash;
					((GrabbableObject)FlashInUsb).targetFloorPosition = val;
					((Component)FlashInUsb).transform.localPosition = val;
				}
			}
		}

		protected virtual bool IsHoldFlash()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!localPlayerController.isHoldingObject)
			{
				return false;
			}
			if ((Object)(object)localPlayerController.currentlyHeldObjectServer.itemProperties != (Object)(object)DesktopStorage.FlashDriveItem)
			{
				return false;
			}
			if (FlashInUsb != null)
			{
				return false;
			}
			return true;
		}

		public virtual void InsertIntoUsb(PlayerControllerB playerWhoTriggered)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (playerWhoTriggered.isHoldingObject && playerWhoTriggered.currentlyHeldObjectServer != null)
			{
				Vector3 val = ((Component)this).transform.localPosition + OffsetFlash;
				GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer;
				playerWhoTriggered.DiscardHeldObject(true, parentTo, val, true);
				InsertIntoUsbServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)currentlyHeldObjectServer));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void InsertIntoUsbServerRpc(NetworkBehaviourReference flashRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0083: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(988634225u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref flashRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this