Decompiled source of DSPAllPlanetInfo v1.1.12

DSPAllPlanetInfo.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
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("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPAllPlanetInfo;

[HarmonyPatch]
internal class Hook
{
	[HarmonyPatch(typeof(UIPlanetDetail), "_OnUpdate")]
	private class Transpiler_replace_30to100
	{
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (list[1].opcode == OpCodes.Ldc_I4_S)
			{
				list[1].operand = 100;
			}
			return list.AsEnumerable();
		}
	}

	[HarmonyPatch(typeof(UIPlanetDetail), "_OnOpen")]
	public static class UIPlanetDetail_OnOpen_Postfix
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			UI.setWindowPos();
			if (Main.ShowAdditionalInformationWindow.Value && (int)UIGame.viewMode != 3)
			{
				if (((Component)UIRoot.instance.uiGame.mechaLab).gameObject.activeSelf)
				{
					((Component)UIRoot.instance.uiGame.mechaLab).gameObject.SetActive(false);
					MiniLabPanelOn = true;
				}
				else
				{
					MiniLabPanelOn = false;
				}
				UI.infoWindow.SetActive(UI.infoWindowEnable);
				((Component)UI.planetInfoButtonButton).GetComponent<UIButton>().highlighted = UI.infoWindowEnable;
				InfoCreater.lineMax = DSPGame.globalOption.uiLayoutHeight / 20 - 8;
				((Component)UIRoot.instance.uiGame.dfMonitor).gameObject.SetActive(!UI.infoWindowEnable);
			}
		}
	}

	[HarmonyPatch(typeof(UIPlanetDetail), "_OnClose")]
	public static class UIPlanetDetail_OnClose_Postfix
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			UI.infoWindow.SetActive(false);
			if (MiniLabPanelOn)
			{
				GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Mini Lab Panel").SetActive(true);
			}
			((Component)UIRoot.instance.uiGame.dfMonitor).gameObject.SetActive(true);
		}
	}

	[HarmonyPatch(typeof(UIPlanetDetail), "_OnOpen")]
	public static class UIPlanetDetail_OnCreate_PostPatch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			InfoCreater.pageNo = 0;
			InfoCreater.startStationNo[0] = 1;
		}
	}

	public static bool MiniLabPanelOn;

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
	[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
	[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIStarmap), "OnCursorFunction2Click")]
	[HarmonyPatch(typeof(UIStarmap), "OnStarClick")]
	public static bool UIStarDetail_Prefix(ref int __state)
	{
		__state = GameMain.history.universeObserveLevel;
		GameMain.history.universeObserveLevel = 4;
		return true;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
	[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
	[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIStarmap), "OnCursorFunction2Click")]
	[HarmonyPatch(typeof(UIStarmap), "OnStarClick")]
	public static void UIStarDetail_Postfix(int __state)
	{
		GameMain.history.universeObserveLevel = __state;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
	public static bool UIStarDetail_RefreshDynamicProperties_Prefix(UIStarDetail __instance)
	{
		if (__instance.star != null && !__instance.star.calculated)
		{
			__instance.loadingTextGo.SetActive(true);
			__instance.star.RunCalculateThread();
			return false;
		}
		return true;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
	public static void UIPlanetDetail_RefreshDynamicProperties_Postfix(UIPlanetDetail __instance)
	{
		InfoCreater.StationInfo(__instance);
	}
}
internal class InfoCreater
{
	public static int lineMax;

	public static int pageNo;

	public static int lastStationNo;

	public static int[] startStationNo = new int[100];

	public static void StationInfo(UIPlanetDetail __instance)
	{
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Invalid comparison between Unknown and I4
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Invalid comparison between Unknown and I4
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		if (!__instance.planet.calculated)
		{
			return;
		}
		int num = 0;
		int num2 = 0;
		UI.nextButton.SetActive(false);
		if (pageNo > 0)
		{
			UI.previousButton.SetActive(true);
		}
		else
		{
			UI.previousButton.SetActive(false);
		}
		if (UIRoot.instance.uiGame.planetDetail.planet.factory != null)
		{
			PlanetFactory factory = UIRoot.instance.uiGame.planetDetail.planet.factory;
			if (factory.transport.stationCursor > 0)
			{
				for (int i = startStationNo[pageNo]; i < factory.transport.stationCursor; i++)
				{
					if (factory.transport.stationPool[i] == null || !factory.transport.stationPool[i].isStellar)
					{
						continue;
					}
					if (num2 + factory.transport.stationPool[i].storage.Length > lineMax)
					{
						UI.nextButton.SetActive(true);
						lastStationNo = i;
						break;
					}
					UI.Line[num].transform.localPosition = new Vector3(-125f, UI.posY - 10f - (float)(num2 * 20), 0f);
					UI.Line[num].SetActive(true);
					UI.ItemName[num2].SetActive(false);
					UI.ItemIcon[num2].SetActive(false);
					UI.ItemLogic[num2].SetActive(false);
					UI.ItemCount[num2].SetActive(false);
					num++;
					num2++;
					for (int j = 0; j < factory.transport.stationPool[i].storage.Length; j++)
					{
						if (factory.transport.stationPool[i].storage[j].itemId != 0)
						{
							UI.ItemName[num2].GetComponent<Text>().text = ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(factory.transport.stationPool[i].storage[j].itemId)).name;
							UI.ItemName[num2].SetActive(true);
							UI.ItemIcon[num2].GetComponent<Image>().sprite = ((ProtoSet<ItemProto>)(object)LDB.items).Select(factory.transport.stationPool[i].storage[j].itemId).iconSprite;
							UI.ItemIcon[num2].SetActive(true);
							UI.ItemCount[num2].GetComponent<Text>().text = $"{factory.transport.stationPool[i].storage[j].count:#,0}";
							UI.ItemCount[num2].SetActive(true);
							if ((int)factory.transport.stationPool[i].storage[j].remoteLogic == 2)
							{
								UI.ItemLogic[num2].GetComponent<Text>().text = Localization.Translate("需求");
								((Graphic)UI.ItemLogic[num2].GetComponent<Text>()).color = new Color(0.88f, 0.55f, 0.36f, 0.5f);
							}
							else if ((int)factory.transport.stationPool[i].storage[j].remoteLogic == 1)
							{
								UI.ItemLogic[num2].GetComponent<Text>().text = Localization.Translate("供应");
								((Graphic)UI.ItemLogic[num2].GetComponent<Text>()).color = new Color(0.24f, 0.55f, 0.65f, 0.5f);
							}
							else
							{
								UI.ItemLogic[num2].GetComponent<Text>().text = Localization.Translate("仓储");
								((Graphic)UI.ItemLogic[num2].GetComponent<Text>()).color = new Color(1f, 1f, 1f, 0.3f);
							}
							UI.ItemLogic[num2].SetActive(true);
							num2++;
						}
						if (num2 == lineMax)
						{
							break;
						}
					}
				}
			}
			else
			{
				UI.Line[0].transform.localPosition = new Vector3(-125f, UI.posY - 10f - (float)(num2 * 20), 0f);
				UI.Line[0].SetActive(true);
				num++;
				num2++;
				UI.ItemName[1].GetComponent<Text>().text = Localization.Translate("No Interstellar Logistics Station");
				UI.ItemIcon[1].SetActive(false);
				UI.ItemCount[1].SetActive(false);
				UI.ItemLogic[1].SetActive(false);
				num2++;
			}
			UI.Line[num].transform.localPosition = new Vector3(-125f, UI.posY - 10f - (float)(num2 * 20), 0f);
			UI.Line[num].SetActive(true);
			num++;
			for (int k = num2; k < 108; k++)
			{
				UI.ItemName[k].SetActive(false);
				UI.ItemIcon[k].SetActive(false);
				UI.ItemCount[k].SetActive(false);
				UI.ItemLogic[k].SetActive(false);
			}
			for (int l = num; l < 50; l++)
			{
				UI.Line[l].SetActive(false);
			}
		}
		else
		{
			for (int m = 1; m < 108; m++)
			{
				UI.ItemName[m].SetActive(false);
				UI.ItemIcon[m].SetActive(false);
				UI.ItemCount[m].SetActive(false);
				UI.ItemLogic[m].SetActive(false);
			}
			for (int n = 1; n < 50; n++)
			{
				UI.Line[n].SetActive(false);
			}
			UI.ItemName[1].SetActive(true);
			UI.ItemName[1].GetComponent<Text>().text = Localization.Translate("No Interstellar Logistics Station");
		}
	}
}
internal class PlanetCreater
{
	public static void Create(PlanetData planetData)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Invalid comparison between Unknown and I4
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Invalid comparison between Unknown and I4
		try
		{
			PlanetAlgorithm val = PlanetModelingManager.Algorithm(planetData);
			if (val == null)
			{
				return;
			}
			HighStopwatch val2 = new HighStopwatch();
			double num = 0.0;
			double num2 = 0.0;
			double num3 = 0.0;
			if (planetData.data == null)
			{
				val2.Begin();
				planetData.data = new PlanetRawData(planetData.precision);
				planetData.modData = planetData.data.InitModData(planetData.modData);
				planetData.data.CalcVerts();
				planetData.aux = new PlanetAuxData(planetData);
				val.GenerateTerrain(planetData.mod_x, planetData.mod_y);
				val.CalcWaterPercent();
				num = val2.duration;
			}
			if (planetData.factory == null)
			{
				val2.Begin();
				if ((int)planetData.type != 5)
				{
					val.GenerateVegetables();
				}
				num2 = val2.duration;
				val2.Begin();
				if ((int)planetData.type != 5)
				{
					val.GenerateVeins();
				}
				num3 = val2.duration;
			}
			if (planetData.landPercentDirty)
			{
				PlanetAlgorithm.CalcLandPercent(planetData);
				planetData.landPercentDirty = false;
			}
			if (PlanetModelingManager.planetComputeThreadLogs != null)
			{
				List<string> planetComputeThreadLogs = PlanetModelingManager.planetComputeThreadLogs;
				lock (planetComputeThreadLogs)
				{
					PlanetModelingManager.planetComputeThreadLogs.Add($"{planetData.displayName}\r\nGenerate Terrain {num:F5} s\r\nGenerate Vegetables {num2:F5} s\r\nGenerate Veins {num3:F5} s\r\n");
					return;
				}
			}
		}
		catch (Exception ex)
		{
			string planetComputeThreadError = PlanetModelingManager.planetComputeThreadError;
			lock (planetComputeThreadError)
			{
				if (string.IsNullOrEmpty(PlanetModelingManager.planetComputeThreadError))
				{
					PlanetModelingManager.planetComputeThreadError = ex.ToString();
				}
			}
		}
	}
}
[BepInPlugin("Appun.DSP.plugin.AllPlanetInfo", "DSPAllPlanetInfo", "1.1.12")]
[BepInProcess("DSPGAME.exe")]
public class Main : BaseUnityPlugin
{
	public class TransportData
	{
		public string PlanetName;

