Decompiled source of StarMapTools v1.6.9

StarMapTools.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("StarMapTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StarMapTools")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bf224048-4020-497b-b3a4-3a83f0a2990a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StarMapTools;

internal class Drag : MonoBehaviour
{
	private RectTransform rt;

	private RectTransform parent;

	private RectTransform canvas;

	private Vector3 lastPosition;

	private bool drag = false;

	private void Start()
	{
		rt = ((Component)this).GetComponent<RectTransform>();
		parent = ((Component)((Transform)rt).parent).GetComponent<RectTransform>();
		canvas = ((Component)((Transform)parent).parent).GetComponent<RectTransform>();
	}

	private void Update()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0054: 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_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Input.mousePosition - Vector3.right * (float)Screen.width / 2f - Vector3.up * (float)Screen.height / 2f;
		val.x *= canvas.sizeDelta.x / (float)Screen.width;
		val.y *= canvas.sizeDelta.y / (float)Screen.height;
		Vector3 val2 = ((Transform)parent).localPosition + ((Transform)rt).localPosition;
		Rect rect = rt.rect;
		if (val.x >= val2.x - ((Rect)(ref rect)).width / 2f && val.x <= val2.x + ((Rect)(ref rect)).width / 2f && val.y >= val2.y - ((Rect)(ref rect)).height / 2f && val.y <= val2.y + ((Rect)(ref rect)).height / 2f && Input.GetMouseButtonDown(0))
		{
			drag = true;
			lastPosition = val;
		}
		else if (drag && Input.GetMouseButtonUp(0))
		{
			drag = false;
		}
		if (drag)
		{
			RectTransform obj = parent;
			((Transform)obj).localPosition = ((Transform)obj).localPosition + (val - lastPosition);
			lastPosition = val;
		}
	}
}
[BepInPlugin("sky.plugins.dsp.StarMapTools", "StarMapTools", "1.6.9")]
public class StarMapTools : BaseUnityPlugin
{
	public static bool IsEnglish;

	private GameObject prefab_StarMapToolsBasePanel;

	private GameObject ui_StarMapToolsBasePanel;

	private Dropdown StarList;

	private Dropdown PlanetList;

	private Text TitleText;

	private InputField InfoText;

	private Toggle LoadResAmount;

	private bool dataLoadOver = false;

	private bool showGUI = false;

	private bool loadingStarData = false;

	private GalaxyData galaxy;

	private KeyCode switchGUIKey;

	private KeyCode tpKey;

	private List<StarSearcher> starSearchers = new List<StarSearcher>();

	private Button AddSearcherButton;

	private Button RemoveSearcherButton;

	private Dropdown SearcherList;

	private ScrollRect OptionsList;

	private Toggle SearchNextToggle;

	private Toggle RandomSearchToggle;

	private InputField DysonLuminoText;

	private InputField DistanceText;

	private Dropdown ResultList;

	private Toggle VeinGroupToggle;

	private Toggle VeinPGroupToggle;

	private InputField VeinAmountText;

	private Text PrePosText;

	private Vector3 PrePos = Vector3.zero;

	private LineRenderer PrePosLine;

	private Dropdown BaseSkinDropDown;

	private Button SetBaseButton;

	private Button ChangeButton;

	private Button RemoveVeinButton;

	private Button AddVeinButton;

	private Button SearchButton;

	private bool SearchNext = false;

	private List<StarData> SerachResult = new List<StarData>();

	private static StarMapTools self;

	private List<Toggle> StarTypesToggleList;

	private List<RectTransform> PlanteTypesNumLabelList;

	private List<RectTransform> SingularityTypesNumLabelList;

	private List<Toggle> VeinTypesToggleList;

