using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TootTallyAccounts;
using TootTallyCore;
using TootTallyCore.APIServices;
using TootTallyCore.Graphics;
using TootTallyCore.Graphics.Animations;
using TootTallyCore.Utils.Assets;
using TootTallyCore.Utils.TootTallyModules;
using TootTallyCore.Utils.TootTallyNotifs;
using TootTallySettings;
using TootTallySettings.TootTallySettingsObjects;
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.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTallyTrombuddies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Friend list system for TootTallyCore")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("TootTallyTrombuddies")]
[assembly: AssemblyTitle("TootTallyTrombuddies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 TootTallyTrombuddies
{
[BepInPlugin("TootTallyTrombuddies", "TootTallyTrombuddies", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin, ITootTallyModule
{
public static Plugin Instance;
private const string CONFIG_NAME = "Trombuddies.cfg";
private Harmony _harmony;
public static TootTallySettingPage settingPage;
private static TootTallySettingDropdown _toggleDropdown;
private static TootTallySettingDropdown _toggleFriendDropdown;
private static TootTallySettingDropdown _toggleOnlineDropdown;
public ConfigEntry<bool> ModuleConfigEnabled { get; set; }
public bool IsConfigInitialized { get; set; }
public string Name
{
get
{
return "Trombuddies";
}
set
{
Name = value;
}
}
public ConfigEntry<KeyCode> TogglePanel { get; set; }
public ConfigEntry<KeyCode> ToggleFriendOnly { get; set; }
public ConfigEntry<KeyCode> ToggleOnlineOnly { get; set; }
public static void LogInfo(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
}
public static void LogError(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
}
private void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
_harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize);
}
}
private void TryInitialize()
{
ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Modules", "Trombuddies", true, "Friend list system for TootTallyCore");
TootTallyModuleManager.AddModule((ITootTallyModule)(object)this);
}
public void LoadModule()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(Paths.BepInExRootPath, "config/");
ConfigFile val = new ConfigFile(text + "Trombuddies.cfg", true)
{
SaveOnConfigSet = true
};
TogglePanel = val.Bind<KeyCode>("Keybinds", "TogglePanel", (KeyCode)283, "Toggle the Trombuddies Panel.");
ToggleFriendOnly = val.Bind<KeyCode>("Keybinds", "ToggleFriendOnly", (KeyCode)284, "Toggle show friends only.");
ToggleOnlineOnly = val.Bind<KeyCode>("Keybinds", "ToggleOnlineOnly", (KeyCode)285, "Toggle show online users only.");
settingPage = TootTallySettingsManager.AddNewPage("Trombuddies", "Trombuddies", 40f, new Color(0f, 0f, 0f, 0f));
settingPage.AddLabel("TogglePanelLabel", "Toggle Panel Keybind", 24f, (FontStyles)0, (TextAlignmentOptions)1025);
_toggleDropdown = settingPage.AddDropdown("Toggle Panel Keybind", (ConfigEntryBase)(object)TogglePanel);
settingPage.AddLabel("ToggleFriendsLabel", "Toggle Friends Only Keybind", 24f, (FontStyles)0, (TextAlignmentOptions)1025);
_toggleFriendDropdown = settingPage.AddDropdown("Toggle Friends Only Keybind", (ConfigEntryBase)(object)ToggleFriendOnly);
settingPage.AddLabel("ToggleOnlineLabel", "Toggle Online Only Keybind", 24f, (FontStyles)0, (TextAlignmentOptions)1025);
_toggleOnlineDropdown = settingPage.AddDropdown("Toggle Online Only Keybind", (ConfigEntryBase)(object)ToggleOnlineOnly);
settingPage.AddButton("Reset Keybinds", (Action)ResetKeybinds);
Plugin.TryAddThunderstoreIconToPageButton(((BaseUnityPlugin)Instance).Info.Location, Name, settingPage);
ThemeManager.OnThemeRefreshEvents = (Action)Delegate.Combine(ThemeManager.OnThemeRefreshEvents, new Action(TrombuddiesManager.UpdateTheme));
_harmony.PatchAll(typeof(TrombuddiesGameObjectFactory));
LogInfo("Module loaded!");
}
private void ResetKeybinds()
{
_toggleDropdown.dropdown.value = _toggleDropdown.dropdown.options.FindIndex(delegate(OptionData x)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
string text3 = x.text;
KeyCode val3 = (KeyCode)283;
return text3 == ((object)(KeyCode)(ref val3)).ToString();
});
_toggleFriendDropdown.dropdown.value = _toggleFriendDropdown.dropdown.options.FindIndex(delegate(OptionData x)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
string text2 = x.text;
KeyCode val2 = (KeyCode)284;
return text2 == ((object)(KeyCode)(ref val2)).ToString();
});
_toggleOnlineDropdown.dropdown.value = _toggleOnlineDropdown.dropdown.options.FindIndex(delegate(OptionData x)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
string text = x.text;
KeyCode val = (KeyCode)285;
return text == ((object)(KeyCode)(ref val)).ToString();
});
}
public void UnloadModule()
{
ThemeManager.OnThemeRefreshEvents = (Action)Delegate.Remove(ThemeManager.OnThemeRefreshEvents, new Action(TrombuddiesManager.UpdateTheme));
TrombuddiesGameObjectFactory.Dispose();
_harmony.UnpatchSelf();
settingPage.Remove();
LogInfo("Module unloaded!");
}
}
public static class TrombuddiesGameObjectFactory
{
private static GameObject _userCardPrefab;
private static TrombuddiesManager __instance;
[HarmonyPatch(typeof(GameObjectFactory), "OnHomeControllerInitialize")]
[HarmonyPostfix]
public static void InitializeTootTallySettingsManager(HomeController homeController)
{
SetUserCardPrefab();
if ((Object)(object)__instance == (Object)null)
{
__instance = ((Component)Plugin.Instance).gameObject.AddComponent<TrombuddiesManager>();
}
}
private static void SetUserCardPrefab()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Expected O, but got Unknown
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Expected O, but got Unknown
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Expected O, but got Unknown
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
_userCardPrefab = Object.Instantiate<GameObject>(((Component)GameObjectFactory.GetOverlayPanelPrefab.transform.Find("FSLatencyPanel")).gameObject);
((Object)_userCardPrefab).name = "UserCardPrefab";
((Graphic)_userCardPrefab.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
RectTransform component = ((Component)_userCardPrefab.transform.Find("LatencyFG")).GetComponent<RectTransform>();
RectTransform component2 = ((Component)_userCardPrefab.transform.Find("LatencyBG")).GetComponent<RectTransform>();
Image component3 = ((Component)component).GetComponent<Image>();
bool maskable = (((MaskableGraphic)((Component)component2).GetComponent<Image>()).maskable = true);
((MaskableGraphic)component3).maskable = maskable;
((Graphic)((Component)component).GetComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(360f, 100f);
component.sizeDelta = val;
component.anchoredPosition = Vector2.zero;
component2.sizeDelta = val + Vector2.one * 10f;
component2.anchoredPosition = Vector2.zero;
_userCardPrefab.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
GameObject gameObject = ((Component)component).gameObject;
GameObjectFactory.DestroyFromParent(gameObject, "title");
GameObjectFactory.DestroyFromParent(gameObject, "subtitle");
HorizontalLayoutGroup val2 = gameObject.AddComponent<HorizontalLayoutGroup>();
((LayoutGroup)val2).padding = new RectOffset(5, 5, 5, 5);
((HorizontalOrVerticalLayoutGroup)val2).spacing = 20f;
((LayoutGroup)val2).childAlignment = (TextAnchor)4;
maskable = (((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true);
((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = maskable;
maskable = (((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false);
((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = maskable;
GameObject gameObject2 = ((Component)gameObject.transform.Find("MainPage")).gameObject;
((Object)gameObject2).name = "LeftContent";
VerticalLayoutGroup component4 = gameObject2.GetComponent<VerticalLayoutGroup>();
((LayoutGroup)component4).padding = new RectOffset(5, 5, 5, 5);
((HorizontalOrVerticalLayoutGroup)component4).spacing = 4f;
((LayoutGroup)component4).childAlignment = (TextAnchor)4;
maskable = (((HorizontalOrVerticalLayoutGroup)component4).childControlWidth = true);
((HorizontalOrVerticalLayoutGroup)component4).childControlHeight = maskable;
maskable = (((HorizontalOrVerticalLayoutGroup)component4).childForceExpandWidth = true);
((HorizontalOrVerticalLayoutGroup)component4).childForceExpandHeight = maskable;
GameObject val3 = Object.Instantiate<GameObject>(gameObject2, gameObject.transform);
((Object)val3).name = "RightContent";
VerticalLayoutGroup component5 = val3.GetComponent<VerticalLayoutGroup>();
maskable = (((HorizontalOrVerticalLayoutGroup)component5).childControlWidth = false);
((HorizontalOrVerticalLayoutGroup)component5).childControlHeight = maskable;
maskable = (((HorizontalOrVerticalLayoutGroup)component5).childForceExpandWidth = false);
((HorizontalOrVerticalLayoutGroup)component5).childForceExpandHeight = maskable;
GameObject val4 = new GameObject("PFPPrefab", new Type[1] { typeof(Image) });
Image component6 = val4.GetComponent<Image>();
((MaskableGraphic)component6).maskable = true;
component6.preserveAspect = true;
GameObject val5 = Object.Instantiate<GameObject>(val4, val4.transform);
((Object)val5).name = "ImageMask";
GameObject val6 = Object.Instantiate<GameObject>(val5, val5.transform);
((Object)val6).name = "Image";
Mask val7 = val5.AddComponent<Mask>();
val7.showMaskGraphic = false;
Image component7 = val5.GetComponent<Image>();
component7.sprite = AssetManager.GetSprite("PfpMask.png");
val5.GetComponent<RectTransform>().sizeDelta = new Vector2(90f, 90f);
Image component8 = val6.GetComponent<Image>();
val4.transform.SetSiblingIndex(0);
((Behaviour)component6).enabled = false;
component8.sprite = AssetManager.GetSprite("icon.png");
component8.preserveAspect = false;
LayoutElement val8 = val4.AddComponent<LayoutElement>();
float minHeight = (val8.minWidth = 96f);
val8.minHeight = minHeight;
GameObject val9 = Object.Instantiate<GameObject>(val4, gameObject.transform);
val9.transform.SetSiblingIndex(0);
((Object)val9).name = "PFP";
Object.DestroyImmediate((Object)(object)val4);
Object.DontDestroyOnLoad((Object)(object)_userCardPrefab);
_userCardPrefab.SetActive(false);
}
public static GameObject CreateUserCard(Transform canvasTransform, User user, string status)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_00f6: 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_0129: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: 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_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(_userCardPrefab, canvasTransform);
((Object)val).name = user.username + "UserCard";
val.SetActive(true);
GameObject gameObject = ((Component)val.transform.Find("LatencyFG/LeftContent")).gameObject;
Image pfp = ((Component)gameObject.transform.parent.Find("PFP/ImageMask/Image")).GetComponent<Image>();
if (user.picture != null)
{
AssetManager.GetProfilePictureByID(user.id, (Action<Sprite>)delegate(Sprite sprite)
{
pfp.sprite = sprite;
});
}
EventTrigger val2 = ((Component)pfp).gameObject.AddComponent<EventTrigger>();
Entry val3 = new Entry();
val3.eventID = (EventTriggerType)4;
((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate
{
TrombuddiesManager.OpenUserProfile(user.id);
});
val2.triggers.Add(val3);
Entry val4 = new Entry();
val4.eventID = (EventTriggerType)0;
((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
GameObjectFactory.TintImage(pfp, Color.black, 0.25f);
});
val2.triggers.Add(val4);
Entry val5 = new Entry();
val5.eventID = (EventTriggerType)1;
((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
((Graphic)pfp).color = Color.white;
});
val2.triggers.Add(val5);
TMP_Text val6 = GameObjectFactory.CreateSingleText(gameObject.transform, "Name", user.username ?? "", (TextFont)0);
TMP_Text val7 = GameObjectFactory.CreateSingleText(gameObject.transform, "Status", status ?? "", (TextFont)0);
bool enableWordWrapping = (val7.enableWordWrapping = false);
val6.enableWordWrapping = enableWordWrapping;
TextOverflowModes overflowMode = (TextOverflowModes)1;
val7.overflowMode = (TextOverflowModes)1;
val6.overflowMode = overflowMode;
GameObject gameObject2 = ((Component)val.transform.Find("LatencyFG/RightContent")).gameObject;
if (user.id != TootTallyUser.userInfo.id)
{
Color val9 = (((Graphic)((Component)val.transform.Find("LatencyBG")).GetComponent<Image>()).color = UserFriendStatusToColor(user.friend_status));
Color val10 = val9;
GameObjectFactory.TintImage(((Component)val.transform.Find("LatencyFG")).GetComponent<Image>(), val10, 0.1f);
if (user.friend_status == "Friend" || user.friend_status == "Mutuals")
{
GameObjectFactory.CreateCustomButton(gameObject2.transform, Vector2.zero, Vector2.one * 45f, AssetManager.GetSprite("UserRemove64.png"), "RemoveFriendButton", (Action)delegate
{
TrombuddiesManager.OnRemoveButtonPress(user);
});
}
else
{
GameObjectFactory.CreateCustomButton(gameObject2.transform, Vector2.zero, Vector2.one * 45f, AssetManager.GetSprite("UserAdd64.png"), "AddFriendButton", (Action)delegate
{
TrombuddiesManager.OnAddButtonPress(user);
});
}
}
else
{
((Graphic)((Component)val.transform.Find("LatencyBG")).GetComponent<Image>()).color = Color.cyan;
GameObjectFactory.TintImage(((Component)val.transform.Find("LatencyFG")).GetComponent<Image>(), Color.cyan, 0.1f);
}
return val;
}
private static Color UserFriendStatusToColor(string status)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_0071: Unknown result type (might be due to invalid IL or missing references)
if (1 == 0)
{
}
Color result = ((status == "Friend") ? new Color(0f, 0.8f, 0f, 1f) : ((!(status == "Mutuals")) ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 0f, 1f, 1f)));
if (1 == 0)
{
}
return result;
}
public static void Dispose()
{
Object.DestroyImmediate((Object)(object)__instance);
}
}
public class TrombuddiesManager : MonoBehaviour
{
private static readonly List<KeyCode> _keyInputList = new List<KeyCode>
{
Plugin.Instance.ToggleFriendOnly.Value,
Plugin.Instance.ToggleOnlineOnly.Value,
(KeyCode)273,
(KeyCode)274,
(KeyCode)276,
(KeyCode)275,
(KeyCode)98,
(KeyCode)97
};
private static readonly List<KeyCode> _kenoKeys = new List<KeyCode>
{
(KeyCode)273,
(KeyCode)273,
(KeyCode)274,
(KeyCode)274,
(KeyCode)276,
(KeyCode)275,
(KeyCode)276,
(KeyCode)275,
(KeyCode)98,
(KeyCode)97
};
private static int _kenoIndex;
public static bool IsPanelActive;
private static bool _isInitialized;
private static bool _isUpdating;
private static GameObject _overlayCanvas;
private static TootTallyAnimation _panelAnimationFG;
private static TootTallyAnimation _panelAnimationBG;
private static GameObject _overlayPanel;
private static GameObject _overlayPanelContainer;
private static RectTransform _containerRect;
private static TMP_Text _titleText;
private static List<GameObject> _userObjectList;
private static bool _showAllSUsers;
private static bool _showFriends;
private static float _scrollAcceleration;
private void Awake()
{
if (!_isInitialized)
{
Initialize();
TootTallyNotifManager.DisplayNotif("TromBuddies Panel Initialized!", 6f);
}
}
private static void Initialize()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Expected O, but got Unknown
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: 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_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
_kenoIndex = 0;
_overlayCanvas = new GameObject("TootTallyOverlayCanvas");
Object.DontDestroyOnLoad((Object)(object)_overlayCanvas);
Canvas val = _overlayCanvas.AddComponent<Canvas>();
val.renderMode = (RenderMode)0;
val.overrideSorting = true;
val.sortingOrder = 1;
CanvasScaler val2 = _overlayCanvas.AddComponent<CanvasScaler>();
val2.referenceResolution = new Vector2(1920f, 1080f);
val2.uiScaleMode = (ScaleMode)1;
_userObjectList = new List<GameObject>();
_overlayPanel = GameObjectFactory.CreateOverlayPanel(_overlayCanvas.transform, Vector2.zero, new Vector2(1700f, 900f), 20f, "BonerBuddiesOverlayPanel");
((Graphic)((Component)_overlayPanel.transform.Find("FSLatencyPanel/LatencyFG")).GetComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f);
_overlayPanelContainer = ((Component)_overlayPanel.transform.Find("FSLatencyPanel/LatencyFG/MainPage")).gameObject;
_overlayPanel.transform.Find("FSLatencyPanel/LatencyFG").localScale = Vector2.op_Implicit(Vector2.zero);
_overlayPanel.transform.Find("FSLatencyPanel/LatencyBG").localScale = Vector2.op_Implicit(Vector2.zero);
_containerRect = _overlayPanelContainer.GetComponent<RectTransform>();
_containerRect.anchoredPosition = Vector2.zero;
_containerRect.sizeDelta = new Vector2(1700f, 700f);
Object.DestroyImmediate((Object)(object)_overlayPanelContainer.GetComponent<VerticalLayoutGroup>());
GridLayoutGroup val3 = _overlayPanelContainer.AddComponent<GridLayoutGroup>();
((LayoutGroup)val3).padding = new RectOffset(20, 20, 20, 20);
val3.spacing = new Vector2(5f, 5f);
val3.cellSize = new Vector2(380f, 120f);
((LayoutGroup)val3).childAlignment = (TextAnchor)1;
((Component)_overlayPanelContainer.transform.parent).gameObject.AddComponent<Mask>();
GameObjectFactory.DestroyFromParent(((Component)_overlayPanelContainer.transform.parent).gameObject, "subtitle");
GameObjectFactory.DestroyFromParent(((Component)_overlayPanelContainer.transform.parent).gameObject, "title");
TMP_Text val4 = GameObjectFactory.CreateSingleText(_overlayPanelContainer.transform, "title", "TromBuddies", (TextFont)0);
_titleText = ((Component)val4).GetComponent<TMP_Text>();
LayoutElement val5 = ((Component)val4).gameObject.AddComponent<LayoutElement>();
val5.ignoreLayout = true;
((Graphic)val4).raycastTarget = false;
val4.alignment = (TextAlignmentOptions)258;
val4.rectTransform.anchoredPosition = new Vector2(0f, 15f);
val4.rectTransform.pivot = new Vector2(0f, 0.5f);
val4.rectTransform.sizeDelta = new Vector2(1700f, 800f);
val4.fontSize = 60f;
val4.overflowMode = (TextOverflowModes)1;
GameObjectFactory.CreateCustomButton(_overlayPanelContainer.transform.parent, Vector2.zero, new Vector2(60f, 60f), AssetManager.GetSprite("Close64.png"), "CloseTromBuddiesButton", (Action)TogglePanel);
_overlayPanel.SetActive(false);
IsPanelActive = false;
_isInitialized = true;
}
private void Update()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (!_isInitialized)
{
return;
}
if (Input.GetKeyDown(Plugin.Instance.TogglePanel.Value))
{
UserStatusManager.ResetTimerAndWakeUpIfIdle();
TogglePanel();
}
if (!IsPanelActive)
{
return;
}
_keyInputList.ForEach(delegate(KeyCode key)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(key))
{
HandleKeyDown(key);
}
});
if (Input.mouseScrollDelta.y != 0f)
{
AddScrollAcceleration(Input.mouseScrollDelta.y * 2f);
}
UpdateScrolling();
}
private static void HandleKeyDown(KeyCode keypressed)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
if (_isUpdating)
{
TootTallyNotifManager.DisplayNotif("Panel currently updating, be patient!", 6f);
return;
}
if (Plugin.Instance.ToggleOnlineOnly.Value == keypressed)
{
_showAllSUsers = !_showAllSUsers;
TootTallyNotifManager.DisplayNotif(_showAllSUsers ? "Showing all users" : "Showing online users", 6f);
UpdateUsers();
}
else if (Plugin.Instance.ToggleFriendOnly.Value == keypressed)
{
_showFriends = !_showFriends;
TootTallyNotifManager.DisplayNotif(_showFriends ? "Showing friends only" : "Showing non-friend users", 6f);
UpdateUsers();
}
if (_kenoKeys.Contains(keypressed))
{
if (_kenoIndex != -1 && _kenoKeys[_kenoIndex] == keypressed)
{
_kenoIndex++;
if (_kenoIndex >= _kenoKeys.Count)
{
OnKenomiCodeEnter();
}
}
else
{
_kenoIndex = 0;
}
}
else
{
_kenoIndex = 0;
}
}
private static void OnKenomiCodeEnter()
{
_titleText.text = "BonerBuddies";
TootTallyNotifManager.DisplayNotif("Secret found... ☠", 6f);
_kenoIndex = -1;
}
private static void AddScrollAcceleration(float value)
{
_scrollAcceleration -= value / Time.deltaTime;
}
private static void UpdateScrolling()
{
//IL_000b: 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)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
_containerRect.anchoredPosition = new Vector2(_containerRect.anchoredPosition.x, Math.Max(_containerRect.anchoredPosition.y + _scrollAcceleration * Time.deltaTime, 0f));
if (_containerRect.anchoredPosition.y <= 0f)
{
_scrollAcceleration = 0f;
}
else
{
_scrollAcceleration -= _scrollAcceleration * 10f * Time.deltaTime;
}
}
public static void TogglePanel()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_00c9: 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_00d0: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
IsPanelActive = !IsPanelActive;
if (!((Object)(object)_overlayPanel != (Object)null))
{
return;
}
TootTallyAnimation panelAnimationBG = _panelAnimationBG;
if (panelAnimationBG != null)
{
panelAnimationBG.Dispose();
}
TootTallyAnimation panelAnimationFG = _panelAnimationFG;
if (panelAnimationFG != null)
{
panelAnimationFG.Dispose();
}
Vector2 val = (IsPanelActive ? Vector2.one : Vector2.zero);
float num = (IsPanelActive ? 1f : 0.45f);
SecondDegreeDynamicsAnimation val2 = (IsPanelActive ? new SecondDegreeDynamicsAnimation(1.75f, 1f, 0f) : new SecondDegreeDynamicsAnimation(3.2f, 1f, 0.25f));
SecondDegreeDynamicsAnimation val3 = (IsPanelActive ? new SecondDegreeDynamicsAnimation(1.75f, 1f, 0f) : new SecondDegreeDynamicsAnimation(3.2f, 1f, 0.25f));
_panelAnimationFG = TootTallyAnimationManager.AddNewScaleAnimation(((Component)_overlayPanel.transform.Find("FSLatencyPanel/LatencyFG")).gameObject, val, num, val2, (Action<GameObject>)null);
_panelAnimationBG = TootTallyAnimationManager.AddNewScaleAnimation(((Component)_overlayPanel.transform.Find("FSLatencyPanel/LatencyBG")).gameObject, val, num, val3, (Action<GameObject>)delegate
{
if (!IsPanelActive)
{
_overlayPanel.SetActive(IsPanelActive);
}
});
if (IsPanelActive)
{
_overlayPanel.SetActive(IsPanelActive);
UpdateUsers();
}
else
{
ClearUsers();
}
}
public static void UpdateUsers()
{
if (IsPanelActive && !_isUpdating && TootTallyUser.userInfo != null)
{
_isUpdating = true;
if (_showFriends && _showAllSUsers)
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.GetFriendList(Plugin.GetAPIKey, (Action<List<User>>)OnUpdateUsersResponse));
}
else if (_showAllSUsers)
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.GetAllUsersUpToPageID(TootTallyUser.userInfo.id, 3, (Action<List<User>>)OnUpdateUsersResponse));
}
else if (_showFriends)
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.GetOnlineFriends(Plugin.GetAPIKey, (Action<List<User>>)OnUpdateUsersResponse));
}
else
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.GetLatestOnlineUsers(TootTallyUser.userInfo.id, (Action<List<User>>)OnUpdateUsersResponse));
}
}
}
private static void OnUpdateUsersResponse(List<User> users)
{
ClearUsers();
users?.ForEach(delegate(User user)
{
_userObjectList.Add(TrombuddiesGameObjectFactory.CreateUserCard(_overlayPanelContainer.transform, user, GetStatusString(user)));
});
_isUpdating = false;
}
private static string GetStatusString(User user)
{
string status = user.status;
string text = status;
if (!(text == "Offline"))
{
if (text == "Idle")
{
return "<size=16><color=yellow>" + user.status + "</color></size>";
}
if (user.currently_playing != null)
{
return "<size=16><color=green>" + user.status + "\n" + user.currently_playing[0].short_name + "</color></size>";
}
return "<size=16><color=green>" + user.status + "</color></size>";
}
return "<size=16><color=red>" + user.status + "</color></size>";
}
public static void OnAddButtonPress(User user)
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.AddFriend(Plugin.GetAPIKey, user.id, (Action<bool>)OnFriendResponse));
}
public static void OnRemoveButtonPress(User user)
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)TootTallyAPIService.RemoveFriend(Plugin.GetAPIKey, user.id, (Action<bool>)OnFriendResponse));
}
public static void OpenUserProfile(int id)
{
Application.OpenURL($"https://toottally.com/profile/{id}");
}
private static void OnFriendResponse(bool value)
{
if (value)
{
UpdateUsers();
}
TootTallyNotifManager.DisplayNotif(value ? "Friend list updated." : "Action couldn't be done.", 6f);
}
public static void ClearUsers()
{
_userObjectList?.ForEach((Action<GameObject>)Object.DestroyImmediate);
_userObjectList?.Clear();
}
public static void UpdateTheme()
{
if (_isInitialized)
{
Dispose();
Initialize();
}
}
public static void Dispose()
{
if (_isInitialized)
{
Object.DestroyImmediate((Object)(object)_overlayCanvas);
_isInitialized = false;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TootTallyTrombuddies";
public const string PLUGIN_NAME = "TootTallyTrombuddies";
public const string PLUGIN_VERSION = "1.0.2";
}
}