		public int PlanetId;

		public string StationName;

		public int StationId;

		public int ItemId;

		public int ItemCount;

		public int ItemMax;

		public ELogisticStorage Logic;
	}

	[HarmonyPatch(typeof(UIStarmap), "_OnClose")]
	public static class UIStarmap_OnClose_Postfix
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (GameMain.data.history.techStates[4104].unlocked)
			{
				GameMain.history.universeObserveLevel = 4;
			}
			else if (GameMain.data.history.techStates[4103].unlocked)
			{
				GameMain.history.universeObserveLevel = 3;
			}
			else if (GameMain.data.history.techStates[4102].unlocked)
			{
				GameMain.history.universeObserveLevel = 2;
			}
			else if (GameMain.data.history.techStates[4101].unlocked)
			{
				GameMain.history.universeObserveLevel = 1;
			}
			else
			{
				GameMain.history.universeObserveLevel = 0;
			}
		}
	}

	public static ConfigEntry<bool> RequireUniverseExploration4;

	public static ConfigEntry<bool> ShowAdditionalInformationWindow;

	public static StringBuilder SB;

	public static bool PlanetWindowOpen;

	public static PlanetData prePlanet;

	public static int tmpUniverseObserveLevel;

	public static Sprite UseUniverseExploration5Icon;

	public static Sprite planetInfoIcon;

	private Vector2 scrollPosition = Vector2.zero;

	public static int fontSize = 20;

	public static int fixedHeight = 30;

	public static bool needRefresh = false;

	public static List<TransportData> transportdata = new List<TransportData>();

	public void Start()
	{
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		ShowAdditionalInformationWindow = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowAdditionalInformationWindow", true, "Show planetary logistics information");
		LoadIcon();
		UI.Create();
	}

	private void LoadIcon()
	{
		try
		{
			AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DSPAllPlanetInfo.icon"));
			if ((Object)(object)val == (Object)null)
			{
				LogManager.Logger.LogInfo((object)"asset bundle not loaded.");
				return;
			}
			UseUniverseExploration5Icon = val.LoadAsset<Sprite>("4105");
			planetInfoIcon = val.LoadAsset<Sprite>("PlanetInfo");
		}
		catch (Exception ex)
		{
			LogManager.Logger.LogInfo((object)("e.Message " + ex.Message));
			LogManager.Logger.LogInfo((object)("e.StackTrace " + ex.StackTrace));
		}
	}

	private bool ResetInput(Rect rect)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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_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_002d: 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)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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_0061: 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_0071: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		float xMin = ((Rect)(ref rect)).xMin;
		Matrix4x4 matrix = GUI.matrix;
		float num = xMin * ((Matrix4x4)(ref matrix)).lossyScale.x;
		float xMax = ((Rect)(ref rect)).xMax;
		matrix = GUI.matrix;
		float num2 = xMax * ((Matrix4x4)(ref matrix)).lossyScale.x;
		float yMin = ((Rect)(ref rect)).yMin;
		matrix = GUI.matrix;
		float num3 = yMin * ((Matrix4x4)(ref matrix)).lossyScale.x;
		float yMax = ((Rect)(ref rect)).yMax;
		matrix = GUI.matrix;
		float num4 = yMax * ((Matrix4x4)(ref matrix)).lossyScale.x;
		float x = Input.mousePosition.x;
		float num5 = (float)Screen.height - Input.mousePosition.y;
		if (num <= x && x <= num2 && num3 <= num5 && num5 <= num4)
		{
			int[] source = new int[3] { 0, 1, 2 };
			if (((IEnumerable<int>)source).Any((Func<int, bool>)Input.GetMouseButton) || Input.mouseScrollDelta.y != 0f)
			{
				Input.ResetInputAxes();
				return true;
			}
		}
		return false;
	}
}
public class LogManager
{
	public static ManualLogSource Logger;
}
internal class UI : MonoBehaviour
{
	public static int windowWidth = 550;