	private void Start()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		Harmony.CreateAndPatchAll(typeof(StarMapTools), (string)null);
		self = this;
		StarMapToolsTranslate.regAllTranslate();
		switchGUIKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("config", "switchGUI", (KeyCode)282, "开关GUI的按键".getTranslate()).Value;
		tpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("config", "tp", (KeyCode)283, "传送按键".getTranslate()).Value;
		AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("StarMapTools.starmaptools"));
		prefab_StarMapToolsBasePanel = val.LoadAsset<GameObject>("StarMapToolsBasePanel");
	}

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_087c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0886: Expected O, but got Unknown
		//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c0: Expected O, but got Unknown
		//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_08dd: Expected O, but got Unknown
		//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_08fa: Expected O, but got Unknown
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Expected O, but got Unknown
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Expected O, but got Unknown
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Expected O, but got Unknown
		//IL_055a: Unknown result type (might be due to invalid IL or missing references)
		//IL_055f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0502: Unknown result type (might be due to invalid IL or missing references)
		//IL_0507: Unknown result type (might be due to invalid IL or missing references)
		//IL_050c: Unknown result type (might be due to invalid IL or missing references)
		//IL_050e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_0535: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_0699: Unknown result type (might be due to invalid IL or missing references)
		//IL_0624: Unknown result type (might be due to invalid IL or missing references)
		//IL_0637: Unknown result type (might be due to invalid IL or missing references)
		if (dataLoadOver)
		{
			if (Input.GetKeyDown(switchGUIKey))
			{
				showGUI = !showGUI;
			}
			if ((showGUI && !ui_StarMapToolsBasePanel.activeSelf) || (!showGUI && ui_StarMapToolsBasePanel.activeSelf))
			{
				ui_StarMapToolsBasePanel.SetActive(!ui_StarMapToolsBasePanel.activeSelf);
				if (!ui_StarMapToolsBasePanel.activeSelf && (Object)(object)PrePosLine != (Object)null && ((Component)PrePosLine).gameObject.activeSelf)
				{
					((Component)PrePosLine).gameObject.SetActive(false);
				}
			}
			if (!showGUI)
			{
				return;
			}
			if (UIRoot.instance.galaxySelect.starmap.galaxyData != null)
			{
				if (SearchNext && SearchNextToggle.isOn)
				{
					LoadResAmount.isOn = false;
					if (RandomSearchToggle.isOn)
					{
						UIRoot.instance.galaxySelect.Rerand();
					}
					else
					{
						GameDesc value = Traverse.Create((object)UIRoot.instance.galaxySelect).Field("gameDesc").GetValue<GameDesc>();
						InputField value2 = Traverse.Create((object)UIRoot.instance.galaxySelect).Field("seedInput").GetValue<InputField>();
						int galaxySeed = value.galaxySeed;
						galaxySeed++;
						value2.text = galaxySeed.ToString();
						value.galaxySeed = galaxySeed;
						UIRoot.instance.galaxySelect.SetStarmapGalaxy();
					}
				}
				else
				{
					SearchNext = false;
				}
				if (galaxy != UIRoot.instance.galaxySelect.starmap.galaxyData)
				{
					TitleText.text = "新游戏模式".getTranslate();
					galaxy = UIRoot.instance.galaxySelect.starmap.galaxyData;
					StarList.ClearOptions();
					ResultList.ClearOptions();
					StarData[] stars = galaxy.stars;
					foreach (StarData val in stars)
					{
						StarList.options.Add(new OptionData(val.displayName));
					}
					StarList.value = -1;
					StarList.RefreshShownValue();
					if (SearchNext)
					{
						((UnityEvent)SearchButton.onClick).Invoke();
					}
				}
			}
			else if (GameMain.galaxy != null)
			{
				SearchNext = false;
				if (galaxy != GameMain.galaxy)
				{
					TitleText.text = "读档模式".getTranslate();
					galaxy = GameMain.galaxy;
					StarList.ClearOptions();
					ResultList.ClearOptions();
					StarData[] stars2 = galaxy.stars;
					foreach (StarData val2 in stars2)
					{
						StarList.options.Add(new OptionData(val2.displayName));
					}
					StarList.value = -1;
					StarList.RefreshShownValue();
				}
				if (Input.GetKeyDown(tpKey))
				{
					UIRoot.instance.uiGame.buildMenu.SetCurrentCategory(0);
					object obj = galaxy.StarById(StarList.value + 1);
					GameMain.data.ArriveStar((StarData)obj);
					if (PlanetList.value > 0)
					{
						obj = ((StarData)obj).planets[PlanetList.value - 1];
					}
					((MonoBehaviour)this).StartCoroutine(wait(obj));
				}
				if ((Input.GetKeyDown((KeyCode)308) && Input.GetKey((KeyCode)306)) || (Input.GetKey((KeyCode)308) && Input.GetKeyDown((KeyCode)306)))
				{
					PrePos = Vector3.zero;
					PrePosText.text = "无预设坐标";
				}
				if (Input.GetMouseButtonDown(0) && Input.GetKey((KeyCode)308) && Input.GetKey((KeyCode)306) && GameMain.localPlanet != null)
				{
					Ray val3 = GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition);
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Raycast(val3, ref val4, 800f, 8720, (QueryTriggerInteraction)2))
					{
						PrePos = ((RaycastHit)(ref val4)).point;
						PrePosText.text = ((object)(Vector3)(ref PrePos)).ToString();
					}
				}
				if (PrePos != Vector3.zero && GameMain.localPlanet != null)
				{
					if ((Object)(object)PrePosLine == (Object)null)
					{
						UIPowerGizmo powerGizmo = UIRoot.instance.uiGame.powerGizmo;
						LineRenderer value3 = Traverse.Create((object)powerGizmo).Field("lineGizmoPrefab").GetValue<LineRenderer>();
						PrePosLine = Object.Instantiate<LineRenderer>(value3, GameMain.mainPlayer.transform.parent);
					}
					if ((Object)(object)PrePosLine != (Object)null)
					{
						((Component)PrePosLine).transform.SetParent(GameMain.mainPlayer.transform.parent);
						PrePosLine.SetPosition(0, GameMain.mainPlayer.position);
						PrePosLine.SetPosition(1, PrePos);
						if (!((Component)PrePosLine).gameObject.activeSelf)
						{
							((Component)PrePosLine).gameObject.SetActive(true);
						}
					}
				}
				else
				{
					if (PrePos != Vector3.zero)
					{
						PrePos = Vector3.zero;
						PrePosText.text = "无预设坐标";
					}
					if ((Object)(object)PrePosLine != (Object)null && ((Component)PrePosLine).gameObject.activeSelf)
					{
						((Component)PrePosLine).gameObject.SetActive(false);
					}
				}
			}
			else if (TitleText.text != "等待数据".getTranslate())
			{
				TitleText.text = "等待数据".getTranslate();
				StarList.ClearOptions();
				PlanetList.ClearOptions();
				ResultList.ClearOptions();
				InfoText.text = "";
				SearchNext = false;
			}
			if (loadingStarData)
			{
				StarData val5 = galaxy.StarById(StarList.value + 1);
				if (val5.loaded || !LoadResAmount.isOn)
				{
					loadingStarData = false;
				}
				PlanetList.value = -1;
				PlanetList.RefreshShownValue();
			}
		}
		else if ((Object)(object)((Component)UIRoot.instance.overlayCanvas).transform != (Object)null && (Object)(object)GameMain.instance != (Object)null)
		{
			LoadUIData();
			Translate();
			InitSeachUI();
			((UnityEvent<int>)(object)StarList.onValueChanged).AddListener((UnityAction<int>)OnStarChange);
			((UnityEvent<int>)(object)PlanetList.onValueChanged).AddListener((UnityAction<int>)OnPlanetChange);
			((UnityEvent)SearchButton.onClick).AddListener(new UnityAction(OnSearchButtonClick));
			((UnityEvent<int>)(object)ResultList.onValueChanged).AddListener((UnityAction<int>)OnResultChange);
			((UnityEvent)SetBaseButton.onClick).AddListener(new UnityAction(OnSetBase));
			((UnityEvent)AddSearcherButton.onClick).AddListener(new UnityAction(AddSearcher));
			((UnityEvent)RemoveSearcherButton.onClick).AddListener(new UnityAction(RemoveSearcher));
			((UnityEvent<int>)(object)SearcherList.onValueChanged).AddListener((UnityAction<int>)ShowSearcher);
			dataLoadOver = true;
		}
	}

	private void LoadUIData()
	{
		ui_StarMapToolsBasePanel = Object.Instantiate<GameObject>(prefab_StarMapToolsBasePanel, ((Component)UIRoot.instance.overlayCanvas).transform);
		((Component)ui_StarMapToolsBasePanel.transform.Find("TitleText")).gameObject.AddComponent<Drag>();
		ui_StarMapToolsBasePanel.SetActive(false);
		TitleText = ((Component)ui_StarMapToolsBasePanel.transform.Find("TitleText")).GetComponent<Text>();
		StarList = ((Component)ui_StarMapToolsBasePanel.transform.Find("StarList")).GetComponent<Dropdown>();
		PlanetList = ((Component)ui_StarMapToolsBasePanel.transform.Find("PlanetList")).GetComponent<Dropdown>();
		InfoText = ((Component)ui_StarMapToolsBasePanel.transform.Find("InfoText")).GetComponent<InputField>();
		LoadResAmount = ((Component)ui_StarMapToolsBasePanel.transform.Find("LoadResAmount")).GetComponent<Toggle>();
		OptionsList = ((Component)ui_StarMapToolsBasePanel.transform.Find("OptionsList")).GetComponent<ScrollRect>();
		SearchNextToggle = ((Component)ui_StarMapToolsBasePanel.transform.Find("SearchNextToggle")).GetComponent<Toggle>();
		RandomSearchToggle = ((Component)ui_StarMapToolsBasePanel.transform.Find("RandomSearchToggle")).GetComponent<Toggle>();
		DysonLuminoText = ((Component)ui_StarMapToolsBasePanel.transform.Find("DysonLuminoText")).GetComponent<InputField>();
		DistanceText = ((Component)ui_StarMapToolsBasePanel.transform.Find("DistanceText")).GetComponent<InputField>();
		ResultList = ((Component)ui_StarMapToolsBasePanel.transform.Find("ResultList")).GetComponent<Dropdown>();
		SearchButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("SearchButton")).GetComponent<Button>();
		VeinAmountText = ((Component)ui_StarMapToolsBasePanel.transform.Find("VeinAmountText")).GetComponent<InputField>();
		ChangeButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("ChangeButton")).GetComponent<Button>();
		PrePosText = ((Component)ui_StarMapToolsBasePanel.transform.Find("PrePosText")).GetComponent<Text>();
		VeinGroupToggle = ((Component)ui_StarMapToolsBasePanel.transform.Find("VeinGroupToggle")).GetComponent<Toggle>();
		VeinPGroupToggle = ((Component)ui_StarMapToolsBasePanel.transform.Find("VeinPGroupToggle")).GetComponent<Toggle>();
		BaseSkinDropDown = ((Component)ui_StarMapToolsBasePanel.transform.Find("BaseSkinDropDown")).GetComponent<Dropdown>();
		SetBaseButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("SetBaseButton")).GetComponent<Button>();
		RemoveVeinButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("RemoveVeinButton")).GetComponent<Button>();
		AddVeinButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("AddVeinButton")).GetComponent<Button>();
		RemoveSearcherButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("RemoveSearcherButton")).GetComponent<Button>();
		AddSearcherButton = ((Component)ui_StarMapToolsBasePanel.transform.Find("AddSearcherButton")).GetComponent<Button>();
		SearcherList = ((Component)ui_StarMapToolsBasePanel.transform.Find("SearcherList")).GetComponent<Dropdown>();
		((Component)VeinGroupToggle).gameObject.SetActive(false);
		((Component)VeinPGroupToggle).gameObject.SetActive(false);
		((Component)AddVeinButton).gameObject.SetActive(false);
		((Component)RemoveVeinButton).gameObject.SetActive(false);
		((Component)VeinAmountText).gameObject.SetActive(false);
		((Component)PrePosText).gameObject.SetActive(false);
		((Component)ChangeButton).gameObject.SetActive(false);
		((Component)ui_StarMapToolsBasePanel.transform.Find("VeinPTypeDropdown")).gameObject.SetActive(false);
		((Component)ui_StarMapToolsBasePanel.transform.Find("VeinTypeDropdown")).gameObject.SetActive(false);
		((Component)ui_StarMapToolsBasePanel.transform.Find("VeinNumText")).gameObject.SetActive(false);
	}

	private void Translate()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Invalid comparison between Unknown and I4
		IsEnglish = (int)Localization.CurrentLanguage.glyph == 0;
		if (IsEnglish)
		{
			((Component)((Component)LoadResAmount).transform.Find("Label")).GetComponent<Text>().text = "加载矿物数量".getTranslate();
			((Component)((Component)SearchNextToggle).transform.Find("Label")).GetComponent<Text>().text = "连续搜索".getTranslate();
			((Component)((Component)SearchButton).transform.Find("Text")).GetComponent<Text>().text = "搜索".getTranslate();
			((Component)((Component)DysonLuminoText).transform.Find("Placeholder")).GetComponent<Text>().text = "最小光度".getTranslate();
			((Component)((Component)DistanceText).transform.Find("Placeholder")).GetComponent<Text>().text = "最远距离".getTranslate();
		}
	}

	private void InitSeachUI()
	{
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Expected O, but got Unknown
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Expected O, but got Unknown
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Expected O, but got Unknown
		//IL_041f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Expected O, but got Unknown
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_047f: Unknown result type (might be due to invalid IL or missing references)
		//IL_052b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Unknown result type (might be due to invalid IL or missing references)
		Toggle component = ((Component)((Transform)OptionsList.content).Find("TempToggle")).GetComponent<Toggle>();
		GameObject gameObject = ((Component)((Transform)OptionsList.content).Find("TempNumLabel")).gameObject;
		List<string> allStarTypes = StarSearcher.AllStarTypes;
		List<string> allPlanteTypes = StarSearcher.AllPlanteTypes;
		List<string> allSingularityTypes = StarSearcher.AllSingularityTypes;
		List<string> allVeinTypes = StarSearcher.AllVeinTypes;
		StarTypesToggleList = new List<Toggle>();
		PlanteTypesNumLabelList = new List<RectTransform>();
		SingularityTypesNumLabelList = new List<RectTransform>();
		VeinTypesToggleList = new List<Toggle>();
		for (int i = 0; i < allStarTypes.Count; i++)
		{
			RectTransform component2 = ((Component)Object.Instantiate<Toggle>(component, ((Component)component).transform.parent)).GetComponent<RectTransform>();
			((Component)((Transform)component2).Find("Label")).GetComponent<Text>().text = allStarTypes[i];
			((Component)component2).GetComponent<Toggle>().isOn = true;
			component2.anchorMax = new Vector2(0.25f, (float)(1.0 - (double)i * 0.1));
			component2.anchorMin = new Vector2(0f, (float)(1.0 - (double)(i + 1) * 0.1));
			((Component)component2).gameObject.SetActive(true);
			StarTypesToggleList.Add(((Component)component2).GetComponent<Toggle>());
		}
		for (int j = 0; j < allPlanteTypes.Count; j++)
		{
			RectTransform numLabel = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent).GetComponent<RectTransform>();
			((Component)((Transform)numLabel).Find("Label")).GetComponent<Text>().text = allPlanteTypes[j];
			((Component)((Transform)numLabel).Find("NumText")).GetComponent<Text>().text = "0";
			((UnityEvent)((Component)((Transform)numLabel).Find("+")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				int.TryParse(((Component)((Transform)numLabel).Find("NumText")).GetComponent<Text>().text, out var result4);
				result4++;
				((Component)((Transform)numLabel).Find("NumText")).GetComponent<Text>().text = result4.ToString();
			});
			((UnityEvent)((Component)((Transform)numLabel).Find("-")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				int.TryParse(((Component)((Transform)numLabel).Find("NumText")).GetComponent<Text>().text, out var result3);
				result3--;
				((Component)((Transform)numLabel).Find("NumText")).GetComponent<Text>().text = ((result3 > 0) ? result3 : 0).ToString();
			});
			if (j < allPlanteTypes.Count / 2 + 5)
			{
				numLabel.anchorMax = new Vector2(0.5f, (float)(1.0 - (double)j * 0.1));
				numLabel.anchorMin = new Vector2(0.25f, (float)(1.0 - (double)(j + 1) * 0.1));
			}
			else
			{
				int num = j - allPlanteTypes.Count / 2 - 5 + allSingularityTypes.Count;
				numLabel.anchorMax = new Vector2(0.75f, (float)(1.0 - (double)num * 0.1));
				numLabel.anchorMin = new Vector2(0.5f, (float)(1.0 - (double)(num + 1) * 0.1));
			}
			((Component)numLabel).gameObject.SetActive(true);
			PlanteTypesNumLabelList.Add(numLabel);
		}
		for (int k = 0; k < allSingularityTypes.Count; k++)
		{
			RectTransform numLabel2 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent).GetComponent<RectTransform>();
			((Component)((Transform)numLabel2).Find("Label")).GetComponent<Text>().text = allSingularityTypes[k];
			((Component)((Transform)numLabel2).Find("NumText")).GetComponent<Text>().text = "0";
			((UnityEvent)((Component)((Transform)numLabel2).Find("+")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				int.TryParse(((Component)((Transform)numLabel2).Find("NumText")).GetComponent<Text>().text, out var result2);
				result2++;
				((Component)((Transform)numLabel2).Find("NumText")).GetComponent<Text>().text = result2.ToString();
			});
			((UnityEvent)((Component)((Transform)numLabel2).Find("-")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				int.TryParse(((Component)((Transform)numLabel2).Find("NumText")).GetComponent<Text>().text, out var result);
				result--;
				((Component)((Transform)numLabel2).Find("NumText")).GetComponent<Text>().text = ((result > 0) ? result : 0).ToString();
			});
			numLabel2.anchorMax = new Vector2(0.75f, (float)(1.0 - (double)k * 0.1));
			numLabel2.anchorMin = new Vector2(0.5f, (float)(1.0 - (double)(k + 1) * 0.1));
			((Component)numLabel2).gameObject.SetActive(true);
			SingularityTypesNumLabelList.Add(numLabel2);
		}
		for (int l = 0; l < allVeinTypes.Count; l++)
		{
			RectTransform component3 = ((Component)Object.Instantiate<Toggle>(component, ((Component)component).transform.parent)).GetComponent<RectTransform>();
			((Component)((Transform)component3).Find("Label")).GetComponent<Text>().text = allVeinTypes[l];
			component3.anchorMax = new Vector2(1f, (float)(1.0 - (double)l * 0.1));
			component3.anchorMin = new Vector2(0.75f, (float)(1.0 - (double)(l + 1) * 0.1));
			((Component)component3).gameObject.SetActive(true);
			VeinTypesToggleList.Add(((Component)component3).GetComponent<Toggle>());
		}
	}

	private void OnStarChange(int arg0)
	{
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Expected O, but got Unknown
		PlanetList.ClearOptions();
		if (StarList.value >= 0 && StarList.value < galaxy.starCount)
		{
			StarData val = galaxy.StarById(StarList.value + 1);
			if (LoadResAmount.isOn && UIRoot.instance.galaxySelect.starmap.galaxyData != null && !val.loaded)
			{
				val.Load();
			}
			PlanetList.options.Add(new OptionData("恒星".getTranslate()));
			PlanetData[] planets = val.planets;
			foreach (PlanetData val2 in planets)
			{
				PlanetList.options.Add(new OptionData(val2.displayName));
			}
			PlanetList.value = -1;
			PlanetList.RefreshShownValue();
		}
	}

	private void OnPlanetChange(int arg0)
	{
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Invalid comparison between Unknown and I4
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0408: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		StarData val = galaxy.StarById(StarList.value + 1);
		if (PlanetList.value > 0 && PlanetList.value <= val.planetCount)
		{
			PlanetData val2 = val.planets[PlanetList.value - 1];
			string text = val2.displayName + "的信息:".getTranslate() + "\n";
			text = text + "词条:".getTranslate() + val2.singularityString + "\n";
			text = text + "类型:".getTranslate() + val2.typeString + "\n";
			string translate = "未知".getTranslate();
			text = string.Concat(str2: val2.waterItemId switch
			{
				0 => "无".getTranslate(), 
				-1 => "熔岩".getTranslate(), 
				_ => LDB.ItemName(val2.waterItemId), 
			}, str0: text, str1: "海洋类型:".getTranslate(), str3: "\n");
			int[] array = veinSpotsSketch(val2);
			if ((int)val2.type != 5 && array != null)
			{
				text = text + "矿物信息:".getTranslate() + "\n";
				long[] array2 = new long[64];
				val2.CalcVeinAmounts(ref array2, new HashSet<int>(), UIRoot.instance.uiGame.veinAmountDisplayFilter);
				for (int i = 0; i < ((ProtoTable)LDB.veins).Length; i++)
				{
					string name = ((Proto)((ProtoSet<VeinProto>)(object)LDB.veins).dataArray[i]).name;
					object obj2 = array2[i + 1];
					if (array[i + 1] == 0)
					{
						obj2 = "无".getTranslate();
					}
					else if ((long)obj2 == 0)
					{
						if (!LoadResAmount.isOn)
						{
							obj2 = "有".getTranslate();
						}
						else if (UIRoot.instance.galaxySelect.starmap.galaxyData != null)
						{
							obj2 = "正在加载".getTranslate();
							loadingStarData = true;
						}
						else
						{
							obj2 = "未加载,靠近后显示".getTranslate();
						}
					}
					else if (i + 1 == 7)
					{
						obj2 = (double)(long)obj2 * (double)VeinData.oilSpeedMultiplier + " /s";
					}
					text = text + "    " + name + ":" + obj2?.ToString() + "\n";
				}
			}
			InfoText.text = text;
		}
		else
		{
			if (PlanetList.value != 0)
			{
				return;
			}
			string text2 = val.displayName + "星系的信息:".getTranslate() + (loadingStarData ? "正在加载".getTranslate() : "") + "\n";
			text2 = text2 + "恒星类型:".getTranslate() + val.typeString + "\n";
			text2 = text2 + "星球数量:".getTranslate() + val.planetCount + "\n";
			text2 = text2 + "光度:".getTranslate() + val.dysonLumino + "\n";
			string[] obj3 = new string[5]
			{
				text2,
				"距离初始星系恒星:".getTranslate(),
				null,
				null,
				null
			};
			VectorLF3 val3 = val.uPosition - galaxy.StarById(1).uPosition;
			obj3[2] = (((VectorLF3)(ref val3)).magnitude / 2400000.0).ToString();
			obj3[3] = "光年".getTranslate();
			obj3[4] = "\n";
			text2 = string.Concat(obj3);
			text2 += "星球列表:".getTranslate();
			long[] array3 = new long[64];
			int[] array4 = new int[30];
			PlanetData[] planets = val.planets;
			foreach (PlanetData val4 in planets)
			{
				long[] array5 = new long[64];
				val4.CalcVeinAmounts(ref array5, new HashSet<int>(), UIRoot.instance.uiGame.veinAmountDisplayFilter);
				int[] array6 = veinSpotsSketch(val4);
				for (int k = 0; k < ((ProtoTable)LDB.veins).Length; k++)
				{
					array3[k + 1] += array5[k + 1];
					if (array6 != null)
					{
						array4[k + 1] += array6[k + 1];
					}
				}
				text2 = text2 + "-" + val4.typeString + "  " + val4.singularityString;
			}
			text2 = text2 + "\n" + "矿物信息:".getTranslate() + "\n";
			for (int l = 0; l < ((ProtoTable)LDB.veins).Length; l++)
			{
				string name2 = ((Proto)((ProtoSet<VeinProto>)(object)LDB.veins).dataArray[l]).name;
				object obj4 = array3[l + 1];
				if (array4[l + 1] == 0)
				{
					obj4 = "无".getTranslate();
				}
				else if ((long)obj4 == 0)
				{
					if (!LoadResAmount.isOn)
					{
						obj4 = "有".getTranslate();
					}
					else if (UIRoot.instance.galaxySelect.starmap.galaxyData != null)
					{
						obj4 = "正在加载".getTranslate();
						loadingStarData = true;
					}
					else
					{
						obj4 = "未加载,靠近后显示".getTranslate();
					}
				}
				else if (l + 1 == 7)
				{
					obj4 = (double)(long)obj4 * (double)VeinData.oilSpeedMultiplier + " /s";
				}
				text2 = text2 + "    " + name2 + ":" + obj4?.ToString() + "\n";
			}
			InfoText.text = text2;
		}
	}

	private void OnResultChange(int arg0)
	{
		StarList.value = SerachResult[ResultList.value].index;
		StarList.RefreshShownValue();
	}

	private void AddSearcher()
	{
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Expected O, but got Unknown
		StarSearcher starSearcher = new StarSearcher();
		starSearcher.Clear();
		float.TryParse((DysonLuminoText.text == "") ? "0" : DysonLuminoText.text, out starSearcher.dysonLumino);
		float.TryParse((DistanceText.text == "") ? "1000" : DistanceText.text, out starSearcher.distance);
		foreach (Toggle starTypesToggle in StarTypesToggleList)
		{
			if (starTypesToggle.isOn)
			{
				string text = ((Component)((Component)starTypesToggle).transform.Find("Label")).GetComponent<Text>().text;
				starSearcher.StarTypes.Add(text);
			}
		}
		foreach (RectTransform planteTypesNumLabel in PlanteTypesNumLabelList)
		{
			int.TryParse(((Component)((Transform)planteTypesNumLabel).Find("NumText")).GetComponent<Text>().text, out var result);
			if (result > 0)
			{
				string text2 = ((Component)((Transform)planteTypesNumLabel).Find("Label")).GetComponent<Text>().text;
				starSearcher.PlanteTypes.Add(text2 + "*" + result);
			}
		}
		foreach (RectTransform singularityTypesNumLabel in SingularityTypesNumLabelList)
		{
			int.TryParse(((Component)((Transform)singularityTypesNumLabel).Find("NumText")).GetComponent<Text>().text, out var result2);
			if (result2 > 0)
			{
				string text3 = ((Component)((Transform)singularityTypesNumLabel).Find("Label")).GetComponent<Text>().text;
				starSearcher.SingularityTypes.Add(text3 + "*" + result2);
			}
		}
		foreach (Toggle veinTypesToggle in VeinTypesToggleList)
		{
			if (veinTypesToggle.isOn)
			{
				string text4 = ((Component)((Component)veinTypesToggle).transform.Find("Label")).GetComponent<Text>().text;
				starSearcher.VeinTypes.Add(text4);
			}
		}
		starSearchers.Add(starSearcher);
		SearcherList.ClearOptions();
		for (int i = 0; i < starSearchers.Count; i++)
		{
			SearcherList.options.Add(new OptionData("条件" + i));
		}
		SearcherList.value = SearcherList.options.Count - 1;
		SearcherList.RefreshShownValue();
	}

	private void RemoveSearcher()
	{
		if (starSearchers.Count > 0)
		{
			starSearchers.RemoveAt(SearcherList.value);
			SearcherList.options.RemoveAt(SearcherList.value);
			SearcherList.value = SearcherList.options.Count - 1;
			SearcherList.RefreshShownValue();
			ShowSearcher(0);
		}
	}

	private void ShowSearcher(int arg0)
	{
		if (SearcherList.options.Count <= 0)
		{
			return;
		}
		StarSearcher starSearcher = starSearchers[SearcherList.value];
		DysonLuminoText.text = starSearcher.dysonLumino.ToString();
		DistanceText.text = starSearcher.distance.ToString();
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		foreach (Toggle starTypesToggle in StarTypesToggleList)
		{
			string text = ((Component)((Component)starTypesToggle).transform.Find("Label")).GetComponent<Text>().text;
			if (starSearcher.StarTypes.Contains(text))
			{
				starTypesToggle.isOn = true;
			}
			else
			{
				starTypesToggle.isOn = false;
			}
		}
		dictionary.Clear();
		foreach (string planteType in starSearcher.PlanteTypes)
		{
			string[] array = planteType.Split(new char[1] { '*' });
			dictionary.Add(array[0], array[1]);
		}
		foreach (RectTransform planteTypesNumLabel in PlanteTypesNumLabelList)
		{
			string text2 = ((Component)((Transform)planteTypesNumLabel).Find("Label")).GetComponent<Text>().text;
			if (dictionary.ContainsKey(text2))
			{
				((Component)((Transform)planteTypesNumLabel).Find("NumText")).GetComponent<Text>().text = dictionary[text2];
			}
			else
			{
				((Component)((Transform)planteTypesNumLabel).Find("NumText")).GetComponent<Text>().text = "0";
			}
		}
		dictionary.Clear();
		foreach (string singularityType in starSearcher.SingularityTypes)
		{
			string[] array2 = singularityType.Split(new char[1] { '*' });
			dictionary.Add(array2[0], array2[1]);
		}
		foreach (RectTransform singularityTypesNumLabel in SingularityTypesNumLabelList)
		{
			string text3 = ((Component)((Transform)singularityTypesNumLabel).Find("Label")).GetComponent<Text>().text;
			if (dictionary.ContainsKey(text3))
			{
				((Component)((Transform)singularityTypesNumLabel).Find("NumText")).GetComponent<Text>().text = dictionary[text3];
			}
			else
			{
				((Component)((Transform)singularityTypesNumLabel).Find("NumText")).GetComponent<Text>().text = "0";
			}
		}
		foreach (Toggle veinTypesToggle in VeinTypesToggleList)
		{
			string text4 = ((Component)((Component)veinTypesToggle).transform.Find("Label")).GetComponent<Text>().text;
			if (starSearcher.VeinTypes.Contains(text4))
			{
				veinTypesToggle.isOn = true;
			}
			else
			{
				veinTypesToggle.isOn = false;
			}
		}
	}

	private void OnSearchButtonClick()
	{
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		SearchNext = false;
		StarSearcher.galaxyData = galaxy;
		SerachResult.Clear();
		ResultList.ClearOptions();
		for (int i = 0; i < starSearchers.Count; i++)
		{
			StarSearcher starSearcher = starSearchers[i];
			List<StarData> list = starSearcher.Search();
			if (list.Count == 0)
			{
				SearchNext = true;
				break;
			}
			SerachResult.AddRange(list);
		}
		if (SearchNext)
		{
			return;
		}
		foreach (StarData item in SerachResult)
		{
			ResultList.options.Add(new OptionData(item.displayName));
		}
		ResultList.value = -1;
		ResultList.RefreshShownValue();
	}

	private void OnSetBase()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Invalid comparison between Unknown and I4
		if (GameMain.localPlanet != null && (int)GameMain.localPlanet.type != 5)
		{
			for (int i = 0; i < GameMain.localPlanet.factory.vegePool.Length; i++)
			{
				GameMain.localPlanet.factory.RemoveVegeWithComponents(i);
			}
			byte[] modData = GameMain.localPlanet.modData;
			for (int j = 0; j < modData.Length * 2; j++)
			{
				GameMain.localPlanet.AddHeightMapModLevel(j, 3);
			}
			if (GameMain.localPlanet.UpdateDirtyMeshes())
			{
				GameMain.localPlanet.factory.RenderLocalPlanetHeightmap();
			}
			if (GameMain.localPlanet.factory.platformSystem.reformData == null)
			{
				GameMain.localPlanet.factory.platformSystem.InitReformData();
			}
			byte[] reformData = GameMain.localPlanet.factory.platformSystem.reformData;
			for (int k = 0; k < reformData.Length; k++)
			{
				GameMain.localPlanet.factory.platformSystem.SetReformType(k, BaseSkinDropDown.value);
				GameMain.localPlanet.factory.platformSystem.SetReformColor(k, 0);
			}
		}
	}

	public static int[] veinSpotsSketch(PlanetData planet)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Invalid comparison between Unknown and I4
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Invalid comparison between Unknown and I4
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Invalid comparison between Unknown and I4
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Invalid comparison between Unknown and I4
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Invalid comparison between Unknown and I4
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Invalid comparison between Unknown and I4
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Invalid comparison between Unknown and I4
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Invalid comparison between Unknown and I4
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Invalid comparison between Unknown and I4
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Invalid comparison between Unknown and I4
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Invalid comparison between Unknown and I4
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Invalid comparison between Unknown and I4
		ThemeProto val = ((ProtoSet<ThemeProto>)(object)LDB.themes).Select(planet.theme);
		if (val != null)
		{
			DotNet35Random val2 = new DotNet35Random(planet.seed);
			val2.Next();
			val2.Next();
			val2.Next();
			val2.Next();
			val2.Next();
			val2.Next();
			VeinProto[] veinProtos = PlanetModelingManager.veinProtos;
			int[] array = new int[veinProtos.Length];
			if (val.VeinSpot != null)
			{
				Array.Copy(val.VeinSpot, 0, array, 1, Math.Min(val.VeinSpot.Length, array.Length - 1));
			}
			float num = 1f;
			ESpectrType spectr = planet.star.spectr;
			EStarType type = planet.star.type;
			if ((int)type == 0)
			{
				if ((int)spectr == 0)
				{
					num = 2.5f;
				}
				else if ((int)spectr == 1)
				{
					num = 1f;
				}
				else if ((int)spectr == 2)
				{
					num = 0.7f;
				}
				else if ((int)spectr == 3)
				{
					num = 0.6f;
				}
				else if ((int)spectr == 4)
				{
					num = 1f;
				}
				else if ((int)spectr == 5)
				{
					num = 0.4f;
				}
				else if ((int)spectr == 6)
				{
					num = 1.6f;
				}
			}
			else if ((int)type == 1)
			{
				num = 2.5f;
			}
			else if ((int)type == 2)
			{
				num = 3.5f;
				array[9] += 2;
				for (int i = 1; i < 12; i++)
				{
					if (!(val2.NextDouble() < 0.44999998807907104))
					{
						break;
					}
					array[9]++;
				}
				array[10] += 2;
				for (int j = 1; j < 12; j++)
				{
					if (!(val2.NextDouble() < 0.44999998807907104))
					{
						break;
					}
					array[10]++;
				}
				array[12]++;
				for (int k = 1; k < 12; k++)
				{
					if (!(val2.NextDouble() < 0.5))
					{
						break;
					}
					array[12]++;
				}
			}
			else if ((int)type == 3)
			{
				num = 4.5f;
				array[14]++;
				for (int l = 1; l < 12; l++)
				{
					if (!(val2.NextDouble() < 0.6499999761581421))
					{
						break;
					}
					array[14]++;
				}
			}
			else if ((int)type == 4)
			{
				num = 5f;
				array[14]++;
				for (int m = 1; m < 12; m++)
				{
					if (!(val2.NextDouble() < 0.6499999761581421))
					{
						break;
					}
					array[14]++;
				}
			}
			for (int n = 0; n < val.RareVeins.Length; n++)
			{
				int num2 = val.RareVeins[n];
				float num3 = ((planet.star.index == 0) ? val.RareSettings[n * 4] : val.RareSettings[n * 4 + 1]);
				num3 = 1f - Mathf.Pow(1f - num3, num);
				if (!(val2.NextDouble() < (double)num3))
				{
					continue;
				}
				array[num2]++;
				for (int num4 = 1; num4 < 12; num4++)
				{
					if (!(val2.NextDouble() < (double)val.RareSettings[n * 4 + 2]))
					{
						break;
					}
					array[num2]++;
				}
			}
			return array;
		}
		return null;
	}

	private IEnumerator wait(object target)
	{
		yield return (object)new WaitForEndOfFrame();
		if (target is PlanetData)
		{
			GameMain.mainPlayer.uPosition = ((PlanetData)target).uPosition + VectorLF3.unit_z * (double)((PlanetData)target).realRadius;
		}
		else if (target is StarData)
		{
			GameMain.mainPlayer.uPosition = ((StarData)target).uPosition + VectorLF3.unit_z * (double)((StarData)target).physicsRadius;
			loadingStarData = true;
		}
		else if (target is VectorLF3)
		{
			GameMain.mainPlayer.uPosition = (VectorLF3)target;
		}
		else if (target is string && (string)target == "resize")
		{
			GameMain.mainPlayer.transform.localScale = Vector3.one;
		}
		if (!(target is string) || (string)target != "resize")
		{
			((MonoBehaviour)this).StartCoroutine(wait("resize"));
		}
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIStarmap), "OnStarClick")]
	private static bool OnStarClick(UIStarmapStar star)
	{
		if (self.showGUI)
		{
			self.StarList.value = star.star.index;
			self.StarList.RefreshShownValue();
		}
		return true;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIStarmap), "OnPlanetClick")]
	private static bool OnPlanetClick(UIStarmapPlanet planet)
	{
		if (self.showGUI)
		{
			self.StarList.value = planet.planet.star.index;
			self.StarList.RefreshShownValue();
			self.PlanetList.value = planet.planet.index + 1;
			self.PlanetList.RefreshShownValue();
		}
		return true;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(GalaxyData), "Free")]
	private static bool Free(GalaxyData __instance)
	{
		StarData[] stars = __instance.stars;
		foreach (StarData val in stars)
		{
			PlanetData[] planets = val.planets;
			foreach (PlanetData val2 in planets)
			{
				if (val2.loading)
				{
					Debug.Log((object)"由StarMapTools阻止的GalaxyData.Free()");
					return false;
				}
			}
		}
		return true;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
	public static void _OnUpdate(UIMinerWindow __instance)
	{
		//IL_0012: 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_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Invalid comparison between Unknown and I4
		MinerComponent val = __instance.factorySystem.minerPool[__instance.minerId];
		if ((int)val.type != 2 || val.veinCount <= 0)
		{
			return;
		}
		VeinData[] veinPool = __instance.factory.veinPool;
		int num = ((val.veinCount != 0) ? val.veins[val.currentVeinIndex] : 0);
		int productId = veinPool[num].productId;
		ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(productId);
		float num2 = 60f * (float)val.speed * GameMain.history.miningSpeedScale * (float)val.veinCount / (float)val.period;
		Text value = Traverse.Create((object)__instance).Field("coverText").GetValue<Text>();
		string text = "";
		foreach (RecipeProto make in val2.makes)
		{
			if ((int)make.Type == 1)
			{
				text = text + "   可供" + ((double)(num2 / (float)make.ItemCounts[0]) / ((double)(float)make.ResultCounts[0] / ((double)make.TimeSpend / 60.0))).ToString("0.0") + "个熔炉产" + LDB.ItemName(make.Results[0]);
			}
		}
		if (text != "")
		{
			Text val3 = value;
			val3.text = val3.text + "\n" + text;
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIStarmapStar), "OnStarDisplayNameChange")]
	public static void OnStarDisplayNameChange()
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Expected O, but got Unknown
		if (self.galaxy != null)
		{
			self.StarList.ClearOptions();
			self.ResultList.ClearOptions();
			StarData[] stars = self.galaxy.stars;
			foreach (StarData val in stars)
			{
				self.StarList.options.Add(new OptionData(val.displayName));
			}
			self.StarList.value = -1;
			self.StarList.RefreshShownValue();
		}
	}
}
public static class StarMapToolsTranslate
{
	private static Dictionary<string, string> TranslateDict = new Dictionary<string, string>();

