using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using Elements.Assets;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.UIX;
using HarmonyLib;
using Renderite.Shared;
using SkyFrost.Base;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: IgnoresAccessChecksTo("Awwdio")]
[assembly: IgnoresAccessChecksTo("Elements.Assets")]
[assembly: IgnoresAccessChecksTo("Elements.Core")]
[assembly: IgnoresAccessChecksTo("FrooxEngine")]
[assembly: IgnoresAccessChecksTo("Renderite.Shared")]
[assembly: IgnoresAccessChecksTo("SkyFrost.Base")]
[assembly: IgnoresAccessChecksTo("SkyFrost.Base.Models")]
[assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
[assembly: AssemblyCompany("SessionTabOverhaul")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.2.2.0")]
[assembly: AssemblyInformationalVersion("2.2.2+0aa010758f00dd377e53a281c3963c75d0621d6f")]
[assembly: AssemblyProduct("SessionTabOverhaul")]
[assembly: AssemblyTitle("SessionTabOverhaul")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Gyztor/BepisSessionTabOverhaul")]
[assembly: SecurityPermission((SecurityAction)8, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace SessionTabOverhaul
{
[HarmonyPatch(typeof(SessionControlDialog))]
internal static class SessionControlDialogPatches
{
private static readonly float2 rectOffset = new float2(4f, 4f);
[HarmonyPostfix]
[HarmonyPatch("GenerateUi")]
private static void GenerateUiPostfix(SessionControlDialog __instance, Tab tab)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0067: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
if ((int)tab != 0)
{
return;
}
Enumerator<Radio> enumerator = __instance._accessLevelRadios.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Slot parent = ((Component)enumerator.Current).Slot.Parent.Parent.Parent;
LayoutElement component = ((ContainerWorker<Component>)(object)parent).GetComponent<LayoutElement>((Predicate<LayoutElement>)null, false);
Sync<float> preferredHeight = component.PreferredHeight;
((SyncField<float>)(object)preferredHeight).Value = ((SyncField<float>)(object)preferredHeight).Value + 8f;
Sync<float> minHeight = component.MinHeight;
((SyncField<float>)(object)minHeight).Value = ((SyncField<float>)(object)minHeight).Value + 8f;
Enumerator<Slot> enumerator2 = parent.Children.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
RectTransform component2 = ((ContainerWorker<Component>)(object)enumerator2.Current).GetComponent<RectTransform>((Predicate<RectTransform>)null, false);
Sync<float2> offsetMin = component2.OffsetMin;
float2 value = ((SyncField<float2>)(object)offsetMin).Value;
((SyncField<float2>)(object)offsetMin).Value = (ref value) + (ref rectOffset);
Sync<float2> offsetMax = component2.OffsetMax;
value = ((SyncField<float2>)(object)offsetMax).Value;
((SyncField<float2>)(object)offsetMax).Value = (ref value) - (ref rectOffset);
}
}
finally
{
((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();
}
((SyncField<colorX>)(object)((ContainerWorker<Component>)(object)parent).AttachComponent<Image>(true, (Action<Image>)null).Tint).Value = (((parent.ChildIndex & 1) == 0) ? SessionTabOverhaul.FirstRowColor.Value : SessionTabOverhaul.SecondRowColor.Value);
}
}
finally
{
((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
}
}
[HarmonyPostfix]
[HarmonyPatch("OnAttach")]
private static void OnAttachPostfix(SessionControlDialog __instance)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((ContainerWorker<Component>)(object)((Component)__instance).Slot).GetComponent<RectTransform>((Predicate<RectTransform>)null, false);
((SyncField<float2>)(object)component.OffsetMin).Value = new float2(16f, 16f);
((SyncField<float2>)(object)component.OffsetMax).Value = new float2(-16f, -16f);
}
}
[HarmonyPatch(typeof(SessionPermissionController))]
internal static class SessionPermissionControllerPatches
{
[HarmonyPostfix]
[HarmonyPatch("Create")]
private static void CreatePostfix(SessionPermissionController __result)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((SyncField<colorX>)(object)((ContainerWorker<Component>)(object)((Component)__result).Slot).AttachComponent<Image>(true, (Action<Image>)null).Tint).Value = (((((Component)__result).Slot.ChildIndex & 1) == 0) ? SessionTabOverhaul.FirstRowColor.Value : SessionTabOverhaul.SecondRowColor.Value);
Sync<float> minHeight = ((ContainerWorker<Component>)(object)((Component)__result).Slot).GetComponent<LayoutElement>((Predicate<LayoutElement>)null, false).MinHeight;
((SyncField<float>)(object)minHeight).Value = ((SyncField<float>)(object)minHeight).Value + 8f;
HorizontalLayout componentInChildren = ((Component)__result).Slot.GetComponentInChildren<HorizontalLayout>((Predicate<HorizontalLayout>)null, false, false);
((SyncField<float>)(object)((DirectionalLayout)componentInChildren).PaddingBottom).Value = 4f;
((SyncField<float>)(object)((DirectionalLayout)componentInChildren).PaddingRight).Value = 4f;
((SyncField<float>)(object)((DirectionalLayout)componentInChildren).PaddingLeft).Value = 4f;
((SyncField<float>)(object)((DirectionalLayout)componentInChildren).PaddingTop).Value = 4f;
}
[HarmonyPostfix]
[HarmonyPatch("OnCommonUpdate")]
private static void OnCommonUpdatePostfix(SessionPermissionController __instance)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((SyncField<colorX>)(object)((ContainerWorker<Component>)(object)((Component)__instance).Slot).GetComponent<Image>((Predicate<Image>)null, false).Tint).Value = (((((Component)__instance).Slot.ChildIndex & 1) == 0) ? SessionTabOverhaul.FirstRowColor.Value : SessionTabOverhaul.SecondRowColor.Value);
}
}
[ResonitePlugin("net.NepuShiro.SessionTabOverhaul", "SessionTabOverhaul", "2.2.2", "SessionTabOverhaul", "https://github.com/Gyztor/BepisSessionTabOverhaul")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SessionTabOverhaul : BasePlugin
{
internal static ManualLogSource Log;
internal static ConfigEntry<bool> ColorHostName;
internal static ConfigEntry<bool> ColorLocalUserName;
internal static ConfigEntry<bool> HideAllBadges;
internal static ConfigEntry<bool> HideCustomBadges;
internal static ConfigEntry<bool> HidePatreonBadge;
internal static ConfigEntry<bool> ShowParentUserCheckbox;
internal static ConfigEntry<bool> ShowBringButton;
internal static ConfigEntry<bool> ShowDeviceLabel;
internal static ConfigEntry<bool> ShowFPSOrQueuedMessages;
internal static ConfigEntry<bool> ShowSteamButton;
internal static ConfigEntry<bool> ShowVoiceMode;
internal static ConfigEntry<bool> ShowAudioWaveform;
internal static ConfigEntry<colorX> LocalUserColor;
internal static ConfigEntry<colorX> FirstRowColor;
internal static ConfigEntry<colorX> SecondRowColor;
[field: CompilerGenerated]
internal static bool SpritesInjected
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
public override void Load()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Expected O, but got Unknown
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Expected O, but got Unknown
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Expected O, but got Unknown
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Expected O, but got Unknown
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Expected O, but got Unknown
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Expected O, but got Unknown
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ColorHostName = ((BasePlugin)this).Config.Bind<bool>("Usernames", "Color Host Name", true, new ConfigDescription("Color the Host's username like the host icon.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ColorLocalUserName = ((BasePlugin)this).Config.Bind<bool>("Usernames", "Color Local Username", true, new ConfigDescription("Colors the Local Users's username.", (AcceptableValueBase)null, System.Array.Empty<object>()));
HideAllBadges = ((BasePlugin)this).Config.Bind<bool>("Badges", "Hide All Badges", false, new ConfigDescription("Hide all Badges in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
HideCustomBadges = ((BasePlugin)this).Config.Bind<bool>("Badges", "Hide Custom Badges", false, new ConfigDescription("Hide Custom Badges in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
HidePatreonBadge = ((BasePlugin)this).Config.Bind<bool>("Badges", "Hide Patreon Badge", false, new ConfigDescription("Hides the Patreon badge in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowParentUserCheckbox = ((BasePlugin)this).Config.Bind<bool>("User Manipulation", "Show Parent User Checkbox", true, new ConfigDescription("Show the Parent User checkbox in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowBringButton = ((BasePlugin)this).Config.Bind<bool>("User Manipulation", "Show Bring Button", true, new ConfigDescription("Show the Bring button in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowDeviceLabel = ((BasePlugin)this).Config.Bind<bool>("User Info", "Show Device Label", true, new ConfigDescription("Show the Device label in the Session Users list", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowFPSOrQueuedMessages = ((BasePlugin)this).Config.Bind<bool>("User Info", "Show FPS Or Queued", true, new ConfigDescription("Show the FPS / Queued messages in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowSteamButton = ((BasePlugin)this).Config.Bind<bool>("User Info", "Show Steam Button", false, new ConfigDescription("Show the Steam button in the Session Users list.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowVoiceMode = ((BasePlugin)this).Config.Bind<bool>("User Info", "Show Voice Mode", true, new ConfigDescription("Colors the Local Users's username.", (AcceptableValueBase)null, System.Array.Empty<object>()));
ShowAudioWaveform = ((BasePlugin)this).Config.Bind<bool>("User Info", "Show Audio Waveform", false, new ConfigDescription("Shows the Audio Output Waveform behind the user badges.", (AcceptableValueBase)null, System.Array.Empty<object>()));
LocalUserColor = ((BasePlugin)this).Config.Bind<colorX>("Usernames", "Local User Color", Hero.PURPLE, new ConfigDescription("The Color the Local Username should be set to.", (AcceptableValueBase)null, System.Array.Empty<object>()));
FirstRowColor = ((BasePlugin)this).Config.Bind<colorX>("Row Colors", "First Row Color", new colorX(0f, 0.85f, (ColorProfile)1), new ConfigDescription("Background color of the first row in the Session user lists.", (AcceptableValueBase)null, System.Array.Empty<object>()));
SecondRowColor = ((BasePlugin)this).Config.Bind<colorX>("Row Colors", "Second Row Color", new colorX(1f, 0.15f, (ColorProfile)1), new ConfigDescription("Background color of the second row in the Session user lists.", (AcceptableValueBase)null, System.Array.Empty<object>()));
try
{
((BasePlugin)this).HarmonyInstance.PatchAll();
Log.LogInfo((object)"SessionTabOverhaul Loaded!");
}
catch (System.Exception ex)
{
ManualLogSource log = Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SessionTabOverhaul failed to patch: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<System.Exception>(ex);
}
log.LogError(val);
}
}
}
internal class SessionUserControllerExtraData
{
[field: CompilerGenerated]
public Text? BadgesLabel
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Button? JumpButton
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Button? BringButton
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Checkbox? ParentUserCheckbox
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Text? DeviceLabel
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Text? FPSOrQueuedMessagesLabel
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Image? RowBackgroundImage
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public Text? VoiceModeLabel
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public ValueTag<float>? WaveformGraphTag
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public ValueTag<int>? WaveformGraphOffset
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public LineGraphMesh? WaveformLineGraphMesh
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
[field: CompilerGenerated]
public WeakReference<VolumeMeter>? WorldSpaceVolumeMeter
{
[CompilerGenerated]
get;
[CompilerGenerated]
set;
}
}
[HarmonyPatch(typeof(SessionUserController))]
internal static class SessionUserControllerPatches
{
[CompilerGenerated]
private sealed class <>c__DisplayClass14_0
{
[StructLayout((LayoutKind)3)]
private struct <<CreatePrefix>b__2>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder <>t__builder;
public <>c__DisplayClass14_0 <>4__this;
private TaskAwaiter<CloudResult<User>> <>u__1;
private void MoveNext()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
<>c__DisplayClass14_0 <>c__DisplayClass14_ = <>4__this;
try
{
TaskAwaiter<CloudResult<User>> val;
if (num != 0)
{
val = ((SkyFrostInterface)((Worker)<>c__DisplayClass14_.controller).Cloud).Users.GetUserCached(<>c__DisplayClass14_.user.UserID).GetAwaiter();
if (!val.IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = val;
((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<CloudResult<User>>, <<CreatePrefix>b__2>d>(ref val, ref this);
return;
}
}
else
{
val = <>u__1;
<>u__1 = default(TaskAwaiter<CloudResult<User>>);
num = (<>1__state = -1);
}
CloudResult<User> result = val.GetResult();
if (((CloudResult)result).IsOK)
{
<>c__DisplayClass14_.controller.SetCloudData(result.Entity);
}
}
catch (System.Exception exception)
{
<>1__state = -2;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
public SessionUserController controller;
public User user;
public SessionUserControllerExtraData extraData;
public Action <>9__4;
public Action <>9__5;
internal void <CreatePrefix>b__3(IButton _, ButtonEventData _)
{
if (!((ComponentBase<Component>)(object)controller).IsDestroyed)
{
((SyncField<float>)(object)controller._slider.Target.Value).Value = 1f;
}
}
internal void <CreatePrefix>b__0(IButton _, ButtonEventData _)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003c: Expected O, but got Unknown
if (((Worker)controller).World != Userspace.UserspaceWorld)
{
return;
}
World world = ((Worker)user).World;
Action obj = <>9__4;
if (obj == null)
{
Action val = delegate
{
//IL_0033: 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)
if (user.Root != null)
{
UserRoot root = ((Worker)user).World.LocalUser.Root;
if (root != null)
{
root.JumpToPoint(user.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value && root != null)
{
((Component)root).Slot.SetParent(((Component)user.Root).Slot.Parent, true);
}
object obj2;
if (root == null)
{
obj2 = null;
}
else
{
LocomotionController registeredComponent = root.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj2 = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj3 = ((obj2 is IPhysicalLocomotion) ? obj2 : null);
CharacterController val3 = ((obj3 != null) ? ((IPhysicalLocomotion)obj3).CharacterController : null);
if (val3 != null)
{
val3.LinearVelocity = float3.Zero;
}
}
};
Action val2 = val;
<>9__4 = val;
obj = val2;
}
world.RunSynchronously(obj, false, (IUpdatable)null, false);
}
internal void <CreatePrefix>b__4()
{
//IL_0033: 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)
if (user.Root != null)
{
UserRoot root = ((Worker)user).World.LocalUser.Root;
if (root != null)
{
root.JumpToPoint(user.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value && root != null)
{
((Component)root).Slot.SetParent(((Component)user.Root).Slot.Parent, true);
}
object obj;
if (root == null)
{
obj = null;
}
else
{
LocomotionController registeredComponent = root.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj2 = ((obj is IPhysicalLocomotion) ? obj : null);
CharacterController val = ((obj2 != null) ? ((IPhysicalLocomotion)obj2).CharacterController : null);
if (val != null)
{
val.LinearVelocity = float3.Zero;
}
}
}
internal void <CreatePrefix>b__1(IButton _, ButtonEventData _)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003c: Expected O, but got Unknown
if (((Worker)controller).World != Userspace.UserspaceWorld)
{
return;
}
World world = ((Worker)user).World;
Action obj = <>9__5;
if (obj == null)
{
Action val = delegate
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass14_1 CS$<>8__locals16 = new <>c__DisplayClass14_1
{
CS$<>8__locals1 = this
};
if (((Worker)user).World.LocalUser.Root != null)
{
CS$<>8__locals16.root = user.Root;
UserRoot obj2 = CS$<>8__locals16.root;
object obj3;
if (obj2 == null)
{
obj3 = null;
}
else
{
LocomotionController registeredComponent = obj2.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj3 = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj4 = ((obj3 is IPhysicalLocomotion) ? obj3 : null);
CS$<>8__locals16.charControl = ((obj4 != null) ? ((IPhysicalLocomotion)obj4).CharacterController : null);
if (CS$<>8__locals16.charControl != null && ((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value != 3.4028235E+38f)
{
CS$<>8__locals16.oldval = ((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value;
((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value = 3.4028235E+38f;
UserRoot obj5 = CS$<>8__locals16.root;
if (obj5 != null)
{
Slot slot = ((Component)obj5).Slot;
if (slot != null)
{
slot.RunInUpdates(15, (Action)delegate
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
UserRoot obj6 = CS$<>8__locals16.root;
if (obj6 != null)
{
obj6.JumpToPoint(((Worker)CS$<>8__locals16.CS$<>8__locals1.user).World.LocalUser.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = CS$<>8__locals16.CS$<>8__locals1.extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value)
{
UserRoot obj7 = CS$<>8__locals16.root;
if (obj7 != null)
{
((Component)obj7).Slot.SetParent(((Component)((Worker)CS$<>8__locals16.CS$<>8__locals1.user).World.LocalUser.Root).Slot.Parent, true);
}
}
((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value = CS$<>8__locals16.oldval;
});
}
}
}
}
};
Action val2 = val;
<>9__5 = val;
obj = val2;
}
world.RunSynchronously(obj, false, (IUpdatable)null, false);
}
internal void <CreatePrefix>b__5()
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass14_1 CS$<>8__locals16 = new <>c__DisplayClass14_1
{
CS$<>8__locals1 = this
};
if (((Worker)user).World.LocalUser.Root == null)
{
return;
}
CS$<>8__locals16.root = user.Root;
UserRoot obj = CS$<>8__locals16.root;
object obj2;
if (obj == null)
{
obj2 = null;
}
else
{
LocomotionController registeredComponent = obj.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj2 = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj3 = ((obj2 is IPhysicalLocomotion) ? obj2 : null);
CS$<>8__locals16.charControl = ((obj3 != null) ? ((IPhysicalLocomotion)obj3).CharacterController : null);
if (CS$<>8__locals16.charControl == null || ((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value == 3.4028235E+38f)
{
return;
}
CS$<>8__locals16.oldval = ((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value;
((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value = 3.4028235E+38f;
UserRoot obj4 = CS$<>8__locals16.root;
if (obj4 == null)
{
return;
}
Slot slot = ((Component)obj4).Slot;
if (slot == null)
{
return;
}
slot.RunInUpdates(15, (Action)delegate
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
UserRoot obj5 = CS$<>8__locals16.root;
if (obj5 != null)
{
obj5.JumpToPoint(((Worker)CS$<>8__locals16.CS$<>8__locals1.user).World.LocalUser.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = CS$<>8__locals16.CS$<>8__locals1.extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value)
{
UserRoot obj6 = CS$<>8__locals16.root;
if (obj6 != null)
{
((Component)obj6).Slot.SetParent(((Component)((Worker)CS$<>8__locals16.CS$<>8__locals1.user).World.LocalUser.Root).Slot.Parent, true);
}
}
((SyncField<float>)(object)CS$<>8__locals16.charControl.LinearDamping).Value = CS$<>8__locals16.oldval;
});
}
[AsyncStateMachine(typeof(<<CreatePrefix>b__2>d))]
internal System.Threading.Tasks.Task <CreatePrefix>b__2()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<<CreatePrefix>b__2>d <<CreatePrefix>b__2>d = default(<<CreatePrefix>b__2>d);
<<CreatePrefix>b__2>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<CreatePrefix>b__2>d.<>4__this = this;
<<CreatePrefix>b__2>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<CreatePrefix>b__2>d.<>t__builder)).Start<<<CreatePrefix>b__2>d>(ref <<CreatePrefix>b__2>d);
return ((AsyncTaskMethodBuilder)(ref <<CreatePrefix>b__2>d.<>t__builder)).Task;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass14_1
{
public UserRoot root;
public CharacterController charControl;
public float oldval;
public <>c__DisplayClass14_0 CS$<>8__locals1;
internal void <CreatePrefix>b__6()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
UserRoot obj = root;
if (obj != null)
{
obj.JumpToPoint(((Worker)CS$<>8__locals1.user).World.LocalUser.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = CS$<>8__locals1.extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value)
{
UserRoot obj2 = root;
if (obj2 != null)
{
((Component)obj2).Slot.SetParent(((Component)((Worker)CS$<>8__locals1.user).World.LocalUser.Root).Slot.Parent, true);
}
}
((SyncField<float>)(object)charControl.LinearDamping).Value = oldval;
}
}
private const string headless = "headless";
private const string headlessSprite = "<sprite name=\"headless\">";
private const string screen = "screen";
private const string screenSprite = "<sprite name=\"screen\">";
private const string vr = "vr";
private const string vrSprite = "<sprite name=\"vr\">";
private const string muteSprite = "<sprite name=\"Mute\">";
private const string whisperSprite = "<sprite name=\"Whisper\">";
private const string normalSprite = "<sprite name=\"Normal\">";
private const string shoutSprite = "<sprite name=\"Shout\">";
private const string broadcastSprite = "<sprite name=\"Broadcast\">";
private static readonly colorX HostColor = new colorX(1f, 0.678f, 0.169f, 1f, (ColorProfile)1);
private static colorX? _initialColor;
private static readonly ConditionalWeakTable<SessionUserController, SessionUserControllerExtraData> controllerExtraData = new ConditionalWeakTable<SessionUserController, SessionUserControllerExtraData>();
[HarmonyPrefix]
[HarmonyPatch("Create")]
private static bool CreatePrefix(out SessionUserController __result, User user, UIBuilder ui)
{
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: 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_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: 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_05bc: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0603: Unknown result type (might be due to invalid IL or missing references)
//IL_0613: Unknown result type (might be due to invalid IL or missing references)
//IL_0622: Unknown result type (might be due to invalid IL or missing references)
//IL_0517: Unknown result type (might be due to invalid IL or missing references)
//IL_051c: Unknown result type (might be due to invalid IL or missing references)
//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0700: Unknown result type (might be due to invalid IL or missing references)
//IL_070f: Unknown result type (might be due to invalid IL or missing references)
//IL_0719: Expected O, but got Unknown
//IL_0759: Unknown result type (might be due to invalid IL or missing references)
//IL_075e: Unknown result type (might be due to invalid IL or missing references)
//IL_077d: Unknown result type (might be due to invalid IL or missing references)
//IL_0787: Expected O, but got Unknown
//IL_0658: Unknown result type (might be due to invalid IL or missing references)
//IL_065d: Unknown result type (might be due to invalid IL or missing references)
//IL_0679: Unknown result type (might be due to invalid IL or missing references)
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0696: Expected O, but got Unknown
//IL_079f: Unknown result type (might be due to invalid IL or missing references)
//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
//IL_07cd: Expected O, but got Unknown
//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
//IL_08cf: 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_08e8: Expected O, but got Unknown
//IL_0911: 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_0925: Unknown result type (might be due to invalid IL or missing references)
//IL_092f: Expected O, but got Unknown
//IL_0958: Unknown result type (might be due to invalid IL or missing references)
//IL_095d: Unknown result type (might be due to invalid IL or missing references)
//IL_096c: Unknown result type (might be due to invalid IL or missing references)
//IL_0976: Expected O, but got Unknown
//IL_098f: Unknown result type (might be due to invalid IL or missing references)
//IL_0994: Unknown result type (might be due to invalid IL or missing references)
//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
//IL_09ad: Expected O, but got Unknown
//IL_0810: Unknown result type (might be due to invalid IL or missing references)
//IL_0815: Unknown result type (might be due to invalid IL or missing references)
//IL_09db: Unknown result type (might be due to invalid IL or missing references)
//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0a03: Invalid comparison between Unknown and I4
//IL_088d: Unknown result type (might be due to invalid IL or missing references)
//IL_0897: Expected O, but got Unknown
//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a21: Invalid comparison between Unknown and I4
<>c__DisplayClass14_0 CS$<>8__locals87 = new <>c__DisplayClass14_0();
CS$<>8__locals87.user = user;
ui.Style.MinHeight = SessionUserController.HEIGHT + 8;
HorizontalLayout val = ui.HorizontalLayout(4f, 4f, (Alignment?)(Alignment)4);
((SyncField<bool>)(object)((DirectionalLayout)val).ForceExpandHeight).Value = false;
((SyncField<bool>)(object)((DirectionalLayout)val).ForceExpandWidth).Value = false;
CS$<>8__locals87.controller = ((ContainerWorker<Component>)(object)((Component)val).Slot).AttachComponent<SessionUserController>(true, (Action<SessionUserController>)null);
CS$<>8__locals87.controller._cachedUserName = CS$<>8__locals87.user.UserName;
CS$<>8__locals87.controller.TargetUser = CS$<>8__locals87.user;
CS$<>8__locals87.extraData = controllerExtraData.GetOrCreateValue(CS$<>8__locals87.controller);
FontCollection badgeFontCollection = CS$<>8__locals87.controller.GetBadgeFontCollection();
CS$<>8__locals87.extraData.RowBackgroundImage = ((ContainerWorker<Component>)(object)((Component)val).Slot).AttachComponent<Image>(true, (Action<Image>)null);
((SyncField<colorX>)(object)CS$<>8__locals87.extraData.RowBackgroundImage.Tint).Value = (((((Component)val).Slot.ChildIndex & 1) == 0) ? SessionTabOverhaul.FirstRowColor.Value : SessionTabOverhaul.SecondRowColor.Value);
LocaleString val2;
if (SessionTabOverhaul.ShowFPSOrQueuedMessages.Value)
{
ui.Style.MinHeight = SessionUserController.HEIGHT;
ui.Style.MinWidth = 2.5f * (float)SessionUserController.HEIGHT;
ui.Panel();
SessionUserControllerExtraData sessionUserControllerExtraData = CS$<>8__locals87.extraData;
val2 = LocaleString.op_Implicit(GetUserFPSOrQueuedMessages(CS$<>8__locals87.user));
sessionUserControllerExtraData.FPSOrQueuedMessagesLabel = ui.Text(ref val2, true, (Alignment?)(Alignment)4, true, (string)null);
((SyncRef<IAssetProvider<FontSet>>)(object)CS$<>8__locals87.extraData.FPSOrQueuedMessagesLabel.Font).Target = (IAssetProvider<FontSet>)(object)badgeFontCollection;
ui.NestOut();
}
colorX val3;
if (SessionTabOverhaul.ShowDeviceLabel.Value)
{
ui.Style.MinWidth = 1.5f * (float)SessionUserController.HEIGHT;
ui.Style.MinHeight = 0.8f * (float)SessionUserController.HEIGHT;
ui.Panel();
SessionUserControllerExtraData sessionUserControllerExtraData2 = CS$<>8__locals87.extraData;
val2 = LocaleString.op_Implicit(GetUserDevice(CS$<>8__locals87.user));
sessionUserControllerExtraData2.DeviceLabel = ui.Text(ref val2, true, (Alignment?)(Alignment)4, true, (string)null);
((SyncRef<IAssetProvider<FontSet>>)(object)CS$<>8__locals87.extraData.DeviceLabel.Font).Target = (IAssetProvider<FontSet>)(object)badgeFontCollection;
Sync<colorX> color = CS$<>8__locals87.extraData.DeviceLabel.Color;
val3 = colorX.Red;
((SyncField<colorX>)(object)color).Value = ((colorX)(ref val3)).SetValue(0.7f);
ui.NestOut();
}
ui.Style.MinWidth = -1f;
ui.Style.FlexibleWidth = 1f;
ui.Style.MinHeight = SessionUserController.HEIGHT;
ui.Panel();
SyncRef<Text> name = CS$<>8__locals87.controller._name;
val2 = LocaleString.op_Implicit(CS$<>8__locals87.controller._cachedUserName);
name.Target = ui.Text(ref val2, true, (Alignment?)(Alignment)3, true, (string)null);
val3 = _initialColor.GetValueOrDefault();
if (!_initialColor.HasValue)
{
val3 = ((SyncField<colorX>)(object)CS$<>8__locals87.controller._name.Target.Color).Value;
_initialColor = val3;
}
if (CS$<>8__locals87.user.IsHost && SessionTabOverhaul.ColorHostName.Value)
{
((SyncField<colorX>)(object)CS$<>8__locals87.controller._name.Target.Color).Value = HostColor;
}
if (CS$<>8__locals87.user.IsLocalUser && SessionTabOverhaul.ColorLocalUserName.Value)
{
((SyncField<colorX>)(object)CS$<>8__locals87.controller._name.Target.Color).Value = SessionTabOverhaul.LocalUserColor.Value;
}
if (CS$<>8__locals87.user.UserID != null)
{
UIExtensions.SetupAction<string>(((ContainerWorker<Component>)(object)((Component)CS$<>8__locals87.controller._name.Target).Slot).AttachComponent<Button>(true, (Action<Button>)null), (ButtonEventHandler<string>)SessionUserController.OpenUserProfile, CS$<>8__locals87.user.UserID, 0f);
}
ui.NestOut();
ui.Style.FlexibleWidth = -1f;
ui.Style.MinWidth = 224f;
ui.Style.MinHeight = 0.8f * (float)SessionUserController.HEIGHT;
ui.Panel();
ui.OverlappingLayout(0f, (Alignment?)null);
if (SessionTabOverhaul.ShowAudioWaveform.Value)
{
RectMesh<LineGraphMesh> obj = ui.RectMesh<LineGraphMesh>((IAssetProvider<Material>)null);
LineGraphMesh mesh = obj.Mesh;
((SyncField<float>)(object)mesh.Width).Value = 1f;
ValueGraphRecorder val4 = ((ContainerWorker<Component>)(object)((Component)obj).Slot).AttachComponent<ValueGraphRecorder>(true, (Action<ValueGraphRecorder>)null);
ValueTag<float> val5 = ((ContainerWorker<Component>)(object)((Component)obj).Slot).AttachComponent<ValueTag<float>>(true, (Action<ValueTag<float>>)null);
val4.SourceValue.Target = (IField<float>)(object)val5.Value;
val4.TargetArray.Target = mesh.Values;
val4.TargetArrayOffset.Target = (IField<int>)(object)mesh.StartIndex;
val4.RangeMin.Target = (IField<float>)(object)mesh.MinValue;
val4.RangeMax.Target = (IField<float>)(object)mesh.MaxValue;
((SyncField<int>)(object)val4.Points).Value = 256;
ValueTag<int> val6 = ((ContainerWorker<Component>)(object)((Component)obj).Slot).AttachComponent<ValueTag<int>>(true, (Action<ValueTag<int>>)null);
val4.TargetArrayOffset.Target = (IField<int>)(object)val6.Value;
CS$<>8__locals87.extraData.WaveformLineGraphMesh = mesh;
CS$<>8__locals87.extraData.WaveformGraphOffset = val6;
CS$<>8__locals87.extraData.WaveformGraphTag = val5;
}
if (!SessionTabOverhaul.HideAllBadges.Value)
{
SessionUserControllerExtraData sessionUserControllerExtraData3 = CS$<>8__locals87.extraData;
val2 = LocaleString.op_Implicit("");
sessionUserControllerExtraData3.BadgesLabel = ui.Text(ref val2, true, (Alignment?)(Alignment)3, true, (string)null);
((SyncRef<IAssetProvider<FontSet>>)(object)CS$<>8__locals87.extraData.BadgesLabel.Font).Target = (IAssetProvider<FontSet>)(object)badgeFontCollection;
}
ui.NestOut();
ui.NestOut();
ui.Style.MinWidth = 192f;
ui.Style.MinHeight = SessionUserController.HEIGHT;
CS$<>8__locals87.controller._slider.Target = ui.Slider((float)SessionUserController.HEIGHT, 1f, 0f, 2f, false);
((SyncField<colorX>)(object)((InteractionElement)CS$<>8__locals87.controller._slider.Target).BaseColor).Value = GetUserVoiceModeColor(CS$<>8__locals87.user);
ColorDriver obj2 = ((SyncElementList<ColorDriver>)(object)((InteractionElement)CS$<>8__locals87.controller._slider.Target).ColorDrivers)[0];
((SyncField<ColorMode>)(object)obj2.TintColorMode).Value = (ColorMode)0;
((SyncField<colorX>)(object)obj2.NormalColor).Value = colorX.LightGray;
((SyncField<colorX>)(object)obj2.HighlightColor).Value = colorX.White;
((SyncField<colorX>)(object)obj2.PressColor).Value = colorX.Gray;
((SyncField<colorX>)(object)obj2.DisabledColor).Value = colorX.DarkGray;
if (SessionTabOverhaul.ShowVoiceMode.Value)
{
ui.Style.MinWidth = SessionUserController.HEIGHT;
val2 = LocaleString.op_Implicit(GetUserVoiceModeLabel(CS$<>8__locals87.user));
Button val7 = ui.Button(ref val2);
((SyncField<colorX>)(object)((InteractionElement)val7).BaseColor).Value = new colorX(1f, 0f, (ColorProfile)1);
val7.LocalPressed += (ButtonEventHandler)delegate
{
if (!((ComponentBase<Component>)(object)CS$<>8__locals87.controller).IsDestroyed)
{
((SyncField<float>)(object)CS$<>8__locals87.controller._slider.Target.Value).Value = 1f;
}
};
CS$<>8__locals87.extraData.VoiceModeLabel = ((Component)val7).Slot.GetComponentInChildren<Text>((Predicate<Text>)null, false, false);
((SyncRef<IAssetProvider<FontSet>>)(object)CS$<>8__locals87.extraData.VoiceModeLabel.Font).Target = (IAssetProvider<FontSet>)(object)badgeFontCollection;
}
ui.Style.MinWidth = 64f;
ui.Style.MinHeight = SessionUserController.HEIGHT;
SyncRef<Button> mute = CS$<>8__locals87.controller._mute;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Mute", (string)null, true, (Dictionary<string, object>)null);
mute.Target = ui.Button(ref val2, new ButtonEventHandler(CS$<>8__locals87.controller.OnMute));
CS$<>8__locals87.controller._jump.Target = ((ContainerWorker<Component>)(object)ui.World.RootSlot.FindChildOrAdd("__TEMP", true)).GetComponentOrAttach<Button>((Predicate<Button>)null);
SessionUserControllerExtraData sessionUserControllerExtraData4 = CS$<>8__locals87.extraData;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Jump", (string)null, true, (Dictionary<string, object>)null);
sessionUserControllerExtraData4.JumpButton = ui.Button(ref val2);
CS$<>8__locals87.extraData.JumpButton.LocalPressed += (ButtonEventHandler)delegate
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003c: Expected O, but got Unknown
if (((Worker)CS$<>8__locals87.controller).World == Userspace.UserspaceWorld)
{
World world = ((Worker)CS$<>8__locals87.user).World;
Action obj4 = CS$<>8__locals87.<>9__4;
if (obj4 == null)
{
Action val10 = delegate
{
//IL_0033: 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)
if (CS$<>8__locals87.user.Root != null)
{
UserRoot root = ((Worker)CS$<>8__locals87.user).World.LocalUser.Root;
if (root != null)
{
root.JumpToPoint(CS$<>8__locals87.user.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = CS$<>8__locals87.extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value && root != null)
{
((Component)root).Slot.SetParent(((Component)CS$<>8__locals87.user.Root).Slot.Parent, true);
}
object obj5;
if (root == null)
{
obj5 = null;
}
else
{
LocomotionController registeredComponent = root.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj5 = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj6 = ((obj5 is IPhysicalLocomotion) ? obj5 : null);
CharacterController val12 = ((obj6 != null) ? ((IPhysicalLocomotion)obj6).CharacterController : null);
if (val12 != null)
{
val12.LinearVelocity = float3.Zero;
}
}
};
Action val11 = val10;
CS$<>8__locals87.<>9__4 = val10;
obj4 = val11;
}
world.RunSynchronously(obj4, false, (IUpdatable)null, false);
}
};
if (SessionTabOverhaul.ShowBringButton.Value)
{
SessionUserControllerExtraData sessionUserControllerExtraData5 = CS$<>8__locals87.extraData;
val2 = LocaleString.op_Implicit("Bring");
sessionUserControllerExtraData5.BringButton = ui.Button(ref val2);
CS$<>8__locals87.extraData.BringButton.LocalPressed += (ButtonEventHandler)delegate
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003c: Expected O, but got Unknown
if (((Worker)CS$<>8__locals87.controller).World == Userspace.UserspaceWorld)
{
World world = ((Worker)CS$<>8__locals87.user).World;
Action obj4 = CS$<>8__locals87.<>9__5;
if (obj4 == null)
{
Action val10 = delegate
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass14_0 <>c__DisplayClass14_ = CS$<>8__locals87;
if (((Worker)CS$<>8__locals87.user).World.LocalUser.Root != null)
{
UserRoot root = CS$<>8__locals87.user.Root;
UserRoot obj5 = root;
object obj6;
if (obj5 == null)
{
obj6 = null;
}
else
{
LocomotionController registeredComponent = obj5.GetRegisteredComponent<LocomotionController>((Predicate<LocomotionController>)null);
obj6 = ((registeredComponent != null) ? registeredComponent.ActiveModule : null);
}
object obj7 = ((obj6 is IPhysicalLocomotion) ? obj6 : null);
CharacterController charControl = ((obj7 != null) ? ((IPhysicalLocomotion)obj7).CharacterController : null);
if (charControl != null && ((SyncField<float>)(object)charControl.LinearDamping).Value != 3.4028235E+38f)
{
float oldval = ((SyncField<float>)(object)charControl.LinearDamping).Value;
((SyncField<float>)(object)charControl.LinearDamping).Value = 3.4028235E+38f;
UserRoot obj8 = root;
if (obj8 != null)
{
Slot slot = ((Component)obj8).Slot;
if (slot != null)
{
slot.RunInUpdates(15, (Action)delegate
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
UserRoot obj9 = root;
if (obj9 != null)
{
obj9.JumpToPoint(((Worker)<>c__DisplayClass14_.user).World.LocalUser.Root.HeadPosition, 1.5f);
}
Checkbox? parentUserCheckbox = <>c__DisplayClass14_.extraData.ParentUserCheckbox;
if (parentUserCheckbox != null && ((SyncField<bool>)(object)parentUserCheckbox.State).Value)
{
UserRoot obj10 = root;
if (obj10 != null)
{
((Component)obj10).Slot.SetParent(((Component)((Worker)<>c__DisplayClass14_.user).World.LocalUser.Root).Slot.Parent, true);
}
}
((SyncField<float>)(object)charControl.LinearDamping).Value = oldval;
});
}
}
}
}
};
Action val11 = val10;
CS$<>8__locals87.<>9__5 = val10;
obj4 = val11;
}
world.RunSynchronously(obj4, false, (IUpdatable)null, false);
}
};
}
if (SessionTabOverhaul.ShowParentUserCheckbox.Value)
{
CS$<>8__locals87.extraData.ParentUserCheckbox = ui.Checkbox(false);
}
if (SessionTabOverhaul.ShowSteamButton.Value)
{
ui.Style.MinWidth = 80f;
val2 = LocaleString.op_Implicit("Steam");
Button val8 = ui.Button(ref val2);
((ComponentBase<Component>)(object)val8).Enabled = false;
SyncVar val9 = default(SyncVar);
ulong num = default(ulong);
if (CS$<>8__locals87.user.Metadata.TryGetElement("SteamID", ref val9) && val9.TryGetValue<ulong>(ref num))
{
((ComponentBase<Component>)(object)val8).Enabled = true;
Hyperlink obj3 = ((ContainerWorker<Component>)(object)((Component)val8).Slot).AttachComponent<Hyperlink>(true, (Action<Hyperlink>)null);
((SyncField<Uri>)(object)obj3.URL).Value = new Uri($"https://steamcommunity.com/profiles/{num}");
((SyncField<string>)(object)obj3.Reason).Value = "SessionTabOverhaul Steam Profile";
}
}
ui.Style.MinWidth = 108f;
SyncRef<Button> respawn = CS$<>8__locals87.controller._respawn;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Respawn", (string)null, true, (Dictionary<string, object>)null);
respawn.Target = ui.Button(ref val2, new ButtonEventHandler(CS$<>8__locals87.controller.OnRespawn));
ui.Style.MinWidth = 80f;
SyncRef<Button> silence = CS$<>8__locals87.controller._silence;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Silence", (string)null, true, (Dictionary<string, object>)null);
silence.Target = ui.Button(ref val2, new ButtonEventHandler(CS$<>8__locals87.controller.OnSilence));
ui.Style.MinWidth = 48f;
SyncRef<Button> kick = CS$<>8__locals87.controller._kick;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Kick", (string)null, true, (Dictionary<string, object>)null);
kick.Target = ui.Button(ref val2, new ButtonEventHandler(CS$<>8__locals87.controller.OnKick));
SyncRef<Button> ban = CS$<>8__locals87.controller._ban;
val2 = LocaleHelper.AsLocaleKey("User.Actions.Ban", (string)null, true, (Dictionary<string, object>)null);
ban.Target = ui.Button(ref val2, new ButtonEventHandler(CS$<>8__locals87.controller.OnBan));
ui.NestOut();
if (CS$<>8__locals87.user.IsHost)
{
CS$<>8__locals87.controller.AddBadge("host");
}
if (PlatformExtensions.IsMobilePlatform(CS$<>8__locals87.user.Platform))
{
CS$<>8__locals87.controller.AddBadge("mobile");
}
if ((int)CS$<>8__locals87.user.Platform == 2)
{
CS$<>8__locals87.controller.AddBadge("linux");
}
if ((int)CS$<>8__locals87.user.HeadDevice == 1)
{
CS$<>8__locals87.controller.AddBadge("headless");
}
if (CS$<>8__locals87.user.UserID != null)
{
((Worker)CS$<>8__locals87.controller).StartTask((Func<System.Threading.Tasks.Task>)([AsyncStateMachine(typeof(<>c__DisplayClass14_0.<<CreatePrefix>b__2>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass14_0.<<CreatePrefix>b__2>d <<CreatePrefix>b__2>d = default(<>c__DisplayClass14_0.<<CreatePrefix>b__2>d);
<<CreatePrefix>b__2>d.<>t__builder = AsyncTaskMethodBuilder.Create();
<<CreatePrefix>b__2>d.<>4__this = CS$<>8__locals87;
<<CreatePrefix>b__2>d.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <<CreatePrefix>b__2>d.<>t__builder)).Start<<>c__DisplayClass14_0.<<CreatePrefix>b__2>d>(ref <<CreatePrefix>b__2>d);
return ((AsyncTaskMethodBuilder)(ref <<CreatePrefix>b__2>d.<>t__builder)).Task;
}));
}
__result = CS$<>8__locals87.controller;
return false;
}
[HarmonyPrefix]
[HarmonyPatch("AddBadge", new System.Type[] { typeof(string) })]
private static bool AddStandardBadgePrefix(SessionUserController __instance, string spriteName)
{
SessionUserControllerExtraData sessionUserControllerExtraData = default(SessionUserControllerExtraData);
if (!controllerExtraData.TryGetValue(__instance, ref sessionUserControllerExtraData) || sessionUserControllerExtraData?.BadgesLabel == null)
{
return false;
}
if (SessionTabOverhaul.HidePatreonBadge.Value && (spriteName == "patreon" || spriteName == "stripe" || spriteName == "supporter"))
{
return false;
}
Sync<string> content = sessionUserControllerExtraData.BadgesLabel.Content;
if (((SyncField<string>)(object)content).Value.Length > 0)
{
((SyncField<string>)(object)content).Value = ((SyncField<string>)(object)content).Value + " ";
}
((SyncField<string>)(object)content).Value = ((SyncField<string>)(object)content).Value + "<sprite name=\"" + spriteName + "\">";
return false;
}
[HarmonyPrefix]
[HarmonyPatch("AddBadge", new System.Type[]
{
typeof(Uri),
typeof(string),
typeof(bool)
})]
private static bool AddCustomBadgePrefix(SessionUserController __instance, Uri badge, string key)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
DynamicSpriteFont val = (DynamicSpriteFont)__instance.GetBadgeFontCollection().FontSets[1];
if (!val.HasSprite(key))
{
val.AddSprite(key, badge, 1.25f);
}
if (SessionTabOverhaul.HideCustomBadges.Value)
{
return false;
}
AddStandardBadgePrefix(__instance, key);
return false;
}
[HarmonyPostfix]
[HarmonyPatch("GetBadgeFontCollection")]
private unsafe static void GetBadgeFontCollectionPostfix(FontCollection __result)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
if (SessionTabOverhaul.SpritesInjected)
{
return;
}
DynamicSpriteFont val = (DynamicSpriteFont)__result.FontSets[1];
if (!val.HasSprite("screen"))
{
val.AddSprite("screen", new Uri("resdb:///1c88a45653f60a9b29eefc5e3adc4659f3021a85debd5b4f3425ff29d4564794"), 1f);
}
if (!val.HasSprite("vr"))
{
val.AddSprite("vr", new Uri("resdb:///1d2dc53aa1b44d8a21aaaa3ce41b695ae724eb0553e7ee08d50fc0c7922ae149"), 1f);
}
VoiceMode[] values = System.Enum.GetValues<VoiceMode>();
for (int i = 0; i < values.Length; i++)
{
VoiceMode val2 = values[i];
string text = ((object)(*(VoiceMode*)(&val2))/*cast due to .constrained prefix*/).ToString();
if (!val.HasSprite(text))
{
val.AddSprite(text, VoiceHelper.GetIcon(val2), 1f);
}
}
SessionTabOverhaul.SpritesInjected = true;
}
private static string GetUserDevice(User user)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)user.HeadDevice == 1)
{
return "<sprite name=\"headless\">";
}
if (user.VR_Active)
{
return "<sprite name=\"vr\">";
}
return "<sprite name=\"screen\">";
}
private static VoiceMode GetUserVoiceMode(User user)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!Sync<bool>.op_Implicit(user.isMuted))
{
return user.VoiceMode;
}
return (VoiceMode)0;
}
private static string GetUserVoiceModeLabel(User user)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected I4, but got Unknown
VoiceMode userVoiceMode = GetUserVoiceMode(user);
return (int)userVoiceMode switch
{
0 => "<sprite name=\"Mute\">",
1 => "<sprite name=\"Whisper\">",
2 => "<sprite name=\"Normal\">",
3 => "<sprite name=\"Shout\">",
4 => "<sprite name=\"Broadcast\">",
_ => "",
};
}
private static colorX GetUserVoiceModeColor(User user)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
colorX color = VoiceHelper.GetColor(GetUserVoiceMode(user));
return ((colorX)(ref color)).SetSaturation(0.5f);
}
private static string GetUserFPSOrQueuedMessages(User user)
{
//IL_005e: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (user.QueuedMessages <= 10)
{
return $"<color=#F0F0F0>{MathX.RoundToInt(user.FPS)} <size=60%>FPS";
}
System.Runtime.CompilerServices.DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new System.Runtime.CompilerServices.DefaultInterpolatedStringHandler(22, 2);
defaultInterpolatedStringHandler.AppendLiteral("<color=");
colorX val = colorX.Red;
val = ((colorX)(ref val)).SetValue(0.7f);
defaultInterpolatedStringHandler.AppendFormatted(((colorX)(ref val)).ToHexString(false, "#"));
defaultInterpolatedStringHandler.AppendLiteral(">");
defaultInterpolatedStringHandler.AppendFormatted<int>(user.QueuedMessages);
defaultInterpolatedStringHandler.AppendLiteral(" <size=60%>Q'd");
return defaultInterpolatedStringHandler.ToStringAndClear();
}
private static void AssignVoiceStream(User user, OpusStream<MonoSample>? voiceStream, SessionUserControllerExtraData extraData)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
if (voiceStream == null)
{
voiceStream = Enumerable.FirstOrDefault<OpusStream<MonoSample>>(Enumerable.OfType<OpusStream<MonoSample>>((System.Collections.IEnumerable)user.Streams), (Func<OpusStream<MonoSample>, bool>)((OpusStream<MonoSample> s) => ((Stream)s).Name == "Voice"));
}
if (voiceStream == null)
{
return;
}
((Worker)user).World.RunSynchronously((Action)delegate
{
if (((Worker)user).World.LocalUser.Root != null)
{
UserRoot root = user.Root;
Slot val = ((root != null) ? ((Component)root).Slot : null);
if (val != null)
{
VolumeMeter componentOrAttach = ((ContainerWorker<Component>)(object)val.FindLocalChildOrAdd(user.UserName + "'s Voice Stream VolumeMeter")).GetComponentOrAttach<VolumeMeter>((Predicate<VolumeMeter>)null);
((VolumeMeterBase)componentOrAttach).Source.Target = (IWorldAudioDataSource)(object)voiceStream;
((SyncField<float>)(object)((VolumeMeterBase)componentOrAttach).Power).Value = 0.25f;
((SyncField<float>)(object)((VolumeMeterBase)componentOrAttach).Smoothing).Value = 0f;
extraData.WorldSpaceVolumeMeter = new WeakReference<VolumeMeter>(componentOrAttach);
}
}
}, false, (IUpdatable)null, false);
}
[HarmonyPostfix]
[HarmonyPatch("OnCommonUpdate")]
private static void OnCommonUpdatePostfix(SessionUserController __instance)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Invalid comparison between Unknown and I4
//IL_0046: 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_01ae: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00f6: 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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
SessionUserControllerExtraData sessionUserControllerExtraData = default(SessionUserControllerExtraData);
if (!controllerExtraData.TryGetValue(__instance, ref sessionUserControllerExtraData) || sessionUserControllerExtraData == null)
{
return;
}
if (sessionUserControllerExtraData.RowBackgroundImage != null)
{
((SyncField<colorX>)(object)sessionUserControllerExtraData.RowBackgroundImage.Tint).Value = (((((Component)__instance).Slot.ChildIndex & 1) == 0) ? SessionTabOverhaul.FirstRowColor.Value : SessionTabOverhaul.SecondRowColor.Value);
}
User targetUser = __instance.TargetUser;
if (__instance._name.Target != null && (int)targetUser.HeadDevice != 1)
{
if (!targetUser.IsPresentInWorld)
{
((SyncField<colorX>)(object)__instance._name.Target.Color).Value = colorX.Red;
}
else if (!targetUser.IsPresentInHeadset)
{
Sync<colorX> color = __instance._name.Target.Color;
colorX red = colorX.Red;
((SyncField<colorX>)(object)color).Value = ((colorX)(ref red)).SetSaturation(0.5f);
}
else
{
((SyncField<colorX>)(object)__instance._name.Target.Color).Value = (colorX)(((??)_initialColor) ?? colorX.White);
if (targetUser.IsHost && SessionTabOverhaul.ColorHostName.Value)
{
((SyncField<colorX>)(object)__instance._name.Target.Color).Value = HostColor;
}
if (targetUser.IsLocalUser && SessionTabOverhaul.ColorLocalUserName.Value)
{
((SyncField<colorX>)(object)__instance._name.Target.Color).Value = SessionTabOverhaul.LocalUserColor.Value;
}
}
}
if (sessionUserControllerExtraData.FPSOrQueuedMessagesLabel != null)
{
((SyncField<string>)(object)sessionUserControllerExtraData.FPSOrQueuedMessagesLabel.Content).Value = GetUserFPSOrQueuedMessages(targetUser);
}
if (sessionUserControllerExtraData.DeviceLabel != null)
{
((SyncField<string>)(object)sessionUserControllerExtraData.DeviceLabel.Content).Value = GetUserDevice(targetUser);
}
((SyncField<colorX>)(object)((InteractionElement)__instance._slider.Target).BaseColor).Value = GetUserVoiceModeColor(targetUser);
if (sessionUserControllerExtraData.VoiceModeLabel != null)
{
((SyncField<string>)(object)sessionUserControllerExtraData.VoiceModeLabel.Content).Value = GetUserVoiceModeLabel(targetUser);
}
if (sessionUserControllerExtraData.JumpButton != null)
{
((ComponentBase<Component>)(object)sessionUserControllerExtraData.JumpButton).Enabled = !targetUser.IsLocalUser;
}
if (sessionUserControllerExtraData.BringButton != null)
{
((ComponentBase<Component>)(object)sessionUserControllerExtraData.BringButton).Enabled = !targetUser.IsLocalUser;
}
if (sessionUserControllerExtraData.ParentUserCheckbox != null)
{
((ComponentBase<Component>)(object)sessionUserControllerExtraData.ParentUserCheckbox).Enabled = !targetUser.IsLocalUser;
}
if (sessionUserControllerExtraData.WaveformGraphTag != null && sessionUserControllerExtraData.WaveformLineGraphMesh != null && sessionUserControllerExtraData.WaveformGraphOffset != null)
{
VolumeMeter val = default(VolumeMeter);
if (sessionUserControllerExtraData.WorldSpaceVolumeMeter != null && sessionUserControllerExtraData.WorldSpaceVolumeMeter.TryGetTarget(ref val) && val != null)
{
((SyncField<float>)(object)sessionUserControllerExtraData.WaveformGraphTag.Value).Value = 0.5f + val.Volume.Value / 2f * (float)((((Worker)__instance).World.Time.LocalUpdateIndex % 2 == 0) ? 1 : (-1));
}
else
{
((SyncField<float>)(object)sessionUserControllerExtraData.WaveformGraphTag.Value).Value = 0.5f;
AssignVoiceStream(targetUser, null, sessionUserControllerExtraData);
}
((SyncField<int>)(object)sessionUserControllerExtraData.WaveformLineGraphMesh.StartIndex).Value = Sync<int>.op_Implicit(sessionUserControllerExtraData.WaveformGraphOffset.Value) - 1;
}
}
}
public static class PluginMetadata
{
public const string GUID = "net.NepuShiro.SessionTabOverhaul";
public const string NAME = "SessionTabOverhaul";
public const string VERSION = "2.2.2";
public const string AUTHORS = "SessionTabOverhaul";
public const string REPOSITORY_URL = "https://github.com/Gyztor/BepisSessionTabOverhaul";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class IgnoresAccessChecksToAttribute : System.Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}