	public static Rect windowRectNemu = new Rect(0f, 50f, 400f, 0f);

	public static Rect windowRectStation = new Rect(0f, 120f, (float)windowWidth, 100f);

	public static Rect windowRectMiner = new Rect(0f, 120f, (float)windowWidth, 0f);

	public static Rect windowRectFactories = new Rect(0f, 120f, (float)windowWidth, 0f);

	public static GameObject infoWindow;

	public static GameObject[] ItemName = (GameObject[])(object)new GameObject[108];

	public static GameObject[] ItemIcon = (GameObject[])(object)new GameObject[108];

	public static GameObject[] ItemCount = (GameObject[])(object)new GameObject[108];

	public static GameObject[] ItemLogic = (GameObject[])(object)new GameObject[108];

	public static GameObject[] Line = (GameObject[])(object)new GameObject[50];

	public static GameObject WindowTitle;

	public static GameObject previousButton;

	public static GameObject nextButton;

	public static Button previousButtonButton;

	public static Button nextButtonButton;

	public static Button planetInfoButtonButton;

	public static GameObject planetInfoButton;

	public static bool infoWindowEnable = true;

	public static float posY = -40f;

	public static void Create()
	{
		//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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_067c: Unknown result type (might be due to invalid IL or missing references)
		//IL_069d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0731: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fb: Expected O, but got Unknown
		//IL_080d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0817: Expected O, but got Unknown
		//IL_0829: Unknown result type (might be due to invalid IL or missing references)
		//IL_0833: Expected O, but got Unknown
		LogManager.Logger.LogInfo((object)"Create1");
		GameObject gameObject = ((Component)UIRoot.instance.uiGame.starmap.lockNorthButton).gameObject;
		planetInfoButton = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
		planetInfoButtonButton = planetInfoButton.GetComponent<Button>();
		planetInfoButton.GetComponent<UIButton>().tips.offset = new Vector2(-300f, 500f);
		((Component)planetInfoButton.transform.Find("icon")).GetComponent<Image>().sprite = Main.planetInfoIcon;
		((Component)planetInfoButton.transform.Find("icon")).GetComponent<RectTransform>().sizeDelta = new Vector2(30f, 30f);
		LogManager.Logger.LogInfo((object)"Create2");
		GameObject gameObject2 = ((Component)UIRoot.instance.uiGame.planetDetail).gameObject;
		infoWindow = Object.Instantiate<GameObject>(gameObject2);
		((Object)infoWindow).name = "infoWindow";
		infoWindow.transform.SetParent(gameObject2.transform.parent, true);
		infoWindow.transform.localScale = gameObject2.transform.localScale;
		Object.Destroy((Object)(object)((Component)infoWindow.transform.Find("base-info-group/res-group/res-entry/icon")).GetComponent<UIButton>());
		Object.Destroy((Object)(object)infoWindow.GetComponent<UIPlanetDetail>());
		previousButton = Object.Instantiate<GameObject>(GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Assembler Window/produce/copy-button"), infoWindow.transform);
		previousButton.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 20f);
		previousButton.GetComponent<RectTransform>().anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 0f, 0f));
		((Component)previousButton.transform.Find("Text")).GetComponent<Text>().text = Localization.Translate("Previous Page");
		Object.Destroy((Object)(object)((Component)previousButton.transform.Find("Text")).GetComponent<Localizer>());
		Object.Destroy((Object)(object)previousButton.GetComponent<UIButton>());
		((Object)previousButton).name = "previousButton";
		previousButton.SetActive(true);
		previousButtonButton = previousButton.GetComponent<Button>();
		nextButton = Object.Instantiate<GameObject>(previousButton.gameObject, infoWindow.transform);
		((Component)nextButton.transform.Find("Text")).GetComponent<Text>().text = Localization.Translate("Next Page");
		((Object)nextButton).name = "nextButton";
		nextButton.SetActive(true);
		nextButtonButton = nextButton.GetComponent<Button>();
		WindowTitle = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("type-text")).gameObject, infoWindow.transform);
		WindowTitle.transform.localPosition = new Vector3(-250f, 15f, 0f);
		WindowTitle.GetComponent<Text>().text = Localization.Translate("Interstellar Logistics");
		WindowTitle.GetComponent<Text>().verticalOverflow = (VerticalWrapMode)1;
		WindowTitle.GetComponent<Text>().resizeTextMaxSize = 20;
		WindowTitle.SetActive(true);
		((Component)infoWindow.transform.Find("icon")).gameObject.SetActive(false);
		for (int i = 0; i < 108; i++)
		{
			((Component)infoWindow.transform.Find("bg")).gameObject.SetActive(false);
			((Component)infoWindow.transform.Find("base-info-group/res-group")).gameObject.SetActive(false);
			ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(1001);
			ItemName[i] = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("type-text")).gameObject, infoWindow.transform);
			((Object)ItemName[i]).name = "ItemName " + i;
			ItemName[i].transform.localPosition = new Vector3(-245f, posY - (float)(i * 20), 0f);
			ItemName[i].GetComponent<RectTransform>().sizeDelta = new Vector2(150f, 20f);
			ItemName[i].GetComponent<Text>().alignment = (TextAnchor)3;
			ItemName[i].SetActive(false);
			LogManager.Logger.LogInfo((object)"Create10");
			ItemIcon[i] = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("base-info-group/res-group/res-entry/icon")).gameObject, infoWindow.transform);
			((Object)ItemIcon[i]).name = "ItemIcon " + i;
			ItemIcon[i].transform.localPosition = new Vector3(-85f, posY - (float)(i * 20), 0f);
			((Behaviour)ItemIcon[i].GetComponent<Image>()).enabled = true;
			ItemIcon[i].SetActive(false);
			Object.Destroy((Object)(object)ItemIcon[i].GetComponent<UIButton>());
			ItemCount[i] = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("base-info-group/res-group/res-entry/value-text")).gameObject, infoWindow.transform);
			((Object)ItemCount[i]).name = "ItemCount " + i;
			ItemCount[i].transform.localPosition = new Vector3(-35f, posY - (float)(i * 20), 0f);
			ItemCount[i].GetComponent<RectTransform>().sizeDelta = new Vector2(40f, 20f);
			ItemCount[i].GetComponent<Text>().alignment = (TextAnchor)5;
			ItemCount[i].SetActive(false);
			ItemLogic[i] = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("type-text")).gameObject, infoWindow.transform);
			((Object)ItemLogic[i]).name = "ItemLogic " + i;
			ItemLogic[i].transform.localPosition = new Vector3(-30f, posY - (float)(i * 20), 0f);
			ItemLogic[i].GetComponent<RectTransform>().sizeDelta = new Vector2(40f, 20f);
			ItemLogic[i].GetComponent<Text>().alignment = (TextAnchor)3;
			ItemLogic[i].SetActive(false);
		}
		for (int j = 0; j < 50; j++)
		{
			Line[j] = Object.Instantiate<GameObject>(((Component)infoWindow.transform.Find("base-info-group/res-group/line")).gameObject, infoWindow.transform);
			Line[j].transform.localScale = new Vector3(0.75f, 1f, 1f);
			Object.Destroy((Object)(object)((Component)Line[j].transform.Find("display-combo")).gameObject);
			Line[j].SetActive(false);
		}
		Object.Destroy((Object)(object)((Component)infoWindow.transform.Find("name-input")).gameObject);
		Object.Destroy((Object)(object)((Component)infoWindow.transform.Find("type-text")).gameObject);
		Object.Destroy((Object)(object)((Component)infoWindow.transform.Find("base-info-group")).gameObject);
		((UnityEvent)previousButtonButton.onClick).AddListener(new UnityAction(OnClickPreviousButton));
		((UnityEvent)nextButtonButton.onClick).AddListener(new UnityAction(OnClickNextButton));
		((UnityEvent)planetInfoButtonButton.onClick).AddListener(new UnityAction(OnClickplanetInfoButton));
		setWindowPos();
	}

	public static void setWindowPos()
	{
		//IL_0039: 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_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: 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)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		int uiLayoutHeight = DSPGame.globalOption.uiLayoutHeight;
		int num = uiLayoutHeight * Screen.width / Screen.height;
		planetInfoButton.transform.localPosition = new Vector3((float)(-(num / 2) + 50), (float)(uiLayoutHeight / 2 - 30), 0f);
		infoWindow.transform.localPosition = new Vector3((float)(260 - num), (float)(uiLayoutHeight / 2 - 370), 0f);
		infoWindow.GetComponent<RectTransform>().sizeDelta = new Vector2(infoWindow.GetComponent<RectTransform>().sizeDelta.x, (float)(uiLayoutHeight - 130));
		previousButton.transform.localPosition = new Vector3(-125f, -20f, 0f);
		nextButton.transform.localPosition = new Vector3(-20f, -20f, 0f);
	}

	public static void OnClickPreviousButton()
	{
		InfoCreater.pageNo--;
		UIRoot.instance.uiGame.planetDetail.RefreshDynamicProperties();
	}

	public static void OnClickNextButton()
	{
		InfoCreater.pageNo++;
		InfoCreater.startStationNo[InfoCreater.pageNo] = InfoCreater.lastStationNo;
		UIRoot.instance.uiGame.planetDetail.RefreshDynamicProperties();
	}

	public static void OnClickplanetInfoButton()
	{
		infoWindowEnable = !infoWindowEnable;
		infoWindow.SetActive(infoWindowEnable);
		((Component)planetInfoButtonButton).GetComponent<UIButton>().highlighted = infoWindowEnable;
		((Component)UIRoot.instance.uiGame.dfMonitor).gameObject.SetActive(!infoWindowEnable);
	}
}