	public static string getTranslate(this string s)
	{
		if (StarMapTools.IsEnglish && TranslateDict.ContainsKey(s))
		{
			return TranslateDict[s];
		}
		return s;
	}

	public static void regAllTranslate()
	{
		TranslateDict.Clear();
		TranslateDict.Add("开关GUI的按键", "Open and Close GUI Key");
		TranslateDict.Add("传送按键", "TP Key");
		TranslateDict.Add("新游戏模式", "NEW GAME");
		TranslateDict.Add("读档模式", "IN GAME");
		TranslateDict.Add("等待数据", "WAIT DATA");
		TranslateDict.Add("加载矿物数量", "Load Vein Amount");
		TranslateDict.Add("连续搜索", "Search Next Seed");
		TranslateDict.Add("最小光度", "Minimum luminosity");
		TranslateDict.Add("最远距离", "Maximum light year");
		TranslateDict.Add("搜索", "Search");
		TranslateDict.Add("恒星", "Star");
		TranslateDict.Add("恒星类型:", "Star Type:");
		TranslateDict.Add("星球数量:", "Planet Num:");
		TranslateDict.Add("星系的信息:", " Info:");
		TranslateDict.Add("光度:", "Luminosity:");
		TranslateDict.Add("距离初始星系恒星:", "Distance from the beginning:");
		TranslateDict.Add("光年", "Light years");
		TranslateDict.Add("星球列表:", "Planet List:");
		TranslateDict.Add("的信息:", " Info:");
		TranslateDict.Add("类型:", "Type:");
		TranslateDict.Add("词条:", "Singularity:");
		TranslateDict.Add("海洋类型:", "Ocean Type:");
		TranslateDict.Add("未知", " Unknown:");
		TranslateDict.Add("熔岩", " Lava");
		TranslateDict.Add("矿物信息:", "VeinList:");
		TranslateDict.Add("无", "None");
		TranslateDict.Add("有", "Exist");
		TranslateDict.Add("正在加载", "Loading");
		TranslateDict.Add("未加载,靠近后显示", "Not loaded, display when approaching");
	}
}
internal class StarSearcher
{
	public List<string> StarTypes = new List<string>();

