using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Sonigon;
using TMPro;
using TabInfo.Extensions;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Extensions;
using UnboundLib.GameModes;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ItemShops.Patches
{
[HarmonyPatch(typeof(EscapeMenuHandler))]
internal class EscMenu_Patch
{
[HarmonyPrefix]
[HarmonyPatch("ToggleEsc")]
private static bool CheckShopStatus()
{
bool isLockingInput = TabInfoManager.IsLockingInput;
if (isLockingInput)
{
TabFrame tabFrame = TabInfoManager.TabFrame;
((Component)TabInfoManager.TabFrame).gameObject.SetActive(false);
TabInfoManager.TabFrame.toggled = false;
}
return !isLockingInput;
}
}
}
namespace TabInfo
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.willuwontu.rounds.tabinfo", "Tab Info", "0.0.4")]
[BepInProcess("Rounds.exe")]
public class TabInfo : BaseUnityPlugin
{
public static class WaitFor
{
public static IEnumerator Frames(int frameCount)
{
if (frameCount <= 0)
{
throw new ArgumentOutOfRangeException("frameCount", "Cannot wait for less that 1 frame");
}
while (frameCount > 0)
{
frameCount--;
yield return null;
}
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__24_0;
public static UnityAction <>9__28_0;
public static Func<AudioClip, bool> <>9__28_3;
public static Func<AudioClip, bool> <>9__28_4;
internal void <NewGUI>b__24_0()
{
}
internal void <Start>b__28_0()
{
}
internal bool <Start>b__28_3(AudioClip clip)
{
return ((Object)clip).name.Contains("UI_Button_Click");
}
internal bool <Start>b__28_4(AudioClip clip)
{
return ((Object)clip).name.Contains("UI_Button_Hover");
}
}
private const string ModId = "com.willuwontu.rounds.tabinfo";
private const string ModName = "Tab Info";
public const string Version = "0.0.4";
public const string ModInitials = "TI";
public List<AudioClip> click;
public List<AudioClip> hover;
public List<SoundEvent> clickSounds = new List<SoundEvent>();
public List<SoundEvent> hoverSounds = new List<SoundEvent>();
private bool ready = false;
public static TabInfo instance { get; private set; }
public AssetBundle Assets { get; private set; }
private static void CycleArt()
{
ArtHandler.instance.NextArt();
ArtHandler.instance.NextArt();
}
internal static string ConfigKey(string name)
{
return "com.willuwontu.rounds.tabinfo_" + name.ToLower();
}
internal static bool GetBool(StatCategory category, bool defaultValue = true)
{
return PlayerPrefs.GetInt(ConfigKey(category.name), defaultValue ? 1 : 0) == 1;
}
internal static void SetBool(StatCategory category, bool value)
{
PlayerPrefs.SetInt(ConfigKey(category.name), value ? 1 : 0);
}
internal static bool GetBool(Stat stat, bool defaultValue = true)
{
return PlayerPrefs.GetInt(ConfigKey(stat.category.name + " " + stat.name), defaultValue ? 1 : 0) == 1;
}
internal static void SetBool(Stat stat, bool value)
{
PlayerPrefs.SetInt(ConfigKey(stat.category.name + " " + stat.name), value ? 1 : 0);
}
private IEnumerator SetupGUI(GameObject menu)
{
yield return (object)new WaitUntil((Func<bool>)(() => ready));
yield return (object)new WaitForSecondsRealtime(0.1f);
NewGUI(menu);
}
private void NewGUI(GameObject menu)
{
//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_00b3: Expected O, but got Unknown
TextMeshProUGUI val = default(TextMeshProUGUI);
MenuHandler.CreateText("Tab Info", menu, ref val, 90, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText("Categories", menu, ref val, 75, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 60, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
foreach (StatCategory value in TabInfoManager.Categories.Values)
{
string name = value.name;
object obj = <>c.<>9__24_0;
if (obj == null)
{
UnityAction val2 = delegate
{
};
<>c.<>9__24_0 = val2;
obj = (object)val2;
}
ModGUI(MenuHandler.CreateMenu(name, (UnityAction)obj, menu, 60, true, true, ((Component)menu.transform.parent).gameObject, true, -1), value);
}
}
private void ModGUI(GameObject menu, StatCategory category)
{
TextMeshProUGUI val = default(TextMeshProUGUI);
MenuHandler.CreateText(category.name.ToUpper(), menu, ref val, 90, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText("Toggle Category", menu, ref val, 60, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateToggle(GetBool(category), category.name ?? "", menu, (UnityAction<bool>)ChangeCategoryToggleValue, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText("Toggle Stats ", menu, ref val, 60, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
foreach (Stat value in category.Stats.Values)
{
ModGUI(menu, value);
}
void ChangeCategoryToggleValue(bool value)
{
SetBool(category, value);
CycleArt();
}
}
private void ModGUI(GameObject menu, Stat stat)
{
MenuHandler.CreateToggle(GetBool(stat), stat.category.name + " " + stat.name, menu, (UnityAction<bool>)ChangeStatToggleValue, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
void ChangeStatToggleValue(bool value)
{
SetBool(stat, value);
CycleArt();
}
}
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("com.willuwontu.rounds.tabinfo");
val.PatchAll();
}
private void Start()
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Expected O, but got Unknown
//IL_049b: Unknown result type (might be due to invalid IL or missing references)
//IL_04a5: Expected O, but got Unknown
Unbound.RegisterClientSideMod("com.willuwontu.rounds.tabinfo");
Unbound.RegisterCredits("Tab Info", new string[1] { "willuwontu" }, new string[2] { "github", "Ko-Fi" }, new string[2] { "https://github.com/willuwontu/wills-wacky-cards", "https://ko-fi.com/willuwontu" });
object obj = <>c.<>9__28_0;
if (obj == null)
{
UnityAction val = delegate
{
};
<>c.<>9__28_0 = val;
obj = (object)val;
}
Unbound.RegisterMenu("Tab Info", (UnityAction)obj, (Action<GameObject>)delegate(GameObject menu)
{
((MonoBehaviour)Unbound.Instance).StartCoroutine(SetupGUI(menu));
}, (GameObject)null, false);
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 60, (Action)delegate
{
ready = true;
});
instance = this;
Assets = AssetUtils.LoadAssetBundleFromResources("tabinfo", typeof(TabInfo).Assembly);
click = (from clip in Assets.LoadAllAssets<AudioClip>().ToList()
where ((Object)clip).name.Contains("UI_Button_Click")
select clip).ToList();
hover = (from clip in Assets.LoadAllAssets<AudioClip>().ToList()
where ((Object)clip).name.Contains("UI_Button_Hover")
select clip).ToList();
try
{
foreach (AudioClip item in click)
{
SoundContainer val2 = ScriptableObject.CreateInstance<SoundContainer>();
val2.setting.volumeIntensityEnable = true;
val2.setting.volumeDecibel = 10f;
val2.audioClip[0] = item;
SoundEvent val3 = ScriptableObject.CreateInstance<SoundEvent>();
val3.soundContainerArray[0] = val2;
clickSounds.Add(val3);
}
foreach (AudioClip item2 in hover)
{
SoundContainer val4 = ScriptableObject.CreateInstance<SoundContainer>();
val4.setting.volumeIntensityEnable = true;
val4.setting.volumeDecibel = 10f;
val4.audioClip[0] = item2;
SoundEvent val5 = ScriptableObject.CreateInstance<SoundEvent>();
val5.soundContainerArray[0] = val4;
hoverSounds.Add(val5);
}
}
catch (Exception ex)
{
Debug.LogException(ex);
}
TabInfoManager.canvas = Object.Instantiate<GameObject>(instance.Assets.LoadAsset<GameObject>("Info Canvas"));
RectTransform component = TabInfoManager.canvas.GetComponent<RectTransform>();
((Transform)component).localScale = Vector3.one;
TabInfoManager.canvas.GetComponent<Canvas>().worldCamera = Camera.current;
Object.DontDestroyOnLoad((Object)(object)TabInfoManager.canvas);
TabInfoManager.canvas.AddComponent<TabListener>();
TabInfoManager.tabFrameTemplate = instance.Assets.LoadAsset<GameObject>("Info Container");
TabInfoManager.teamFrameTemplate = instance.Assets.LoadAsset<GameObject>("Team Frame");
TabInfoManager.playerFrameTemplate = instance.Assets.LoadAsset<GameObject>("Player Frame");
TabInfoManager.cardButtonTemplate = instance.Assets.LoadAsset<GameObject>("Card Button");
TabInfoManager.statSectionTemplate = instance.Assets.LoadAsset<GameObject>("Stat Section");
TabInfoManager.statObjectTemplate = instance.Assets.LoadAsset<GameObject>("Stat Object");
TabInfoManager.cardHolderTemplate = instance.Assets.LoadAsset<GameObject>("Card Holder");
TabFrame tabFrame = TabInfoManager.TabFrame;
GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)GameEnd);
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)BattleStart);
GameModeManager.AddHook("PlayerPickStart", (Func<IGameModeHandler, IEnumerator>)PlayerPickStart);
GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)PlayerPickEnd);
GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)PointStart);
GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)PickStart);
GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)PickEnd);
GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)RoundStart);
GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)RoundEnd);
NetworkEventCallbacks val6 = ((Component)this).gameObject.AddComponent<NetworkEventCallbacks>();
val6.OnJoinedRoomEvent += new NetworkEvent(OnJoinedRoomAction);
val6.OnLeftRoomEvent += new NetworkEvent(OnLeftRoomAction);
}
private void OnJoinedRoomAction()
{
}
private void OnLeftRoomAction()
{
TabFrame tabFrame = TabInfoManager.TabFrame;
TabInfoManager.TabFrame.toggled = false;
((Component)TabInfoManager.TabFrame).gameObject.SetActive(TabInfoManager.TabFrame.toggled);
}
private IEnumerator RoundStart(IGameModeHandler gm)
{
TabInfoManager.CurrentRound++;
TabInfoManager.CurrentPoint = 0;
yield break;
}
private IEnumerator RoundEnd(IGameModeHandler gm)
{
yield break;
}
private IEnumerator PointStart(IGameModeHandler gm)
{
TabInfoManager.CurrentPoint++;
yield break;
}
private IEnumerator PointEnd(IGameModeHandler gm)
{
yield break;
}
private IEnumerator PlayerPickStart(IGameModeHandler gm)
{
yield break;
}
private IEnumerator PlayerPickEnd(IGameModeHandler gm)
{
yield break;
}
private IEnumerator PickStart(IGameModeHandler gm)
{
yield break;
}
private IEnumerator PickEnd(IGameModeHandler gm)
{
yield break;
}
private IEnumerator BattleStart(IGameModeHandler gm)
{
yield break;
}
private IEnumerator GameStart(IGameModeHandler gm)
{
_ = TabInfoManager.TabFrame;
TabInfoManager.TabFrame.toggled = false;
((Component)TabInfoManager.TabFrame).gameObject.SetActive(TabInfoManager.TabFrame.toggled);
TabInfoManager.CurrentRound = 0;
TabInfoManager.CurrentPoint = 0;
yield break;
}
private IEnumerator GameEnd(IGameModeHandler gm)
{
yield break;
}
private void DestroyAll<T>() where T : Object
{
T[] array = Object.FindObjectsOfType<T>();
for (int num = array.Length - 1; num >= 0; num--)
{
Debug.Log((object)$"Attempting to Destroy {((object)array[num]).GetType().Name} number {num}");
Object.Destroy((Object)(object)array[num]);
}
}
}
}
namespace TabInfo.Utils
{
public class ColorManager
{
public static float RelativeLuminance(Color color)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
float num = ColorPartValue(color.r);
float num2 = ColorPartValue(color.g);
float num3 = ColorPartValue(color.b);
return 0.2126f * num + 0.7152f * num2 + 0.0722f * num3;
static float ColorPartValue(float part)
{
return (part <= 0.03928f) ? (part / 12.92f) : Mathf.Pow((part + 0.055f) / 1.055f, 2.4f);
}
}
public static float ColorContrast(Color a, Color b)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
float num2 = RelativeLuminance(a) + 0.05f;
float num3 = RelativeLuminance(b) + 0.05f;
return Mathf.Max(num2, num3) / Mathf.Min(num2, num3);
}
public static Color[] GetContrastingColors(Color backgroundColor, Color textColor, float ratio)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: 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_0120: Unknown result type (might be due to invalid IL or missing references)
Color[] array = (Color[])(object)new Color[2];
float num = RelativeLuminance(backgroundColor);
float num2 = RelativeLuminance(textColor);
if (num2 > num)
{
array[0] = textColor;
array[1] = backgroundColor;
}
else
{
array[1] = textColor;
array[0] = backgroundColor;
}
if (!(ColorContrast(backgroundColor, textColor) < ratio))
{
return array;
}
float num3 = default(float);
float num4 = default(float);
float num5 = default(float);
Color.RGBToHSV(array[0], ref num3, ref num4, ref num5);
float num6 = default(float);
float num7 = default(float);
float num8 = default(float);
Color.RGBToHSV(array[1], ref num6, ref num7, ref num8);
if (ColorContrast(Color.HSVToRGB(num6, num7, 0f), Color.HSVToRGB(num3, num4, 1f)) >= ratio)
{
float num9 = 1f - num5;
float num10 = num8;
float[] array2 = new float[9] { 0.12f, 0.1f, 0.08f, 0.05f, 0.04f, 0.03f, 0.02f, 0.01f, 0.005f };
int i = 0;
float num11 = num9 / (num9 + num10);
float num12 = num10 / (num9 + num10);
while (ColorContrast(Color.HSVToRGB(num3, num4, num5), Color.HSVToRGB(num6, num7, num8)) < ratio)
{
for (; ColorContrast(Color.HSVToRGB(num3, num4, num5 + num11 * array2[i]), Color.HSVToRGB(num6, num7, num8 - num12 * array2[i])) > ratio && i < array2.Length - 1; i++)
{
}
num5 += num11 * array2[i];
num8 -= num12 * array2[i];
}
array[0] = Color.HSVToRGB(num3, num4, num5);
array[1] = Color.HSVToRGB(num6, num7, num8);
}
else
{
array[0] = Color.white;
while (ColorContrast(Color.white, Color.HSVToRGB(num6, num7, num8)) < ratio)
{
num8 -= 0.01f;
}
array[1] = Color.HSVToRGB(num6, num7, num8);
}
return array;
}
}
public class PlayerCardBar : MonoBehaviour
{
public PlayerFrame playerFrame;
private Dictionary<int, PlayerCardButton> cardButtons = new Dictionary<int, PlayerCardButton>();
private void Start()
{
for (int i = 0; i < playerFrame.player.data.currentCards.Count(); i++)
{
CardInfo card = playerFrame.player.data.currentCards[i];
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.cardButtonTemplate, ((Component)this).transform);
PlayerCardButton playerCardButton = val.AddComponent<PlayerCardButton>();
playerCardButton.card = card;
playerCardButton.cardBar = this;
((TMP_Text)playerCardButton.Text).text = playerCardButton.CardInitials(card);
cardButtons.Add(i, playerCardButton);
}
}
private void Update()
{
if (cardButtons.Count() < playerFrame.player.data.currentCards.Count())
{
for (int i = cardButtons.Count(); i < playerFrame.player.data.currentCards.Count(); i++)
{
CardInfo card = playerFrame.player.data.currentCards[i];
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.cardButtonTemplate, ((Component)this).transform);
PlayerCardButton playerCardButton = val.AddComponent<PlayerCardButton>();
playerCardButton.card = card;
playerCardButton.cardBar = this;
((TMP_Text)playerCardButton.Text).text = playerCardButton.CardInitials(card);
cardButtons.Add(i, playerCardButton);
}
}
else if (cardButtons.Count() > playerFrame.player.data.currentCards.Count())
{
for (int num = cardButtons.Count(); num >= playerFrame.player.data.currentCards.Count(); num--)
{
PlayerCardButton playerCardButton2 = cardButtons[num];
Object.Destroy((Object)(object)((Component)playerCardButton2).gameObject);
cardButtons.Remove(num);
}
}
for (int j = 0; j < playerFrame.player.data.currentCards.Count(); j++)
{
CardInfo card2 = playerFrame.player.data.currentCards[j];
PlayerCardButton playerCardButton3 = cardButtons[j];
playerCardButton3.card = card2;
((TMP_Text)playerCardButton3.Text).text = playerCardButton3.CardInitials(card2);
}
}
}
public class PlayerCardButton : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
{
public PlayerCardBar cardBar;
public CardInfo card;
private TextMeshProUGUI _text = null;
private GameObject displayedCard;
public TextMeshProUGUI Text
{
get
{
if (_text == null)
{
_text = ((Component)((Component)this).transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>();
}
return _text;
}
}
private void Start()
{
((TMP_Text)Text).text = CardInitials(card);
}
internal string CardInitials(CardInfo card)
{
string cardName = card.cardName;
cardName = cardName.Substring(0, 2);
string text = cardName[0].ToString().ToUpper();
if (cardName.Length > 1)
{
string text2 = cardName[1].ToString().ToLower();
return text + text2;
}
return text;
}
public void OnPointerEnter(PointerEventData eventData)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)displayedCard != (Object)null)
{
Object.Destroy((Object)(object)displayedCard);
}
displayedCard = Object.Instantiate<GameObject>(TabInfoManager.cardHolderTemplate, TabInfoManager.canvas.transform);
displayedCard.transform.position = ((Component)this).gameObject.transform.position;
GameObject cardObj = Object.Instantiate<GameObject>(((Component)card).gameObject, displayedCard.transform);
CardVisuals componentInChildren = cardObj.GetComponentInChildren<CardVisuals>();
componentInChildren.firstValueToSet = true;
cardObj.transform.localPosition = Vector3.zero;
Collider2D[] componentsInChildren = displayedCard.GetComponentsInChildren<Collider2D>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Behaviour)componentsInChildren[i]).enabled = false;
}
cardObj.GetComponentInChildren<Canvas>().sortingLayerName = "MostFront";
((Behaviour)cardObj.GetComponentInChildren<GraphicRaycaster>()).enabled = false;
((Behaviour)cardObj.GetComponentInChildren<SetScaleToZero>()).enabled = false;
((Component)cardObj.GetComponentInChildren<SetScaleToZero>()).transform.localScale = Vector3.one * 1.15f;
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
cardObj.transform.localScale = Vector3.one * 25f;
});
}
public void OnPointerExit(PointerEventData eventData)
{
if ((Object)(object)displayedCard != (Object)null)
{
Object.Destroy((Object)(object)displayedCard);
}
}
private void OnDisable()
{
if ((Object)(object)displayedCard != (Object)null)
{
Object.Destroy((Object)(object)displayedCard);
}
}
}
public class PlayerFrame : MonoBehaviour
{
public TeamFrame teamFrame;
public PlayerCardBar cardBar;
public Player player;
private GameObject _cardBar;
private GameObject _cardBarFrame;
private TextMeshProUGUI _nameText;
private bool toggled = true;
private Button _button;
private GameObject _statHolder;
private TextMeshProUGUI _kda = null;
private List<StatSection> statSections = new List<StatSection>();
public GameObject CardBar
{
get
{
if (!((Object)(object)_cardBar != (Object)null))
{
_cardBar = ((Component)((Component)this).transform.Find("Player Cards/Scroll View/Viewport/Content")).gameObject;
}
return _cardBar;
}
}
public GameObject CardBarFrame
{
get
{
if (!((Object)(object)_cardBarFrame != (Object)null))
{
_cardBarFrame = ((Component)((Component)this).transform.Find("Player Cards")).gameObject;
}
return _cardBarFrame;
}
}
public TextMeshProUGUI NameText
{
get
{
if (!((Object)(object)_nameText != (Object)null))
{
_nameText = ((Component)((Component)this).transform.Find("Player Header/Player Name")).gameObject.GetComponent<TextMeshProUGUI>();
}
return _nameText;
}
}
public Button Button
{
get
{
if (!((Object)(object)_button != (Object)null))
{
_button = ((Component)((Component)this).transform.Find("Player Header")).gameObject.GetComponent<Button>();
}
return _button;
}
}
public GameObject StatHolder
{
get
{
if (!((Object)(object)_statHolder != (Object)null))
{
_statHolder = ((Component)((Component)this).transform.Find("Player Stats")).gameObject;
}
return _statHolder;
}
}
public TextMeshProUGUI KDA
{
get
{
if (_kda == null)
{
_kda = ((Component)((Component)this).transform.Find("Player Header/KDA")).gameObject.GetComponent<TextMeshProUGUI>();
}
return _kda;
}
}
public TextMeshProUGUI Spacer => ((Component)((Component)this).transform.Find("Player Header/Spacer")).gameObject.GetComponent<TextMeshProUGUI>();
private void OnHeaderClicked()
{
toggled = !toggled;
CardBarFrame.SetActive(toggled);
StatHolder.SetActive(toggled);
}
private void Start()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
cardBar = CardBar.AddComponent<PlayerCardBar>();
cardBar.playerFrame = this;
((UnityEvent)Button.onClick).AddListener(new UnityAction(OnHeaderClicked));
((TMP_Text)NameText).text = player.data.view.Owner.NickName;
((Component)Spacer).gameObject.SetActive(false);
((Component)KDA).gameObject.SetActive(false);
foreach (StatCategory item in from c in TabInfoManager.Categories.Values
orderby c.priority, c.name.ToLower()
select c)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.statSectionTemplate, StatHolder.transform);
StatSection statSection = val.AddComponent<StatSection>();
statSection.playerFrame = this;
statSection.category = item;
statSections.Add(statSection);
}
}
private void Update()
{
if (statSections.Count() != TabInfoManager.Categories.Values.Count)
{
StatCategory[] extraCategories = statSections.Select((StatSection section) => section.category).Except(TabInfoManager.Categories.Values).ToArray();
StatSection[] array = statSections.Where((StatSection section) => extraCategories.Contains(section.category)).ToArray();
StatSection[] array2 = array;
foreach (StatSection statSection in array2)
{
Object.Destroy((Object)(object)((Component)statSection).gameObject);
statSections.Remove(statSection);
}
StatCategory[] array3 = TabInfoManager.Categories.Values.Except(statSections.Select((StatSection section) => section.category)).ToArray();
StatCategory[] array4 = array3;
foreach (StatCategory category in array4)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.statSectionTemplate, StatHolder.transform);
StatSection statSection2 = val.AddComponent<StatSection>();
statSection2.playerFrame = this;
statSection2.category = category;
statSections.Add(statSection2);
}
StatCategory[] sectionOrder = (from c in TabInfoManager.Categories.Values
orderby c.priority, c.name.ToLower()
select c).ToArray();
int i;
for (i = 0; i < sectionOrder.Length; i++)
{
((Component)statSections.Where((StatSection section) => section.category == sectionOrder[i]).First()).transform.SetSiblingIndex(i);
}
}
foreach (StatSection statSection3 in statSections)
{
if (((Component)statSection3).gameObject.activeSelf != statSection3.category.DisplayCondition(player))
{
((Component)statSection3).gameObject.SetActive(statSection3.category.DisplayCondition(player));
}
}
}
}
internal class StatObject : MonoBehaviour
{
public StatSection section;
public Stat stat;
private TextMeshProUGUI _statName = null;
private TextMeshProUGUI _statValue = null;
public TextMeshProUGUI StatName
{
get
{
if (_statName == null)
{
_statName = ((Component)((Component)this).transform.Find("Name")).GetComponent<TextMeshProUGUI>();
}
return _statName;
}
}
public TextMeshProUGUI StatValue
{
get
{
if (_statValue == null)
{
_statValue = ((Component)((Component)this).transform.Find("Value")).GetComponent<TextMeshProUGUI>();
}
return _statValue;
}
}
private void Update()
{
((TMP_Text)StatName).text = stat.name + ":";
((TMP_Text)StatValue).text = stat.DisplayValue(section.playerFrame.player);
}
}
internal class StatSection : MonoBehaviour
{
public PlayerFrame playerFrame;
public StatCategory category;
private TextMeshProUGUI _title = null;
private GameObject _statHolder = null;
private Button _button = null;
private bool toggled = true;
private List<StatObject> statObjects = new List<StatObject>();
public TextMeshProUGUI Title
{
get
{
if (_title == null)
{
_title = ((Component)((Component)this).transform.Find("Stat Section Header/Section Name")).GetComponent<TextMeshProUGUI>();
}
return _title;
}
}
public GameObject StatHolder
{
get
{
if (_statHolder == null)
{
_statHolder = ((Component)((Component)this).transform.Find("Stat Section Stats Holder")).gameObject;
}
return _statHolder;
}
}
public Button Button
{
get
{
if (_button == null)
{
_button = ((Component)((Component)this).transform.Find("Stat Section Header")).GetComponent<Button>();
}
return _button;
}
}
private void OnHeaderClicked()
{
toggled = !toggled;
StatHolder.SetActive(toggled);
}
public void Start()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
((UnityEvent)Button.onClick).AddListener(new UnityAction(OnHeaderClicked));
foreach (Stat item in category.Stats.Values.OrderBy((Stat stat) => stat.name))
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.statObjectTemplate, StatHolder.transform);
StatObject statObject = val.AddComponent<StatObject>();
statObject.stat = item;
statObject.section = this;
statObjects.Add(statObject);
}
}
public void Update()
{
((TMP_Text)Title).text = category.name;
if (statObjects.Count() != category.Stats.Values.Count())
{
Stat[] extraStats = statObjects.Select((StatObject stat) => stat.stat).Except(category.Stats.Values).ToArray();
StatObject[] array = statObjects.Where((StatObject stat) => extraStats.Contains(stat.stat)).ToArray();
StatObject[] array2 = array;
foreach (StatObject statObject in array2)
{
Object.Destroy((Object)(object)((Component)statObject).gameObject);
statObjects.Remove(statObject);
}
Stat[] array3 = category.Stats.Values.Except(statObjects.Select((StatObject stat) => stat.stat)).ToArray();
Stat[] array4 = array3;
foreach (Stat stat2 in array4)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.statObjectTemplate, StatHolder.transform);
StatObject statObject2 = val.AddComponent<StatObject>();
statObject2.stat = stat2;
statObject2.section = this;
statObjects.Add(statObject2);
}
Stat[] statOrder = category.Stats.Values.OrderBy((Stat stat) => stat.name).ToArray();
int i;
for (i = 0; i < statOrder.Length; i++)
{
((Component)statObjects.Where((StatObject statObj) => statObj.stat == statOrder[i]).First()).gameObject.transform.SetSiblingIndex(i);
}
}
foreach (StatObject statObject3 in statObjects)
{
if (((Component)statObject3).gameObject.activeSelf != statObject3.stat.DisplayCondition(playerFrame.player))
{
((Component)statObject3).gameObject.SetActive(statObject3.stat.DisplayCondition(playerFrame.player));
}
}
}
}
public class TabFrame : MonoBehaviour
{
private TextMeshProUGUI _title = null;
private Button _closeButton = null;
private GameObject _teamHolder = null;
private List<TeamFrame> teamFrames = new List<TeamFrame>();
internal bool toggled;
public TextMeshProUGUI Title
{
get
{
if (_title == null)
{
_title = ((Component)((Component)this).transform.Find("Title Bar/Title")).gameObject.GetComponent<TextMeshProUGUI>();
}
return _title;
}
}
public Button CloseButton
{
get
{
if (_closeButton == null)
{
_closeButton = ((Component)((Component)this).transform.Find("Title Bar/Close")).GetComponent<Button>();
}
return _closeButton;
}
}
public GameObject TeamHolder
{
get
{
if (_teamHolder == null)
{
_teamHolder = ((Component)((Component)this).transform.Find("Scroll View/Viewport/Content")).gameObject;
}
return _teamHolder;
}
}
public CanvasGroup CanvasGroup => ((Component)this).GetComponent<CanvasGroup>();
private void Start()
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
foreach (int item in from team in PlayerManager.instance.players.Select((Player player) => player.teamID).Distinct()
orderby team
select team)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.teamFrameTemplate, TeamHolder.transform);
TeamFrame teamFrame = val.AddComponent<TeamFrame>();
teamFrame.team = item;
teamFrames.Add(teamFrame);
}
((UnityEvent)CloseButton.onClick).AddListener((UnityAction)delegate
{
toggled = false;
((Component)this).gameObject.SetActive(false);
});
}
private void Update()
{
if (teamFrames.Count() != PlayerManager.instance.players.Select((Player player) => player.teamID).Distinct().Count())
{
IEnumerable<int> extraTeams = teamFrames.Select((TeamFrame teamFrame) => teamFrame.team).Except(PlayerManager.instance.players.Select((Player player) => player.teamID).Distinct());
IEnumerable<TeamFrame> enumerable = teamFrames.Where((TeamFrame teamFrame) => extraTeams.Contains(teamFrame.team));
foreach (TeamFrame item in enumerable)
{
Object.Destroy((Object)(object)item);
teamFrames.Remove(item);
}
IEnumerable<int> enumerable2 = PlayerManager.instance.players.Select((Player player) => player.teamID).Distinct().Except(teamFrames.Select((TeamFrame teamFrame) => teamFrame.team));
foreach (int item2 in enumerable2)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.teamFrameTemplate, TeamHolder.transform);
TeamFrame teamFrame2 = val.AddComponent<TeamFrame>();
teamFrame2.team = item2;
teamFrames.Add(teamFrame2);
}
int[] teamOrder = (from team in PlayerManager.instance.players.Select((Player player) => player.teamID).Distinct()
orderby team
select team).ToArray();
int i;
for (i = 0; i < teamOrder.Length; i++)
{
((Component)teamFrames.Where((TeamFrame teamframe) => teamframe.team == teamOrder[i]).First()).gameObject.transform.SetSiblingIndex(i);
}
}
((TMP_Text)Title).text = $"{GameModeManager.CurrentHandler.Name} - Round {TabInfoManager.CurrentRound} - Point {TabInfoManager.CurrentPoint} - {PlayerManager.instance.players.Count()} Players";
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)this).GetComponent<RectTransform>());
}
}
public static class TabInfoManager
{
private static Dictionary<string, StatCategory> _categories;
public static readonly StatCategory basicStats;
internal static GameObject canvas;
internal static GameObject tabFrameTemplate;
internal static GameObject teamFrameTemplate;
internal static GameObject playerFrameTemplate;
internal static GameObject cardButtonTemplate;
internal static GameObject statSectionTemplate;
internal static GameObject statObjectTemplate;
internal static GameObject cardHolderTemplate;
internal static TabFrame tabFrame;
private static List<string> hiddenGameModes;
public static ReadOnlyDictionary<string, StatCategory> Categories => new ReadOnlyDictionary<string, StatCategory>(_categories);
internal static TabFrame TabFrame
{
get
{
if ((Object)(object)tabFrame == (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(tabFrameTemplate, canvas.transform);
tabFrame = val.AddComponent<TabFrame>();
val.SetActive(false);
}
return tabFrame;
}
}
public static int RoundsToWin
{
get
{
try
{
return (int)GameModeManager.CurrentHandler.Settings["roundsToWinGame"];
}
catch
{
return 0;
}
}
}
public static int PointsToWin
{
get
{
try
{
return (int)GameModeManager.CurrentHandler.Settings["pointsToWinRound"];
}
catch
{
return 0;
}
}
}
public static int CurrentRound { get; internal set; }
public static int CurrentPoint { get; internal set; }
public static bool IsLockingInput
{
get
{
if ((Object)(object)TabFrame != (Object)null)
{
return ((Component)TabFrame).gameObject.activeSelf;
}
return false;
}
}
public static StatCategory RegisterCategory(string name, int priority)
{
if (_categories.Keys.Contains(name.ToLower()))
{
throw new ArgumentException("Category name must be unique.");
}
if (priority < 0)
{
throw new ArgumentException("Category priority cannot be less than 0.");
}
StatCategory statCategory = new StatCategory(name, priority);
_categories.Add(name.ToLower(), statCategory);
return statCategory;
}
public static Stat RegisterStat(StatCategory category, string name, Func<Player, bool> displayCondition, Func<Player, string> displayValue)
{
if (category.Stats.ContainsKey(name.ToLower()))
{
throw new ArgumentException("Stat Names must be unique for the category that they're in.");
}
return category.RegisterStat(name, displayCondition, displayValue);
}
static TabInfoManager()
{
_categories = new Dictionary<string, StatCategory>();
tabFrame = null;
hiddenGameModes = new List<string>();
basicStats = new StatCategory("Basic Stats", -1);
_categories.Add(basicStats.name.ToLower(), basicStats);
basicStats.RegisterStat("HP", (Player value) => true, (Player player) => $"{player.data.health:F0}/{player.data.maxHealth:F0}");
basicStats.RegisterStat("Damage", (Player value) => true, (Player player) => $"{player.data.weaponHandler.gun.damage * player.data.weaponHandler.gun.bulletDamageMultiplier * 55f:F0}");
basicStats.RegisterStat("Block Cooldown", (Player value) => true, (Player player) => $"{player.data.block.Cooldown():F2}s");
basicStats.RegisterStat("Reload Time", (Player value) => true, (Player player) => string.Format("{0:F2}s", (float)ExtensionMethods.InvokeMethod((object)((Component)player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>(), "ReloadTime", Array.Empty<object>())));
basicStats.RegisterStat("Ammo", (Player value) => true, (Player player) => $"{((Component)player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>().maxAmmo:F0}");
basicStats.RegisterStat("Movespeed", (Player value) => true, (Player player) => $"{player.data.stats.movementSpeed:F2}");
}
public static void RegisterHiddenGameMode(string gameModeID)
{
hiddenGameModes.Add(gameModeID);
}
public static void ToggleTabFrame()
{
if (!hiddenGameModes.Contains(GameModeManager.CurrentHandlerID))
{
TabFrame tabFrame = TabFrame;
TabFrame.toggled = !TabFrame.toggled;
((Component)TabFrame).gameObject.SetActive(TabFrame.toggled);
if (!TabFrame.toggled)
{
Object.Destroy((Object)(object)((Component)TabFrame).gameObject);
}
}
}
}
internal class TabListener : MonoBehaviour
{
private void Update()
{
if (Object.op_Implicit((Object)(object)PlayerManager.instance) && PlayerManager.instance.players != null && PlayerManager.instance.players.Count > 0 && PlayerManager.instance.LocalPlayers().Length != 0 && PlayerManager.instance.LocalPlayers().Any((Player player) => player.data.playerActions != null && ((OneAxisInputControl)player.data.playerActions.GetAdditionalData().toggleTab).WasPressed))
{
TabInfoManager.ToggleTabFrame();
}
}
}
public class StatCategory
{
public readonly string name;
public readonly int priority;
private Dictionary<string, Stat> _stats = new Dictionary<string, Stat>();
public ReadOnlyDictionary<string, Stat> Stats => new ReadOnlyDictionary<string, Stat>(_stats);
internal Stat RegisterStat(string name, Func<Player, bool> condition, Func<Player, string> value)
{
if (_stats.ContainsKey(name.ToLower()))
{
throw new ArgumentException("Stat Names must be unique.");
}
Stat stat = new Stat(name, this, condition, value);
_stats.Add(name.ToLower(), stat);
return stat;
}
internal StatCategory(string name, int priority)
{
this.name = name;
this.priority = priority;
}
internal bool DisplayCondition(Player player)
{
bool flag = TabInfo.GetBool(this);
if (flag)
{
flag = Stats.Values.Any((Stat stat) => stat.DisplayCondition(player));
}
return flag;
}
}
public class Stat
{
public readonly string name;
internal StatCategory category;
private Func<Player, string> displayValue;
private Func<Player, bool> displayCondition;
internal Stat(string name, StatCategory category, Func<Player, bool> condition, Func<Player, string> value)
{
this.name = name;
this.category = category;
displayCondition = condition;
displayValue = value;
}
internal bool DisplayCondition(Player player)
{
bool flag = TabInfo.GetBool(this);
if (flag)
{
try
{
flag = displayCondition(player);
}
catch (Exception ex)
{
Debug.LogError((object)("[Tab Info] Error thrown when fetching the display condition for Stat '" + name + "' in Category '" + category.name + "', see log below for details:"));
Debug.LogException(ex);
}
}
return flag;
}
internal string DisplayValue(Player player)
{
string result = "";
try
{
result = displayValue(player);
}
catch (Exception ex)
{
Debug.LogError((object)("[Tab Info] Error thrown when fetching the display value for Stat '" + name + "' in Category '" + category.name + "', see log below for details:"));
Debug.LogException(ex);
}
return result;
}
}
public class TeamFrame : MonoBehaviour
{
public int team;
private Image _bg = null;
private GameObject _playerHolder = null;
private TextMeshProUGUI _teamName = null;
private TextMeshProUGUI _teamScore = null;
private List<PlayerFrame> playerFrames = new List<PlayerFrame>();
private PlayerSkin teamSkin;
private Color[] colors;
private bool toggled = true;
public Image HeaderBG
{
get
{
if (_bg == null)
{
_bg = ((Component)((Component)this).transform.Find("Team Header")).GetComponent<Image>();
}
return _bg;
}
}
public GameObject PlayerHolder
{
get
{
if (_playerHolder == null)
{
_playerHolder = ((Component)((Component)this).transform.Find("Players")).gameObject;
}
return _playerHolder;
}
}
public TextMeshProUGUI TeamName
{
get
{
if (_teamName == null)
{
_teamName = ((Component)((Component)this).transform.Find("Team Header/Team Name")).gameObject.GetComponent<TextMeshProUGUI>();
}
return _teamName;
}
}
public TextMeshProUGUI TeamScore
{
get
{
if (_teamScore == null)
{
_teamScore = ((Component)((Component)this).transform.Find("Team Header/Score")).gameObject.GetComponent<TextMeshProUGUI>();
}
return _teamScore;
}
}
public TextMeshProUGUI Spacer => ((Component)((Component)this).transform.Find("Team Header/Spacer")).gameObject.GetComponent<TextMeshProUGUI>();
private void OnHeaderClicked()
{
toggled = !toggled;
PlayerHolder.SetActive(toggled);
}
private void Start()
{
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
foreach (Player item in from player in PlayerManager.instance.GetPlayersInTeam(team)
orderby player.playerID
select player)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.playerFrameTemplate, PlayerHolder.transform);
PlayerFrame playerFrame = val.AddComponent<PlayerFrame>();
playerFrame.player = item;
playerFrame.teamFrame = this;
playerFrames.Add(playerFrame);
}
if (playerFrames.Count() > 0)
{
teamSkin = playerFrames[0].player.GetTeamColors();
((TMP_Text)TeamName).text = ExtraPlayerSkins.GetTeamColorName(PlayerExtensions.colorID(playerFrames[0].player));
colors = ColorManager.GetContrastingColors(teamSkin.winText, teamSkin.particleEffect, 3.5f);
((Graphic)HeaderBG).color = colors[1];
((Graphic)TeamName).color = colors[0];
((Graphic)TeamScore).color = colors[0];
((Graphic)Spacer).color = colors[0];
}
((UnityEvent)((Component)HeaderBG).GetComponent<Button>().onClick).AddListener(new UnityAction(OnHeaderClicked));
}
private void Update()
{
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
if (playerFrames.Count() != PlayerManager.instance.GetPlayersInTeam(team).Count())
{
IEnumerable<Player> extraPlayers = playerFrames.Select((PlayerFrame playerFrame) => playerFrame.player).Except(PlayerManager.instance.GetPlayersInTeam(team));
IEnumerable<PlayerFrame> enumerable = playerFrames.Where((PlayerFrame playerFrame) => extraPlayers.Contains(playerFrame.player));
foreach (PlayerFrame item in enumerable)
{
Object.Destroy((Object)(object)((Component)item).gameObject);
playerFrames.Remove(item);
}
IEnumerable<Player> enumerable2 = PlayerManager.instance.GetPlayersInTeam(team).Except(playerFrames.Select((PlayerFrame playerFrame) => playerFrame.player));
foreach (Player item2 in enumerable2)
{
GameObject val = Object.Instantiate<GameObject>(TabInfoManager.playerFrameTemplate, PlayerHolder.transform);
PlayerFrame playerFrame2 = val.AddComponent<PlayerFrame>();
playerFrame2.player = item2;
playerFrame2.teamFrame = this;
playerFrames.Add(playerFrame2);
}
Player[] playerOrder = (from player in PlayerManager.instance.GetPlayersInTeam(team)
orderby player.playerID
select player).ToArray();
int i;
for (i = 0; i < playerOrder.Length; i++)
{
((Component)playerFrames.Where((PlayerFrame playerFrame) => (Object)(object)playerFrame.player == (Object)(object)playerOrder[i]).First()).gameObject.transform.SetSiblingIndex(i);
}
}
TeamScore teamScore = GameModeManager.CurrentHandler.GetTeamScore(team);
((TMP_Text)TeamScore).text = $"{teamScore.rounds}/{TabInfoManager.RoundsToWin} Rounds {teamScore.points}/{TabInfoManager.PointsToWin} Points";
if (playerFrames.Count() > 0 && (Object)(object)teamSkin != (Object)(object)playerFrames[0].player.GetTeamColors())
{
teamSkin = playerFrames[0].player.GetTeamColors();
((TMP_Text)TeamName).text = ExtraPlayerSkins.GetTeamColorName(PlayerExtensions.colorID(playerFrames[0].player));
colors = ColorManager.GetContrastingColors(teamSkin.winText, teamSkin.particleEffect, 3.5f);
((Graphic)HeaderBG).color = colors[1];
((Graphic)TeamName).color = colors[0];
((Graphic)TeamScore).color = colors[0];
((Graphic)Spacer).color = colors[0];
}
}
}
}
namespace TabInfo.Patches
{
[HarmonyPatch(typeof(PlayerActions))]
internal class PlayerActions_Patch
{
[HarmonyPatch(typeof(PlayerActions))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(new Type[] { })]
[HarmonyPostfix]
private static void CreateAction(PlayerActions __instance)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
__instance.GetAdditionalData().toggleTab = (PlayerAction)typeof(PlayerActions).InvokeMember("CreatePlayerAction", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, __instance, new object[1] { "(TabInfo) Toggle Tab" });
}
[HarmonyPostfix]
[HarmonyPatch("CreateWithControllerBindings")]
private static void SetControllerBinding(ref PlayerActions __result)
{
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerActions), "CreateWithKeyboardBindings")]
private static void SetKeyboardBinding(ref PlayerActions __result)
{
__result.GetAdditionalData().toggleTab.AddDefaultBinding((Key[])(object)new Key[1] { (Key)66 });
}
}
}
namespace TabInfo.Monobehaviours
{
public class ButtonInteraction : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler
{
public UnityEvent mouseClick = new UnityEvent();
public UnityEvent mouseEnter = new UnityEvent();
public UnityEvent mouseExit = new UnityEvent();
public Button button;
public AudioSource source;
private Random random = new Random();
private void Start()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
button = ((Component)this).gameObject.GetComponent<Button>();
source = ExtensionMethods.GetOrAddComponent<AudioSource>(((Component)this).gameObject, false);
mouseEnter.AddListener(new UnityAction(OnEnter));
mouseExit.AddListener(new UnityAction(OnExit));
mouseClick.AddListener(new UnityAction(OnClick));
}
public void OnEnter()
{
if (((Selectable)button).interactable)
{
source.PlayOneShot(TabInfo.instance.hover[random.Next(TabInfo.instance.hover.Count)]);
}
}
public void OnExit()
{
if (((Selectable)button).interactable)
{
source.PlayOneShot(TabInfo.instance.hover[random.Next(TabInfo.instance.hover.Count)]);
}
}
public void OnClick()
{
if (((Selectable)button).interactable)
{
source.PlayOneShot(TabInfo.instance.click[random.Next(TabInfo.instance.click.Count)]);
EventSystem.current.SetSelectedGameObject((GameObject)null);
}
}
public void OnPointerEnter(PointerEventData eventData)
{
if (((Selectable)button).interactable)
{
UnityEvent obj = mouseEnter;
if (obj != null)
{
obj.Invoke();
}
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (((Selectable)button).interactable)
{
UnityEvent obj = mouseExit;
if (obj != null)
{
obj.Invoke();
}
}
}
public void OnPointerClick(PointerEventData eventData)
{
if (((Selectable)button).interactable)
{
UnityEvent obj = mouseClick;
if (obj != null)
{
obj.Invoke();
}
}
}
}
}
namespace TabInfo.Extensions
{
[Serializable]
public class PlayerActionsAdditionalData
{
public PlayerAction toggleTab;
public PlayerActionsAdditionalData()
{
toggleTab = null;
}
}
public static class PlayerActionsExtension
{
public static readonly ConditionalWeakTable<PlayerActions, PlayerActionsAdditionalData> data = new ConditionalWeakTable<PlayerActions, PlayerActionsAdditionalData>();
public static PlayerActionsAdditionalData GetAdditionalData(this PlayerActions playerActions)
{
return data.GetOrCreateValue(playerActions);
}
public static void AddData(this PlayerActions playerActions, PlayerActionsAdditionalData value)
{
try
{
data.Add(playerActions, value);
}
catch (Exception)
{
}
}
}
public static class PlayerManagerExtension
{
public static Player GetPlayerWithID(this PlayerManager playerManager, int playerID)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
return (Player)typeof(PlayerManager).InvokeMember("GetPlayerWithID", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, playerManager, new object[1] { playerID });
}
public static Player[] LocalPlayers(this PlayerManager playerManager)
{
if (playerManager.players == null || playerManager.players.Count() == 0)
{
return (Player[])(object)new Player[0];
}
return playerManager.players.Where((Player player) => PhotonNetwork.OfflineMode || player.data.view.IsMine).ToArray();
}
}
}