Decompiled source of QToolsFix v1.0.1

QTools.dll

Decompiled 2 years ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("QTool")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Fix material issue")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QTool")]
[assembly: AssemblyTitle("QTools")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace QTools
{
	[BepInPlugin("me.forest.plugin.Dyson.QTools", "QTools", "3.2")]
	public class QTools : BaseUnityPlugin
	{
		private Rect windowRect = new Rect(0f, 0f, 0f, 0f);

		private bool keyLock = false;

		private bool mouseLock = false;

		private Vector3 lastMousePosition;

		private Hashtable translateMap = new Hashtable();

		private int max = 40;

		private float line = 2f;

		private float leftAndRight = 10f;

		private float top = 25f;

		private float bottom = 10f;

		private float side = 0f;

		private bool showGUI = false;

		private bool dataLoadOver = false;

		private int GUIstate = 0;

		private int selectedItemId = 0;

		private int yield = 0;

		private float offset = 0f;

		private float offset_y = 0f;

		private int maxColumn = 0;

		private Texture2D background;

		private Material lineMaterial;

		private Hashtable customRecipes = new Hashtable();

		private Hashtable customFactory = new Hashtable();

		private Hashtable defaultRecipes = new Hashtable();

		private int defaultFactory = -2;

		private string lastCustomedTarget = null;

		private void Start()
		{
			Harmony.CreateAndPatchAll(typeof(QTools), (string)null);
			InitTranslateMap();
		}

		private void OnGUI()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: 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_0254: Expected O, but got Unknown
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)96) && !keyLock)
			{
				keyLock = true;
				if (!showGUI)
				{
					showGUI = true;
					if (!Object.op_Implicit((Object)(object)lineMaterial))
					{
						lineMaterial = new Material(Shader.Find("UI/Default"));
					}
					if ((Object)(object)UIRoot.instance != (Object)null)
					{
						UIRoot.instance.OpenLoadingUI();
					}
				}
				else
				{
					showGUI = false;
					if ((Object)(object)UIRoot.instance != (Object)null)
					{
						UIRoot.instance.CloseLoadingUI();
					}
				}
			}
			if (Input.GetKeyUp((KeyCode)96) && keyLock)
			{
				keyLock = false;
			}
			if (Input.GetKeyDown((KeyCode)8))
			{
				GUIstate = 0;
				yield = 0;
				offset = 0f;
				offset_y = 0f;
				customRecipes.Clear();
				customFactory.Clear();
			}
			if (showGUI)
			{
				((Rect)(ref windowRect)).width = Screen.width;
				((Rect)(ref windowRect)).height = Screen.height;
				max -= (int)Input.mouseScrollDelta.y;
				max = ((max < 15) ? 15 : max);
				max = ((max > 52) ? 52 : max);
				side = (float)((double)((Rect)(ref windowRect)).width - 2.0 * (double)leftAndRight - (double)(max - 1) * (double)line) / (float)max;
				GUI.skin.label.fontSize = (int)((double)side / 5.0);
				GUI.skin.button.fontSize = (int)((double)side / 5.0);
				GUI.skin.textField.fontSize = (int)((double)side / 5.0);
				windowRect = GUI.Window(0, windowRect, new WindowFunction(drawWindow), "QTools");
			}
		}

		private void drawWindow(int WindowID)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)background == (Object)null)
			{
				background = new Texture2D(10, 10);
				GUI.skin.label.normal.textColor = Color.black;
			}
			if (GUIstate == 1)
			{
				GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height), (Texture)(object)background);
			}
			if ((Object)(object)GameMain.instance != (Object)null || dataLoadOver)
			{
				dataLoadOver = true;
				switch (GUIstate)
				{
				case 0:
					showItems();
					break;
				case 1:
					calAndShowResult();
					break;
				}
			}
			else
			{
				GUI.Label(new Rect(10f, 20f, ((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height), translate("等待游戏资源加载!"));
			}
		}

		private void showItems()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			ItemProto[] dataArray = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray;
			foreach (ItemProto val in dataArray)
			{
				if (val.recipes.Count > 0)
				{
					if (GUI.Button(new Rect(leftAndRight + (float)(num % max) * (side + line), top + (float)(num / max) * (side + line), side, side), (Texture)(object)val.iconSprite.texture))
					{
						selectedItemId = ((Proto)val).ID;
						GUIstate = 1;
					}
					num++;
				}
			}
		}

		private void calAndShowResult()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_065b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0994: Unknown result type (might be due to invalid IL or missing references)
			//IL_0951: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_0865: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed1: Unknown result type (might be due to invalid IL or missing references)
			ArrayList arrayList = new ArrayList();
			Hashtable hashtable = new Hashtable();
			Hashtable hashtable2 = new Hashtable();
			Hashtable hashtable3 = new Hashtable();
			Hashtable hashtable4 = new Hashtable();
			float num = leftAndRight - offset;
			float num2 = top - offset_y;
			string text = GUI.TextField(new Rect(num + (float)(((double)side + (double)line) * 2.0), num2, side, side), yield.ToString(), 6);
			if ((text.Length >= "`".Length && text.IndexOf("`") != -1) || (text.Length >= "·".Length && text.IndexOf("·") != -1))
			{
				showGUI = false;
				if ((Object)(object)UIRoot.instance != (Object)null)
				{
					UIRoot.instance.CloseLoadingUI();
				}
			}
			else
			{
				int.TryParse(text, out yield);
			}
			maxColumn = 0;
			calRaws(selectedItemId, yield, 0, "0", arrayList);
			lastCustomedTarget = null;
			defaultFactory = -2;
			defaultRecipes.Clear();
			optimizationResults(arrayList);
			if (Input.GetMouseButtonDown(0) && !mouseLock)
			{
				mouseLock = true;
				lastMousePosition = Input.mousePosition;
			}
			if (Input.GetMouseButtonUp(0) && mouseLock)
			{
				mouseLock = false;
			}
			if (Input.GetMouseButton(0) && mouseLock)
			{
				if ((double)offset >= 0.0 && (double)offset <= (double)getMaxOffset())
				{
					offset += lastMousePosition.x - Input.mousePosition.x;
				}
				else
				{
					offset = (((double)offset < 0.0) ? 0f : getMaxOffset());
				}
				lastMousePosition.x = Input.mousePosition.x;
				if ((double)offset_y >= 0.0 && (double)offset_y <= (double)getMaxOffset_y(arrayList))
				{
					offset_y -= lastMousePosition.y - Input.mousePosition.y;
				}
				else
				{
					offset_y = (((double)offset_y < 0.0) ? 0f : getMaxOffset_y(arrayList));
				}
				lastMousePosition.y = Input.mousePosition.y;
			}
			for (int i = 0; i < arrayList.Count; i++)
			{
				ArrayList arrayList2 = (ArrayList)arrayList[i];
				for (int j = 0; j < arrayList2.Count; j++)
				{
					Hashtable hashtable5 = (Hashtable)arrayList2[j];
					int num3 = (int)hashtable5["itemId"];
					double num4 = (double)hashtable5["count"];
					int num5 = (int)hashtable5["type"];
					string text2 = (string)hashtable5["target"];
					int num6 = (int)hashtable5["column"];
					string text3;
					switch (num5)
					{
					case 0:
						text3 = translate("原料") + "\n";
						if (hashtable.ContainsKey(num3))
						{
							hashtable[num3] = (double)hashtable[num3] + num4;
						}
						else
						{
							hashtable[num3] = num4;
						}
						break;
					case 1:
						text3 = translate("自提供") + "\n";
						if (hashtable3.ContainsKey(num3))
						{
							hashtable3[num3] = (double)hashtable3[num3] + num4;
						}
						else
						{
							hashtable3[num3] = num4;
						}
						break;
					case 2:
						text3 = translate("副产物") + "\n";
						if (hashtable2.ContainsKey(num3))
						{
							hashtable2[num3] = (double)hashtable2[num3] + num4;
						}
						else
						{
							hashtable2[num3] = num4;
						}
						break;
					case 3:
						text3 = ((i == 0) ? (translate("目标") + "\n") : (translate("临时物") + "\n"));
						break;
					case 4:
						text3 = translate("加工厂") + "\n";
						if (hashtable4.ContainsKey(num3))
						{
							hashtable4[num3] = (double)hashtable4[num3] + num4;
						}
						else
						{
							hashtable4[num3] = num4;
						}
						break;
					default:
						text3 = translate("未知") + "\n";
						break;
					}
					if (num5 == 0 || num5 == 2)
					{
						GUI.Box(new Rect(num + (float)num6 * (side + line), num2 + (float)(i * 2) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).iconSprite.texture);
					}
					else if (num5 == 1 || num5 == 3)
					{
						if (GUI.Button(new Rect(num + (float)num6 * (side + line), num2 + (float)(i * 2) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).iconSprite.texture))
						{
							if (Input.GetMouseButtonUp(1))
							{
								defaultRecipes.Add(num3, customRecipes[text2]);
							}
							else
							{
								if ((int)customRecipes[text2] + 1 >= ((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).recipes.Count)
								{
									customRecipes[text2] = -1;
								}
								else
								{
									int iD = ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).recipes[(int)customRecipes[text2] + 1]).ID;
									if (iD == 58 || iD == 115)
									{
										if ((int)customRecipes[text2] + 2 >= ((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).recipes.Count)
										{
											customRecipes[text2] = -1;
										}
										else
										{
											customRecipes[text2] = (int)customRecipes[text2] + 2;
										}
									}
									else
									{
										customRecipes[text2] = (int)customRecipes[text2] + 1;
									}
								}
								lastCustomedTarget = text2;
							}
						}
					}
					else if (num5 == 4)
					{
						if (num3 >= 2303 && num3 <= 2305)
						{
							if (GUI.Button(new Rect(num + (float)num6 * (side + line), num2 + (float)(i * 2) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).iconSprite.texture))
							{
								if (Input.GetMouseButtonUp(1))
								{
									defaultFactory = num3;
								}
								else
								{
									customFactory[text2] = (num3 - 2303 + 1) % 3 + 2303;
								}
							}
						}
						else
						{
							GUI.Box(new Rect(num + (float)num6 * (side + line), num2 + (float)(i * 2) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(num3).iconSprite.texture);
						}
					}
					if (num5 == 4 && (bool)hashtable5["notFull"])
					{
						GUI.skin.label.normal.textColor = Color.red;
					}
					GUI.Label(new Rect(num + (float)num6 * (side + line), num2 + (float)(i * 2 + 1) * (side + line), side, side), text3 + num4 + ((num5 == 4) ? "" : "/min"));
					GUI.skin.label.normal.textColor = Color.black;
					if (i > 0 && num5 != 2)
					{
						DrawLine((float)((double)num + (double)num6 * ((double)side + (double)line) + (double)side / 2.0), num2 + (float)(i * 2) * (side + line), (float)((double)num + (double)getParentColumn(text2, i, arrayList) * ((double)side + (double)line) + (double)side / 2.0), num2 + (float)((i - 1) * 2) * (side + line) + side);
					}
				}
			}
			int num7 = 0;
			foreach (int key in hashtable.Keys)
			{
				GUI.Box(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 3) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(key).iconSprite.texture);
				GUI.Label(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 4) * (side + line), side, side), translate("原料") + "\n" + hashtable[key].ToString() + "/min");
				num7++;
			}
			foreach (int key2 in hashtable3.Keys)
			{
				GUI.Box(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 3) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(key2).iconSprite.texture);
				GUI.Label(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 4) * (side + line), side, side), translate("自提供") + "\n" + hashtable3[key2].ToString() + "/min");
				num7++;
			}
			foreach (int key3 in hashtable4.Keys)
			{
				GUI.Box(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 3) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(key3).iconSprite.texture);
				GUI.Label(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 4) * (side + line), side, side), translate("加工厂") + "\n" + hashtable4[key3].ToString());
				num7++;
			}
			foreach (int key4 in hashtable2.Keys)
			{
				GUI.Box(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 3) * (side + line), side, side), (Texture)(object)((ProtoSet<ItemProto>)(object)LDB.items).Select(key4).iconSprite.texture);
				GUI.Label(new Rect(num + (float)num7 * (side + line), num2 + (float)(arrayList.Count * 2 + 4) * (side + line), side, side), translate("副产物") + "\n" + hashtable2[key4].ToString() + "/min");
				num7++;
			}
		}

		private void calRaws(int itemId, double count, int layer, string target, ArrayList rawLayerList)
		{
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Expected I4, but got Unknown
			bool flag = false;
			if (((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).recipes.Count > 0)
			{
				if (defaultRecipes.ContainsKey(itemId))
				{
					customRecipes[target] = defaultRecipes[itemId];
				}
				else if (!customRecipes.ContainsKey(target) || (lastCustomedTarget != null && lastCustomedTarget.Length < target.Length && target.IndexOf(lastCustomedTarget, 0, lastCustomedTarget.Length) != -1))
				{
					customRecipes[target] = 0;
				}
				int num = (int)customRecipes[target];
				if (num == -1)
				{
					if (rawLayerList.Count < layer + 1)
					{
						rawLayerList.Add(new ArrayList());
					}
					((ArrayList)rawLayerList[layer]).Add(new Hashtable
					{
						{ "itemId", itemId },
						{ "count", count },
						{ "type", 1 },
						{ "target", target },
						{ "column", maxColumn }
					});
					return;
				}
				RecipeProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).recipes[num];
				double num2 = count;
				for (int i = 0; i < val.Results.Length; i++)
				{
					if (val.Results[i] == itemId)
					{
						num2 = count / (double)val.ResultCounts[i];
						break;
					}
				}
				if (rawLayerList.Count < layer + 1)
				{
					rawLayerList.Add(new ArrayList());
				}
				for (int j = 0; j < val.Results.Length; j++)
				{
					bool flag2 = val.Results[j] != itemId;
					if (flag2)
					{
						flag = true;
					}
					else
					{
						if (rawLayerList.Count < layer + 2)
						{
							rawLayerList.Add(new ArrayList());
						}
						int num3 = 0;
						double num4 = 1.0;
						ERecipeType type = val.Type;
						ERecipeType val2 = type;
						switch (val2 - 1)
						{
						case 0:
							num3 = 2302;
							break;
						case 1:
							num3 = 2309;
							break;
						case 2:
							num3 = 2308;
							break;
						case 3:
							if (defaultFactory != -2)
							{
								customFactory[target] = defaultFactory;
							}
							else if (!customFactory.ContainsKey(target) || (lastCustomedTarget != null && lastCustomedTarget.Length <= target.Length && target.IndexOf(lastCustomedTarget, 0, lastCustomedTarget.Length) != -1))
							{
								customFactory[target] = 2304;
							}
							num3 = (int)customFactory[target];
							num4 = num3 switch
							{
								2303 => 0.75, 
								2304 => 1.0, 
								_ => 1.5, 
							};
							break;
						case 4:
							num3 = 2310;
							break;
						case 5:
							num3 = 2209;
							break;
						case 6:
							num3 = 2208;
							break;
						case 7:
							num3 = 2314;
							break;
						case 14:
							num3 = 2901;
							break;
						}
						double num5 = num2 / (num4 * (60.0 / ((double)val.TimeSpend / 60.0)));
						bool flag3 = false;
						if ((double)(int)num5 < num5)
						{
							flag3 = true;
							num5 = (int)num5 + 1;
						}
						((ArrayList)rawLayerList[layer + 1]).Add(new Hashtable
						{
							{ "itemId", num3 },
							{ "count", num5 },
							{ "type", 4 },
							{ "target", target },
							{ "column", maxColumn },
							{ "notFull", flag3 }
						});
					}
					((ArrayList)rawLayerList[layer]).Add(new Hashtable
					{
						{
							"itemId",
							val.Results[j]
						},
						{
							"count",
							(double)val.ResultCounts[j] * num2
						},
						{
							"type",
							flag2 ? 2 : 3
						},
						{ "target", target },
						{
							"column",
							maxColumn + (flag2 ? 1 : 0)
						}
					});
				}
				for (int k = 0; k < val.Items.Length; k++)
				{
					if (k > 0)
					{
						maxColumn++;
					}
					calRaws(val.Items[k], (double)val.ItemCounts[k] * num2, layer + 2, target + k, rawLayerList);
				}
				if (flag)
				{
					maxColumn++;
				}
			}
			else
			{
				if (rawLayerList.Count < layer + 1)
				{
					rawLayerList.Add(new ArrayList());
				}
				((ArrayList)rawLayerList[layer]).Add(new Hashtable
				{
					{ "itemId", itemId },
					{ "count", count },
					{ "type", 0 },
					{ "target", target },
					{ "column", maxColumn }
				});
			}
		}

		private void optimizationResults(ArrayList rawLayerList)
		{
		}

		private void DrawLine(float x1, float y1, float x2, float y2)
		{
			x1 = ((Rect)(ref windowRect)).x + x1;
			x2 = ((Rect)(ref windowRect)).x + x2;
			y1 = ((Rect)(ref windowRect)).y + y1;
			y2 = ((Rect)(ref windowRect)).y + y2;
			y1 = ((Rect)(ref windowRect)).height - y1;
			y2 = ((Rect)(ref windowRect)).height - y2;
			GL.PushMatrix();
			lineMaterial.SetPass(0);
			GL.LoadPixelMatrix();
			GL.Begin(1);
			GL.Vertex3(x1, y1, 0f);
			GL.Vertex3(x1, (float)(((double)y1 + (double)y2) / 2.0), 0f);
			GL.Vertex3(x1, (float)(((double)y1 + (double)y2) / 2.0), 0f);
			GL.Vertex3(x2, (float)(((double)y1 + (double)y2) / 2.0), 0f);
			GL.Vertex3(x2, (float)(((double)y1 + (double)y2) / 2.0), 0f);
			GL.Vertex3(x2, y2, 0f);
			GL.End();
			GL.PopMatrix();
		}

		private float getMaxOffset()
		{
			return (maxColumn + 5 < max) ? 0f : ((float)(maxColumn - max + 5) * (side + line));
		}

		private float getMaxOffset_y(ArrayList rawLayerList)
		{
			return ((double)(rawLayerList.Count * 2 + 5) < ((double)((Rect)(ref windowRect)).height - (double)top - (double)bottom) / ((double)side + (double)line)) ? 0f : ((float)(((double)(rawLayerList.Count * 2) - ((double)((Rect)(ref windowRect)).height - (double)top - (double)bottom) / ((double)side + (double)line) + 5.0) * ((double)side + (double)line)));
		}

		private int getParentColumn(string target, int row, ArrayList rawLayerList)
		{
			foreach (Hashtable item in (ArrayList)rawLayerList[row - 1])
			{
				int num = (int)item["type"];
				string text = (string)item["target"];
				int result = (int)item["column"];
				if (target.IndexOf(text, 0, text.Length) != -1 && num != 2)
				{
					return result;
				}
			}
			return 0;
		}

		private void InitTranslateMap()
		{
			translateMap.Clear();
			translateMap.Add("等待游戏资源加载!", "Wait for game resources to load!");
			translateMap.Add("关闭", "Close");
			translateMap.Add("返回", "Return");
			translateMap.Add("原料", "raw");
			translateMap.Add("自提供", "bySelf");
			translateMap.Add("副产物", "byProducts");
			translateMap.Add("目标", "target");
			translateMap.Add("临时物", "temp");
			translateMap.Add("加工厂", "factory");
			translateMap.Add("未知", "unknown");
		}

		private string translate(string text)
		{
			return (translateMap.ContainsKey(text) && Localization.CurrentLanguageIndex > 0) ? translateMap[text].ToString() : text;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "QTools";

		public const string PLUGIN_NAME = "QTool";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}