	public List<string> PlanteTypes = new List<string>();

	public List<string> SingularityTypes = new List<string>();

	public List<string> VeinTypes = new List<string>();

	public float dysonLumino;

	public float distance;

	public static GalaxyData galaxyData { get; set; }

	public static List<string> AllStarTypes => new List<string>
	{
		Localization.Translate("红巨星"),
		Localization.Translate("黄巨星"),
		Localization.Translate("白巨星"),
		Localization.Translate("蓝巨星"),
		"M" + Localization.Translate("型恒星"),
		"K" + Localization.Translate("型恒星"),
		"G" + Localization.Translate("型恒星"),
		"F" + Localization.Translate("型恒星"),
		"A" + Localization.Translate("型恒星"),
		"B" + Localization.Translate("型恒星"),
		"O" + Localization.Translate("型恒星"),
		Localization.Translate("中子星"),
		Localization.Translate("白矮星"),
		Localization.Translate("黑洞")
	};

	public static List<string> AllPlanteTypes
	{
		get
		{
			List<string> list = new List<string>();
			ThemeProto[] dataArray = ((ProtoSet<ThemeProto>)(object)LDB.themes).dataArray;
			foreach (ThemeProto val in dataArray)
			{
				if (!list.Contains(val.displayName))
				{
					list.Add(val.displayName);
				}
			}
			return list;
		}
	}

