Decompiled source of VeinControl v1.1.3

VeinControl.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
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("VeinControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VeinControl")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4d37a74f-e2c4-4bb1-94c4-2e18906cfe74")]
[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 VeinControl;

public static class TranslateDic
{
	private static Dictionary<string, string> TranslateDict;

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

	public static void RegallTranslate()
	{
		TranslateDict = new Dictionary<string, string>
		{
			{ "启动/关闭", "On/Off" },
			{ "移动矿堆失败", "Failed to move the pile" },
			{ "当前纬度过高,为避免出错,无法移动矿堆", "The current latitude is too high to move the pile to avoid errors" },
			{ "确定", "recognize" },
			{ "移动所有矿", "Move all veins" },
			{ "切割出", "Cut out" },
			{ "整理为", "Organized as" },
			{ "个", "veins" },
			{ "行", "lines" },
			{ "合并油井", "Merge Oil" },
			{ "合并矿脉", "Merge VeinGroup" },
			{ "矿脉工具", "Vein Control Tool" },
			{ "不添加", "No Add Vein" },
			{ "添加油井速率", "Add oil interval" },
			{ "添加矿脉数量", "Add vein interval" },
			{ "点按", "Click" },
			{ "按压", "Press" },
			{ "生成矿物点击模式", "Add vein Mode" },
			{ "无穷", "Infinite" },
			{ "警告:不要将油井移动到极点附近", "WARNING:Don'T move veins near poles" },
			{ "ctrl+鼠标左键:移动单矿", "ctrl+LeftMouse:Move Vein" },
			{ "alt+鼠标左键:移动矿堆", "alt+LeftMouse:Move the vein group" },
			{ "shift+鼠标左键:移动所有矿", "shift+LeftMouse:Move all veins" },
			{ "alt+x+鼠标左键:切割矿脉", "alt+x+LeftMouse:Cut the veins from vein group" },
			{ "X:进入拆除模式可以拆除矿脉", "x:Remove vein on Dismantle Mode" },
			{ "~(Esc键下方):合并/不合并", "~:Merge or not merge " }
		};
	}
}
[BepInPlugin("cn.blacksnipe.dsp.VeinControl", "VeinControl", "1.1.3")]
[BepInProcess("DSPGAME.exe")]
public class VeinControl : BaseUnityPlugin
{
	private const string GUID = "cn.blacksnipe.dsp.VeinControl";

	private const string NAME = "VeinControl";

	private const string VERSION = "1.1.3";

	private const string GAME_PROCESS = "DSPGAME.exe";

	public static bool IsEnglish;

	private int baseSize;

	private bool coolDown;

	private bool RefreshBaseSize;

	public int veintype;

	public bool ShowWindow;

	public bool ShowInstructionsWindow;

	public bool Window_moving;

	public bool FirstOpen;

	public bool MouseInWindow;

	public VeinData pointveindata;

	public float Temp_Window_Moving_X;

	public float Temp_Window_Moving_Y;

	public float Temp_Window_X_move;

	public float Temp_Window_Y_move;

	public float Window_Width;

	public float Window_Height;

	public float Window_X;

	public float Window_Y;

	public static ConfigEntry<int> scale;

	public static ConfigEntry<int> changeveinsposx;

	public static ConfigEntry<int> veinlines;

	public static ConfigEntry<bool> ControlToggol;

	public static ConfigEntry<bool> MergeOil;

	public static ConfigEntry<bool> MergeVeinGroup;

	public static ConfigEntry<bool> MoveAllVeinGroup;

	public static ConfigEntry<KeyboardShortcut> OpenWindowKey;

	public int AddVeinNumber;

	public int AddVeinMode;

	public bool[] OilAddIntervalBool;

	public float[] OilAddIntervalValue;

	public float OilAddInterval;

	public int oillowerlimit;

	private int UILine;

	private GUIStyle normalStyle;

	private GUIStyle selectedIconStyle;

	private Texture2D selectedTexture;

	private Texture2D blacktexture;

	private bool firstDraw;

	public int BaseSize
	{
		get
		{
			return baseSize;
		}
		set
		{
			baseSize = value;
			scale.Value = value;
			RefreshBaseSize = true;
		}
	}

	public bool CoolDown
	{
		get
		{
			return coolDown;
		}
		set
		{
			coolDown = value;
			if (value)
			{
				Task.Run(delegate
				{
					Thread.Sleep(1000);
					coolDown = false;
				});
			}
		}
	}

	private void Start()
	{
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Expected O, but got Unknown
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		ShowWindow = false;
		FirstOpen = true;
		veintype = 0;
		TranslateDic.RegallTranslate();
		changeveinsposx = ((BaseUnityPlugin)this).Config.Bind<int>("切割矿脉数量", "changeveinsposx", 9, (ConfigDescription)null);
		veinlines = ((BaseUnityPlugin)this).Config.Bind<int>("矿物行数", "veinlines", 3, (ConfigDescription)null);
		ControlToggol = ((BaseUnityPlugin)this).Config.Bind<bool>("启动/关闭", "ControlToggol", false, (ConfigDescription)null);
		MergeOil = ((BaseUnityPlugin)this).Config.Bind<bool>("合并油井", "MergeOil", false, (ConfigDescription)null);
		MoveAllVeinGroup = ((BaseUnityPlugin)this).Config.Bind<bool>("移动所有矿", "MoveAllVeinGroup", false, (ConfigDescription)null);
		MergeVeinGroup = ((BaseUnityPlugin)this).Config.Bind<bool>("合并矿堆", "MergeVeinGroup", false, (ConfigDescription)null);
		OpenWindowKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("打开窗口快捷键", "Key", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null);
		scale = ((BaseUnityPlugin)this).Config.Bind<int>("大小适配", "scale", 16, (ConfigDescription)null);
		BaseSize = scale.Value;
		Window_X = 450f;
		Window_Y = 200f;
		Temp_Window_Moving_X = 0f;
		Temp_Window_Moving_Y = 0f;
		OilAddIntervalBool = new bool[3];
		OilAddIntervalValue = new float[3] { 0.1f, 1f, 10f };
		SetOilAddInterval(1);
		oillowerlimit = (int)(1f / VeinData.oilSpeedMultiplier);
		AddVeinNumber = 1000000000;
		UILine = 10;
		selectedTexture = new Texture2D(1, 1);
		selectedTexture.SetPixel(0, 0, new Color(10f / 51f, 10f / 51f, 10f / 51f));
		selectedTexture.Apply();
		blacktexture = new Texture2D(1, 1);
		blacktexture.SetPixel(0, 0, new Color(0f, 0f, 0f));
		blacktexture.Apply();
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		KeyboardShortcut value = OpenWindowKey.Value;
		if (((KeyboardShortcut)(ref value)).IsDown() && (Object)(object)LDB.items != (Object)null)
		{
			ShowWindow = !ShowWindow;
			if (ShowWindow)
			{
				firstDraw = true;
			}
		}
		if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)304))
		{
			veintype = 0;
		}
		if (!ShowWindow || !MouseInWindow)
		{
			controlVein();
		}
	}

	public void OnGUI()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Invalid comparison between Unknown and I4
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Expected O, but got Unknown
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Expected O, but got Unknown
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		IsEnglish = (int)Localization.CurrentLanguage.glyph == 0;
		if (firstDraw)
		{
			firstDraw = false;
			BaseSize = GUI.skin.label.fontSize;
		}
		if (normalStyle == null)
		{
			normalStyle = new GUIStyle();
			selectedIconStyle = new GUIStyle();
			selectedIconStyle.normal.background = selectedTexture;
		}
		if (ShowWindow && 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 (RefreshBaseSize)
		{
			RefreshBaseSize = false;
			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;
			Window_Width = BaseSize * 18;
		}
		if (ShowWindow)
		{
			int num3 = BaseSize + 4 + (IsEnglish ? 3 : 0);
			Window_Height = num3 * UILine;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(Window_X, Window_Y, Window_Width, Window_Height);
			GUI.DrawTexture(val, (Texture)(object)blacktexture);
			moveWindow(ref Window_X, ref Window_Y, ref Temp_Window_X_move, ref Temp_Window_Y_move, ref Window_moving, ref Temp_Window_Moving_X, ref Temp_Window_Moving_Y, Window_Width);
			val = GUI.Window(20220702, val, new WindowFunction(VeinControlConfigWindow), "矿脉工具".Translate() + "(1.1.3)ps:ctrl+↑↓");
			if (ShowInstructionsWindow)
			{
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(Window_X + Window_Width, Window_Y, IsEnglish ? ((float)(num3 * 20)) : Window_Width, (float)(num3 * 12));
				val2 = GUI.Window(20220703, val2, new WindowFunction(InstructionsWindow), "");
			}
		}
	}

	public void VeinControlConfigWindow(int winId)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		int num = BaseSize + 4 + (IsEnglish ? 3 : 0);
		GUI.skin.horizontalSlider.margin = new RectOffset(0, 0, num / 2, 0);
		UILine = 15;
		if (GUI.Button(new Rect(Window_Width - (float)(num * 2), (float)num, (float)(num + 5), (float)(num + 5)), "?"))
		{
			ShowInstructionsWindow = !ShowInstructionsWindow;
		}
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		ControlToggol.Value = GUILayout.Toggle(ControlToggol.Value, "启动/关闭".Translate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		MergeVeinGroup.Value = GUILayout.Toggle(MergeVeinGroup.Value, "合并矿脉".Translate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		MoveAllVeinGroup.Value = GUILayout.Toggle(MoveAllVeinGroup.Value, "移动所有矿".Translate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		MergeOil.Value = GUILayout.Toggle(MergeOil.Value, "合并油井".Translate(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		GUILayout.Label("整理为".Translate() + $" {veinlines.Value} " + "行".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.FlexibleSpace();
		veinlines.Value = (int)GUILayout.HorizontalSlider((float)veinlines.Value, 1f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)(num * 3)) });
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		GUILayout.Label("切割出".Translate() + $" {changeveinsposx.Value} " + "个".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.FlexibleSpace();
		changeveinsposx.Value = (int)GUILayout.HorizontalSlider((float)changeveinsposx.Value, 2f, 72f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)(num * 3)) });
		GUILayout.EndHorizontal();
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
		GUILayout.Label("生成矿物点击模式".Translate(), Array.Empty<GUILayoutOption>());
		bool flag = GUILayout.Toggle(AddVeinMode == 1, "按压".Translate(), Array.Empty<GUILayoutOption>());
		bool flag2 = GUILayout.Toggle(AddVeinMode == 0, "点按".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.EndHorizontal();
		if (flag2 && AddVeinMode == 1)
		{
			AddVeinMode = 0;
		}
		else if (flag && AddVeinMode == 0)
		{
			AddVeinMode = 1;
		}
		GUILayout.EndVertical();
		float num2 = BaseSize * 2;
		GUILayoutOption[] array = (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Height(num2),
			GUILayout.Width(num2)
		};
		int num3 = (int)((Window_Width - 10f) / num2);
		int num4 = 14 / num3 + ((14 % num3 > 0) ? 1 : 0);
		for (int i = 0; i < num4; i++)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int j = 0; j < num3; j++)
			{
				int num5 = i * num3 + j + 1;
				if (num5 == 15)
				{
					break;
				}
				ItemProtoSet items = LDB.items;
				object obj;
				if (items == null)
				{
					obj = null;
				}
				else
				{
					ItemProto obj2 = ((ProtoSet<ItemProto>)(object)items).Select(((ProtoSet<VeinProto>)(object)LDB.veins).Select(num5).MiningItem);
					if (obj2 == null)
					{
						obj = null;
					}
					else
					{
						Sprite iconSprite = obj2.iconSprite;
						obj = ((iconSprite != null) ? iconSprite.texture : null);
					}
				}
				if (GUILayout.Button((Texture)obj, (veintype == num5) ? selectedIconStyle : normalStyle, array))
				{
					veintype = ((veintype != num5) ? num5 : 0);
				}
			}
			GUILayout.EndHorizontal();
		}
		if (veintype == 7)
		{
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
			GUILayout.Label("添加油井速率".Translate(), Array.Empty<GUILayoutOption>());
			for (int k = 0; k < 3; k++)
			{
				bool flag3 = GUILayout.Toggle(OilAddIntervalBool[k], OilAddIntervalValue[k] + "/s", Array.Empty<GUILayoutOption>());
				if (flag3 != OilAddIntervalBool[k] && flag3)
				{
					SetOilAddInterval(k);
				}
			}
			GUILayout.EndHorizontal();
		}
		else
		{
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)num) });
			GUILayout.Label("添加矿脉数量".Translate(), Array.Empty<GUILayoutOption>());
			bool flag4 = GUILayout.Toggle(AddVeinNumber == 500, "500", Array.Empty<GUILayoutOption>());
			bool flag5 = GUILayout.Toggle(AddVeinNumber != 500, "无穷".Translate(), Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			if (flag4 && AddVeinNumber != 500)
			{
				AddVeinNumber = 500;
			}
			else if (flag5 && AddVeinNumber == 500)
			{
				AddVeinNumber = 1000000000;
			}
		}
		GUILayout.EndVertical();
	}

	public void InstructionsWindow(int winId)
	{
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		GUILayout.Label("警告:不要将油井移动到极点附近".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("ctrl+鼠标左键:移动单矿".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("alt+鼠标左键:移动矿堆".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("shift+鼠标左键:移动所有矿".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("alt+x+鼠标左键:切割矿脉".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("X:进入拆除模式可以拆除矿脉".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.Label("~(Esc键下方):合并/不合并".Translate(), Array.Empty<GUILayoutOption>());
		GUILayout.EndHorizontal();
	}

	public void controlVein()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Invalid comparison between Unknown and I4
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: 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_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		if (GameMain.mainPlayer == null || GameMain.localPlanet == null || (int)GameMain.localPlanet.type == 5 || (Object)(object)GameMain.mainPlayer.controller == (Object)null || GameMain.mainPlayer.controller.actionBuild == null || ((BuildTool)GameMain.mainPlayer.controller.actionBuild.clickTool).active)
		{
			return;
		}
		bool active = ((BuildTool)GameMain.mainPlayer.controller.actionBuild.dismantleTool).active;
		if (active)
		{
			veintype = 0;
		}
		if (veintype != 0 && !active)
		{
			if (AddVeinMode == 0 && Input.GetMouseButtonDown(0))
			{
				AddVein(veintype);
			}
			else if (AddVeinMode == 1 && Input.GetMouseButton(0))
			{
				AddVein(veintype);
			}
		}
		if (Input.GetMouseButton(0) && ControlToggol.Value && active)
		{
			RemoveVeinByMouse();
		}
		if (Input.GetMouseButton(1))
		{
			veintype = 0;
		}
		if (!ControlToggol.Value || !Input.GetMouseButton(0) || active)
		{
			return;
		}
		if (Input.GetMouseButtonDown(0))
		{
			pointveindata = GetVeinByMouse();
		}
		if (pointveindata.amount != 0)
		{
			if (Input.GetKeyDown((KeyCode)96))
			{
				MergeVeinGroup.Value = !MergeVeinGroup.Value;
			}
			RaycastHit val = default(RaycastHit);
			if (MoveAllVeinGroup.Value && Input.GetKey((KeyCode)304))
			{
				GetAllVein(pointveindata);
			}
			else if (Input.GetKey((KeyCode)308) && Input.GetKey((KeyCode)120))
			{
				SplitxVeinsFrom(pointveindata);
			}
			else if (Input.GetKey((KeyCode)308))
			{
				ChangeVeinGroupPos(pointveindata);
			}
			else if (Input.GetKey((KeyCode)306) && Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
			{
				Vector3 point = ((RaycastHit)(ref val)).point;
				ChangeVeinPos(pointveindata, point);
			}
		}
	}

	public void AddVein(int veintype)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Invalid comparison between Unknown and I4
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: 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_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: 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_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: 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_0342: 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_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Invalid comparison between Unknown and I4
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: 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_019a: 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_0131: Unknown result type (might be due to invalid IL or missing references)
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return;
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		int num = ((veintype == 7) ? ((int)(OilAddInterval * (float)oillowerlimit)) : AddVeinNumber);
		VeinData[] veinPool = localPlanet.factory.veinPool;
		foreach (VeinData val2 in veinPool)
		{
			if ((int)val2.type == 0)
			{
				continue;
			}
			Vector3 val3 = point - val2.pos;
			if (!(((Vector3)(ref val3)).magnitude < 1f))
			{
				continue;
			}
			if ((int)val2.type != 7)
			{
				if (localPlanet.factory.veinPool[val2.id].amount + num < 1000000000)
				{
					localPlanet.factory.veinPool[val2.id].amount += num;
					localPlanet.factory.veinGroups[val2.groupIndex].amount += num;
				}
				else
				{
					localPlanet.factory.veinGroups[val2.groupIndex].amount += 1000000000 - localPlanet.factory.veinPool[val2.id].amount;
					localPlanet.factory.veinPool[val2.id].amount = 1000000000;
				}
			}
			else
			{
				localPlanet.factory.veinPool[val2.id].amount += num;
				localPlanet.factory.veinGroups[val2.groupIndex].amount += num;
			}
			return;
		}
		Vector3 pos = point;
		VeinData val4 = default(VeinData);
		val4.amount = num;
		val4.type = (EVeinType)(byte)veintype;
		val4.pos = pos;
		val4.productId = ((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).MiningItem;
		val4.modelIndex = (short)((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).ModelIndex;
		VeinData val5 = val4;
		val5.id = localPlanet.factory.AddVeinData(val5);
		val5.colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref ((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).prefabDesc.colliders[0])).BindToObject(val5.id, 0, (EObjectType)2, val5.pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val5.pos)).normalized)));
		val5.modelId = localPlanet.factoryModel.gpuiManager.AddModel((int)val5.modelIndex, val5.id, val5.pos, Maths.SphericalRotation(val5.pos, Random.value * 360f), true);
		val5.minerCount = 0;
		localPlanet.factory.AssignGroupIndexForNewVein(ref val5);
		localPlanet.factory.veinPool[val5.id] = val5;
		localPlanet.factory.RefreshVeinMiningDisplay(val5.id, 0, 0);
		localPlanet.factory.RecalculateVeinGroup((int)localPlanet.factory.veinPool[val5.id].groupIndex);
	}

	public VeinData GetVeinByMouse()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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)
		//IL_0104: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Invalid comparison between Unknown and I4
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_00c8: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return default(VeinData);
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		float num = 100f;
		VeinData result = default(VeinData);
		VeinData[] veinPool = localPlanet.factory.veinPool;
		foreach (VeinData val2 in veinPool)
		{
			if (val2.id != 0)
			{
				Vector3 val3 = point - val2.pos;
				if (((Vector3)(ref val3)).magnitude < num && (int)val2.type > 0)
				{
					val3 = point - val2.pos;
					num = ((Vector3)(ref val3)).magnitude;
					result = val2;
				}
			}
		}
		if (num > 4f)
		{
			return default(VeinData);
		}
		return result;
	}

	public void RemoveVeinByMouse()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_008d: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: 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_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return;
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		VeinData[] veinPool = localPlanet.factory.veinPool;
		foreach (VeinData val2 in veinPool)
		{
			Vector3 val3 = point - val2.pos;
			if (((Vector3)(ref val3)).magnitude < 1f && (int)val2.type > 0)
			{
				localPlanet.factory.veinGroups[val2.groupIndex].count--;
				localPlanet.factory.veinGroups[val2.groupIndex].amount -= val2.amount;
				localPlanet.factory.RemoveVeinWithComponents(val2.id);
				if (localPlanet.factory.veinGroups[val2.groupIndex].count == 0)
				{
					localPlanet.factory.veinGroups[val2.groupIndex].type = (EVeinType)0;
					localPlanet.factory.veinGroups[val2.groupIndex].amount = 0L;
					localPlanet.factory.veinGroups[val2.groupIndex].pos = Vector3.zero;
				}
				break;
			}
		}
	}

	public void ChangeVeinGroupPos(VeinData vd)
	{
		//IL_0027: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected I4, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Invalid comparison between Unknown and I4
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: 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_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Invalid comparison between Unknown and I4
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: 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_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		if (CoolDown)
		{
			return;
		}
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return;
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		VeinData[] veinPool = localPlanet.factory.veinPool;
		Vector3 pos = veinPool[vd.id].pos;
		int num = 0;
		PrefabDesc prefabDesc = ((ProtoSet<VeinProto>)(object)LDB.veins).Select((int)vd.type).prefabDesc;
		VeinData[] array = veinPool;
		foreach (VeinData val2 in array)
		{
			if (val2.id <= 0 || val2.groupIndex != veinPool[vd.id].groupIndex)
			{
				continue;
			}
			int id = val2.id;
			if ((int)vd.type == 7 && MergeOil.Value && vd.id != id)
			{
				localPlanet.factory.veinPool[vd.id].amount += val2.amount;
				localPlanet.factory.veinGroups[vd.groupIndex].count--;
				localPlanet.factory.RemoveVeinWithComponents(val2.id);
				localPlanet.factory.RecalculateVeinGroup((int)localPlanet.factory.veinPool[vd.id].groupIndex);
				localPlanet.factory.ArrangeVeinGroups();
				continue;
			}
			if (MergeVeinGroup.Value)
			{
				veinPool[id].pos = point;
			}
			else
			{
				Vector3 val3 = PostionCompute(pos, point, val2.pos, num++, (int)vd.type == 7);
				if (CoolDown)
				{
					return;
				}
				if ((double)Vector3.Distance(val3, val2.pos) < 0.01)
				{
					continue;
				}
				veinPool[id].pos = val3;
				if (float.IsNaN(veinPool[id].pos.x) || float.IsNaN(veinPool[id].pos.y) || float.IsNaN(veinPool[id].pos.z))
				{
					continue;
				}
			}
			int colliderId = veinPool[id].colliderId;
			localPlanet.physics.RemoveColliderData(colliderId);
			veinPool[id].colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref prefabDesc.colliders[0])).BindToObject(id, 0, (EObjectType)2, veinPool[id].pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref veinPool[id].pos)).normalized)));
			localPlanet.factoryModel.gpuiManager.AlterModel((int)veinPool[id].modelIndex, veinPool[id].modelId, id, veinPool[id].pos, Maths.SphericalRotation(veinPool[id].pos, 90f), true);
		}
		localPlanet.factory.RecalculateVeinGroup((int)vd.groupIndex);
		localPlanet.factory.ArrangeVeinGroups();
	}

	public void ChangeVeinPos(VeinData vd, Vector3 pos)
	{
		//IL_0007: 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_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected I4, but got Unknown
		//IL_007e: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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_0163: 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_0202: 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_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: 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_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: 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_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: 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_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_0386: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		PlanetData localPlanet = GameMain.localPlanet;
		int id = vd.id;
		VeinData[] veinPool = localPlanet.factory.veinPool;
		veinPool[id].pos = pos;
		int colliderId = veinPool[id].colliderId;
		localPlanet.physics.RemoveColliderData(colliderId);
		veinPool[id].colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref ((ProtoSet<VeinProto>)(object)LDB.veins).Select((int)veinPool[id].type).prefabDesc.colliders[0])).BindToObject(id, 0, (EObjectType)2, veinPool[id].pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref veinPool[id].pos)).normalized)));
		localPlanet.factoryModel.gpuiManager.AlterModel((int)veinPool[id].modelIndex, veinPool[id].modelId, id, veinPool[id].pos, Maths.SphericalRotation(veinPool[id].pos, 90f), true);
		bool flag = false;
		int num = -1;
		Vector3 val3;
		if (localPlanet.factory.veinGroups[veinPool[id].groupIndex].count > 1)
		{
			Vector3 val = pos - localPlanet.factory.veinGroups[veinPool[id].groupIndex].pos * (localPlanet.realRadius + 2.5f);
			if ((double)((Vector3)(ref val)).magnitude > 10.0)
			{
				flag = true;
				num = veinPool[id].groupIndex;
				veinPool[id].groupIndex = -1;
			}
		}
		else
		{
			localPlanet.factory.veinGroups[veinPool[id].groupIndex].pos = veinPool[id].pos / (localPlanet.realRadius + 2.5f);
			VeinData[] veinPool2 = localPlanet.factory.veinPool;
			foreach (VeinData val2 in veinPool2)
			{
				if (val2.type == veinPool[id].type && val2.groupIndex != num)
				{
					val3 = val2.pos - veinPool[id].pos;
					if (((Vector3)(ref val3)).magnitude < 10f)
					{
						num = veinPool[id].groupIndex;
						veinPool[id].groupIndex = val2.groupIndex;
						localPlanet.factory.RecalculateVeinGroup(num);
					}
				}
			}
		}
		if (flag)
		{
			localPlanet.factory.RecalculateVeinGroup(num);
			VeinData[] veinPool3 = localPlanet.factory.veinPool;
			foreach (VeinData val4 in veinPool3)
			{
				if (val4.type == veinPool[id].type && val4.groupIndex != num)
				{
					val3 = val4.pos - veinPool[id].pos;
					if (((Vector3)(ref val3)).magnitude < 10f)
					{
						veinPool[id].groupIndex = val4.groupIndex;
					}
				}
			}
			if (veinPool[id].groupIndex == -1)
			{
				veinPool[id].groupIndex = (short)localPlanet.factory.AddVeinGroup(veinPool[id].type, ((Vector3)(ref veinPool[id].pos)).normalized);
			}
		}
		localPlanet.factory.RecalculateVeinGroup((int)veinPool[id].groupIndex);
		localPlanet.factory.ArrangeVeinGroups();
	}

	public void GetAllVein(VeinData vd)
	{
		//IL_0027: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Invalid comparison between Unknown and I4
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: 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_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Invalid comparison between Unknown and I4
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: 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_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Expected I4, but got Unknown
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: 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_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		if (CoolDown)
		{
			return;
		}
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return;
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		VeinData[] veinPool = localPlanet.factory.veinPool;
		Vector3 pos = veinPool[vd.id].pos;
		int num = 0;
		VeinData[] array = veinPool;
		foreach (VeinData val2 in array)
		{
			if (val2.id <= 0 || val2.type != vd.type)
			{
				continue;
			}
			int id = val2.id;
			if ((int)vd.type == 7 && MergeOil.Value && vd.id != id)
			{
				localPlanet.factory.veinPool[vd.id].amount += val2.amount;
				localPlanet.factory.veinGroups[vd.groupIndex].amount += val2.amount;
				localPlanet.factory.veinGroups[val2.groupIndex].count--;
				localPlanet.factory.RemoveVeinWithComponents(val2.id);
				localPlanet.factory.RecalculateVeinGroup((int)localPlanet.factory.veinPool[vd.id].groupIndex);
				localPlanet.factory.RecalculateVeinGroup((int)val2.groupIndex);
				localPlanet.factory.ArrangeVeinGroups();
				continue;
			}
			veinPool[id].pos = (MergeVeinGroup.Value ? point : PostionCompute(pos, point, val2.pos, num++, (int)vd.type == 7));
			if (CoolDown)
			{
				return;
			}
			if (!float.IsNaN(veinPool[id].pos.x) && !float.IsNaN(veinPool[id].pos.y) && !float.IsNaN(veinPool[id].pos.z))
			{
				if (val2.groupIndex != vd.groupIndex)
				{
					int groupIndex = veinPool[val2.id].groupIndex;
					veinPool[val2.id].groupIndex = vd.groupIndex;
					localPlanet.factory.RecalculateVeinGroup(groupIndex);
					localPlanet.factory.RecalculateVeinGroup((int)vd.groupIndex);
					localPlanet.factory.ArrangeVeinGroups();
				}
				int colliderId = veinPool[id].colliderId;
				localPlanet.physics.RemoveColliderData(colliderId);
				veinPool[id].colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref ((ProtoSet<VeinProto>)(object)LDB.veins).Select((int)veinPool[id].type).prefabDesc.colliders[0])).BindToObject(id, 0, (EObjectType)2, veinPool[id].pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref veinPool[id].pos)).normalized)));
				localPlanet.factoryModel.gpuiManager.AlterModel((int)veinPool[id].modelIndex, veinPool[id].modelId, id, veinPool[id].pos, Maths.SphericalRotation(veinPool[id].pos, 90f), true);
			}
		}
		localPlanet.factory.RecalculateVeinGroup((int)vd.groupIndex);
		localPlanet.factory.ArrangeVeinGroups();
	}

	public void SplitxVeinsFrom(VeinData vd)
	{
		//IL_0027: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: 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_01ec: 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_0202: 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)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: 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_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Expected I4, but got Unknown
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		if (CoolDown)
		{
			return;
		}
		PlanetData localPlanet = GameMain.localPlanet;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(GameMain.mainPlayer.controller.mainCamera.ScreenPointToRay(Input.mousePosition), ref val, 800f, 8720, (QueryTriggerInteraction)2))
		{
			return;
		}
		if (localPlanet.factory.veinGroups[localPlanet.factory.veinPool[vd.id].groupIndex].count <= changeveinsposx.Value)
		{
			ChangeVeinGroupPos(vd);
			return;
		}
		Vector3 point = ((RaycastHit)(ref val)).point;
		VeinData[] veinPool = localPlanet.factory.veinPool;
		Vector3 pos = veinPool[vd.id].pos;
		bool flag = false;
		List<int> list = new List<int>();
		VeinData[] array = veinPool;
		foreach (VeinData val2 in array)
		{
			if (val2.id <= 0 || val2.groupIndex != vd.groupIndex)
			{
				continue;
			}
			int id = val2.id;
			if (vd.id == id)
			{
				flag = true;
			}
			if (flag || list.Count != changeveinsposx.Value - 1)
			{
				list.Add(val2.id);
				if (list.Count == changeveinsposx.Value)
				{
					break;
				}
			}
		}
		if (list.Count != changeveinsposx.Value)
		{
			return;
		}
		int num = 0;
		foreach (int item in list)
		{
			veinPool[item].pos = (MergeVeinGroup.Value ? point : PostionCompute(pos, point, veinPool[item].pos, num++));
			if (!float.IsNaN(veinPool[item].pos.x) && !float.IsNaN(veinPool[item].pos.y) && !float.IsNaN(veinPool[item].pos.z))
			{
				int colliderId = veinPool[item].colliderId;
				localPlanet.physics.RemoveColliderData(colliderId);
				veinPool[item].colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref ((ProtoSet<VeinProto>)(object)LDB.veins).Select((int)veinPool[item].type).prefabDesc.colliders[0])).BindToObject(item, 0, (EObjectType)2, veinPool[item].pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref veinPool[item].pos)).normalized)));
				localPlanet.factoryModel.gpuiManager.AlterModel((int)veinPool[item].modelIndex, veinPool[item].modelId, item, veinPool[item].pos, Maths.SphericalRotation(veinPool[item].pos, 90f), true);
			}
		}
		bool flag2 = true;
		VeinData[] array2 = veinPool;
		foreach (VeinData val3 in array2)
		{
			if (!list.Contains(val3.id) && val3.type == vd.type)
			{
				Vector3 val4 = localPlanet.factory.veinPool[vd.id].pos - val3.pos;
				if (((Vector3)(ref val4)).magnitude < 5f)
				{
					flag2 = false;
					break;
				}
			}
		}
		if (!flag2)
		{
			return;
		}
		int groupIndex = localPlanet.factory.veinPool[vd.id].groupIndex;
		localPlanet.factory.veinPool[vd.id].groupIndex = (short)localPlanet.factory.AddVeinGroup(vd.type, ((Vector3)(ref vd.pos)).normalized);
		foreach (int item2 in list)
		{
			if (item2 != vd.id)
			{
				localPlanet.factory.veinPool[item2].groupIndex = localPlanet.factory.veinPool[vd.id].groupIndex;
			}
		}
		localPlanet.factory.RecalculateVeinGroup((int)localPlanet.factory.veinPool[vd.id].groupIndex);
		localPlanet.factory.RecalculateVeinGroup(groupIndex);
		localPlanet.factory.ArrangeVeinGroups();
	}

	public Vector3 PostionCompute(Vector3 begin, Vector3 end, Vector3 pointpos, int index, bool oil = false)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: 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)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: 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_0169: 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_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: 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_028f: 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_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: 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_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		if (end.y > 193f || end.y < -193f)
		{
			UIMessageBox.Show("移动矿堆失败".Translate(), "当前纬度过高,为避免出错,无法移动矿堆".Translate(), "确定".Translate(), 3);
			CoolDown = true;
			return pointpos;
		}
		if ((MergeOil.Value && oil) || MergeVeinGroup.Value)
		{
			return end;
		}
		Vector3 val = end;
		float realRadius = GameMain.localPlanet.realRadius;
		Quaternion val2 = Maths.SphericalRotation(begin, 0f);
		float num = (oil ? 15f : 1.5f);
		Vector3 val3;
		if (!oil)
		{
			val.x = (int)val.x;
			val.z = (int)val.z;
			val.y = (int)val.y;
			val3 = begin + val2 * (new Vector3((float)(index / veinlines.Value), 0f, (float)(index % veinlines.Value)) * num);
		}
		else
		{
			val3 = begin - val2 * new Vector3((float)(index / veinlines.Value * 8), 0f, (float)(index % veinlines.Value) * num);
		}
		double num2 = Math.Atan(begin.z / begin.x) - Math.Atan(val.z / val.x);
		double num3 = Math.Acos(begin.y / realRadius) - Math.Acos(val.y / realRadius);
		double num4 = 0.0 - Math.Atan(val3.z / val3.x) + num2;
		double num5 = Math.Acos(val3.y / realRadius) - num3;
		if (num2 == double.NaN || num3 == double.NaN || num4 == double.NaN || num5 == double.NaN)
		{
			return pointpos;
		}
		val3.x = (float)((end.x < 0f) ? (0.0 - Math.Abs(Math.Sin(num5) * Math.Cos(num4))) : Math.Abs(Math.Sin(num5) * Math.Cos(num4)));
		val3.y = (float)((end.y < 0f) ? (0.0 - Math.Abs(Math.Cos(num5))) : Math.Abs(Math.Cos(num5)));
		val3.z = (float)((end.z < 0f) ? (0.0 - Math.Abs(Math.Sin(num5) * Math.Sin(num4))) : Math.Abs(Math.Sin(num5) * Math.Sin(num4)));
		val3.x *= realRadius;
		val3.y *= realRadius;
		val3.z *= realRadius;
		if (val3.x == float.NaN || val3.y == float.NaN || val3.z == float.NaN || val3.y > 190f || val3.y < -190f)
		{
			return pointpos;
		}
		return val3;
	}

	internal void SetOilAddInterval(int selectedIndex)
	{
		OilAddInterval = OilAddIntervalValue[selectedIndex];
		for (int i = 0; i < 3; i++)
		{
			OilAddIntervalBool[i] = i == selectedIndex;
		}
	}

	public string VeintypechineseTranslate(int i)
	{
		return i switch
		{
			1 => "铁矿", 
			2 => "铜矿", 
			3 => "硅矿", 
			4 => "钛矿", 
			5 => "石矿", 
			6 => "碳矿", 
			7 => "原油涌泉", 
			8 => "可燃冰", 
			9 => "金伯利矿石", 
			10 => "分形硅石", 
			11 => "有机晶体", 
			12 => "光栅石", 
			13 => "刺笋结晶", 
			14 => "单极磁矿", 
			_ => "", 
		};
	}

	public int VeinIdToItemId(int veinId)
	{
		return veinId switch
		{
			1 => 1001, 
			2 => 1002, 
			3 => 1003, 
			4 => 1004, 
			5 => 1005, 
			6 => 1006, 
			7 => 1007, 
			8 => 1011, 
			9 => 1012, 
			10 => 1013, 
			11 => 1117, 
			12 => 1014, 
			13 => 1015, 
			14 => 1016, 
			_ => 0, 
		};
	}

	public void moveWindow(ref float x, ref float y, ref float x_move, ref float y_move, ref bool movewindow, ref float tempx, ref float tempy, float x_width)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_0025: 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_0054: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Vector2.op_Implicit(Input.mousePosition);
		int height = Screen.height;
		bool flag = x <= val.x && x + Window_Width >= val.x;
		bool flag2 = (float)Screen.height >= y + val.y && (float)Screen.height <= Window_Height + y + val.y;
		MouseInWindow = flag && flag2;
		if (val.x > x && val.x < x + x_width && (float)height - val.y > y && (float)height - val.y < y + 20f)
		{
			if (Input.GetMouseButton(0))
			{
				if (!movewindow)
				{
					x_move = x;
					y_move = y;
					tempx = val.x;
					tempy = (float)height - val.y;
				}
				movewindow = true;
				x = x_move + val.x - tempx;
				y = y_move + ((float)height - val.y) - tempy;
			}
			else
			{
				movewindow = false;
				tempx = x;
				tempy = y;
			}
		}
		else if (movewindow)
		{
			movewindow = false;
			x = x_move + val.x - tempx;
			y = y_move + ((float)height - val.y) - tempy;
		}
	}
}