Decompiled source of MoreStatInfo v1.5.8

MoreStatInfo.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using MoreStatInfo.Model;
using MoreStatInfo.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SuperStation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SuperStation")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("061d45a7-58d9-4049-b964-4de2ac7ab0af")]
[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 MoreStatInfo
{
	internal class GUIDraw
	{
		public string[] columnsbuttonstr = new string[11]
		{
			"物品", "实时产量", "实时消耗", "理论产量", "需求产量", "生产者", "消费者", "总计", "本地提供", "本地需求",
			"本地仓储"
		};

		public int cursortcolumnindex;

		public int cursortrule;

		public int heightdis;

		public float MainWindow_x = 200f;

		public float MainWindow_y = 200f;

		public float MainWindowHeight = 700f;

		public float MainWindowWidth = 1150f;

		public bool OnGUIInited;

		public float PanelMaskWidth;

		public bool[] Productsearchcondition;

		public int switchheight;

		public int switchwitdh;

		private GUIStyle buttonstyleblue = null;

		private GUIStyle buttonstyleyellow = null;

		private GUILayoutOption[] doubleiconoptions;

		private GUIStyle emptyStyle;

		private GUILayoutOption[] iconoptions;

		private Texture2D mytexture;

		private GUIStyle normalPlanetButtonStyle;

		private GUIStyle selectedPlanetButtonStyle;

		private GUIStyle styleboldblue;

		private GUIStyle styleitemname = null;

		private GUIStyle stylenormalblue;

		private GUIStyle stylesmallblue;

		private GUIStyle stylesmallyellow;

		private GUIStyle styleyellow;

		private GUIStyle whiteStyle;

		private static GameObject ui_morestatinfopanel;

		private bool _filtercondition;

		private bool _multplanetproduct;

		private bool _PlanetorSum;

		private bool _refreshfactoryinfo;

		private bool _refreshPlanetinfo;

		private bool _RemoteorLocal;

		private bool _ShowGUIWindow;

		private bool _sortbyPlanetDataDis;

		private bool _sortbypointproduct;

		private bool _sortbyVeinCount;

		private bool _TGMKinttostringMode;

		private int baseSize;

		private bool bottomscaling;

		private bool building = true;

		private int[] ColumnWidth;

		private bool compound = true;

		private bool comsumeimittoggle;

		private int comsumelowerlimit;

		private string comsumelowerlimitstr = "0";

		private bool dropdownbutton;

		private Dictionary<int, int> factoryinfoshow = new Dictionary<int, int>();

		private List<int> iteminfoshow = new List<int>();

		private int ItemInfoShowIndex = 1;

		private bool leftscaling;

		private float MainWindow_x_move = 200f;

		private float MainWindow_y_move = 200f;

		private bool moving;

		private bool noreachneedproduce;

		private bool noreachtheoryproduce;

		private bool onlyseechose;

		private int pdselectinfoindex = 1;

		private Vector2 pdselectscrollPosition;

		private List<int> planetinfoshow = new List<int>();

		private List<int> planetsproductinfoshow = new List<int>();

		private int pointPlanetId;

		private StringBuilder[] Powerenergyinfoshow;

		private bool producelimittoggle;

		private int producelowerlimit;

		private string producelowerlimitstr = "0";

		private bool rawmaterial = true;

		private bool RefreshBaseSize;

		private bool rightscaling;

		private StringBuilder sb;

		private Vector2 scrollPosition;

		private bool[] searchcondition_bool = new bool[40];

		private string searchcondition_TypeName;

		private bool secondrawmaterial = true;

		private int selectitemId;

		private bool StopRefresh;

		private float temp_MainWindow_x = 10f;

		private float temp_MainWindow_y = 200f;

		private bool theorycomsumelimittoggle;

		private int theorycomsumelowerlimit;

		private string theorycomsumelowerlimitstr = "0";

		private bool theorynoreachneedproduce;

		private bool theoryproducelimittoggle;

		private int theoryproducelowerlimit;

		private string theoryproducelowerlimitstr = "0";

		private int unloadPlanetNum;

		public int BaseSize
		{
			get
			{
				return baseSize;
			}
			set
			{
				if (baseSize != value)
				{
					baseSize = value;
					MoreStatInfo.scale.Value = value;
					RefreshBaseSize = true;
					heightdis = value * 2;
				}
			}
		}

		public bool Filtercondition
		{
			get
			{
				return _filtercondition;
			}
			set
			{
				if (value != _filtercondition)
				{
					_filtercondition = value;
					if (value)
					{
						RefreshPlanetinfo = false;
						Refreshfactoryinfo = false;
					}
				}
			}
		}

		public bool Multplanetproduct
		{
			get
			{
				return _multplanetproduct;
			}
			set
			{
				if (value != _multplanetproduct)
				{
					_multplanetproduct = value;
					if (value)
					{
						Refreshfactoryinfo = false;
						RefreshPlanetinfo = false;
						PlanetorSum = true;
					}
				}
			}
		}

		public bool PlanetorSum
		{
			get
			{
				return _PlanetorSum;
			}
			set
			{
				if (value != _PlanetorSum)
				{
					_PlanetorSum = value;
					if (!value)
					{
						pointPlanetId = 0;
					}
				}
			}
		}

		public bool Refreshfactoryinfo
		{
			get
			{
				return _refreshfactoryinfo;
			}
			set
			{
				if (value != _refreshfactoryinfo)
				{
					_refreshfactoryinfo = value;
					if (value)
					{
						Filtercondition = false;
						RefreshPlanetinfo = false;
						Multplanetproduct = false;
						RefreshFactory(pointPlanetId);
					}
				}
			}
		}

		public bool RefreshPlanetinfo
		{
			get
			{
				return _refreshPlanetinfo;
			}
			set
			{
				if (value != _refreshPlanetinfo)
				{
					_refreshPlanetinfo = value;
					if (value)
					{
						Refreshfactoryinfo = false;
						Filtercondition = false;
						Multplanetproduct = false;
					}
				}
			}
		}

		public bool RemoteorLocal
		{
			get
			{
				return _RemoteorLocal;
			}
			set
			{
				if (value == _RemoteorLocal)
				{
					return;
				}
				_RemoteorLocal = value;
				columnsbuttonstr[8] = ((!RemoteorLocal) ? "本地提供".GetTranslate() : "远程提供".GetTranslate());
				columnsbuttonstr[9] = ((!RemoteorLocal) ? "本地需求".GetTranslate() : "远程需求".GetTranslate());
				columnsbuttonstr[10] = ((!RemoteorLocal) ? "本地仓储".GetTranslate() : "远程仓储".GetTranslate());
				if (cursortcolumnindex >= 8 && cursortcolumnindex <= 10)
				{
					switch (cursortrule)
					{
					case 1:
						columnsbuttonstr[cursortcolumnindex] += "↑";
						break;
					case -1:
						columnsbuttonstr[cursortcolumnindex] += "↓";
						break;
					case 0:
						columnsbuttonstr[cursortcolumnindex] += "-";
						break;
					}
				}
			}
		}

		public bool ShowGUIWindow
		{
			get
			{
				return _ShowGUIWindow;
			}
			set
			{
				_ShowGUIWindow = value;
				ui_morestatinfopanel.SetActive(value);
			}
		}

		public bool SortbyPointProduct
		{
			get
			{
				return _sortbypointproduct;
			}
			set
			{
				if (value == _sortbypointproduct)
				{
					return;
				}
				_sortbypointproduct = value;
				if (value)
				{
					int[] itemIds = ItemProto.itemIds;
					foreach (int num in itemIds)
					{
						Productsearchcondition[num] = false;
					}
					if (selectitemId > 0)
					{
						Productsearchcondition[selectitemId] = true;
					}
				}
			}
		}

		public bool TGMKinttostringMode
		{
			get
			{
				return _TGMKinttostringMode;
			}
			set
			{
				if (value != _TGMKinttostringMode)
				{
					_TGMKinttostringMode = value;
				}
			}
		}

		public GUIDraw(int baseFontSize)
		{
			BaseSize = baseFontSize;
			Powerenergyinfoshow = new StringBuilder[5];
			GameObject val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("MoreStatInfo.morestatinfopanel")).LoadAsset<GameObject>("MoreStatInfoPanel");
			ui_morestatinfopanel = Object.Instantiate<GameObject>(val, ((Component)UIRoot.instance.overlayCanvas).transform);
		}

		public void ChangeSort(int columnnum)
		{
			if (cursortrule != 0)
			{
				columnsbuttonstr[cursortcolumnindex] = columnsbuttonstr[cursortcolumnindex].Substring(0, columnsbuttonstr[cursortcolumnindex].Length - 1);
			}
			if (columnnum != cursortcolumnindex)
			{
				cursortrule = 1;
			}
			else
			{
				cursortrule++;
				if (cursortrule > 1)
				{
					cursortrule = -1;
				}
			}
			cursortcolumnindex = columnnum;
			switch (cursortrule)
			{
			case 1:
				columnsbuttonstr[columnnum] += "↑";
				break;
			case -1:
				columnsbuttonstr[columnnum] += "↓";
				break;
			case 0:
				cursortcolumnindex = 0;
				break;
			}
		}

		public void Draw()
		{
			if (Input.GetKey((KeyCode)306))
			{
				int num = (int)(Input.GetAxis("Mouse Wheel") * 10f);
				int num2 = BaseSize + num;
				if (Input.GetKeyDown((KeyCode)273))
				{
					num2++;
				}
				if (Input.GetKeyDown((KeyCode)274))
				{
					num2--;
				}
				num2 = Math.Max(5, Math.Min(num2, 35));
				BaseSize = num2;
			}
			if (!OnGUIInited)
			{
				OnGUIInited = true;
				Init();
			}
			if (RefreshBaseSize)
			{
				RefreshBaseSize = false;
				RefreshFontSize();
			}
			if (!ShowGUIWindow)
			{
				return;
			}
			PanelMaskWidth = MainWindowWidth;
			SwitchWindowShowFun();
			MainWindowShowFun();
			if (PlanetorSum || RefreshPlanetinfo)
			{
				PanelMaskWidth += heightdis * 7;
				PlanetWindowShowFun();
			}
			UIPanelSet();
			if (!StopRefresh && MoreStatInfo.OneSecondElapsed)
			{
				MoreStatInfo.allstatinfo.TargetPlanetIds = planetsproductinfoshow;
				MoreStatInfo.allstatinfo.TargetPlanetId = pointPlanetId;
				PanelMode panelMode = PanelMode.GalaxyStatInfo;
				if (PlanetorSum)
				{
					if (Multplanetproduct)
					{
						panelMode = PanelMode.MultiplePlanetStatInfo;
					}
					else if (pointPlanetId != 0)
					{
						panelMode = PanelMode.TargetSinglePlanetStatInfo;
					}
				}
				MoreStatInfo.allstatinfo.RefreshProperty(panelMode);
				SortItemIndex(MoreStatInfo.allstatinfo.ProductCount, MoreStatInfo.allstatinfo.ProductExist, cursortcolumnindex, cursortrule);
				RefreshPlanet();
			}
			if (MoreStatInfo.OneSecondElapsed)
			{
				MoreStatInfo.OneSecondElapsed = false;
			}
		}

		public void RefreshFontSize()
		{
			GUI.skin.label.fontSize = BaseSize;
			GUI.skin.button.fontSize = BaseSize;
			GUI.skin.toggle.fontSize = BaseSize;
			GUI.skin.textField.fontSize = BaseSize;
			GUI.skin.textArea.fontSize = BaseSize;
			buttonstyleblue.fontSize = BaseSize;
			buttonstyleyellow.fontSize = BaseSize;
			selectedPlanetButtonStyle.fontSize = BaseSize;
			normalPlanetButtonStyle.fontSize = BaseSize;
			styleboldblue.fontSize = BaseSize + 5;
			stylesmallblue.fontSize = BaseSize;
			styleyellow.fontSize = BaseSize + 5;
			stylesmallyellow.fontSize = BaseSize;
			styleitemname.fontSize = BaseSize;
			switchwitdh = (MoreStatInfo.IsEnglish ? (7 * heightdis) : (4 * heightdis));
			switchheight = heightdis * 10;
			iconoptions = (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width((float)heightdis),
				GUILayout.Height((float)heightdis)
			};
			doubleiconoptions = (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width((float)(2 * heightdis)),
				GUILayout.Height((float)(2 * heightdis))
			};
		}

		public void SortItemIndex(long[][] itemsmap, bool[] productexist, int columnnum, int sortrules)
		{
			iteminfoshow.Clear();
			for (int i = 0; i < ItemProto.itemIds.Length; i++)
			{
				int num = ItemProto.itemIds[i];
				if (!productexist[num] || num == 1030 || num == 1031 || (((num >= 1000 && num < 1030) || num == 1208) && !rawmaterial) || (num > 1100 && num < 1200 && !secondrawmaterial))
				{
					continue;
				}
				ItemProto val = ItemProto.itemProtoById[num];
				if (val == null || (val.CanBuild && !building))
				{
					continue;
				}
				if (val.recipes.Count > 0)
				{
					switch (num)
					{
					default:
						if (val.BuildIndex == 0 && !compound)
						{
							continue;
						}
						break;
					case 1003:
					case 1101:
					case 1102:
					case 1103:
					case 1104:
					case 1105:
					case 1106:
					case 1107:
					case 1108:
					case 1109:
					case 1110:
					case 1111:
					case 1112:
					case 1113:
					case 1114:
					case 1115:
					case 1116:
					case 1117:
					case 1118:
					case 1119:
					case 1120:
					case 1121:
					case 1122:
					case 1123:
					case 1124:
					case 1125:
					case 1126:
					case 1127:
					case 1128:
					case 1129:
					case 1130:
					case 1131:
					case 1132:
					case 1133:
					case 1134:
					case 1135:
					case 1136:
					case 1137:
					case 1138:
					case 1139:
					case 1140:
					case 1141:
					case 1142:
					case 1143:
					case 1144:
					case 1145:
					case 1146:
					case 1147:
					case 1148:
					case 1149:
					case 1150:
					case 1151:
					case 1152:
					case 1153:
					case 1154:
					case 1155:
					case 1156:
					case 1157:
					case 1158:
					case 1159:
					case 1160:
					case 1161:
					case 1162:
					case 1163:
					case 1164:
					case 1165:
					case 1166:
					case 1167:
					case 1168:
					case 1169:
					case 1170:
					case 1171:
					case 1172:
					case 1173:
					case 1174:
					case 1175:
					case 1176:
					case 1177:
					case 1178:
					case 1179:
					case 1180:
					case 1181:
					case 1182:
					case 1183:
					case 1184:
					case 1185:
					case 1186:
					case 1187:
					case 1188:
					case 1189:
					case 1190:
					case 1191:
					case 1192:
					case 1193:
					case 1194:
					case 1195:
					case 1196:
					case 1197:
					case 1198:
					case 1199:
						break;
					}
				}
				if ((!onlyseechose || Productsearchcondition[num]) && (!noreachtheoryproduce || (productexist[num] && itemsmap[num][0] < itemsmap[num][2])) && (!noreachneedproduce || (productexist[num] && itemsmap[num][0] < itemsmap[num][3])) && (!theorynoreachneedproduce || (productexist[num] && itemsmap[num][2] < itemsmap[num][3])) && (!producelimittoggle || (productexist[num] && itemsmap[num][0] > producelowerlimit)) && (!comsumeimittoggle || (productexist[num] && itemsmap[num][1] > comsumelowerlimit)) && (!theoryproducelimittoggle || (productexist[num] && itemsmap[num][2] > theoryproducelowerlimit)) && (!theorycomsumelimittoggle || (productexist[num] && itemsmap[num][3] > theorycomsumelowerlimit)))
				{
					iteminfoshow.Add(num);
				}
			}
			if (sortrules == 0)
			{
				return;
			}
			if (columnnum == 0)
			{
				if (sortrules == 1)
				{
					iteminfoshow.Reverse();
				}
				return;
			}
			columnnum--;
			int count = iteminfoshow.Count;
			for (int j = 0; j < count; j++)
			{
				for (int k = j + 1; k < count; k++)
				{
					int num2 = iteminfoshow[k];
					if (sortrules == 1)
					{
						if (itemsmap[iteminfoshow[j]][columnnum] > itemsmap[num2][columnnum])
						{
							List<int> list = iteminfoshow;
							int index = j;
							List<int> list2 = iteminfoshow;
							int index2 = k;
							int value = iteminfoshow[k];
							int value2 = iteminfoshow[j];
							list[index] = value;
							list2[index2] = value2;
						}
					}
					else if (itemsmap[iteminfoshow[j]][columnnum] < itemsmap[num2][columnnum])
					{
						List<int> list = iteminfoshow;
						int index2 = j;
						List<int> list3 = iteminfoshow;
						int index = k;
						int value2 = iteminfoshow[k];
						int value = iteminfoshow[j];
						list[index2] = value2;
						list3[index] = value;
					}
				}
			}
		}

		private bool CheckItemConditions(int itemId, long[][] tempDiction)
		{
			if (((itemId >= 1000 && itemId < 1030) || itemId == 1208) && !rawmaterial)
			{
				return false;
			}
			if (itemId > 1100 && itemId < 1200 && !secondrawmaterial)
			{
				return false;
			}
			if (((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).CanBuild && !building)
			{
				return false;
			}
			if (((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).recipes.Count > 0)
			{
				switch (itemId)
				{
				default:
					if (((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).BuildIndex == 0 && !compound)
					{
						return false;
					}
					break;
				case 1003:
				case 1101:
				case 1102:
				case 1103:
				case 1104:
				case 1105:
				case 1106:
				case 1107:
				case 1108:
				case 1109:
				case 1110:
				case 1111:
				case 1112:
				case 1113:
				case 1114:
				case 1115:
				case 1116:
				case 1117:
				case 1118:
				case 1119:
				case 1120:
				case 1121:
				case 1122:
				case 1123:
				case 1124:
				case 1125:
				case 1126:
				case 1127:
				case 1128:
				case 1129:
				case 1130:
				case 1131:
				case 1132:
				case 1133:
				case 1134:
				case 1135:
				case 1136:
				case 1137:
				case 1138:
				case 1139:
				case 1140:
				case 1141:
				case 1142:
				case 1143:
				case 1144:
				case 1145:
				case 1146:
				case 1147:
				case 1148:
				case 1149:
				case 1150:
				case 1151:
				case 1152:
				case 1153:
				case 1154:
				case 1155:
				case 1156:
				case 1157:
				case 1158:
				case 1159:
				case 1160:
				case 1161:
				case 1162:
				case 1163:
				case 1164:
				case 1165:
				case 1166:
				case 1167:
				case 1168:
				case 1169:
				case 1170:
				case 1171:
				case 1172:
				case 1173:
				case 1174:
				case 1175:
				case 1176:
				case 1177:
				case 1178:
				case 1179:
				case 1180:
				case 1181:
				case 1182:
				case 1183:
				case 1184:
				case 1185:
				case 1186:
				case 1187:
				case 1188:
				case 1189:
				case 1190:
				case 1191:
				case 1192:
				case 1193:
				case 1194:
				case 1195:
				case 1196:
				case 1197:
				case 1198:
				case 1199:
					break;
				}
			}
			if (noreachtheoryproduce && tempDiction[itemId][0] >= tempDiction[itemId][2])
			{
				return false;
			}
			if (noreachneedproduce && tempDiction[itemId][0] >= tempDiction[itemId][3])
			{
				return false;
			}
			if (theorynoreachneedproduce && tempDiction[itemId][2] >= tempDiction[itemId][3])
			{
				return false;
			}
			if (producelimittoggle && tempDiction[itemId][0] <= producelowerlimit)
			{
				return false;
			}
			if (comsumeimittoggle && tempDiction[itemId][1] <= comsumelowerlimit)
			{
				return false;
			}
			if (theoryproducelimittoggle && tempDiction[itemId][2] <= theoryproducelowerlimit)
			{
				return false;
			}
			if (theorycomsumelimittoggle && tempDiction[itemId][3] <= theorycomsumelowerlimit)
			{
				return false;
			}
			return true;
		}

		private bool CheckProductCondition(int pdid)
		{
			return (from selectedItem in Productsearchcondition.Select((bool isSelected, int itemId) => new { isSelected, itemId })
				where selectedItem.isSelected
				select selectedItem).All(selectedItem => MoreStatInfo.allstatinfo.planetstatinfoDic[pdid].ProductExist[selectedItem.itemId] && CheckItemConditions(selectedItem.itemId, MoreStatInfo.allstatinfo.planetstatinfoDic[pdid].ProductCount));
		}

		private string ClampString(string str, int minLength, int maxLength)
		{
			if (str.Length < minLength)
			{
				return new string('0', minLength);
			}
			return (str.Length > maxLength) ? str.Substring(0, maxLength) : str;
		}

		private void Init()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Expected O, but got Unknown
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Expected O, but got Unknown
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Expected O, but got Unknown
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			switchwitdh = (MoreStatInfo.IsEnglish ? (7 * heightdis) : (4 * heightdis));
			switchheight = heightdis * 10;
			for (int i = 0; i < 5; i++)
			{
				if (i == 2)
				{
					Powerenergyinfoshow[i] = new StringBuilder("          J", 16);
				}
				else
				{
					Powerenergyinfoshow[i] = new StringBuilder("          W", 16);
				}
			}
			sb = new StringBuilder("                ", 16);
			ColumnWidth = new int[11];
			factoryinfoshow = new Dictionary<int, int>();
			Productsearchcondition = new bool[12000];
			_TGMKinttostringMode = true;
			Color32 val = default(Color32);
			((Color32)(ref val))..ctor((byte)167, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)240, (byte)191, (byte)103, byte.MaxValue);
			emptyStyle = new GUIStyle();
			whiteStyle = new GUIStyle();
			whiteStyle.normal.background = Texture2D.whiteTexture;
			styleitemname = new GUIStyle();
			styleitemname.normal.textColor = Color.white;
			buttonstyleblue = new GUIStyle(GUI.skin.button);
			buttonstyleyellow = new GUIStyle(GUI.skin.button);
			normalPlanetButtonStyle = new GUIStyle(GUI.skin.button);
			selectedPlanetButtonStyle = new GUIStyle(GUI.skin.button);
			selectedPlanetButtonStyle.normal.textColor = Color32.op_Implicit(new Color32((byte)215, (byte)186, (byte)245, byte.MaxValue));
			buttonstyleblue.normal.textColor = Color32.op_Implicit(val);
			buttonstyleyellow.normal.textColor = Color32.op_Implicit(val2);
			buttonstyleblue.margin = new RectOffset();
			buttonstyleyellow.margin = new RectOffset();
			normalPlanetButtonStyle.margin = new RectOffset();
			selectedPlanetButtonStyle.margin = new RectOffset();
			mytexture = new Texture2D(10, 10);
			for (int j = 0; j < ((Texture)mytexture).width; j++)
			{
				for (int k = 0; k < ((Texture)mytexture).height; k++)
				{
					mytexture.SetPixel(j, k, new Color(0f, 0f, 0f, 1f));
				}
			}
			mytexture.Apply();
			styleboldblue = new GUIStyle
			{
				fontStyle = (FontStyle)1,
				fontSize = 20
			};
			stylesmallblue = new GUIStyle
			{
				fontStyle = (FontStyle)0,
				fontSize = 15
			};
			stylenormalblue = new GUIStyle
			{
				fontStyle = (FontStyle)0,
				fontSize = 20
			};
			stylesmallblue.normal.textColor = Color32.op_Implicit(val);
			styleboldblue.normal.textColor = Color32.op_Implicit(val);
			stylenormalblue.normal.textColor = Color32.op_Implicit(val);
			styleyellow = new GUIStyle
			{
				fontStyle = (FontStyle)1,
				fontSize = 20
			};
			stylesmallyellow = new GUIStyle
			{
				fontStyle = (FontStyle)0,
				fontSize = 15
			};
			styleyellow.normal.textColor = Color32.op_Implicit(val2);
			stylesmallyellow.normal.textColor = Color32.op_Implicit(val2);
			iconoptions = (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width((float)heightdis),
				GUILayout.Height((float)heightdis)
			};
			doubleiconoptions = (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width((float)(2 * heightdis)),
				GUILayout.Height((float)(2 * heightdis))
			};
		}

		private void RefreshFactory(int pdid)
		{
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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)
			//IL_007c: 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)
			factoryinfoshow.Clear();
			if (pdid == 0)
			{
				StarData[] stars = GameMain.galaxy.stars;
				foreach (StarData val in stars)
				{
					PlanetData[] planets = val.planets;
					foreach (PlanetData val2 in planets)
					{
						if (val2.factory == null)
						{
							continue;
						}
						EntityData[] entityPool = val2.factory.entityPool;
						foreach (EntityData val3 in entityPool)
						{
							int protoId = val3.protoId;
							if (protoId > 0)
							{
								if (!factoryinfoshow.ContainsKey(protoId))
								{
									factoryinfoshow.Add(protoId, 0);
								}
								factoryinfoshow[protoId]++;
							}
						}
					}
				}
				return;
			}
			PlanetData val4 = GameMain.galaxy.PlanetById(pdid);
			if (val4.factory == null)
			{
				return;
			}
			EntityData[] entityPool2 = val4.factory.entityPool;
			foreach (EntityData val5 in entityPool2)
			{
				int protoId2 = val5.protoId;
				if (protoId2 > 0)
				{
					if (!factoryinfoshow.ContainsKey(protoId2))
					{
						factoryinfoshow.Add(protoId2, 0);
					}
					factoryinfoshow[protoId2]++;
				}
			}
		}

		private void RefreshPlanet()
		{
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Invalid comparison between Unknown and I4
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Invalid comparison between Unknown and I4
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Invalid comparison between Unknown and I4
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Invalid comparison between Unknown and I4
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Invalid comparison between Unknown and I4
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Invalid comparison between Unknown and I4
			planetinfoshow.Clear();
			unloadPlanetNum = 0;
			StarData[] stars = GameMain.galaxy.stars;
			foreach (StarData val in stars)
			{
				PlanetData[] planets = val.planets;
				foreach (PlanetData val2 in planets)
				{
					unloadPlanetNum += ((val2.data == null && val2.factory == null) ? 1 : 0);
					PlanetStatInfo planetStatInfo = MoreStatInfo.allstatinfo.planetstatinfoDic[val2.id];
					if ((PlanetorSum && ((!RefreshPlanetinfo && planetStatInfo.productCursor == 0) || (Refreshfactoryinfo && !planetStatInfo.Existfactory))) || ((Filtercondition || Refreshfactoryinfo) && (!planetStatInfo.Existfactory || !CheckProductCondition(val2.id))))
					{
						continue;
					}
					bool flag = true;
					for (int k = 1; k <= 30 && flag; k++)
					{
						if (searchcondition_bool[k])
						{
							if (k <= 14 && planetStatInfo.planetsveinSpotsSketch[k] == 0)
							{
								flag = false;
							}
							if (k == 15 && ((val2.gasItems == null && val2.orbitAroundPlanet == null) || (val2.gasItems != null && val2.gasItems[0] != 1011 && val2.gasItems[1] != 1011) || (val2.orbitAroundPlanet != null && val2.orbitAroundPlanet.gasItems[0] != 1011 && val2.orbitAroundPlanet.gasItems[1] != 1011)))
							{
								flag = false;
							}
							if (k == 16 && ((val2.gasItems == null && val2.orbitAroundPlanet == null) || (val2.gasItems != null && val2.gasItems[0] != 1120 && val2.gasItems[1] != 1120) || (val2.orbitAroundPlanet != null && val2.orbitAroundPlanet.gasItems[0] != 1120 && val2.orbitAroundPlanet.gasItems[1] != 1120)))
							{
								flag = false;
							}
							if (k == 17 && ((val2.gasItems == null && val2.orbitAroundPlanet == null) || (val2.gasItems != null && val2.gasItems[0] != 1121 && val2.gasItems[1] != 1121) || (val2.orbitAroundPlanet != null && val2.orbitAroundPlanet.gasItems[0] != 1121 && val2.orbitAroundPlanet.gasItems[1] != 1121)))
							{
								flag = false;
							}
							if (k == 18 && val2.waterItemId != 1000)
							{
								flag = false;
							}
							if (k == 19 && val2.waterItemId != 1116)
							{
								flag = false;
							}
							if (k == 20 && (int)val2.singularity != 1)
							{
								flag = false;
							}
							if (k == 21 && (int)val2.singularity != 2)
							{
								flag = false;
							}
							if (k == 22 && (int)val2.singularity != 4)
							{
								flag = false;
							}
							if (k == 23 && (int)val2.singularity != 8)
							{
								flag = false;
							}
							if (k == 24 && (int)val2.singularity != 16)
							{
								flag = false;
							}
							if (k == 25 && (int)val2.singularity != 32)
							{
								flag = false;
							}
							if (k == 26 && !planetStatInfo.Existfactory)
							{
								flag = false;
							}
							if (k == 27 && planetStatInfo.Existfactory)
							{
								flag = false;
							}
							if (k == 28 && planetStatInfo.Lackofelectricity)
							{
								flag = false;
							}
							if (k == 29 && val2.data == null)
							{
								flag = false;
							}
							if (k == 30 && val2.data != null)
							{
								flag = false;
							}
						}
					}
					if (!string.IsNullOrEmpty(searchcondition_TypeName) && val2.typeString != searchcondition_TypeName)
					{
						flag = false;
					}
					if (flag)
					{
						planetinfoshow.Add(val2.id);
					}
				}
			}
			if (_sortbyPlanetDataDis)
			{
				planetinfoshow.Sort(delegate(int a, int b)
				{
					double num8 = DistancecalCulate.PlayerToPlanetDis(GameMain.galaxy.PlanetById(a)) - DistancecalCulate.PlayerToPlanetDis(GameMain.galaxy.PlanetById(b));
					if (num8 > 0.0)
					{
						return 1;
					}
					return (num8 != 0.0) ? (-1) : 0;
				});
			}
			if (_sortbyVeinCount)
			{
				planetinfoshow.Sort(delegate(int a, int b)
				{
					int num6 = MoreStatInfo.allstatinfo.planetstatinfoDic[a].planetsveinSpotsSketch.Where((int n, int index) => searchcondition_bool[index]).Sum();
					int num7 = MoreStatInfo.allstatinfo.planetstatinfoDic[b].planetsveinSpotsSketch.Where((int n, int index) => searchcondition_bool[index]).Sum();
					if (num7 - num6 > 0)
					{
						return 1;
					}
					return (num7 - num6 != 0) ? (-1) : 0;
				});
			}
			if (!SortbyPointProduct || !Filtercondition)
			{
				return;
			}
			int num = 0;
			for (int l = 0; l < ItemProto.itemIds.Length; l++)
			{
				int num2 = ItemProto.itemIds[l];
				if (Productsearchcondition[num2])
				{
					num = num2;
					break;
				}
			}
			if (num == 0)
			{
				return;
			}
			int count = planetinfoshow.Count;
			for (int m = 0; m < count; m++)
			{
				int num3 = planetinfoshow[m];
				for (int num4 = m + 1; num4 < count; num4++)
				{
					int num5 = planetinfoshow[num4];
					if (MoreStatInfo.allstatinfo.planetstatinfoDic[num3].ProductCount[num][0] < MoreStatInfo.allstatinfo.planetstatinfoDic[num5].ProductCount[num][0])
					{
						List<int> list = planetinfoshow;
						int index2 = m;
						List<int> list2 = planetinfoshow;
						int index3 = num4;
						int value = planetinfoshow[num4];
						int value2 = planetinfoshow[m];
						list[index2] = value;
						list2[index3] = value2;
					}
				}
			}
		}

		public void FactoryInfoPanel()
		{
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			int count = factoryinfoshow.Count;
			int num = (int)((MainWindowWidth - 20f) / (float)(heightdis * 3));
			int num2 = count / num + ((count % num > 0) ? 1 : 0);
			for (int i = 0; i < num2; i++)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int j = 0; j < num; j++)
				{
					int num3 = i * num + j;
					if (num3 == count)
					{
						break;
					}
					KeyValuePair<int, int> keyValuePair = factoryinfoshow.ElementAt(num3);
					ItemProto val = ItemProto.itemProtoById[keyValuePair.Key];
					GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
					if (j % 2 == 0)
					{
						GUILayout.Button((Texture)(object)val.iconSprite.texture, emptyStyle, doubleiconoptions);
						GUILayout.Label(keyValuePair.Value.ToString() ?? "", stylesmallblue, Array.Empty<GUILayoutOption>());
					}
					else
					{
						GUILayout.Label(keyValuePair.Value.ToString() ?? "", stylesmallblue, Array.Empty<GUILayoutOption>());
						GUILayout.Button((Texture)(object)val.iconSprite.texture, emptyStyle, doubleiconoptions);
					}
					GUILayout.EndVertical();
					GUILayout.Space((float)heightdis);
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
				GUILayout.Space(50f);
			}
			GUIStyle val2 = styleboldblue;
			for (int k = 0; k < 5; k++)
			{
				if (TGMKinttostringMode)
				{
					StringBuilderUtility.WriteKMG(Powerenergyinfoshow[k], 9, MoreStatInfo.allstatinfo.Powerenergyinfoshow[k], false);
				}
				else
				{
					val2 = stylesmallblue;
				}
			}
			GUILayout.Label("发电性能".GetTranslate() + ":" + (TGMKinttostringMode ? Powerenergyinfoshow[0].ToString() : (MoreStatInfo.allstatinfo.Powerenergyinfoshow[0] + "W")), val2, Array.Empty<GUILayoutOption>());
			GUILayout.Label("耗电需求".GetTranslate() + ":" + (TGMKinttostringMode ? Powerenergyinfoshow[1].ToString() : (MoreStatInfo.allstatinfo.Powerenergyinfoshow[1] + "W")), val2, Array.Empty<GUILayoutOption>());
			GUILayout.Label("总耗能".GetTranslate() + ":" + (TGMKinttostringMode ? Powerenergyinfoshow[2].ToString() : (MoreStatInfo.allstatinfo.Powerenergyinfoshow[2] + "J")), val2, Array.Empty<GUILayoutOption>());
			GUILayout.Label("放电功率".GetTranslate() + ":" + (TGMKinttostringMode ? Powerenergyinfoshow[3].ToString() : (MoreStatInfo.allstatinfo.Powerenergyinfoshow[3] + "W")), val2, Array.Empty<GUILayoutOption>());
			GUILayout.Label("充电功率".GetTranslate() + ":" + (TGMKinttostringMode ? Powerenergyinfoshow[4].ToString() : (MoreStatInfo.allstatinfo.Powerenergyinfoshow[4] + "W")), val2, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("导出数据".GetTranslate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)heightdis) }))
			{
				OutputDataUtil.OutputFactoryBuildInfo();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		public void MainWindow(int id)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			try
			{
				GUILayout.BeginArea(new Rect(10f, 20f, MainWindowWidth - 20f, MainWindowHeight - 30f));
				scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				if (Refreshfactoryinfo)
				{
					FactoryInfoPanel();
				}
				else if (RefreshPlanetinfo)
				{
					PlanetInfoPanel();
				}
				else
				{
					StatInfoPanel();
				}
				if (Filtercondition)
				{
					FilterUI();
				}
				GUILayout.EndVertical();
				GUILayout.EndScrollView();
				GUILayout.EndArea();
			}
			catch
			{
			}
		}

		public void PlanetInfoPanel()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("附属气态星产物".GetTranslate(), Array.Empty<GUILayoutOption>());
			for (int i = 15; i <= 17; i++)
			{
				searchcondition_bool[i] = GUILayout.Toggle(searchcondition_bool[i], i.GetSearchchinese(), Array.Empty<GUILayoutOption>());
			}
			GUILayout.Label("星球特殊性".GetTranslate(), Array.Empty<GUILayoutOption>());
			for (int j = 18; j <= 25; j++)
			{
				searchcondition_bool[j] = GUILayout.Toggle(searchcondition_bool[j], j.GetSearchchinese(), Array.Empty<GUILayoutOption>());
			}
			if (searchcondition_bool[26] != GUILayout.Toggle(searchcondition_bool[26], "具有工厂".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				searchcondition_bool[26] = !searchcondition_bool[26];
				if (searchcondition_bool[26])
				{
					searchcondition_bool[27] = false;
				}
			}
			if (searchcondition_bool[27] != GUILayout.Toggle(searchcondition_bool[27], "不具有工厂".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				searchcondition_bool[27] = !searchcondition_bool[27];
				if (searchcondition_bool[27])
				{
					searchcondition_bool[26] = false;
				}
			}
			if (searchcondition_bool[28] != GUILayout.Toggle(searchcondition_bool[28], "电力不足".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				searchcondition_bool[28] = !searchcondition_bool[28];
				if (searchcondition_bool[28])
				{
					searchcondition_bool[26] = true;
				}
			}
			if (searchcondition_bool[29] != GUILayout.Toggle(searchcondition_bool[29], "已加载星球".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				searchcondition_bool[29] = !searchcondition_bool[29];
				if (searchcondition_bool[29])
				{
					searchcondition_bool[30] = false;
				}
			}
			if (searchcondition_bool[30] != GUILayout.Toggle(searchcondition_bool[30], "未加载星球".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				searchcondition_bool[30] = !searchcondition_bool[30];
				if (searchcondition_bool[30])
				{
					searchcondition_bool[29] = false;
				}
			}
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("目标星球矿物".GetTranslate(), Array.Empty<GUILayoutOption>());
			for (int k = 1; k <= 14; k++)
			{
				searchcondition_bool[k] = GUILayout.Toggle(searchcondition_bool[k], k.GetSearchchinese(), Array.Empty<GUILayoutOption>());
			}
			_sortbyPlanetDataDis = GUILayout.Toggle(_sortbyPlanetDataDis, "依照离玩家距离排序".GetTranslate(), Array.Empty<GUILayoutOption>());
			_sortbyVeinCount = GUILayout.Toggle(_sortbyVeinCount, "依矿脉数量排序".GetTranslate(), Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("取消所有条件".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				for (int num = searchcondition_bool.Length - 1; num >= 0; num--)
				{
					searchcondition_bool[num] = false;
				}
			}
			GUILayout.Label("未加载星球".GetTranslate() + $"{unloadPlanetNum}", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("加载全部星球".GetTranslate(), Array.Empty<GUILayoutOption>()))
			{
				PlanetLoad.LoadAllPlanet();
			}
			if (PlanetModelingManager.calPlanetReqList.Count > 0)
			{
				GUILayout.Label($"{PlanetModelingManager.calPlanetReqList.Count}" + "个星球加载中".GetTranslate(), Array.Empty<GUILayoutOption>());
				GUILayout.Label("请勿切换存档".GetTranslate(), Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("星球类型".GetTranslate(), Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(string.IsNullOrEmpty(searchcondition_TypeName) ? "未选择".GetTranslate() : searchcondition_TypeName, Array.Empty<GUILayoutOption>()))
			{
				dropdownbutton = !dropdownbutton;
			}
			if (dropdownbutton)
			{
				if (GUILayout.Button("取消选择", Array.Empty<GUILayoutOption>()))
				{
					dropdownbutton = !dropdownbutton;
					searchcondition_TypeName = string.Empty;
				}
				for (int l = 0; l < PlanetLoad.PlanetType.Count; l++)
				{
					string text = PlanetLoad.PlanetType[l];
					if (GUILayout.Button(text, Array.Empty<GUILayoutOption>()))
					{
						dropdownbutton = !dropdownbutton;
						searchcondition_TypeName = text;
					}
				}
			}
			GUILayout.EndVertical();
			GUILayout.Space((float)heightdis);
			PlanetData val;
			if (pointPlanetId > 0 && (val = GameMain.galaxy.PlanetById(pointPlanetId)) != null)
			{
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				GUILayout.Label("行星信息".GetTranslate() + ":", styleboldblue, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(20f);
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				string text2 = GUILayout.TextArea(val.displayName, Array.Empty<GUILayoutOption>());
				if (!text2.Equals(val.displayName))
				{
					val.overrideName = text2;
					val.NotifyOnDisplayNameChange();
				}
				if (val.gasItems == null)
				{
					string itemText = val.waterItemId.GetItemText();
					GUILayout.Space(5f);
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("海洋类型".GetTranslate() + ":", stylenormalblue, Array.Empty<GUILayoutOption>());
					GUILayout.Space(20f);
					GUILayout.Label(itemText, stylenormalblue, Array.Empty<GUILayoutOption>());
					GUILayout.EndHorizontal();
					GUILayout.Space(5f);
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("星球类型".GetTranslate() + ":", stylenormalblue, Array.Empty<GUILayoutOption>());
					GUILayout.Space(20f);
					GUILayout.Label(val.typeString, stylenormalblue, Array.Empty<GUILayoutOption>());
					GUILayout.EndHorizontal();
					if (val.singularityString.Length > 0)
					{
						GUILayout.Space(5f);
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						GUILayout.Label("星球特殊性".GetTranslate() + ": ", stylenormalblue, Array.Empty<GUILayoutOption>());
						GUILayout.Space(20f);
						GUILayout.Label(val.singularityString, stylenormalblue, Array.Empty<GUILayoutOption>());
						GUILayout.EndHorizontal();
					}
				}
				GUILayout.Space(5f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("工厂状态".GetTranslate() + ":", stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.Space(20f);
				GUILayout.Label(MoreStatInfo.allstatinfo.planetstatinfoDic[val.id].Existfactory ? "有".GetTranslate() : "无".GetTranslate(), stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.Space(5f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("距离玩家".GetTranslate() + ":", stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.Space(20f);
				GUILayout.Label(DistancecalCulate.PlayerToPlanetDisTranslate(val), stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				if (GUILayout.Button("方向指引".GetTranslate(), Array.Empty<GUILayoutOption>()))
				{
					GameMain.mainPlayer.navigation._indicatorAstroId = val.id;
				}
				GUILayout.Space(20f);
				if (val.gasItems != null)
				{
					for (int m = 0; m < val.gasItems.Length; m++)
					{
						ItemProto val2 = ItemProto.itemProtoById[val.gasItems[m]];
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						GUILayout.Button((Texture)(object)val2.iconSprite.texture, emptyStyle, iconoptions);
						GUILayout.Label(((Proto)val2).name + ":" + $"{val.gasSpeeds[m]:N2}", stylenormalblue, Array.Empty<GUILayoutOption>());
						GUILayout.EndHorizontal();
					}
				}
				else
				{
					VeinSearch.CalcVeinAmounts(val);
					int[] array = VeinSearch.veinSpotsSketch(val);
					int num2 = 1;
					while (array != null && num2 <= 14)
					{
						if (array[num2] != 0)
						{
							long num3 = VeinSearch.veinAmounts[num2];
							ItemProto val3 = ItemProto.itemProtoById[((ProtoSet<VeinProto>)(object)LDB.veins).Select(num2).MiningItem];
							GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
							GUILayout.Button((Texture)(object)val3.iconSprite.texture, emptyStyle, iconoptions);
							StringBuilderUtility.WriteKMG(sb, 9, num3, false);
							GUILayout.Label(((Proto)val3).name + sb.ToString() + "(" + array[num2] + ")", stylenormalblue, Array.Empty<GUILayoutOption>());
							GUILayout.EndHorizontal();
						}
						num2++;
					}
				}
				GUILayout.EndVertical();
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
				GUILayout.Space(20f);
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				if (val.orbitAroundPlanet != null)
				{
					GUILayout.Label("围绕行星".GetTranslate() + ":", styleboldblue, Array.Empty<GUILayoutOption>());
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Space(20f);
					GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
					text2 = GUILayout.TextArea(val.orbitAroundPlanet.displayName, Array.Empty<GUILayoutOption>());
					if (!text2.Equals(val.orbitAroundPlanet.displayName))
					{
						val.orbitAroundPlanet.overrideName = text2;
						val.orbitAroundPlanet.NotifyOnDisplayNameChange();
					}
					for (int n = 0; n < val.orbitAroundPlanet.gasItems.Length; n++)
					{
						ItemProto val4 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(val.orbitAroundPlanet.gasItems[n]);
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						GUILayout.Button((Texture)(object)val4.iconSprite.texture, emptyStyle, iconoptions);
						GUILayout.Label(((Proto)val4).name + ":" + $"{val.orbitAroundPlanet.gasSpeeds[n]:N2}", stylenormalblue, Array.Empty<GUILayoutOption>());
						GUILayout.EndHorizontal();
					}
					GUILayout.EndVertical();
					GUILayout.EndHorizontal();
					GUILayout.Space((float)heightdis);
				}
				GUILayout.Label("恒星信息".GetTranslate() + ":", styleboldblue, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(20f);
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				StarData star = val.star;
				string text3 = GUILayout.TextArea(star.displayName, Array.Empty<GUILayoutOption>());
				if (!text3.Equals(star.displayName))
				{
					star.overrideName = text3;
					star.NotifyOnDisplayNameChange();
				}
				GUILayout.Space(5f);
				GUILayout.Label(star.typeString, stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.Space(5f);
				GUILayout.Label("恒星亮度".GetTranslate() + ":" + star.dysonLumino, stylenormalblue, Array.Empty<GUILayoutOption>());
				GUILayout.Space(5f);
				GUILayout.EndVertical();
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
				GUILayout.EndVertical();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		public void StatInfoPanel()
		{
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			ColumnWidth[0] = (MoreStatInfo.IsEnglish ? (heightdis * 8) : (heightdis * 4));
			for (int i = 1; i <= 10; i++)
			{
				if (i == 5 || i == 6)
				{
					ColumnWidth[i] = (TGMKinttostringMode ? (heightdis * 4) : (heightdis * 2));
				}
				else
				{
					ColumnWidth[i] = heightdis * 4;
				}
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Space((float)heightdis);
			for (int j = 0; j <= 10; j++)
			{
				GUIStyle val = ((j % 2 == 0) ? buttonstyleyellow : buttonstyleblue);
				if (GUILayout.Button(columnsbuttonstr[j].GetTranslate(), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)ColumnWidth[j]) }))
				{
					ChangeSort(j);
				}
			}
			GUILayout.EndHorizontal();
			foreach (int item in iteminfoshow.Skip((ItemInfoShowIndex - 1) * 20).Take(20))
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				int num = item;
				ItemProto val2 = ItemProto.itemProtoById[num];
				if (val2 == null)
				{
					continue;
				}
				GUILayout.Button((Texture)(object)val2.iconSprite.texture, emptyStyle, iconoptions);
				GUILayout.Label(((Proto)val2).name, styleitemname, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)ColumnWidth[0]) });
				for (int k = 0; k < 10; k++)
				{
					GUIStyle val3 = ((k % 2 == 0) ? styleboldblue : styleyellow);
					if (TGMKinttostringMode)
					{
						StringBuilderUtility.WriteKMG(sb, 9, MoreStatInfo.allstatinfo.ProductCount[num][k], false);
					}
					else
					{
						val3 = ((k % 2 == 0) ? stylesmallblue : stylesmallyellow);
					}
					string text = (TGMKinttostringMode ? sb.ToString() : MoreStatInfo.allstatinfo.ProductCount[num][k].ToString());
					GUILayout.Label(text, val3, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width((float)ColumnWidth[k + 1]),
						GUILayout.Height((float)heightdis)
					});
				}
				GUILayout.EndHorizontal();
			}
			int num2 = (int)((float)iteminfoshow.Count / 20.5f) + 1;
			ItemInfoShowIndex = Math.Min(ItemInfoShowIndex, num2);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int l = 1; l <= num2; l++)
			{
				if (num2 <= 1)
				{
					break;
				}
				GUIStyle button = GUI.skin.button;
				if (l == ItemInfoShowIndex)
				{
					button = selectedPlanetButtonStyle;
				}
				if (GUILayout.Button(l.ToString() ?? "", button, iconoptions))
				{
					ItemInfoShowIndex = l;
				}
			}
			if (GUILayout.Button("导出数据".GetTranslate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)heightdis) }))
			{
				OutputDataUtil.OutputItemInfo();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		public void UIPanelSet()
		{
			//IL_001d: 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_005f: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			RectTransform component = ui_morestatinfopanel.GetComponent<RectTransform>();
			RectTransform component2 = ((Component)UIRoot.instance.overlayCanvas).GetComponent<RectTransform>();
			float num = component2.sizeDelta.x * 1f / (float)Screen.width;
			float num2 = component2.sizeDelta.y * 1f / (float)Screen.height;
			component.sizeDelta = new Vector2(num * PanelMaskWidth, num2 * MainWindowHeight);
			((Transform)component).localPosition = Vector2.op_Implicit(new Vector2((0f - component2.sizeDelta.x) / 2f + MainWindow_x * num, component2.sizeDelta.y / 2f - MainWindow_y * num2 - component.sizeDelta.y));
		}

		private void FilterUI()
		{
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("产物筛选".GetTranslate(), Array.Empty<GUILayoutOption>());
			rawmaterial = GUILayout.Toggle(rawmaterial, "一级原料".GetTranslate(), Array.Empty<GUILayoutOption>());
			secondrawmaterial = GUILayout.Toggle(secondrawmaterial, "二级原料".GetTranslate(), Array.Empty<GUILayoutOption>());
			building = GUILayout.Toggle(building, "建筑".GetTranslate(), Array.Empty<GUILayoutOption>());
			compound = GUILayout.Toggle(compound, "合成材料".GetTranslate(), Array.Empty<GUILayoutOption>());
			onlyseechose = GUILayout.Toggle(onlyseechose, "只看目标产物".GetTranslate(), Array.Empty<GUILayoutOption>());
			SortbyPointProduct = GUILayout.Toggle(SortbyPointProduct, "依目标产物排序".GetTranslate(), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			noreachtheoryproduce = GUILayout.Toggle(noreachtheoryproduce, "实时产量<理论产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			noreachneedproduce = GUILayout.Toggle(noreachneedproduce, "实时产量<需求产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			theorynoreachneedproduce = GUILayout.Toggle(theorynoreachneedproduce, "理论产量<需求产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			bool[] array = new bool[4] { producelimittoggle, comsumeimittoggle, theorycomsumelimittoggle, theoryproducelimittoggle };
			string[] array2 = new string[4] { producelowerlimitstr, comsumelowerlimitstr, theorycomsumelowerlimitstr, theoryproducelowerlimitstr };
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			array[0] = GUILayout.Toggle(producelimittoggle, "实时产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			array2[0] = GUILayout.TextArea(producelowerlimitstr + "/min", Array.Empty<GUILayoutOption>());
			array[1] = GUILayout.Toggle(comsumeimittoggle, "实时消耗".GetTranslate(), Array.Empty<GUILayoutOption>());
			array2[1] = GUILayout.TextArea(comsumelowerlimitstr + "/min", Array.Empty<GUILayoutOption>());
			array[2] = GUILayout.Toggle(theorycomsumelimittoggle, "需求产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			array2[2] = GUILayout.TextArea(theorycomsumelowerlimitstr + "/min", Array.Empty<GUILayoutOption>());
			array[3] = GUILayout.Toggle(theoryproducelimittoggle, "理论产量".GetTranslate(), Array.Empty<GUILayoutOption>());
			array2[3] = GUILayout.TextArea(theoryproducelowerlimitstr + "/min", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			producelowerlimitstr = Regex.Replace(array2[0], "[^0-9]", "");
			comsumelowerlimitstr = Regex.Replace(array2[1], "[^0-9]", "");
			theorycomsumelowerlimitstr = Regex.Replace(array2[2], "[^0-9]", "");
			theoryproducelowerlimitstr = Regex.Replace(array2[3], "[^0-9]", "");
			producelowerlimitstr = ClampString(producelowerlimitstr, 0, 9);
			comsumelowerlimitstr = ClampString(comsumelowerlimitstr, 0, 9);
			theorycomsumelowerlimitstr = ClampString(theorycomsumelowerlimitstr, 0, 9);
			theoryproducelowerlimitstr = ClampString(theoryproducelowerlimitstr, 0, 9);
			int.TryParse(comsumelowerlimitstr, out comsumelowerlimit);
			int.TryParse(theorycomsumelowerlimitstr, out theorycomsumelowerlimit);
			int.TryParse(theoryproducelowerlimitstr, out theoryproducelowerlimit);
			int.TryParse(producelowerlimitstr, out producelowerlimit);
			if (!SequenceCompare.SequenceEqual(array, new bool[4] { producelimittoggle, comsumeimittoggle, theorycomsumelimittoggle, theoryproducelimittoggle }))
			{
				producelimittoggle = array[0];
				comsumeimittoggle = array[1];
				theorycomsumelimittoggle = array[2];
				theoryproducelimittoggle = array[3];
			}
			List<int> list = new List<int>();
			int[] itemIds = ItemProto.itemIds;
			foreach (int num in itemIds)
			{
				if (num == 1030 || num == 1031 || (((num >= 1000 && num < 1030) || num == 1208) && !rawmaterial) || (num > 1100 && num < 1200 && !secondrawmaterial))
				{
					continue;
				}
				ItemProto val = ItemProto.itemProtoById[num];
				if (val == null || (val.CanBuild && !building))
				{
					continue;
				}
				if (val.recipes.Count > 0)
				{
					switch (num)
					{
					default:
						if (val.BuildIndex == 0 && !compound)
						{
							continue;
						}
						break;
					case 1003:
					case 1101:
					case 1102:
					case 1103:
					case 1104:
					case 1105:
					case 1106:
					case 1107:
					case 1108:
					case 1109:
					case 1110:
					case 1111:
					case 1112:
					case 1113:
					case 1114:
					case 1115:
					case 1116:
					case 1117:
					case 1118:
					case 1119:
					case 1120:
					case 1121:
					case 1122:
					case 1123:
					case 1124:
					case 1125:
					case 1126:
					case 1127:
					case 1128:
					case 1129:
					case 1130:
					case 1131:
					case 1132:
					case 1133:
					case 1134:
					case 1135:
					case 1136:
					case 1137:
					case 1138:
					case 1139:
					case 1140:
					case 1141:
					case 1142:
					case 1143:
					case 1144:
					case 1145:
					case 1146:
					case 1147:
					case 1148:
					case 1149:
					case 1150:
					case 1151:
					case 1152:
					case 1153:
					case 1154:
					case 1155:
					case 1156:
					case 1157:
					case 1158:
					case 1159:
					case 1160:
					case 1161:
					case 1162:
					case 1163:
					case 1164:
					case 1165:
					case 1166:
					case 1167:
					case 1168:
					case 1169:
					case 1170:
					case 1171:
					case 1172:
					case 1173:
					case 1174:
					case 1175:
					case 1176:
					case 1177:
					case 1178:
					case 1179:
					case 1180:
					case 1181:
					case 1182:
					case 1183:
					case 1184:
					case 1185:
					case 1186:
					case 1187:
					case 1188:
					case 1189:
					case 1190:
					case 1191:
					case 1192:
					case 1193:
					case 1194:
					case 1195:
					case 1196:
					case 1197:
					case 1198:
					case 1199:
						break;
					}
				}
				list.Add(num);
			}
			int num2 = (int)MainWindowWidth / heightdis - 2;
			int count = list.Count;
			int num3 = count / num2 + ((count % num2 > 0) ? 1 : 0);
			for (int j = 0; j < num3; j++)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int k = 0; k < num2; k++)
				{
					int num4 = j * num2 + k;
					if (num4 == count)
					{
						break;
					}
					int num5 = list[num4];
					ItemProto val2 = ItemProto.itemProtoById[num5];
					GUIStyle val3 = emptyStyle;
					if (Productsearchcondition[num5])
					{
						val3 = whiteStyle;
					}
					if (GUILayout.Button((Texture)(object)val2.iconSprite.texture, val3, iconoptions))
					{
						Productsearchcondition[num5] = !Productsearchcondition[num5];
						if (SortbyPointProduct && Productsearchcondition[num5])
						{
							Array.Clear(Productsearchcondition, 0, 12000);
							Productsearchcondition[num5] = true;
						}
					}
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.EndVertical();
		}

		private void MainWindowShowFun()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			MoreStatInfo.IsEnglish = (int)Localization.CurrentLanguage.glyph == 0;
			MoveWindow();
			Scaling_Window();
			GUI.DrawTexture(GUI.Window(20210821, new Rect(MainWindow_x, MainWindow_y, MainWindowWidth, MainWindowHeight), new WindowFunction(MainWindow), "统计面板".GetTranslate() + "(1.5.8)ps:ctrl+↑↓"), (Texture)(object)mytexture);
		}

		private void PlanetWindow(int id)
		{
			try
			{
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				int num = (int)(MainWindowHeight / (float)(heightdis + 1) - 2f);
				for (int i = (pdselectinfoindex - 1) * num; i < pdselectinfoindex * num && i < planetinfoshow.Count; i++)
				{
					GUIStyle val = normalPlanetButtonStyle;
					if (!Multplanetproduct)
					{
						if (pointPlanetId == planetinfoshow[i])
						{
							val = selectedPlanetButtonStyle;
						}
						if (GUILayout.Button(GameMain.galaxy.PlanetById(planetinfoshow[i]).displayName, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)heightdis) }))
						{
							pointPlanetId = planetinfoshow[i];
							RefreshFactory(pointPlanetId);
						}
						continue;
					}
					if (planetsproductinfoshow.Contains(planetinfoshow[i]))
					{
						val = selectedPlanetButtonStyle;
					}
					if (GUILayout.Button(GameMain.galaxy.PlanetById(planetinfoshow[i]).displayName, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)heightdis) }))
					{
						if (planetsproductinfoshow.Contains(planetinfoshow[i]))
						{
							planetsproductinfoshow.Remove(planetinfoshow[i]);
						}
						else
						{
							planetsproductinfoshow.Add(planetinfoshow[i]);
						}
					}
				}
				int num2 = planetinfoshow.Count / num + ((planetinfoshow.Count % num != 0) ? 1 : 0);
				GUILayout.FlexibleSpace();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int j = ((pdselectinfoindex <= 3) ? 1 : (pdselectinfoindex - 2)); j <= num2; j++)
				{
					if (GUILayout.Button(j.ToString(), (j == pdselectinfoindex) ? selectedPlanetButtonStyle : normalPlanetButtonStyle, iconoptions))
					{
						pdselectinfoindex = j;
					}
				}
				GUILayout.Space(10f);
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
			}
			catch
			{
			}
		}

		private void PlanetWindowShowFun()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(GUI.Window(202108213, new Rect(MainWindow_x + MainWindowWidth, MainWindow_y, (float)(heightdis * 7), MainWindowHeight), new WindowFunction(PlanetWindow), ""), (Texture)(object)mytexture);
		}

		private void SwitchWindow(int id)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginArea(new Rect(10f, 20f, (float)switchwitdh, (float)switchheight));
			RemoteorLocal = GUILayout.Toggle(RemoteorLocal, "本地/远程".GetTranslate(), Array.Empty<GUILayoutOption>());
			PlanetorSum = GUILayout.Toggle(PlanetorSum, "全部/星球".GetTranslate(), Array.Empty<GUILayoutOption>());
			StopRefresh = GUILayout.Toggle(StopRefresh, "停止刷新".GetTranslate(), Array.Empty<GUILayoutOption>());
			TGMKinttostringMode = GUILayout.Toggle(TGMKinttostringMode, "单位转化".GetTranslate(), Array.Empty<GUILayoutOption>());
			Filtercondition = GUILayout.Toggle(Filtercondition, "筛选条件".GetTranslate(), Array.Empty<GUILayoutOption>());
			Refreshfactoryinfo = GUILayout.Toggle(Refreshfactoryinfo, "工厂信息".GetTranslate(), Array.Empty<GUILayoutOption>());
			RefreshPlanetinfo = GUILayout.Toggle(RefreshPlanetinfo, "星球信息".GetTranslate(), Array.Empty<GUILayoutOption>());
			Multplanetproduct = GUILayout.Toggle(Multplanetproduct, "多选星球".GetTranslate(), Array.Empty<GUILayoutOption>());
			GUILayout.EndArea();
		}

		private void SwitchWindowShowFun()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(GUI.Window(202108212, new Rect(MainWindow_x - (float)switchwitdh, MainWindow_y, (float)switchwitdh, (float)switchheight), new WindowFunction(SwitchWindow), ""), (Texture)(object)mytexture);
		}

		public void MoveWindow()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_002e: 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_0057: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if (leftscaling || rightscaling || bottomscaling)
			{
				return;
			}
			Vector2 val = Vector2.op_Implicit(Input.mousePosition);
			if (val.x > MainWindow_x && val.x < MainWindow_x + MainWindowWidth && (float)Screen.height - val.y > MainWindow_y && (float)Screen.height - val.y < MainWindow_y + 20f)
			{
				if (Input.GetMouseButton(0))
				{
					if (!moving)
					{
						MainWindow_x_move = MainWindow_x;
						MainWindow_y_move = MainWindow_y;
						temp_MainWindow_x = val.x;
						temp_MainWindow_y = (float)Screen.height - val.y;
					}
					moving = true;
					MainWindow_x = MainWindow_x_move + val.x - temp_MainWindow_x;
					MainWindow_y = MainWindow_y_move + ((float)Screen.height - val.y) - temp_MainWindow_y;
				}
				else
				{
					moving = false;
					temp_MainWindow_x = MainWindow_x;
					temp_MainWindow_y = MainWindow_y;
				}
			}
			else if (moving)
			{
				moving = false;
				MainWindow_x = MainWindow_x_move + val.x - temp_MainWindow_x;
				MainWindow_y = MainWindow_y_move + ((float)Screen.height - val.y) - temp_MainWindow_y;
			}
			MainWindow_y = Math.Max(10f, Math.Min(Screen.height - 10, MainWindow_y));
			MainWindow_x = Math.Max(10f, Math.Min(Screen.width - 10, MainWindow_x));
		}

		public void Scaling_Window()
		{
			//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_0028: 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_0056: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00cd: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			float num = MainWindowWidth;
			float num2 = MainWindowHeight;
			if (Input.GetMouseButton(0))
			{
				Vector2 val = Vector2.op_Implicit(Input.mousePosition);
				if ((val.x + 10f > MainWindow_x && val.x - 10f < MainWindow_x && (float)Screen.height - val.y >= MainWindow_y && (float)Screen.height - val.y <= MainWindow_y + num2) || leftscaling)
				{
					num -= val.x - MainWindow_x;
					MainWindow_x = val.x;
					leftscaling = true;
					rightscaling = false;
				}
				if ((val.x + 10f > MainWindow_x + num && val.x - 10f < MainWindow_x + num && (float)Screen.height - val.y >= MainWindow_y && (float)Screen.height - val.y <= MainWindow_y + num2) || rightscaling)
				{
					num += val.x - MainWindow_x - num;
					rightscaling = true;
					leftscaling = false;
				}
				if (((float)Screen.height - val.y + 2f > num2 + MainWindow_y && (float)Screen.height - val.y - 2f < num2 + MainWindow_y && val.x >= MainWindow_x && val.x <= MainWindow_x + num) || bottomscaling)
				{
					num2 += (float)Screen.height - val.y - (MainWindow_y + num2);
					bottomscaling = true;
				}
				if ((rightscaling || leftscaling) && (float)Screen.height - val.y + 10f > MainWindow_y && (float)Screen.height - val.y - 10f < MainWindow_y && val.x >= MainWindow_x && val.x <= MainWindow_x + num)
				{
					num2 -= (float)Screen.height - val.y - MainWindow_y;
					MainWindow_y = (float)Screen.height - val.y;
				}
			}
			if (Input.GetMouseButtonUp(0))
			{
				rightscaling = false;
				leftscaling = false;
				bottomscaling = false;
			}
			MainWindowWidth = num;
			MainWindowHeight = num2;
		}

		internal void Reset()
		{
			Array.Clear(Productsearchcondition, 0, 12000);
		}
	}
	public static class MoreStatInfoTranslate
	{
		private static Dictionary<string, string> TranslateDict = new Dictionary<string, string>();

		public static string GetItemText(this int itemId)
		{
			string result = "无".GetTranslate();
			if (itemId < 0)
			{
				result = itemId switch
				{
					-2 => Localization.Translate("冰"), 
					-1 => Localization.Translate("熔岩"), 
					_ => Localization.Translate("未知"), 
				};
			}
			else
			{
				ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId);
				if (val != null)
				{
					result = ((Proto)val).name;
				}
			}
			return result;
		}

		public static string GetSearchchinese(this int Index)
		{
			if (0 < Index && Index < 15)
			{
				return ((Proto)ItemProto.itemProtoById[((ProtoSet<VeinProto>)(object)LDB.veins).Select(Index).MiningItem]).name;
			}
			return Index switch
			{
				15 => "可燃冰".GetTranslate(), 
				16 => "氢".GetTranslate(), 
				17 => "重氢".GetTranslate(), 
				18 => "水".GetTranslate(), 
				19 => "硫酸".GetTranslate(), 
				20 => "潮汐锁定".GetTranslate(), 
				21 => "轨道共振1:2".GetTranslate(), 
				22 => "轨道共振1:4".GetTranslate(), 
				23 => "横躺自传".GetTranslate(), 
				24 => "反向自传".GetTranslate(), 
				25 => "多卫星".GetTranslate(), 
				_ => "", 
			};
		}

		public static string GetTranslate(this string s)
		{
			return (MoreStatInfo.IsEnglish && TranslateDict.ContainsKey(s) && TranslateDict[s].Length > 0) ? TranslateDict[s] : s;
		}

		public static void regallTranslate()
		{
			TranslateDict.Clear();
			TranslateDict.Add("统计面板", "StatPannel");
			TranslateDict.Add("导出数据", "Output Data");
			TranslateDict.Add("放电功率", "Discharging power");
			TranslateDict.Add("充电功率", "Charging power");
			TranslateDict.Add("可燃冰", "Fire ice");
			TranslateDict.Add("氢", "Hydrogen");
			TranslateDict.Add("重氢", "Deuterium");
			TranslateDict.Add("水", "Water");
			TranslateDict.Add("硫酸", "Sulfuric acid");
			TranslateDict.Add("潮汐锁定", "Tidal locking perpetual day and night");
			TranslateDict.Add("轨道共振1:2", "Orbital resonance 1:2");
			TranslateDict.Add("轨道共振1:4", "Orbital resonance 1:4");
			TranslateDict.Add("距离玩家", "Distance from player");
			TranslateDict.Add("横躺自传", "Horizontal rotation");
			TranslateDict.Add("反向自传", "Reverse rotation");
			TranslateDict.Add("多卫星", "Satellite");
			TranslateDict.Add("工厂状态", "Factory Status");
			TranslateDict.Add("有", "Existed");
			TranslateDict.Add("电力不足", "Insufficient power");
			TranslateDict.Add("产物筛选", "Item filter");
			TranslateDict.Add("一级原料", "rawmaterial");
			TranslateDict.Add("二级原料", "secondrawmaterial");
			TranslateDict.Add("建筑", "Building");
			TranslateDict.Add("合成材料", "Compound");
			TranslateDict.Add("只看目标产物", "only show point item");
			TranslateDict.Add("依目标产物排序", "Sort by point item's prod.");
			TranslateDict.Add("实时产量<理论产量", "prod.<Theoretical prod.");
			TranslateDict.Add("实时产量<需求产量", "prod.<Theoretical cons.");
			TranslateDict.Add("理论产量<需求产量", "Theoretical prod.<Theoretical cons.");
			TranslateDict.Add("发电性能", "Generation capacity");
			TranslateDict.Add("耗电需求", "Consumption demand");
			TranslateDict.Add("总耗能", "Total energy consumption");
			TranslateDict.Add("物品", "ItemName");
			TranslateDict.Add("无", "None");
			TranslateDict.Add("生产者", "Producer");
			TranslateDict.Add("消费者", "Consumer");
			TranslateDict.Add("总计", "Total");
			TranslateDict.Add("本地提供", "LocalProvide");
			TranslateDict.Add("本地需求", "LocalDemand");
			TranslateDict.Add("本地仓储", "LocalStore");
			TranslateDict.Add("远程提供", "RemoteProvide");
			TranslateDict.Add("远程需求", "RemoteDemand");
			TranslateDict.Add("远程仓储", "RemoteStore");
			TranslateDict.Add("实时产量", "Prodcution");
			TranslateDict.Add("实时消耗", "Consumption");
			TranslateDict.Add("需求产量", "Theoretical cons.");
			TranslateDict.Add("理论产量", "Theoretical prod.");
			TranslateDict.Add("围绕行星", "Orbit Around Planet");
			TranslateDict.Add("恒星亮度", "Star lumination");
			TranslateDict.Add("恒星信息", "Star information");
			TranslateDict.Add("星球类型", "Planet type");
			TranslateDict.Add("海洋类型", "Ocean type");
			TranslateDict.Add("行星信息", "Planet information");
			TranslateDict.Add("方向指引", "Indicator");
			TranslateDict.Add("目标星球矿物", "VeinType");
			TranslateDict.Add("附属气态星产物", "GasType");
			TranslateDict.Add("星球特殊性", "PlanetSingularity");
			TranslateDict.Add("本地/远程", "Local/Remote");
			TranslateDict.Add("全部/星球", "Total/Planets");
			TranslateDict.Add("停止刷新", "StopRefresh");
			TranslateDict.Add("单位转化", "Unit conversion");
			TranslateDict.Add("筛选条件", "FilterCondition");
			TranslateDict.Add("工厂信息", "FactoryInfo");
			TranslateDict.Add("星球信息", "PlanetInfo");
			TranslateDict.Add("多选星球", "Multiple select planets");
			TranslateDict.Add("防止穿透", "Close White Panel");
			TranslateDict.Add("加载全部星球", "Load All Planets");
			TranslateDict.Add("已加载星球", "Loaded Planets");
			TranslateDict.Add("未加载星球", "Unloaded Planets");
			TranslateDict.Add("个星球加载中", "Unloaded Planets");
			TranslateDict.Add("未选择", "UnSelected");
		}
	}
	[BepInPlugin("cn.blacksnipe.dsp.MoreStatInfo", "MoreStatInfo", "1.5.8")]
	public class MoreStatInfo : BaseUnityPlugin
	{
		public const string GUID = "cn.blacksnipe.dsp.MoreStatInfo";

		public const string NAME = "MoreStatInfo";

		public const string VERSION = "1.5.8";

		public static AllStatInfo allstatinfo;

		public static bool IsEnglish;

		public static bool OneSecondElapsed;

		public static ConfigEntry<int> scale;

		private static GUIDraw guiDraw;

		private static ConfigEntry<KeyboardShortcut> QuickKey;

		private bool firstStart = true;

		private bool IsFirstMainMenu;

		private IEnumerator OneSecondCheck()
		{
			while (true)
			{
				OneSecondElapsed = true;
				yield return (object)new WaitForSeconds(1f);
			}
		}

		private void OnGUI()
		{
			if (IsFirstMainMenu)
			{
				guiDraw.Draw();
			}
		}

		private void Start()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			scale = ((BaseUnityPlugin)this).Config.Bind<int>("大小适配", "scale", 16, (ConfigDescription)null);
			QuickKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("打开窗口快捷键", "Key", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null);
			MoreStatInfoTranslate.regallTranslate();
			Debug.Log((object)"MoreStatInfo Start");
			((MonoBehaviour)this).StartCoroutine(OneSecondCheck());
		}

		private void Update()
		{
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameMain.instance == (Object)null)
			{
				return;
			}
			if (!IsFirstMainMenu)
			{
				UIRoot instance = UIRoot.instance;
				if (instance != null)
				{
					UIMainMenu uiMainMenu = instance.uiMainMenu;
					if (((uiMainMenu != null) ? new bool?(((ManualBehaviour)uiMainMenu).active) : null).GetValueOrDefault() && ItemProto.itemIds != null)
					{
						IsFirstMainMenu = true;
						guiDraw = new GUIDraw(scale.Value);
						allstatinfo = default(AllStatInfo);
						allstatinfo.Init();
					}
				}
			}
			if (!GameMain.instance.running)
			{
				firstStart = false;
				while (PlanetModelingManager.calPlanetReqList.Count > 0)
				{
					PlanetModelingManager.calPlanetReqList.Dequeue();
				}
			}
			else if (!firstStart)
			{
				firstStart = true;
				if (guiDraw.OnGUIInited)
				{
					guiDraw.Reset();
				}
				allstatinfo.Collect(GameMain.galaxy);
			}
			else
			{
				KeyboardShortcut value = QuickKey.Value;
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					guiDraw.ShowGUIWindow = !guiDraw.ShowGUIWindow;
				}
			}
		}
	}
	public enum PanelMode
	{
		GalaxyStatInfo,
		TargetSinglePlanetStatInfo,
		MultiplePlanetStatInfo
	}
	public class PlanetStatInfo
	{
		public bool Existfactory;

		public bool IsUsed;

		public PlanetData pd;

		public int[] planetsveinSpotsSketch;

		public long[] Powerenergyinfoshow;

		public long[][] ProductCount;

		public int productCursor;

		public bool[] ProductExist;

		public Dictionary<int, float> TheoryProductDiction;

		public Dictionary<int, float> TheoryRequireDiction;

		public long[] veinAmounts;

		public bool Lackofelectricity => Powerenergyinfoshow[0] + Powerenergyinfoshow[3] > Powerenergyinfoshow[1];

		public void ClearAll()
		{
			productCursor = 0;
			Array.Clear(Powerenergyinfoshow, 0, 5);
			Array.Clear(veinAmounts, 0, 64);
			Array.Clear(ProductExist, 0, 12000);
			Existfactory = false;
			for (int i = 0; i < ItemProto.itemIds.Length; i++)
			{
				int num = ItemProto.itemIds[i];
				Array.Clear(ProductCount[num], 0, 10);
				TheoryProductDiction[num] = 0f;
				TheoryRequireDiction[num] = 0f;
			}
		}

		public void Collect()
		{
			if (pd.factory == null)
			{
				return;
			}
			ClearAll();
			FactoryProductionStat val = GameMain.data.statistics.production.factoryStatPool[pd.factory.index];
			if (val != null)
			{
				int[] itemIds = ItemProto.itemIds;
				foreach (int num in itemIds)
				{
					int num2 = val.productIndices[num];
					if (num2 != 0)
					{
						productCursor++;
						ProductExist[num] = true;
						ProductCount[num][0] += val.productPool[num2].total[1];
						ProductCount[num][1] += val.productPool[num2].total[8];
					}
				}
				PowerenergyinfoshowCollect(val);
			}
			FactorySystem factorySystem = pd.factory.factorySystem;
			Existfactory = factorySystem.factory.entityCount > 0;
			MinerPoolCollect(factorySystem);
			FractionatorPoolCollect(factorySystem);
			SiloPoolCollect(factorySystem);
			EjectorPoolCollect(factorySystem);
			AssemblerPoolCollect(factorySystem);
			LabPoolCollect(factorySystem);
			PowerGeneratorComponentCollect(factorySystem);
			PowerExchangerComponentCollect(factorySystem);
			StorageInfoCollect(factorySystem);
			StationComponentCollect(factorySystem);
			for (int j = 0; j < ItemProto.itemIds.Length; j++)
			{
				int num3 = ItemProto.itemIds[j];
				ProductCount[num3][2] = (long)TheoryProductDiction[num3];
				ProductCount[num3][3] = (long)TheoryRequireDiction[num3];
				if (ProductCount[num3][2] > 0 || ProductCount[num3][3] > 0)
				{
					productCursor++;
					ProductExist[num3] = true;
				}
			}
		}

		public void Init()
		{
			IsUsed = true;
			TheoryProductDiction = new Dictionary<int, float>();
			TheoryRequireDiction = new Dictionary<int, float>();
			Powerenergyinfoshow = new long[5];
			ProductCount = new long[12000][];
			ProductExist = new bool[12000];
			veinAmounts = new long[64];
			for (int i = 0; i < ItemProto.itemIds.Length; i++)
			{
				int num = ItemProto.itemIds[i];
				ProductCount[num] = new long[10];
				TheoryProductDiction.Add(num, 0f);
				TheoryRequireDiction.Add(num, 0f);
			}
		}

		internal void Collect(PlanetData pd)
		{
			this.pd = pd;
			VeinInfoCal();
		}

		private void AssemblerPoolCollect(FactorySystem fs)
		{
			//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_0019: 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_0042: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			AssemblerComponent[] assemblerPool = fs.assemblerPool;
			foreach (AssemblerComponent val in assemblerPool)
			{
				RecipeProto val2;
				if (val.id <= 0 || val.entityId <= 0 || (val2 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(val.recipeId)) == null)
				{
					continue;
				}
				for (int j = 0; j < val2.Items.Length; j++)
				{
					ProductCount[val2.Items[j]][5]++;
					if (val.extraSpeed == 0)
					{
						TheoryRequireDiction[val2.Items[j]] += (float)val2.ItemCounts[j] * 9f * (float)val.speedOverride / ((float)val2.TimeSpend * 25f);
					}
					else
					{
						TheoryRequireDiction[val2.Items[j]] += (float)val2.ItemCounts[j] * 9f * (float)val.speed / ((float)val2.TimeSpend * 25f);
					}
				}
				for (int k = 0; k < val2.Results.Length; k++)
				{
					ProductCount[val2.Results[k]][4]++;
					if (val.extraSpeed == 0)
					{
						TheoryProductDiction[val2.Results[k]] += (float)val2.ResultCounts[k] * 9f * (float)val.speedOverride / ((float)val2.TimeSpend * 25f);
					}
					else
					{
						TheoryProductDiction[val2.Results[k]] += (float)val2.ResultCounts[k] * 9f * (float)(val.speed + val.extraSpeed / 10) / ((float)val2.TimeSpend * 25f);
					}
				}
			}
		}

		private void EjectorPoolCollect(FactorySystem fs)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			EjectorComponent[] ejectorPool = fs.ejectorPool;
			foreach (EjectorComponent val in ejectorPool)
			{
				if (val.id > 0 && val.entityId > 0)
				{
					ProductCount[1501][5]++;
					TheoryRequireDiction[1501] += 20f;
				}
			}
		}

		private void FractionatorPoolCollect(FactorySystem fs)
		{
			//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_0019: 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_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_0084: Unknown result type (might be due to invalid IL or missing references)
			FractionatorComponent[] fractionatorPool = fs.fractionatorPool;
			for (int i = 0; i < fractionatorPool.Length; i++)
			{
				FractionatorComponent val = fractionatorPool[i];
				if (val.id > 0 && val.entityId > 0)
				{
					ProductCount[1121][4]++;
					ProductCount[1120][5]++;
					float num = Mathf.Clamp(Mathf.Min(val.fluidInputCargoCount, 30f) * (float)(int)((double)val.fluidInputCount / (double)val.fluidInputCargoCount + 0.5) * 60f, 0f, 7200f) * (1f + ((FractionatorComponent)(ref val)).extraIncProduceProb) / 100f;
					TheoryProductDiction[1121] += num;
					TheoryRequireDiction[1120] += num;
				}
			}
		}

		private void LabPoolCollect(FactorySystem fs)
		{
			//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_0019: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			LabComponent[] labPool = fs.labPool;
			foreach (LabComponent val in labPool)
			{
				RecipeProto val2;
				if (val.id <= 0 || val.entityId <= 0 || (val2 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(val.recipeId)) == null)
				{
					continue;
				}
				bool flag = val.productive && !val.forceAccMode;
				float num = (float)val.speedOverride * (1f + (float)val.extraSpeed * 0.1f / (float)val.speedOverride) * 3600f / (float)val.timeSpend;
				for (int j = 0; j < val2.Items.Length; j++)
				{
					ProductCount[val2.Items[j]][5]++;
					if (flag)
					{
						TheoryRequireDiction[val2.Items[j]] += (float)val2.ItemCounts[j] * num * 1f / (1f + (float)val.extraSpeed * 1f / ((float)val.speed * 10f));
					}
					else
					{
						TheoryRequireDiction[val2.Items[j]] += (float)val2.ItemCounts[j] * num;
					}
				}
				for (int k = 0; k < val2.Results.Length; k++)
				{
					ProductCount[val2.Results[k]][4]++;
					TheoryProductDiction[val2.Results[k]] += num * (float)val2.ResultCounts[k];
				}
			}
		}

		private void MinerPoolCollect(FactorySystem fs)
		{
			//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_0019: 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_003b: 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: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Invalid comparison between Unknown and I4
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			MinerComponent[] minerPool = fs.minerPool;
			foreach (MinerComponent val in minerPool)
			{
				if (val.id <= 0 || val.entityId <= 0)
				{
					continue;
				}
				if ((int)val.type == 1 && pd.waterItemId > 0)
				{
					TheoryProductDiction[pd.waterItemId] += (long)(50f * GameMain.history.miningSpeedScale);
				}
				else if ((int)val.type == 2 && val.veinCount > 0)
				{
					int num = 0;
					for (int j = 0; j < val.veins.Length; j++)
					{
						if (val.veins[j] != 0 && val.veins[j] < fs.factory.veinPool.Length)
						{
							VeinData val2 = fs.factory.veinPool[val.veins[j]];
							if (val2.productId != 0)
							{
								num = val2.productId;
								break;
							}
						}
					}
					ProductCount[num][4]++;
					bool flag = pd.factory.entityPool[val.entityId].stationId > 0;
					TheoryProductDiction[num] += (long)((float)(30 * ((!flag) ? 1 : 2) * val.veinCount) * GameMain.history.miningSpeedScale * (float)val.speed) / 10000;
				}
				else
				{
					if ((int)val.type != 3 || val.veinCount <= 0)
					{
						continue;
					}
					for (int k = 0; k < val.veins.Length; k++)
					{
						if (val.veins[k] != 0 && val.veins[k] < fs.factory.veinPool.Length)
						{
							VeinData val3 = fs.factory.veinPool[val.veins[k]];
							ProductCount[1007][4]++;
							TheoryProductDiction[1007] += (long)((float)val3.amount * GameMain.history.miningSpeedScale * VeinData.oilSpeedMultiplier * 60f);
							break;
						}
					}
				}
			}
		}

		private void PowerenergyinfoshowCollect(FactoryProductionStat factoryProduction)
		{
			if (factoryProduction.powerPool != null && factoryProduction.powerPool.Length != 0)
			{
				Powerenergyinfoshow[0] = factoryProduction.powerPool[0].total[0] / 10;
				Powerenergyinfoshow[1] = factoryProduction.powerPool[1].total[0] / 10;
				Powerenergyinfoshow[2] = factoryProduction.energyConsumption;
				Powerenergyinfoshow[3] = factoryProduction.powerPool[3].total[0] / 10;
				Powerenergyinfoshow[4] = factoryProduction.powerPool[2].total[0] / 10;
			}
		}

		private void PowerExchangerComponentCollect(FactorySystem fs)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			PowerExchangerComponent[] excPool = fs.factory.powerSystem.excPool;
			foreach (PowerExchangerComponent val in excPool)
			{
				if (val.id > 0 && val.targetState != 0f)
				{
					int num = ((val.targetState == 1f) ? 2207 : 2206);
					int num2 = 4413 - num;
					ProductCount[num][4]++;
					ProductCount[num2][5]++;
					TheoryProductDiction[num] += 10f;
					TheoryRequireDiction[num2] += 10f;
				}
			}
		}

		private void PowerGeneratorComponentCollect(FactorySystem fs)
		{
			//IL_001f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			PowerGeneratorComponent[] genPool = fs.factory.powerSystem.genPool;
			for (int i = 0; i < genPool.Length; i++)
			{
				PowerGeneratorComponent val = genPool[i];
				if (val.gamma)
				{
					float num2 = 1f - GameMain.history.solarEnergyLossRate;
					num += ((PowerGeneratorComponent)(ref val)).EtaCurrent_Gamma(num2) * (float)((PowerGeneratorComponent)(ref val)).RequiresCurrent_Gamma(num2);
					ProductCount[1208][4]++;
				}
			}
			if (num > 0f)
			{
				TheoryProductDiction[1208] = (long)(num * 3f / 1000000f);
			}
		}

		private void SiloPoolCollect(FactorySystem fs)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			SiloComponent[] siloPool = fs.siloPool;
			foreach (SiloComponent val in siloPool)
			{
				if (val.id > 0 && val.entityId > 0)
				{
					ProductCount[1503][5]++;
					TheoryRequireDiction[1503] += 5f;
				}
			}
		}

		private void StationComponentCollect(FactorySystem fs)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_012f: 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_0137: Invalid comparison between Unknown and I4
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Invalid comparison between Unknown and I4
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			StationComponent[] stationPool = fs.factory.transport.stationPool;
			foreach (StationComponent val in stationPool)
			{
				if (val == null || val.entityId <= 0)
				{
					continue;
				}
				for (int j = 0; j < val.storage.Length; j++)
				{
					StationStore val2 = val.storage[j];
					int itemId = val2.itemId;
					if (itemId <= 0)
					{
						continue;
					}
					ProductCount[itemId][6] += val2.count;
					if (AllStatInfo.RemoteorLocal)
					{
						if (val.isCollector || val.isStellar)
						{
							if ((int)val2.remoteLogic == 1)
							{
								ProductCount[itemId][7] += val2.count;
							}
							else if ((int)val2.remoteLogic == 2)
							{
								ProductCount[itemId][8] += val2.count;
							}
							else
							{
								ProductCount[itemId][9] += val2.count;
							}
						}
					}
					else if ((int)val2.localLogic == 1)
					{
						ProductCount[itemId][7] += val2.count;
					}
					else if ((int)val2.localLogic == 2)
					{
						ProductCount[itemId][8] += val2.count;
					}
					else
					{
						ProductCount[itemId][9] += val2.count;
					}
				}
				float miningSpeedScale = GameMain.history.miningSpeedScale;
				if (val.collectionPerTick != null && val.isCollector)
				{
					PrefabDesc prefabDesc = ((ProtoSet<ItemProto>)(object)LDB.items).Select(ItemProto.stationCollectorId).prefabDesc;
					double num = (double)prefabDesc.workEnergyPerTick * 60.0;
					num /= (double)prefabDesc.stationCollectSpeed;
					double gasTotalHeat = pd.gasTotalHeat;
					float num2 = ((gasTotalHeat - num <= 0.0) ? 1f : ((float)(((double)miningSpeedScale * gasTotalHeat - num) / (gasTotalHeat - num))));
					for (int k = 0; k < val.collectionIds.Length; k++)
					{
						int itemId2 = val.storage[k].itemId;
						TheoryProductDiction[itemId2] += (long)(val.collectionPerTick[k] * num2 * 3600f);
						ProductCount[itemId2][4]++;
					}
				}
			}
		}

		private void StorageInfoCollect(FactorySystem fs)
		{
			//IL_010e: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			if (fs.storage == null)
			{
				return;
			}
			if (fs.storage.storagePool != null)
			{
				StorageComponent[] storagePool = fs.storage.storagePool;
				foreach (StorageComponent val in storagePool)
				{
					if (val == null || val.entityId <= 0 || val.isEmpty)
					{
						continue;
					}
					for (int j = 0; j < val.grids.Length; j++)
					{
						int itemId = val.grids[j].itemId;
						if (itemId > 0)
						{
							ProductCount[itemId][6] += val.grids[j].count;
						}