	public static List<string> AllSingularityTypes => new List<string>
	{
		Localization.Translate("卫星"),
		Localization.Translate("潮汐锁定永昼永夜"),
		Localization.Translate("潮汐锁定1:2"),
		Localization.Translate("潮汐锁定1:4"),
		Localization.Translate("横躺自转"),
		Localization.Translate("反向自转"),
		Localization.Translate("多卫星")
	};

	public static List<string> AllVeinTypes
	{
		get
		{
			List<string> list = new List<string>();
			VeinProto[] dataArray = ((ProtoSet<VeinProto>)(object)LDB.veins).dataArray;
			foreach (VeinProto val in dataArray)
			{
				list.Add(((Proto)val).name);
			}
			return list;
		}
	}

	public List<StarData> Search()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		List<StarData> list = new List<StarData>();
		if (galaxyData != null)
		{
			StarData[] stars = galaxyData.stars;
			foreach (StarData val in stars)
			{
				if (!StarTypes.Contains(val.typeString) || !(val.dysonLumino >= dysonLumino))
				{
					continue;
				}
				VectorLF3 val2 = val.uPosition - galaxyData.StarById(1).uPosition;
				if (!(((VectorLF3)(ref val2)).magnitude / 2400000.0 <= (double)distance))
				{
					continue;
				}
				List<string> TempPlanteTypes = new List<string>();
				List<string> TempSingularityTypes = new List<string>();
				List<string> TempVeinTypes = new List<string>();
				PlanetData[] planets = val.planets;
				foreach (PlanetData val3 in planets)
				{
					TempPlanteTypes.Add(val3.typeString);
					TempSingularityTypes.Add(val3.singularityString);
				}
				int[] array = new int[30];
				PlanetData[] planets2 = val.planets;
				foreach (PlanetData planet in planets2)
				{
					int[] array2 = StarMapTools.veinSpotsSketch(planet);
					for (int l = 0; l < ((ProtoTable)LDB.veins).Length; l++)
					{
						if (array2 != null)
						{
							array[l + 1] += array2[l + 1];
						}
					}
				}
				for (int m = 0; m < ((ProtoTable)LDB.veins).Length; m++)
				{
					if (array[m + 1] > 0)
					{
						TempVeinTypes.Add(((Proto)((ProtoSet<VeinProto>)(object)LDB.veins).dataArray[m]).name);
					}
				}
				if (PlanteTypes.TrueForAll(delegate(string ePlanetType)
				{
					string[] array4 = ePlanetType.Split(new char[1] { '*' });
					int.TryParse(array4[1], out var result2);
					int num2 = 0;
					foreach (string item in TempPlanteTypes)
					{
						if (item == array4[0])
						{
							num2++;
						}
					}
					return num2 >= result2;
				}) && SingularityTypes.TrueForAll(delegate(string ePlanetSingularity)
				{
					string[] array3 = ePlanetSingularity.Split(new char[1] { '*' });
					int.TryParse(array3[1], out var result);
					int num = 0;
					foreach (string item2 in TempSingularityTypes)
					{
						if (item2 == array3[0])
						{
							num++;
						}
					}
					return num >= result;
				}) && VeinTypes.TrueForAll((string eVeinType) => TempVeinTypes.Contains(eVeinType)))
				{
					list.Add(val);
				}
			}
			return list;
		}
		return list;
	}

	public void Clear()
	{
		StarTypes.Clear();
		PlanteTypes.Clear();
		SingularityTypes.Clear();
		VeinTypes.Clear();
		dysonLumino = 0f;
		distance = 1000f;
	}
}