Decompiled source of LocalRatingSystem v1.3.2

LocalRatingSystem.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ClassLibrary1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LocalRatingSystem
{
	[HarmonyPatch(typeof(SettingsPanelController), "OnEnable")]
	public class SettingsOpenPatch
	{
		private static void Postfix()
		{
			MMRPlugin.IsSettingsOpen = true;
		}
	}
	[HarmonyPatch(typeof(SettingsPanelController), "OnDisable")]
	public class SettingsClosePatch
	{
		private static void Postfix()
		{
			MMRPlugin.IsSettingsOpen = false;
		}
	}
	[HarmonyPatch(typeof(MainMenuController), "Awake")]
	public class MainMenuPatch
	{
		private static void Postfix(MainMenuController __instance)
		{
			if ((Object)(object)MMRPlugin.Instance != (Object)null)
			{
				MMRPlugin.Instance.IsMainMenuActive = true;
				MMRPlugin.Instance.StartPTSAnimation();
			}
		}
	}
	[HarmonyPatch(typeof(GameOverController), "Awake")]
	public class GameOverPatch
	{
		private static void Postfix(GameOverController __instance)
		{
			if ((Object)(object)MMRPlugin.Instance != (Object)null)
			{
				MMRPlugin.Instance.OnGameVictory();
			}
		}
	}
	[HarmonyPatch(typeof(CharacterSelectController), "RebuildLocal")]
	public class CharacterSelectPatch
	{
		private static void Postfix(CharacterSelectController __instance, bool deselectButtons)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			try
			{
				FieldInfo field = ((object)__instance).GetType().GetField("currentSurvivorDef", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					object? value = field.GetValue(__instance);
					SurvivorDef val = (SurvivorDef)((value is SurvivorDef) ? value : null);
					if (val != null)
					{
						MMRPlugin.CurrentSelectedCharacter = val.displayNameToken;
						return;
					}
				}
			}
			catch
			{
			}
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedMaster != (Object)null && (Object)(object)firstLocalUser.cachedMaster.bodyPrefab != (Object)null)
			{
				MMRPlugin.CurrentSelectedCharacter = ((Object)firstLocalUser.cachedMaster.bodyPrefab).name;
			}
		}
	}
	public enum LanguageChoice
	{
		Russian,
		English,
		Chinese
	}
	public static class Lang
	{
		public static int CurrentLang = 0;

		private static readonly Dictionary<string, string> Ru = new Dictionary<string, string>
		{
			{ "Calibration", "Калибровка" },
			{ "Recalibration", "Рекалибровка" },
			{ "Rank", "Ранг" },
			{ "Streak", "Стрик" },
			{ "PTS", "PTS" },
			{ "Shop", "Магазин" },
			{ "History", "История матчей" },
			{ "Coins", "Монеты" },
			{ "Buy", "Купить" },
			{ "Equip", "Надеть" },
			{ "Equipped", "Надета" },
			{ "Unequip", "Снять" },
			{ "Close", "Закрыть" },
			{ "Win", "Победа" },
			{ "Loss", "Поражение" },
			{ "Wins", "Побед" },
			{ "Losses", "Поражений" },
			{ "Winrate", "Винрейт" },
			{ "Rank_Lemurian", "Лемурианец" },
			{ "Rank_Hunter", "Охотник" },
			{ "Rank_Heretic", "Еретик" },
			{ "Rank_Reaper", "Жнец" },
			{ "Rank_Lord", "Владыка" },
			{ "Rank_King", "Король без королевства" },
			{ "Rank_Unranked", "Без ранга" },
			{ "DoublePTS", "Двойной PTS" },
			{ "StreakShield", "Парирование стрика" },
			{ "Active", "АКТИВЕН" },
			{ "Activate", "Активировать" },
			{ "NoCoins", "Недостаточно монет!" },
			{ "Bought", "Куплено" },
			{ "Set", "Задать" },
			{ "HideHUD", "Скрыть HUD" },
			{ "Language", "Язык" },
			{ "ResetCalibration", "Начать калибровку заново" },
			{ "Debug", "DEBUG MENU" },
			{ "DailyPTSStats", "Статистика PTS за день" },
			{ "LastGameResult", "Результат последней игры" },
			{ "Donate", "Поддержать автора" }
		};

		private static readonly Dictionary<string, string> En = new Dictionary<string, string>
		{
			{ "Calibration", "Calibration" },
			{ "Recalibration", "Recalibration" },
			{ "Rank", "Rank" },
			{ "Streak", "Streak" },
			{ "PTS", "PTS" },
			{ "Shop", "Shop" },
			{ "History", "Match History" },
			{ "Coins", "Coins" },
			{ "Buy", "Buy" },
			{ "Equip", "Equip" },
			{ "Equipped", "Equipped" },
			{ "Unequip", "Unequip" },
			{ "Close", "Close" },
			{ "Win", "Win" },
			{ "Loss", "Loss" },
			{ "Wins", "Wins" },
			{ "Losses", "Losses" },
			{ "Winrate", "Winrate" },
			{ "Rank_Lemurian", "Lemurian" },
			{ "Rank_Hunter", "Hunter" },
			{ "Rank_Heretic", "Heretic" },
			{ "Rank_Reaper", "Reaper" },
			{ "Rank_Lord", "Lord" },
			{ "Rank_King", "King without a Kingdom" },
			{ "Rank_Unranked", "Unranked" },
			{ "DoublePTS", "Double PTS" },
			{ "StreakShield", "Streak Shield" },
			{ "Active", "ACTIVE" },
			{ "Activate", "Activate" },
			{ "NoCoins", "Not enough coins!" },
			{ "Bought", "Bought" },
			{ "Set", "Set" },
			{ "HideHUD", "Hide HUD" },
			{ "Language", "Language" },
			{ "ResetCalibration", "Start Calibration Again" },
			{ "Debug", "DEBUG MENU" },
			{ "DailyPTSStats", "Daily PTS Stats" },
			{ "LastGameResult", "Last Game Result" },
			{ "Donate", "Donate" }
		};

		private static readonly Dictionary<string, string> Zh = new Dictionary<string, string>
		{
			{ "Calibration", "定级赛" },
			{ "Recalibration", "重新定级" },
			{ "Rank", "段位" },
			{ "Streak", "连胜" },
			{ "PTS", "PTS" },
			{ "Shop", "商店" },
			{ "History", "比赛历史" },
			{ "Coins", "硬币" },
			{ "Buy", "购买" },
			{ "Equip", "装备" },
			{ "Equipped", "已装备" },
			{ "Unequip", "卸下" },
			{ "Close", "关闭" },
			{ "Win", "胜利" },
			{ "Loss", "失败" },
			{ "Wins", "胜场" },
			{ "Losses", "败场" },
			{ "Winrate", "胜率" },
			{ "Rank_Lemurian", "勒穆里安" },
			{ "Rank_Hunter", "猎人" },
			{ "Rank_Heretic", "异端" },
			{ "Rank_Reaper", "死神" },
			{ "Rank_Lord", "领主" },
			{ "Rank_King", "无冕之王" },
			{ "Rank_Unranked", "未定级" },
			{ "DoublePTS", "双倍PTS" },
			{ "StreakShield", "连胜护盾" },
			{ "Active", "已激活" },
			{ "Activate", "激活" },
			{ "NoCoins", "硬币不足!" },
			{ "Bought", "已购买" },
			{ "Set", "设置" },
			{ "HideHUD", "隐藏HUD" },
			{ "Language", "语言" },
			{ "ResetCalibration", "重新开始定级" },
			{ "Debug", "调试菜单" },
			{ "DailyPTSStats", "今日PTS统计" },
			{ "LastGameResult", "上一场比赛结果" },
			{ "Donate", "支持作者" }
		};

		public static string T(string key)
		{
			Dictionary<string, string> dictionary = ((CurrentLang == 0) ? Ru : ((CurrentLang == 1) ? En : Zh));
			return dictionary.ContainsKey(key) ? dictionary[key] : key;
		}
	}
	public class MMRNetworkComponent : MonoBehaviour
	{
		public int PTS = 500;

		public string RankName = "Без ранга";

		public float WinRate = 0f;

		public bool IsCalibrating = false;

		public int CalibrationGamesLeft = 0;
	}
	public class SecureProfile
	{
		private string savePath;

		private string playerId;

		public int PTS { get; private set; }

		public int Streak { get; private set; }

		public bool IsCalibrating { get; private set; }

		public int CalibrationGamesLeft { get; private set; }

		public int GamesPlayedAfterCalibration { get; private set; }

		public bool HasCalibratedBefore { get; private set; }

		public int Coins { get; private set; }

		public int DailyPTS { get; private set; }

		public string LastPlayedDate { get; private set; } = "";

		public string EquippedFrame { get; private set; } = "";

		public string UnlockedFrames { get; private set; } = "";

		public int DoublePTSBuffCount { get; private set; }

		public int StreakShieldBuffCount { get; private set; }

		public bool IsDoublePTSActive { get; private set; }

		public bool IsStreakShieldActive { get; private set; }

		public SecureProfile()
		{
			string text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "LocalRatingSystem");
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			savePath = Path.Combine(text, "mmr_profile.dat");
			string text2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "LocalMMR", "mmr_profile.dat");
			if (!File.Exists(savePath) && File.Exists(text2))
			{
				try
				{
					File.Copy(text2, savePath);
				}
				catch
				{
				}
			}
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			playerId = ((firstLocalUser == null) ? null : firstLocalUser.userProfile?.name) ?? "DefaultPlayer";
			Load();
		}

		public void Load()
		{
			if (!File.Exists(savePath))
			{
				SetDefaults();
				Save();
				return;
			}
			try
			{
				string[] array = File.ReadAllLines(savePath);
				foreach (string text in array)
				{
					string[] array2 = text.Split('|');
					if (array2.Length == 17 && array2[0] == playerId)
					{
						string input = string.Join("|", array2[0..16]);
						if (array2[16] == GetHash(input))
						{
							PTS = int.Parse(array2[1]);
							Streak = int.Parse(array2[2]);
							IsCalibrating = bool.Parse(array2[3]);
							CalibrationGamesLeft = int.Parse(array2[4]);
							GamesPlayedAfterCalibration = int.Parse(array2[5]);
							HasCalibratedBefore = bool.Parse(array2[6]);
							Coins = int.Parse(array2[7]);
							DailyPTS = int.Parse(array2[8]);
							LastPlayedDate = array2[9];
							EquippedFrame = array2[10];
							UnlockedFrames = array2[11];
							DoublePTSBuffCount = int.Parse(array2[12]);
							StreakShieldBuffCount = int.Parse(array2[13]);
							IsDoublePTSActive = bool.Parse(array2[14]);
							IsStreakShieldActive = bool.Parse(array2[15]);
						}
						else
						{
							SetDefaults();
							Save();
						}
						return;
					}
				}
				SetDefaults();
				Save();
			}
			catch
			{
				SetDefaults();
			}
		}

		public void Save()
		{
			string text = $"{playerId}|{PTS}|{Streak}|{IsCalibrating}|{CalibrationGamesLeft}|{GamesPlayedAfterCalibration}|{HasCalibratedBefore}|{Coins}|{DailyPTS}|{LastPlayedDate}|{EquippedFrame}|{UnlockedFrames}|{DoublePTSBuffCount}|{StreakShieldBuffCount}|{IsDoublePTSActive}|{IsStreakShieldActive}";
			File.WriteAllText(savePath, text + "|" + GetHash(text) + Environment.NewLine);
		}

		private void SetDefaults()
		{
			PTS = 500;
			Streak = 0;
			IsCalibrating = true;
			CalibrationGamesLeft = 10;
			GamesPlayedAfterCalibration = 0;
			HasCalibratedBefore = false;
			Coins = 0;
			DailyPTS = 0;
			LastPlayedDate = "";
			EquippedFrame = "";
			UnlockedFrames = "";
			DoublePTSBuffCount = 0;
			StreakShieldBuffCount = 0;
			IsDoublePTSActive = false;
			IsStreakShieldActive = false;
		}

		public void SetPTS(int amount)
		{
			PTS = Math.Max(0, amount);
			Save();
		}

		public void AddPTS(int change)
		{
			PTS = Math.Max(0, PTS + change);
			Save();
		}

		public void RemoveCoins(int amount)
		{
			Coins = Math.Max(0, Coins - amount);
			Save();
		}

		public void SetCoins(int amount)
		{
			Coins = Math.Max(0, amount);
			Save();
		}

		public void AddCoins(int amount)
		{
			Coins += amount;
			Save();
		}

		public void SetStreak(int streak)
		{
			Streak = streak;
			Save();
		}

		public void SetCalibrating(bool cal, int gamesLeft)
		{
			IsCalibrating = cal;
			CalibrationGamesLeft = gamesLeft;
			Save();
		}

		public void SetDailyPTS(int amount, string date)
		{
			DailyPTS = amount;
			LastPlayedDate = date;
			Save();
		}

		public void SetGamesPlayedAfterCalibration(int count)
		{
			GamesPlayedAfterCalibration = count;
			Save();
		}

		public void SetFrame(string frameId)
		{
			EquippedFrame = frameId;
			Save();
		}

		public void AddDoublePTSBuff()
		{
			DoublePTSBuffCount++;
			Save();
		}

		public void AddStreakShieldBuff()
		{
			StreakShieldBuffCount++;
			Save();
		}

		public void SetDoublePTSActive(bool active)
		{
			IsDoublePTSActive = active;
			Save();
		}

		public void SetStreakShieldActive(bool active)
		{
			IsStreakShieldActive = active;
			Save();
		}

		public void ConsumeDoublePTSBuff()
		{
			if (DoublePTSBuffCount > 0)
			{
				DoublePTSBuffCount--;
				IsDoublePTSActive = false;
				Save();
			}
		}

		public void ConsumeStreakShieldBuff()
		{
			if (StreakShieldBuffCount > 0)
			{
				StreakShieldBuffCount--;
				IsStreakShieldActive = false;
				Save();
			}
		}

		public bool IsFrameUnlocked(string frameId)
		{
			return UnlockedFrames.Contains(frameId);
		}

		public void UnlockFrame(string frameId)
		{
			if (!IsFrameUnlocked(frameId))
			{
				UnlockedFrames = UnlockedFrames + ((UnlockedFrames == "") ? "" : ",") + frameId;
				Save();
			}
		}

		private string GetHash(string input)
		{
			using SHA256 sHA = SHA256.Create();
			return BitConverter.ToString(sHA.ComputeHash(Encoding.UTF8.GetBytes(input))).Replace("-", "").ToLower();
		}
	}
	public class CharStats
	{
		public int Wins { get; set; }

		public int Losses { get; set; }

		public int PtsEarned { get; set; }

		public override string ToString()
		{
			return $"{Wins}|{Losses}|{PtsEarned}";
		}

		public static CharStats Parse(string data)
		{
			string[] array = data.Split('|');
			return (array.Length == 3) ? new CharStats
			{
				Wins = int.Parse(array[0]),
				Losses = int.Parse(array[1]),
				PtsEarned = int.Parse(array[2])
			} : new CharStats();
		}
	}
	[BepInPlugin("com.awic.localratingsystem", "Local Rating System", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MMRPlugin : BaseUnityPlugin
	{
		public static MMRPlugin Instance = null;

		public bool IsMainMenuActive = false;

		public static bool IsSettingsOpen = false;

		public static bool IsShopOpen = false;

		public static bool IsHistoryOpen = false;

		public static bool IsDebugOpen = false;

		public static string CurrentSelectedCharacter = "Unknown";

		private SecureProfile profile = null;

		private Dictionary<string, CharStats> charStats = new Dictionary<string, CharStats>();

		private string charStatsPath = "";

		private ConfigEntry<float> posX = null;

		private ConfigEntry<float> posY = null;

		private ConfigEntry<float> boxWidth = null;

		private ConfigEntry<float> boxHeight = null;

		private ConfigEntry<float> fontSize = null;

		private ConfigEntry<float> medalSize = null;

		private ConfigEntry<float> hudPosX = null;

		private ConfigEntry<float> hudPosY = null;

		private ConfigEntry<float> hudMiniMedalSize = null;

		private ConfigEntry<float> hudBackgroundOpacity = null;

		private ConfigEntry<float> hudFontSize = null;

		private ConfigEntry<float> frameOpacity = null;

		private ConfigEntry<float> charStatsPosX = null;

		private ConfigEntry<float> charStatsPosY = null;

		private ConfigEntry<float> calibrationTextOffsetX = null;

		private ConfigEntry<float> calibrationTextOffsetY = null;

		private ConfigEntry<float> calibrationExtraWidth = null;

		private ConfigEntry<float> calibrationFontSizeOverride = null;

		private ConfigEntry<bool> hideHud = null;

		private ConfigEntry<bool> showHudInMenu = null;

		private ConfigEntry<LanguageChoice> langOverride = null;

		private const int requiredGamesForRecalibration = 50;

		private bool bossKilledThisRun = false;

		private string lastGameStats = "Нет данных";

		private float lastClickTime = 0f;

		private const float DOUBLE_CLICK_TIME = 0.4f;

		private bool awaitingConfirmation = false;

		private string toastMessage = "";

		private float toastTimer = 0f;

		private float ptsPulseTimer = 0f;

		private int lastPTSChange = 0;

		private static float staticPtsDisplay = -1f;

		private static float animStartTime = -1f;

		private static float animStartValue = 0f;

		private static float animTargetValue = 0f;

		private static float animDuration = 2f;

		private int historyPage = 0;

		private const int historyPerPage = 10;

		private string debugPtsInput = "500";

		private string debugCoinsInput = "1000";

		private GUIStyle? hudStyle;

		private GUIStyle? rankStyle;

		private GUIStyle? streakStyle;

		private GUIStyle? ptsStyle;

		private GUIStyle? toastStyle;

		private GUIStyle? shopStyle;

		private GUIStyle? debugStyle;

		private GUIStyle? debugTextFieldStyle;

		private GUIStyle? outlineStyle;

		private GUIStyle? charStatsStyle;

		private GUIStyle? tabStyle;

		private Texture2D? darkTexture;

		private Texture2D? hoverTexture;

		private Texture2D? hudDarkTexture;

		private Texture2D? progressBarBgTexture;

		private Texture2D? progressBarFillTexture;

		private Texture2D? shopBgTexture;

		private Texture2D? debugBgTexture;

		private Texture2D? tabBgTexture;

		private string historyPath = "";

		private string iconsPath = "";

		private Dictionary<string, Texture2D> medalTextures = new Dictionary<string, Texture2D>();

		private Dictionary<string, Texture2D> frameTextures = new Dictionary<string, Texture2D>();

		private float runTimeMinutes = 0f;

		private Dictionary<string, int> shopFrames = new Dictionary<string, int>
		{
			{ "frame_green", 100 },
			{ "frame_purple", 300 },
			{ "frame_red", 500 },
			{ "frame_rainbow", 1000 }
		};

		private bool isDeveloperMode = false;

		private void Awake()
		{
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Expected O, but got Unknown
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Expected O, but got Unknown
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Expected O, but got Unknown
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Expected O, but got Unknown
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Expected O, but got Unknown
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Expected O, but got Unknown
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Expected O, but got Unknown
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Expected O, but got Unknown
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Expected O, but got Unknown
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Expected O, but got Unknown
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Expected O, but got Unknown
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Expected O, but got Unknown
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Expected O, but got Unknown
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Expected O, but got Unknown
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Expected O, but got Unknown
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Expected O, but got Unknown
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Expected O, but got Unknown
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Expected O, but got Unknown
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Expected O, but got Unknown
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Expected O, but got Unknown
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Expected O, but got Unknown
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Expected O, but got Unknown
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Expected O, but got Unknown
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Expected O, but got Unknown
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Expected O, but got Unknown
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Expected O, but got Unknown
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Expected O, but got Unknown
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f9: Expected O, but got Unknown
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Expected O, but got Unknown
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_070a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_0725: Expected O, but got Unknown
			//IL_0720: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Expected O, but got Unknown
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0736: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Expected O, but got Unknown
			//IL_074c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0756: Expected O, but got Unknown
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0762: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Expected O, but got Unknown
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_0782: Expected O, but got Unknown
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_078e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Expected O, but got Unknown
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Expected O, but got Unknown
			Instance = this;
			profile = new SecureProfile();
			string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "LocalRatingSystem");
			charStatsPath = Path.Combine(path, "char_stats.txt");
			historyPath = Path.Combine(path, "LocalRatingSystem_History.txt");
			LoadCharStats();
			if (File.Exists(Path.Combine(Paths.ConfigPath, "developer_mode.txt")))
			{
				isDeveloperMode = true;
			}
			langOverride = ((BaseUnityPlugin)this).Config.Bind<LanguageChoice>("0. UI General", "Language", LanguageChoice.Russian, "Язык интерфейса мода");
			hideHud = ((BaseUnityPlugin)this).Config.Bind<bool>("0. UI General", "HideHUD", false, "Скрыть HUD в игре");
			showHudInMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("0. UI General", "ShowHUDInMenu", true, "Показывать HUD в главном меню");
			switch (langOverride.Value)
			{
			case LanguageChoice.Russian:
				Lang.CurrentLang = 0;
				break;
			case LanguageChoice.English:
				Lang.CurrentLang = 1;
				break;
			case LanguageChoice.Chinese:
				Lang.CurrentLang = 2;
				break;
			}
			langOverride.SettingChanged += delegate
			{
				switch (langOverride.Value)
				{
				case LanguageChoice.Russian:
					Lang.CurrentLang = 0;
					break;
				case LanguageChoice.English:
					Lang.CurrentLang = 1;
					break;
				case LanguageChoice.Chinese:
					Lang.CurrentLang = 2;
					break;
				}
			};
			posX = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "PositionX", 70f, (ConfigDescription)null);
			posY = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "PositionY", 0f, (ConfigDescription)null);
			boxWidth = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "Width", 374.3096f, (ConfigDescription)null);
			boxHeight = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "Height", 515f, (ConfigDescription)null);
			fontSize = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "FontSize", 30.33f, (ConfigDescription)null);
			medalSize = ((BaseUnityPlugin)this).Config.Bind<float>("1. UI Menu", "MedalSize", 239.96f, (ConfigDescription)null);
			hudPosX = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "HudPosX", 0f, (ConfigDescription)null);
			hudPosY = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "HudPosY", 658.36f, (ConfigDescription)null);
			hudMiniMedalSize = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "HudMedalSize", 128f, (ConfigDescription)null);
			hudBackgroundOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "HudOpacity", 0f, (ConfigDescription)null);
			hudFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "HudFontSize", 23.69f, (ConfigDescription)null);
			frameOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "FrameOpacity", 1f, (ConfigDescription)null);
			calibrationTextOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "CalibrationTextOffsetX", -26f, "Сдвиг текста калибровки по X");
			calibrationTextOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "CalibrationTextOffsetY", -4.89f, "Сдвиг текста калибровки по Y");
			calibrationExtraWidth = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "CalibrationExtraWidth", 40f, "Доп. ширина HUD при калибровке");
			calibrationFontSizeOverride = ((BaseUnityPlugin)this).Config.Bind<float>("2. UI In-Game", "CalibrationFontSizeOverride", 23.758f, "Отдельный шрифт калибровки (0 = общий)");
			charStatsPosX = ((BaseUnityPlugin)this).Config.Bind<float>("3. UI Lobby", "CharStatsPosX", 1037.55f, (ConfigDescription)null);
			charStatsPosY = ((BaseUnityPlugin)this).Config.Bind<float>("3. UI Lobby", "CharStatsPosY", 57.22f, (ConfigDescription)null);
			iconsPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Icons");
			if (!Directory.Exists(iconsPath))
			{
				try
				{
					string[] directories = Directory.GetDirectories(Paths.PluginPath, "Icons", SearchOption.AllDirectories);
					if (directories.Length != 0)
					{
						iconsPath = directories[0];
					}
				}
				catch
				{
				}
			}
			if (!Directory.Exists(iconsPath))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"[LocalRatingSystem] CRITICAL: Icons folder not found! Checked near DLL and all plugins subfolders.");
			}
			LoadMedals();
			LoadFrames();
			Run.onRunDestroyGlobal += OnRunEnd;
			new Harmony("com.awic.localratingsystem.mainmenu").PatchAll();
			if (staticPtsDisplay == -1f)
			{
				staticPtsDisplay = profile.PTS;
			}
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)langOverride));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(hideHud));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showHudInMenu));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(posX, new SliderConfig
			{
				min = 0f,
				max = 1920f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(posY, new SliderConfig
			{
				min = 0f,
				max = 1080f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(boxWidth, new SliderConfig
			{
				min = 100f,
				max = 800f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(boxHeight, new SliderConfig
			{
				min = 100f,
				max = 800f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(fontSize, new SliderConfig
			{
				min = 10f,
				max = 60f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(medalSize, new SliderConfig
			{
				min = 50f,
				max = 300f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(hudPosX, new SliderConfig
			{
				min = 0f,
				max = 1920f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(hudPosY, new SliderConfig
			{
				min = 0f,
				max = 1080f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(hudMiniMedalSize, new SliderConfig
			{
				min = 32f,
				max = 128f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(hudBackgroundOpacity, new SliderConfig
			{
				min = 0f,
				max = 1f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(hudFontSize, new SliderConfig
			{
				min = 10f,
				max = 40f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(frameOpacity, new SliderConfig
			{
				min = 0f,
				max = 1f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(calibrationTextOffsetX, new SliderConfig
			{
				min = -200f,
				max = 200f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(calibrationTextOffsetY, new SliderConfig
			{
				min = -100f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(calibrationExtraWidth, new SliderConfig
			{
				min = 0f,
				max = 400f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(calibrationFontSizeOverride, new SliderConfig
			{
				min = 0f,
				max = 60f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(charStatsPosX, new SliderConfig
			{
				min = 0f,
				max = 1920f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(charStatsPosY, new SliderConfig
			{
				min = 0f,
				max = 1080f
			}));
			UpdateRichPresence();
		}

		public void OnGameVictory()
		{
			bossKilledThisRun = true;
		}

		private void LoadCharStats()
		{
			if (!File.Exists(charStatsPath))
			{
				return;
			}
			try
			{
				string[] array = File.ReadAllLines(charStatsPath);
				foreach (string text in array)
				{
					string[] array2 = text.Split(':');
					if (array2.Length == 2)
					{
						charStats[array2[0]] = CharStats.Parse(array2[1]);
					}
				}
			}
			catch
			{
			}
		}

		private void SaveCharStats()
		{
			try
			{
				File.WriteAllLines(charStatsPath, charStats.Select<KeyValuePair<string, CharStats>, string>((KeyValuePair<string, CharStats> kv) => kv.Key + ":" + kv.Value.ToString()));
			}
			catch
			{
			}
		}

		private void LoadMedals()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			string[] array = new string[7] { "lemurian", "hunter", "heretic", "reaper", "lord", "king", "unranked" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				string path = Path.Combine(iconsPath, text + ".png");
				if (File.Exists(path))
				{
					Texture2D val = new Texture2D(2, 2);
					ImageConversion.LoadImage(val, File.ReadAllBytes(path));
					medalTextures[text] = val;
				}
			}
		}

		private void LoadFrames()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			string[] array = new string[4] { "frame_green", "frame_purple", "frame_red", "frame_rainbow" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				string path = Path.Combine(iconsPath, text + ".png");
				if (File.Exists(path))
				{
					Texture2D val = new Texture2D(2, 2);
					ImageConversion.LoadImage(val, File.ReadAllBytes(path));
					frameTextures[text] = val;
				}
			}
		}

		private void ResetToCalibration()
		{
			profile.SetCalibrating(cal: true, 10);
			profile.SetGamesPlayedAfterCalibration(0);
			staticPtsDisplay = profile.PTS;
			animStartTime = -1f;
			UpdateRichPresence();
		}

		private void ShowMessage(string message)
		{
			toastMessage = message;
			toastTimer = 8f;
			if ((Object)(object)Run.instance != (Object)null)
			{
				Chat.AddMessage(message);
			}
		}

		public void StartPTSAnimation()
		{
			if (Math.Abs(staticPtsDisplay - (float)profile.PTS) > 0.5f)
			{
				animStartValue = staticPtsDisplay;
				animTargetValue = profile.PTS;
				animStartTime = Time.realtimeSinceStartup;
				animDuration = (IsMainMenuActive ? 3f : 2f);
			}
		}

		private void OnRunEnd(Run run)
		{
			//IL_00e0: 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_00ee: Invalid comparison between Unknown and I4
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0131: Invalid comparison between Unknown and I4
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected I4, but got Unknown
			if ((Object)(object)run == (Object)null)
			{
				return;
			}
			runTimeMinutes = (((Object)(object)Run.instance != (Object)null) ? Run.instance.fixedTime : 0f) / 60f;
			bool flag = bossKilledThisRun;
			bossKilledThisRun = false;
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			CharacterMaster val = ((firstLocalUser != null) ? firstLocalUser.cachedMaster : null);
			string text = NormalizeCharName(CurrentSelectedCharacter);
			if (text == "Unknown" && (Object)(object)val != (Object)null && (Object)(object)val.bodyPrefab != (Object)null)
			{
				text = NormalizeCharName(((Object)val.bodyPrefab).name);
			}
			string text2 = DateTime.Now.ToString("yyyy-MM-dd");
			if (profile.LastPlayedDate != text2)
			{
				profile.SetDailyPTS(0, text2);
			}
			int num = (((int)run.selectedDifficulty == 0) ? 10 : (((int)run.selectedDifficulty == 1) ? 25 : 40));
			int num2 = (((int)run.selectedDifficulty == 0) ? 15 : 40);
			float num3 = 1f;
			string text3 = ((object)run.selectedDifficulty/*cast due to .constrained prefix*/).ToString();
			if ((int)run.selectedDifficulty > 2)
			{
				int num4 = run.selectedDifficulty - 2;
				if (num4 > 0)
				{
					num3 = 1f + (float)num4 * 0.1f;
					text3 = $"Eclipse {num4}";
				}
			}
			float num5 = 1f;
			int num6 = profile.Streak;
			if (flag)
			{
				num6++;
			}
			else if (!profile.IsStreakShieldActive)
			{
				num6 = 0;
			}
			if (num6 >= 4 && num6 < 10)
			{
				num5 = 1f + (float)(num6 - 3) * 0.1f;
			}
			else if (num6 >= 10)
			{
				num5 = 2f;
			}
			int num7 = (flag ? (run.stageClearCount / 5 * 10) : 0);
			int num8 = (flag ? ((int)((float)(num + num7) * num3 * num5)) : (-(int)((float)num2 * num3)));
			if (profile.IsDoublePTSActive)
			{
				num8 *= 2;
			}
			if (profile.IsCalibrating)
			{
				num8 *= 2;
				profile.SetCalibrating(profile.CalibrationGamesLeft - 1 > 0, profile.CalibrationGamesLeft - 1);
			}
			else
			{
				profile.SetGamesPlayedAfterCalibration(profile.GamesPlayedAfterCalibration + 1);
			}
			((BaseUnityPlugin)this).Logger.LogMessage((object)$"[LocalRatingSystem] Run End: isWin={flag}, change={num8}, runTime={runTimeMinutes:F1} min");
			if (!this.charStats.ContainsKey(text))
			{
				this.charStats[text] = new CharStats();
			}
			CharStats charStats = this.charStats[text];
			if (flag)
			{
				charStats.Wins++;
			}
			else
			{
				charStats.Losses++;
			}
			charStats.PtsEarned += num8;
			SaveCharStats();
			int pTS = profile.PTS;
			profile.AddPTS(num8);
			if (pTS < profile.PTS)
			{
				string item = GetRankInfo(pTS, profile.IsCalibrating).rankName;
				string item2 = GetRankInfo(profile.PTS, profile.IsCalibrating).rankName;
				if (item != item2)
				{
					try
					{
						Util.PlaySound("Play_UI_LevelUp", ((Component)this).gameObject);
					}
					catch
					{
					}
				}
			}
			if (num8 > 0)
			{
				profile.AddCoins(num8 / 10);
			}
			profile.SetDailyPTS(profile.DailyPTS + num8, text2);
			profile.SetStreak(num6);
			if (profile.IsDoublePTSActive)
			{
				profile.ConsumeDoublePTSBuff();
			}
			if (profile.IsStreakShieldActive)
			{
				profile.ConsumeStreakShieldBuff();
			}
			lastPTSChange = num8;
			ptsPulseTimer = 5f;
			string text4 = (flag ? Lang.T("Win") : Lang.T("Loss"));
			lastGameStats = string.Format("{0}\nИзменение: {1}{2} (Всего: {3})\nСложность: {4}", text4, (num8 > 0) ? "+" : "", num8, profile.PTS, text3);
			try
			{
				File.AppendAllText(historyPath, string.Format("[{0:yyyy-MM-dd HH:mm:ss}] {1} | PTS: {2}{3} | Сложность: {4} | Персонаж: {5} | Время: {6:F1} мин", DateTime.Now, text4, (num8 > 0) ? "+" : "", num8, text3, text, runTimeMinutes) + Environment.NewLine, Encoding.UTF8);
			}
			catch
			{
			}
			UpdateRichPresence();
		}

		private (string medalKey, string rankName, Color color) GetRankInfo(int pts, bool calibrating)
		{
			//IL_0024: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_017e: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: 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_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: 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)
			if (calibrating)
			{
				return (medalKey: "unranked", rankName: Lang.T("Rank_Unranked"), color: new Color(0.7f, 0.7f, 0.7f));
			}
			if (pts < 750)
			{
				return (medalKey: "lemurian", rankName: Lang.T("Rank_Lemurian") + " 3", color: new Color(1f, 0.35f, 0.35f));
			}
			if (pts < 1000)
			{
				return (medalKey: "lemurian", rankName: Lang.T("Rank_Lemurian") + " 2", color: new Color(1f, 0.35f, 0.35f));
			}
			if (pts < 1300)
			{
				return (medalKey: "lemurian", rankName: Lang.T("Rank_Lemurian") + " 1", color: new Color(1f, 0.35f, 0.35f));
			}
			if (pts < 1500)
			{
				return (medalKey: "hunter", rankName: Lang.T("Rank_Hunter") + " 3", color: new Color(0.3f, 0.8f, 1f));
			}
			if (pts < 1800)
			{
				return (medalKey: "hunter", rankName: Lang.T("Rank_Hunter") + " 2", color: new Color(0.3f, 0.8f, 1f));
			}
			if (pts < 2100)
			{
				return (medalKey: "hunter", rankName: Lang.T("Rank_Hunter") + " 1", color: new Color(0.3f, 0.8f, 1f));
			}
			if (pts < 2400)
			{
				return (medalKey: "heretic", rankName: Lang.T("Rank_Heretic") + " 3", color: new Color(0.7f, 0.5f, 1f));
			}
			if (pts < 2700)
			{
				return (medalKey: "heretic", rankName: Lang.T("Rank_Heretic") + " 2", color: new Color(0.7f, 0.5f, 1f));
			}
			if (pts < 3000)
			{
				return (medalKey: "heretic", rankName: Lang.T("Rank_Heretic") + " 1", color: new Color(0.7f, 0.5f, 1f));
			}
			if (pts < 3350)
			{
				return (medalKey: "reaper", rankName: Lang.T("Rank_Reaper") + " 3", color: new Color(0.3f, 1f, 0.3f));
			}
			if (pts < 3700)
			{
				return (medalKey: "reaper", rankName: Lang.T("Rank_Reaper") + " 2", color: new Color(0.3f, 1f, 0.3f));
			}
			if (pts < 4000)
			{
				return (medalKey: "reaper", rankName: Lang.T("Rank_Reaper") + " 1", color: new Color(0.3f, 1f, 0.3f));
			}
			if (pts < 4300)
			{
				return (medalKey: "lord", rankName: Lang.T("Rank_Lord") + " 3", color: new Color(1f, 0.8f, 0.2f));
			}
			if (pts < 4600)
			{
				return (medalKey: "lord", rankName: Lang.T("Rank_Lord") + " 2", color: new Color(1f, 0.8f, 0.2f));
			}
			if (pts < 5000)
			{
				return (medalKey: "lord", rankName: Lang.T("Rank_Lord") + " 1", color: new Color(1f, 0.8f, 0.2f));
			}
			return (medalKey: "king", rankName: Lang.T("Rank_King"), color: new Color(1f, 0.2f, 0.4f));
		}

		private (int currentMin, int nextMax) GetRankBounds(int pts, bool calibrating)
		{
			if (calibrating)
			{
				return (currentMin: 0, nextMax: 10);
			}
			if (pts < 750)
			{
				return (currentMin: 500, nextMax: 750);
			}
			if (pts < 1000)
			{
				return (currentMin: 750, nextMax: 1000);
			}
			if (pts < 1300)
			{
				return (currentMin: 1000, nextMax: 1300);
			}
			if (pts < 1500)
			{
				return (currentMin: 1300, nextMax: 1500);
			}
			if (pts < 1800)
			{
				return (currentMin: 1500, nextMax: 1800);
			}
			if (pts < 2100)
			{
				return (currentMin: 1800, nextMax: 2100);
			}
			if (pts < 2400)
			{
				return (currentMin: 2100, nextMax: 2400);
			}
			if (pts < 2700)
			{
				return (currentMin: 2400, nextMax: 2700);
			}
			if (pts < 3000)
			{
				return (currentMin: 2700, nextMax: 3000);
			}
			if (pts < 3350)
			{
				return (currentMin: 3000, nextMax: 3350);
			}
			if (pts < 3700)
			{
				return (currentMin: 3350, nextMax: 3700);
			}
			if (pts < 4000)
			{
				return (currentMin: 3700, nextMax: 4000);
			}
			if (pts < 4300)
			{
				return (currentMin: 4000, nextMax: 4300);
			}
			if (pts < 4600)
			{
				return (currentMin: 4300, nextMax: 4600);
			}
			if (pts < 5000)
			{
				return (currentMin: 4600, nextMax: 5000);
			}
			return (currentMin: 5000, nextMax: 5000);
		}

		private void UpdateRichPresence()
		{
			try
			{
				string item = GetRankInfo(profile.PTS, profile.IsCalibrating).rankName;
				string text = (profile.IsCalibrating ? Lang.T("Calibration") : $"{item} ({profile.PTS} PTS)");
				Type.GetType("Steamworks.SteamFriends, Facepunch.Steamworks")?.GetMethod("SetRichPresence", new Type[2]
				{
					typeof(string),
					typeof(string)
				})?.Invoke(null, new object[2] { "status", text });
			}
			catch
			{
			}
		}

		private void Update()
		{
			if (isDeveloperMode && Input.GetKeyDown((KeyCode)291))
			{
				IsDebugOpen = !IsDebugOpen;
			}
			if (IsMainMenuActive)
			{
				if (staticPtsDisplay < 0f)
				{
					staticPtsDisplay = profile.PTS;
				}
				if (animStartTime > 0f)
				{
					float num = Time.realtimeSinceStartup - animStartTime;
					if (num < animDuration)
					{
						float num2 = Mathf.Clamp01(num / animDuration);
						staticPtsDisplay = Mathf.Lerp(animStartValue, animTargetValue, Mathf.SmoothStep(0f, 1f, num2));
					}
					else
					{
						staticPtsDisplay = animTargetValue;
						animStartTime = -1f;
					}
				}
			}
			UpdateNetworkUser();
		}

		private void UpdateNetworkUser()
		{
			if (NetworkUser.readOnlyLocalPlayersList == null || NetworkUser.readOnlyLocalPlayersList.Count <= 0)
			{
				return;
			}
			NetworkUser val = NetworkUser.readOnlyLocalPlayersList[0];
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			MMRNetworkComponent mMRNetworkComponent = ((Component)val).GetComponent<MMRNetworkComponent>();
			if ((Object)(object)mMRNetworkComponent == (Object)null)
			{
				mMRNetworkComponent = ((Component)val).gameObject.AddComponent<MMRNetworkComponent>();
			}
			string item = GetRankInfo(profile.PTS, profile.IsCalibrating).rankName;
			mMRNetworkComponent.PTS = profile.PTS;
			mMRNetworkComponent.RankName = item;
			mMRNetworkComponent.IsCalibrating = profile.IsCalibrating;
			mMRNetworkComponent.CalibrationGamesLeft = profile.CalibrationGamesLeft;
			int num = 0;
			int num2 = 0;
			foreach (CharStats value in charStats.Values)
			{
				num += value.Wins;
				num2 += value.Losses;
			}
			mMRNetworkComponent.WinRate = ((num + num2 > 0) ? ((float)num / (float)(num + num2) * 100f) : 0f);
		}

		private void OnGUI()
		{
			//IL_0023: 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_007b: 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_00d6: 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_0106: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			if (isDeveloperMode)
			{
				GUI.color = new Color(1f, 0f, 0f, 0.5f);
				if (GUI.Button(new Rect(0f, 0f, 30f, 30f), "", GUIStyle.none))
				{
					IsDebugOpen = !IsDebugOpen;
				}
				GUI.DrawTexture(new Rect(0f, 0f, 30f, 30f), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = Color.white;
			}
			bool isSettingsOpen = IsSettingsOpen;
			if ((Object)(object)Run.instance != (Object)null && !hideHud.Value && !isSettingsOpen)
			{
				DrawInGameHud();
			}
			Scene activeScene;
			if (!((Object)(object)Run.instance != (Object)null))
			{
				activeScene = SceneManager.GetActiveScene();
				if (!(((Scene)(ref activeScene)).name == "lobby"))
				{
					goto IL_00fe;
				}
			}
			DrawTabHud();
			goto IL_00fe;
			IL_00fe:
			if (IsMainMenuActive)
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "title" && !isSettingsOpen && showHudInMenu.Value)
				{
					DrawMainMenuPanel();
				}
			}
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "lobby" && !isSettingsOpen)
			{
				DrawCharStats();
			}
			if (IsShopOpen)
			{
				DrawShopMenu();
			}
			if (IsHistoryOpen)
			{
				DrawHistoryMenu();
			}
			if (IsDebugOpen)
			{
				DrawDebugMenu();
			}
			if (toastTimer > 0f)
			{
				DrawToast();
			}
		}

		private string NormalizeCharName(string rawName)
		{
			if (string.IsNullOrEmpty(rawName) || rawName == "Unknown")
			{
				return "Unknown";
			}
			string text = Regex.Replace(rawName, "(?i)(body|_name|-|_)", "").Trim();
			return (text.Length > 0) ? (char.ToUpper(text[0]) + text.Substring(1).ToLower()) : "Unknown";
		}

		private void DrawCharStats()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: 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_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0688: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Expected O, but got Unknown
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: 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)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Expected O, but got Unknown
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			if (charStatsStyle == null)
			{
				charStatsStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 20,
					alignment = (TextAnchor)3,
					fontStyle = (FontStyle)1
				};
				charStatsStyle.normal.textColor = Color.white;
			}
			if ((Object)(object)darkTexture == (Object)null)
			{
				darkTexture = new Texture2D(1, 1);
				darkTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.75f));
				darkTexture.Apply();
			}
			string text = NormalizeCharName(CurrentSelectedCharacter);
			if (text == "Unknown")
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedMaster != (Object)null && (Object)(object)firstLocalUser.cachedMaster.bodyPrefab != (Object)null)
				{
					text = NormalizeCharName(((Object)firstLocalUser.cachedMaster.bodyPrefab).name);
				}
			}
			if (!this.charStats.ContainsKey(text))
			{
				this.charStats[text] = new CharStats();
			}
			CharStats charStats = this.charStats[text];
			float num = ((charStats.Wins + charStats.Losses > 0) ? ((float)charStats.Wins / (float)(charStats.Wins + charStats.Losses) * 100f) : 0f);
			float num2 = 170f;
			bool flag = profile.DoublePTSBuffCount > 0;
			bool flag2 = profile.StreakShieldBuffCount > 0;
			if (flag)
			{
				num2 += 30f;
			}
			if (flag2)
			{
				num2 += 30f;
			}
			if (flag || flag2)
			{
				num2 += 10f;
			}
			int pTS = profile.PTS;
			bool flag3 = false;
			bool flag4 = false;
			int num3 = 0;
			if (NetworkUser.readOnlyInstancesList != null)
			{
				foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
				{
					if ((Object)(object)readOnlyInstances == (Object)null || ((NetworkBehaviour)readOnlyInstances).isLocalPlayer)
					{
						continue;
					}
					MMRNetworkComponent component = ((Component)readOnlyInstances).GetComponent<MMRNetworkComponent>();
					if ((Object)(object)component != (Object)null)
					{
						num3++;
						if (pTS > component.PTS)
						{
							flag3 = true;
						}
						if (pTS < component.PTS)
						{
							flag4 = true;
						}
					}
				}
			}
			if (num3 > 0)
			{
				num2 += 25f;
			}
			float num4 = 340f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(charStatsPosX.Value, charStatsPosY.Value, num4, num2);
			GUI.DrawTexture(val, (Texture)(object)darkTexture);
			GUIStyle val2 = new GUIStyle(charStatsStyle)
			{
				fontSize = 22,
				alignment = (TextAnchor)4
			};
			val2.normal.textColor = Color.yellow;
			val2.wordWrap = true;
			GUIStyle val3 = val2;
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 5f, ((Rect)(ref val)).width - 20f, 40f), text, val3);
			charStatsStyle.fontSize = 18;
			charStatsStyle.normal.textColor = Color.white;
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 55f, ((Rect)(ref val)).width - 20f, 25f), string.Format("{0}: {1}", Lang.T("Wins"), charStats.Wins), charStatsStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 80f, ((Rect)(ref val)).width - 20f, 25f), string.Format("{0}: {1}", Lang.T("Losses"), charStats.Losses), charStatsStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 105f, ((Rect)(ref val)).width - 20f, 25f), string.Format("{0}: {1:F1}%", Lang.T("Winrate"), num), charStatsStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 130f, ((Rect)(ref val)).width - 20f, 25f), $"PTS: {charStats.PtsEarned}", charStatsStyle);
			if (num3 > 0)
			{
				GUIStyle val4 = new GUIStyle(charStatsStyle)
				{
					fontSize = 14,
					alignment = (TextAnchor)4
				};
				if (flag3 && !flag4)
				{
					val4.normal.textColor = Color.green;
					GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 160f, ((Rect)(ref val)).width - 20f, 25f), (Lang.CurrentLang == 0) ? "Вы сильнее всех в лобби!" : ((Lang.CurrentLang == 1) ? "You are stronger than everyone!" : "你是大厅里最强的!"), val4);
				}
				else if (flag4 && !flag3)
				{
					val4.normal.textColor = Color.red;
					GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 160f, ((Rect)(ref val)).width - 20f, 25f), (Lang.CurrentLang == 0) ? "Вы слабее в лобби!" : ((Lang.CurrentLang == 1) ? "You are weaker in lobby!" : "你是大厅里最弱的!"), val4);
				}
				else
				{
					val4.normal.textColor = Color.yellow;
					GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 160f, ((Rect)(ref val)).width - 20f, 25f), (Lang.CurrentLang == 0) ? "Ваш ранг средний." : ((Lang.CurrentLang == 1) ? "Your rank is average." : "你的段位是平均水平。"), val4);
				}
			}
			GUIStyle val5 = new GUIStyle(GUI.skin.button)
			{
				fontSize = 14,
				alignment = (TextAnchor)4
			};
			val5.normal.background = darkTexture;
			val5.normal.textColor = Color.white;
			float num5 = ((Rect)(ref val)).y + (float)((num3 > 0) ? 185 : 160);
			if (flag)
			{
				if (profile.IsDoublePTSActive)
				{
					val5.normal.textColor = Color.green;
					GUI.Label(new Rect(((Rect)(ref val)).x + 10f, num5, ((Rect)(ref val)).width - 20f, 25f), Lang.T("DoublePTS") + ": " + Lang.T("Active"), val5);
				}
				else
				{
					val5.normal.textColor = Color.yellow;
					if (GUI.Button(new Rect(((Rect)(ref val)).x + 10f, num5, ((Rect)(ref val)).width - 20f, 25f), string.Format("{0} {1} ({2})", Lang.T("Activate"), Lang.T("DoublePTS"), profile.DoublePTSBuffCount), val5))
					{
						profile.SetDoublePTSActive(active: true);
						ShowMessage((Lang.CurrentLang == 0) ? "Жетон двойного PTS активирован!" : ((Lang.CurrentLang == 1) ? "Double PTS activated!" : "双倍PTS已激活!"));
					}
				}
				num5 += 30f;
			}
			if (!flag2)
			{
				return;
			}
			if (profile.IsStreakShieldActive)
			{
				val5.normal.textColor = Color.green;
				GUI.Label(new Rect(((Rect)(ref val)).x + 10f, num5, ((Rect)(ref val)).width - 20f, 25f), Lang.T("StreakShield") + ": " + Lang.T("Active"), val5);
				return;
			}
			val5.normal.textColor = Color.cyan;
			if (GUI.Button(new Rect(((Rect)(ref val)).x + 10f, num5, ((Rect)(ref val)).width - 20f, 25f), string.Format("{0} {1} ({2})", Lang.T("Activate"), Lang.T("StreakShield"), profile.StreakShieldBuffCount), val5))
			{
				profile.SetStreakShieldActive(active: true);
				ShowMessage((Lang.CurrentLang == 0) ? "Жетон парирования активирован!" : ((Lang.CurrentLang == 1) ? "Streak Shield activated!" : "连胜护盾已激活!"));
			}
		}

		private void DrawTabHud()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0075: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_0135: Expected O, but got Unknown
			//IL_0150: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00d3: Expected O, but got Unknown
			//IL_00de: 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_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: 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_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Expected O, but got Unknown
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Expected O, but got Unknown
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			bool key = Input.GetKey((KeyCode)9);
			bool flag = Time.timeScale == 0f && (Object)(object)Run.instance != (Object)null;
			if (!key && !flag)
			{
				return;
			}
			if ((Object)(object)tabBgTexture == (Object)null)
			{
				tabBgTexture = new Texture2D(1, 1);
				tabBgTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.65f));
				tabBgTexture.Apply();
			}
			if (tabStyle == null)
			{
				tabStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					alignment = (TextAnchor)3,
					fontStyle = (FontStyle)1,
					wordWrap = false
				};
				tabStyle.normal.textColor = Color.white;
			}
			float num = 360f;
			float num2 = 150f;
			float num3 = (float)Screen.width - num - 20f;
			GUIStyle val = new GUIStyle(tabStyle)
			{
				fontSize = 16
			};
			val.normal.textColor = Color.yellow;
			val.alignment = (TextAnchor)4;
			GUIStyle val2 = val;
			GUI.DrawTexture(new Rect(num3 - 10f, num2 - 10f, num + 20f, 30f), (Texture)(object)tabBgTexture);
			GUI.Label(new Rect(num3, num2 - 5f, num, 20f), (Lang.CurrentLang == 0) ? "Игроки в лобби (MMR)" : ((Lang.CurrentLang == 1) ? "Players in Lobby (MMR)" : "大厅玩家 (MMR)"), val2);
			num2 += 30f;
			if (NetworkUser.readOnlyInstancesList == null)
			{
				return;
			}
			foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
			{
				if ((Object)(object)readOnlyInstances == (Object)null)
				{
					continue;
				}
				MMRNetworkComponent component = ((Component)readOnlyInstances).GetComponent<MMRNetworkComponent>();
				string text = readOnlyInstances.userName ?? "Unknown";
				if ((Object)(object)component != (Object)null)
				{
					Color white = Color.white;
					if (component.PTS > 5000)
					{
						((Color)(ref white))..ctor(1f, 0.2f, 0.4f);
					}
					else if (component.PTS > 4000)
					{
						((Color)(ref white))..ctor(1f, 0.8f, 0.2f);
					}
					else if (component.PTS > 3000)
					{
						((Color)(ref white))..ctor(0.3f, 1f, 0.3f);
					}
					else if (component.PTS > 2100)
					{
						((Color)(ref white))..ctor(0.7f, 0.5f, 1f);
					}
					else if (component.PTS > 1300)
					{
						((Color)(ref white))..ctor(0.3f, 0.8f, 1f);
					}
					else
					{
						((Color)(ref white))..ctor(1f, 0.35f, 0.35f);
					}
					GUI.DrawTexture(new Rect(num3 - 10f, num2 - 2f, num + 20f, 45f), (Texture)(object)tabBgTexture);
					GUIStyle val3 = new GUIStyle(tabStyle);
					val3.normal.textColor = Color.white;
					GUIStyle val4 = val3;
					GUI.Label(new Rect(num3, num2, 200f, 20f), text, val4);
					GUIStyle val5 = new GUIStyle(tabStyle)
					{
						alignment = (TextAnchor)5
					};
					val5.normal.textColor = Color.gray;
					GUIStyle val6 = val5;
					GUI.Label(new Rect(num3 + 200f, num2, 140f, 20f), string.Format("{0}: {1:F0}%", Lang.T("Winrate"), component.WinRate), val6);
					GUIStyle val7 = new GUIStyle(tabStyle);
					val7.normal.textColor = white;
					GUIStyle val8 = val7;
					GUI.Label(new Rect(num3, num2 + 20f, 200f, 20f), component.RankName, val8);
					string text2 = (component.IsCalibrating ? string.Format("{0}: {1}", (component.CalibrationGamesLeft > 0) ? Lang.T("Calibration") : "", component.CalibrationGamesLeft) : $"{component.PTS} PTS");
					GUIStyle val9 = new GUIStyle(tabStyle)
					{
						alignment = (TextAnchor)5
					};
					val9.normal.textColor = Color.white;
					GUIStyle val10 = val9;
					GUI.Label(new Rect(num3 + 200f, num2 + 20f, 140f, 20f), text2, val10);
					num2 += 45f;
				}
			}
		}

		private void DrawInGameHud()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0104: 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_00e2: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Expected O, but got Unknown
			//IL_01f3: 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_020d: Expected O, but got Unknown
			//IL_0208: 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_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0640: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0821: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0937: 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_0959: Unknown result type (might be due to invalid IL or missing references)
			//IL_0974: Unknown result type (might be due to invalid IL or missing references)
			//IL_0904: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_0916: Unknown result type (might be due to invalid IL or missing references)
			//IL_090f: Unknown result type (might be due to invalid IL or missing references)
			//IL_092c: Unknown result type (might be due to invalid IL or missing references)
			if (hudStyle == null)
			{
				hudStyle = new GUIStyle(GUI.skin.label)
				{
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				hudStyle.normal.textColor = Color.white;
			}
			if (outlineStyle == null)
			{
				outlineStyle = new GUIStyle(hudStyle);
			}
			float value = hudFontSize.Value;
			float num = ((profile.IsCalibrating && calibrationFontSizeOverride.Value > 0f) ? calibrationFontSizeOverride.Value : value);
			hudStyle.fontSize = (int)num;
			outlineStyle.fontSize = (int)num;
			if ((Object)(object)hudDarkTexture == (Object)null)
			{
				hudDarkTexture = new Texture2D(1, 1);
			}
			hudDarkTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, hudBackgroundOpacity.Value));
			hudDarkTexture.Apply();
			string item = GetRankInfo(profile.PTS, profile.IsCalibrating).medalKey;
			string text = (profile.IsCalibrating ? string.Format("{0}: {1}", profile.HasCalibratedBefore ? Lang.T("Recalibration") : Lang.T("Calibration"), profile.CalibrationGamesLeft) : $"PTS: {profile.PTS}");
			string text2 = string.Format("{0}: {1}", Lang.T("Streak"), profile.Streak);
			float num2 = 8f;
			float value2 = hudMiniMedalSize.Value;
			GUIStyle val = new GUIStyle(hudStyle);
			float x = val.CalcSize(new GUIContent(text)).x;
			float x2 = val.CalcSize(new GUIContent(text2)).x;
			float num3 = Math.Max(Math.Max(x, x2), 150f);
			float num4 = (profile.IsCalibrating ? calibrationExtraWidth.Value : 0f);
			float num5 = num2 + value2 + 10f + num3 + num2 + num4;
			float num6 = Math.Max(value2, num * 2f + 4f) + num2 * 2f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(hudPosX.Value, hudPosY.Value, num5, num6);
			GUI.DrawTexture(val2, (Texture)(object)hudDarkTexture);
			if (profile.EquippedFrame != "None" && profile.EquippedFrame != "" && frameTextures.ContainsKey(profile.EquippedFrame))
			{
				float num7 = 194f;
				float num8 = 201f;
				float num9 = -19f;
				float num10 = -11f;
				if (profile.EquippedFrame == "frame_green")
				{
					num7 = 194.22f;
					num8 = 200.66f;
					num9 = -20f;
					num10 = -10.67f;
				}
				else if (profile.EquippedFrame == "frame_rainbow")
				{
					num7 = 194f;
					num8 = 201f;
					num9 = -19f;
					num10 = -11f;
				}
				else if (profile.EquippedFrame == "frame_red")
				{
					num7 = 194f;
					num8 = 201f;
					num9 = -19.24f;
					num10 = -11f;
				}
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(((Rect)(ref val2)).x + num2 + value2 + num9, ((Rect)(ref val2)).y + (((Rect)(ref val2)).height - num8) / 2f + num10, num7, num8);
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, frameOpacity.Value);
				GUI.DrawTexture(val3, (Texture)(object)frameTextures[profile.EquippedFrame], (ScaleMode)0);
				GUI.color = color;
			}
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(((Rect)(ref val2)).x + num2, ((Rect)(ref val2)).y + (((Rect)(ref val2)).height - value2) / 2f, value2, value2);
			if (medalTextures.ContainsKey(item) && (Object)(object)medalTextures[item] != (Object)null)
			{
				GUI.DrawTexture(val4, (Texture)(object)medalTextures[item], (ScaleMode)2);
			}
			float num11 = ((Rect)(ref val4)).x + ((Rect)(ref val4)).width + 10f;
			float num12 = ((Rect)(ref val2)).y + (((Rect)(ref val2)).height - (num * 2f + 4f)) / 2f;
			if (profile.EquippedFrame == "frame_green")
			{
				num11 += 15f;
				num12 += -1f;
			}
			else if (profile.EquippedFrame == "frame_rainbow")
			{
				num11 += 14f;
				num12 += -2f;
			}
			else if (profile.EquippedFrame == "frame_red")
			{
				num11 += 13f;
				num12 += -5f;
			}
			else if (profile.EquippedFrame == "frame_purple")
			{
				num11 += 15f;
				num12 += -1f;
			}
			if (profile.IsCalibrating)
			{
				num11 += calibrationTextOffsetX.Value;
				num12 += calibrationTextOffsetY.Value;
			}
			Rect val5 = default(Rect);
			((Rect)(ref val5))..ctor(num11, num12, num3, (float)((int)num + 4));
			Rect val6 = default(Rect);
			((Rect)(ref val6))..ctor(num11, num12 + (float)(int)num + 4f, num3, (float)((int)num + 4));
			Color textColor = hudStyle.normal.textColor;
			Color val7 = Color.white;
			if (profile.EquippedFrame == "frame_green")
			{
				((Color)(ref val7))..ctor(0.2f, 1f, 0.2f);
			}
			else if (profile.EquippedFrame == "frame_purple")
			{
				((Color)(ref val7))..ctor(0.8f, 0.2f, 1f);
			}
			else if (profile.EquippedFrame == "frame_red")
			{
				((Color)(ref val7))..ctor(1f, 0.2f, 0.2f);
			}
			else if (profile.EquippedFrame == "frame_rainbow")
			{
				val7 = Color.Lerp(Color.red, Color.blue, Mathf.PingPong(Time.time, 1f));
			}
			outlineStyle.normal.textColor = Color.black;
			GUI.Label(new Rect(((Rect)(ref val5)).x - 2f, ((Rect)(ref val5)).y, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height), text, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val5)).x + 2f, ((Rect)(ref val5)).y, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height), text, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y - 2f, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height), text, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y + 2f, ((Rect)(ref val5)).width, ((Rect)(ref val5)).height), text, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val6)).x - 2f, ((Rect)(ref val6)).y, ((Rect)(ref val6)).width, ((Rect)(ref val6)).height), text2, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val6)).x + 2f, ((Rect)(ref val6)).y, ((Rect)(ref val6)).width, ((Rect)(ref val6)).height), text2, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val6)).x, ((Rect)(ref val6)).y - 2f, ((Rect)(ref val6)).width, ((Rect)(ref val6)).height), text2, outlineStyle);
			GUI.Label(new Rect(((Rect)(ref val6)).x, ((Rect)(ref val6)).y + 2f, ((Rect)(ref val6)).width, ((Rect)(ref val6)).height), text2, outlineStyle);
			hudStyle.normal.textColor = val7;
			if (ptsPulseTimer > 0f)
			{
				hudStyle.normal.textColor = Color.Lerp(val7, (lastPTSChange > 0) ? Color.green : Color.red, Mathf.Sin(ptsPulseTimer * 10f));
			}
			GUI.Label(val5, text, hudStyle);
			hudStyle.normal.textColor = val7;
			GUI.Label(val6, text2, hudStyle);
			hudStyle.normal.textColor = textColor;
		}

		private void DrawMainMenuPanel()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003d: 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_0075: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00e5: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01c3: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Expected O, but got Unknown
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Expected O, but got Unknown
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0914: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Expected O, but got Unknown
			//IL_0a07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a60: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)darkTexture == (Object)null)
			{
				darkTexture = new Texture2D(1, 1);
				darkTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.75f));
				darkTexture.Apply();
			}
			if ((Object)(object)hoverTexture == (Object)null)
			{
				hoverTexture = new Texture2D(1, 1);
				hoverTexture.SetPixel(0, 0, new Color(0.2f, 0.2f, 0.2f, 0.85f));
				hoverTexture.Apply();
			}
			if ((Object)(object)progressBarBgTexture == (Object)null)
			{
				progressBarBgTexture = new Texture2D(1, 1);
				progressBarBgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.9f));
				progressBarBgTexture.Apply();
			}
			if (rankStyle == null)
			{
				rankStyle = new GUIStyle(GUI.skin.button)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
				rankStyle.normal.background = darkTexture;
				rankStyle.hover.background = hoverTexture;
				rankStyle.active.background = hoverTexture;
				rankStyle.border = new RectOffset(0, 0, 0, 0);
				rankStyle.padding = new RectOffset(0, 0, 0, 0);
			}
			if (streakStyle == null)
			{
				streakStyle = new GUIStyle(GUI.skin.button)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
				streakStyle.normal.background = darkTexture;
				streakStyle.hover.background = hoverTexture;
				streakStyle.active.background = hoverTexture;
				streakStyle.border = new RectOffset(0, 0, 0, 0);
				streakStyle.padding = new RectOffset(0, 0, 0, 0);
				streakStyle.normal.textColor = Color.white;
			}
			if (ptsStyle == null)
			{
				ptsStyle = new GUIStyle(GUI.skin.button)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				};
				ptsStyle.normal.background = darkTexture;
				ptsStyle.hover.background = hoverTexture;
				ptsStyle.active.background = hoverTexture;
				ptsStyle.border = new RectOffset(0, 0, 0, 0);
				ptsStyle.padding = new RectOffset(0, 0, 0, 0);
				ptsStyle.normal.textColor = Color.white;
			}
			if (shopStyle == null)
			{
				shopStyle = new GUIStyle(GUI.skin.button)
				{
					fontStyle = (FontStyle)1,
					fontSize = 20
				};
				shopStyle.normal.background = darkTexture;
				shopStyle.hover.background = hoverTexture;
				shopStyle.active.background = hoverTexture;
				shopStyle.normal.textColor = Color.yellow;
				shopStyle.border = new RectOffset(0, 0, 0, 0);
			}
			rankStyle.fontSize = (int)fontSize.Value;
			streakStyle.fontSize = (int)fontSize.Value;
			ptsStyle.fontSize = (int)fontSize.Value;
			var (key, text, val) = GetRankInfo(profile.PTS, profile.IsCalibrating);
			rankStyle.normal.textColor = val;
			string text2 = (profile.IsCalibrating ? string.Format("{0}: {1}", profile.HasCalibratedBefore ? Lang.T("Recalibration") : Lang.T("Calibration"), profile.CalibrationGamesLeft) : $"PTS: {Mathf.RoundToInt(staticPtsDisplay)}");
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(posX.Value, posY.Value, boxWidth.Value, boxHeight.Value);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, 35f);
			if (GUI.Button(val3, Lang.T("Donate"), shopStyle))
			{
				Application.OpenURL("https://www.donationalerts.com/r/blowkiss");
			}
			float num = 55f;
			float num2 = (boxHeight.Value - medalSize.Value - num - 20f - 80f) / 3f;
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(((Rect)(ref val2)).x + (((Rect)(ref val2)).width - medalSize.Value) / 2f, ((Rect)(ref val2)).y + num, medalSize.Value, medalSize.Value);
			GUI.DrawTexture(val4, (Texture)(object)darkTexture);
			if (medalTextures.ContainsKey(key) && (Object)(object)medalTextures[key] != (Object)null)
			{
				GUI.DrawTexture(val4, (Texture)(object)medalTextures[key], (ScaleMode)2);
			}
			var (num3, num4) = GetRankBounds(profile.PTS, profile.IsCalibrating);
			if (num4 > num3)
			{
				float num5 = Mathf.Clamp01((float)(profile.PTS - num3) / (float)(num4 - num3));
				Rect val5 = default(Rect);
				((Rect)(ref val5))..ctor(((Rect)(ref val4)).x, ((Rect)(ref val4)).y + ((Rect)(ref val4)).height + 5f, medalSize.Value, 8f);
				GUI.DrawTexture(val5, (Texture)(object)progressBarBgTexture);
				if ((Object)(object)progressBarFillTexture == (Object)null)
				{
					progressBarFillTexture = new Texture2D(1, 1);
				}
				progressBarFillTexture.SetPixel(0, 0, val);
				progressBarFillTexture.Apply();
				GUI.DrawTexture(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y, ((Rect)(ref val5)).width * num5, ((Rect)(ref val5)).height), (Texture)(object)progressBarFillTexture);
			}
			float num6 = ((Rect)(ref val4)).y + ((Rect)(ref val4)).height + 20f;
			Rect val6 = default(Rect);
			((Rect)(ref val6))..ctor(((Rect)(ref val2)).x, num6, ((Rect)(ref val2)).width, num2);
			Rect val7 = default(Rect);
			((Rect)(ref val7))..ctor(((Rect)(ref val2)).x, num6 + num2, ((Rect)(ref val2)).width, num2);
			Rect val8 = default(Rect);
			((Rect)(ref val8))..ctor(((Rect)(ref val2)).x, num6 + num2 * 2f, ((Rect)(ref val2)).width, num2);
			if (GUI.Button(val6, text, rankStyle))
			{
				if (profile.IsCalibrating)
				{
					ShowMessage((Lang.CurrentLang == 0) ? "Калибровка уже начата." : ((Lang.CurrentLang == 1) ? "Calibration already started." : "定级赛已开始。"));
				}
				else if (profile.GamesPlayedAfterCalibration < 50)
				{
					ShowMessage((Lang.CurrentLang == 0) ? $"Нужно сыграть еще {50 - profile.GamesPlayedAfterCalibration} игр." : ((Lang.CurrentLang == 1) ? $"Play {50 - profile.GamesPlayedAfterCalibration} more games." : $"还需进行 {50 - profile.GamesPlayedAfterCalibration} 场比赛。"));
				}
				else if (!awaitingConfirmation)
				{
					ShowMessage((Lang.CurrentLang == 0) ? "Двойной клик для рекалибровки." : ((Lang.CurrentLang == 1) ? "Double click to recalibrate." : "双击以重新定级。"));
					awaitingConfirmation = true;
					lastClickTime = Time.time;
				}
				else if (Time.time - lastClickTime <= 0.4f)
				{
					ResetToCalibration();
					awaitingConfirmation = false;
				}
				else
				{
					lastClickTime = Time.time;
				}
			}
			GUI.Button(val7, string.Format("{0}: {1}", Lang.T("Streak"), profile.Streak), streakStyle);
			if (GUI.Button(val8, text2, ptsStyle))
			{
				awaitingConfirmation = false;
				string text3 = ((profile.DailyPTS > 0) ? $"+{profile.DailyPTS}" : $"{profile.DailyPTS}");
				string message = "<b>" + Lang.T("DailyPTSStats") + "</b>\nPTS: " + text3 + "\n\n<b>" + Lang.T("LastGameResult") + ":</b>\n" + lastGameStats;
				ShowMessage(message);
			}
			Rect val9 = default(Rect);
			((Rect)(ref val9))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + ((Rect)(ref val2)).height - 80f, ((Rect)(ref val2)).width, 35f);
			if (GUI.Button(val9, Lang.T("History"), shopStyle))
			{
				IsHistoryOpen = !IsHistoryOpen;
			}
			Rect val10 = default(Rect);
			((Rect)(ref val10))..ctor(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + ((Rect)(ref val2)).height - 40f, ((Rect)(ref val2)).width, 35f);
			if (GUI.Button(val10, Lang.T("Shop"), shopStyle))
			{
				IsShopOpen = !IsShopOpen;
			}
		}

		private void DrawHistoryMenu()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0084: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01b5: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: 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_0248: 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)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Expected O, but got Unknown
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shopBgTexture == (Object)null)
			{
				shopBgTexture = new Texture2D(1, 1);
				shopBgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.95f));
				shopBgTexture.Apply();
			}
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 30,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			val.normal.textColor = Color.yellow;
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				alignment = (TextAnchor)0,
				wordWrap = true
			};
			val2.normal.textColor = Color.white;
			string[] array = new string[0];
			if (File.Exists(historyPath))
			{
				try
				{
					array = File.ReadAllLines(historyPath);
				}
				catch
				{
				}
			}
			string text = ((Lang.CurrentLang == 0) ? "Файл истории пуст или не найден." : ((Lang.CurrentLang == 1) ? "History is empty." : "历史记录为空。"));
			int num = 1;
			historyPage = 0;
			if (array.Length != 0)
			{
				string[] array2 = array.Reverse().ToArray();
				num = (int)Math.Ceiling((double)array2.Length / 10.0);
				historyPage = Mathf.Clamp(historyPage, 0, num - 1);
				IEnumerable<string> values = array2.Skip(historyPage * 10).Take(10);
				text = string.Join("\n\n", values);
			}
			Vector2 val3 = val2.CalcSize(new GUIContent(text));
			Vector2 val4 = val.CalcSize(new GUIContent(Lang.T("History")));
			float num2 = Mathf.Max(400f, val3.x + 60f);
			float num3 = Mathf.Max(200f, val3.y + val4.y + 120f);
			Rect val5 = default(Rect);
			((Rect)(ref val5))..ctor(((float)Screen.width - num2) / 2f, ((float)Screen.height - num3) / 2f, num2, num3);
			GUI.DrawTexture(val5, (Texture)(object)shopBgTexture);
			GUI.Label(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y + 10f, ((Rect)(ref val5)).width, 50f), Lang.T("History"), val);
			GUI.Label(new Rect(((Rect)(ref val5)).x + 20f, ((Rect)(ref val5)).y + 70f, ((Rect)(ref val5)).width - 40f, ((Rect)(ref val5)).height - 140f), text, val2);
			if (array.Length != 0)
			{
				if (historyPage > 0 && GUI.Button(new Rect(((Rect)(ref val5)).x + 20f, ((Rect)(ref val5)).y + num3 - 50f, 100f, 30f), "<<", shopStyle))
				{
					historyPage--;
				}
				if (historyPage < num - 1 && GUI.Button(new Rect(((Rect)(ref val5)).x + num2 - 120f, ((Rect)(ref val5)).y + num3 - 50f, 100f, 30f), ">>", shopStyle))
				{
					historyPage++;
				}
				Rect val6 = new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y + num3 - 50f, num2, 30f);
				string text2 = $"{historyPage + 1} / {num}";
				GUIStyle val7 = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4
				};
				val7.normal.textColor = Color.white;
				GUI.Label(val6, text2, val7);
			}
			if (GUI.Button(new Rect(((Rect)(ref val5)).x + num2 - 50f, ((Rect)(ref val5)).y + 10f, 40f, 40f), "X"))
			{
				IsHistoryOpen = false;
				historyPage = 0;
			}
		}

		private void DrawShopMenu()
		{
			//IL_0086: 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_00a2: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00c2: 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_010d: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_012c: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003d: 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_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shopBgTexture == (Object)null)
			{
				shopBgTexture = new Texture2D(1, 1);
				shopBgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.95f));
				shopBgTexture.Apply();
			}
			float num = 500f;
			float num2 = 500f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2);
			GUI.DrawTexture(val, (Texture)(object)shopBgTexture);
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 30,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			val2.normal.textColor = Color.yellow;
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width, 50f), Lang.T("Shop"), val2);
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 20,
				alignment = (TextAnchor)5
			};
			val3.normal.textColor = Color.yellow;
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 60f, ((Rect)(ref val)).width - 20f, 30f), string.Format("{0}: {1}", Lang.T("Coins"), profile.Coins), val3);
			float num3 = ((Rect)(ref val)).y + 100f;
			if (GUI.Button(new Rect(((Rect)(ref val)).x + 20f, num3, ((Rect)(ref val)).width - 40f, 50f), Lang.T("Buy") + " " + Lang.T("DoublePTS") + " (100)", shopStyle))
			{
				if (profile.Coins >= 100)
				{
					profile.RemoveCoins(100);
					profile.AddDoublePTSBuff();
					Util.PlaySound("Play_UI_Coin", ((Component)this).gameObject);
					ShowMessage((Lang.CurrentLang == 0) ? "Куплен Двойной PTS!" : ((Lang.CurrentLang == 1) ? "Double PTS bought!" : "已购买双倍PTS!"));
				}
				else
				{
					ShowMessage(Lang.T("NoCoins"));
				}
			}
			num3 += 60f;
			if (GUI.Button(new Rect(((Rect)(ref val)).x + 20f, num3, ((Rect)(ref val)).width - 40f, 50f), Lang.T("Buy") + " " + Lang.T("StreakShield") + " (200)", shopStyle))
			{
				if (profile.Coins >= 200)
				{
					profile.RemoveCoins(200);
					profile.AddStreakShieldBuff();
					Util.PlaySound("Play_UI_Coin", ((Component)this).gameObject);
					ShowMessage((Lang.CurrentLang == 0) ? "Куплено Парирование стрика!" : ((Lang.CurrentLang == 1) ? "Streak Shield bought!" : "已购买连胜护盾!"));
				}
				else
				{
					ShowMessage(Lang.T("NoCoins"));
				}
			}
			num3 += 60f;
			Rect val4 = default(Rect);
			Rect val5 = default(Rect);
			foreach (KeyValuePair<string, int> shopFrame in shopFrames)
			{
				((Rect)(ref val4))..ctor(((Rect)(ref val)).x + 20f, num3, 50f, 50f);
				if (frameTextures.ContainsKey(shopFrame.Key))
				{
					GUI.DrawTexture(val4, (Texture)(object)frameTextures[shopFrame.Key], (ScaleMode)2);
				}
				else
				{
					GUI.DrawTexture(val4, (Texture)(object)darkTexture);
				}
				((Rect)(ref val5))..ctor(((Rect)(ref val)).x + 80f, num3, ((Rect)(ref val)).width - 100f, 50f);
				bool flag = profile.EquippedFrame == shopFrame.Key;
				bool flag2 = profile.IsFrameUnlocked(shopFrame.Key);
				string text = shopFrame.Key.Replace("frame_", "").ToUpper();
				string text2 = (flag ? (Lang.T("Equipped") + ": " + text) : (flag2 ? (Lang.T("Equip") + ": " + text) : string.Format("{0} {1} - {2}", Lang.T("Buy"), text, shopFrame.Value)));
				if (flag)
				{
					GUI.enabled = false;
				}
				if (GUI.Button(val5, text2, shopStyle))
				{
					if (flag2)
					{
						profile.SetFrame(shopFrame.Key);
						ShowMessage(Lang.T("Equipped") + ": " + text);
					}
					else if (profile.Coins >= shopFrame.Value)
					{
						profile.RemoveCoins(shopFrame.Value);
						profile.UnlockFrame(shopFrame.Key);
						profile.SetFrame(shopFrame.Key);
						Util.PlaySound("Play_UI_Coin", ((Component)this).gameObject);
						ShowMessage(