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.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OnTogetherMods.Shared;
using PurrNet;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FocusAnywhere")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.1.0")]
[assembly: AssemblyInformationalVersion("0.3.1+622bd7ccbb267719684ff770ce18e1834dc51b45")]
[assembly: AssemblyProduct("FocusAnywhere")]
[assembly: AssemblyTitle("FocusAnywhere")]
[assembly: AssemblyVersion("0.3.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 OnTogetherMods.Shared
{
internal static class PanelStack
{
private const string TableKey = "OnTogetherMods.PanelStack.Panels";
private const string HiddenKey = "OnTogetherMods.PanelStack.Hidden";
private const string IconBarKey = "OnTogetherMods.IconBar.Rect";
private const float Margin = 20f;
private const float FromRight = 0.15f;
private const float Gap = 10f;
private const int WorldScene = 2;
public const int PhotoModeOrder = 0;
public const int EmoteSyncOrder = 10;
public const int TeleportSpotsOrder = 20;
public const int SongPlayerOrder = 30;
public const int TraceOverlayOrder = 40;
public const int NameDesignerOrder = 50;
public const string CanvasPrefix = "OnTogetherMods ";
private static int _deskFrame = -1;
private static bool _desk;
public static float Width => (float)Screen.width * 1080f / (float)Screen.height;
public static bool Hidden
{
get
{
if (!(AppDomain.CurrentDomain.GetData("OnTogetherMods.PanelStack.Hidden") is int num) || Time.frameCount > num)
{
return InDeskMode;
}
return true;
}
}
public static bool InDeskMode
{
get
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0040: Invalid comparison between Unknown and I4
int frameCount = Time.frameCount;
if (_deskFrame != frameCount)
{
_deskFrame = frameCount;
_desk = false;
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).buildIndex == 2)
{
OverlayManager i = MonoSingleton<OverlayManager>.I;
_desk = (Object)(object)i != (Object)null && (int)i.ResolutionMode == 3;
}
}
return _desk;
}
}
public static bool IsModCanvas(Canvas canvas)
{
Canvas val = canvas;
Transform parent = ((Component)canvas).transform.parent;
while ((Object)(object)parent != (Object)null)
{
Canvas component = ((Component)parent).GetComponent<Canvas>();
val = (((Object)(object)component != (Object)null) ? component : val);
parent = parent.parent;
}
return ((Object)((Component)val).gameObject).name.StartsWith("OnTogetherMods ", StringComparison.Ordinal);
}
public static void HideForCapture()
{
AppDomain.CurrentDomain.SetData("OnTogetherMods.PanelStack.Hidden", Time.frameCount + 1);
}
public static Rect Place(string id, int order, Vector2 size)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
Hashtable hashtable = Panels();
int frameCount = Time.frameCount;
hashtable[id] = new double[3] { order, size.y, frameCount };
float width = Width;
float num = Mathf.Max(20f, width * 0.85f - size.x);
float num2 = Bottom(num + size.x, frameCount) - size.y;
foreach (DictionaryEntry item in hashtable)
{
string text = (string)item.Key;
double[] array = (double[])item.Value;
bool flag = (double)frameCount - array[2] <= 2.0;
bool flag2 = array[0] < (double)order || (array[0] == (double)order && string.CompareOrdinal(text, id) < 0);
if (text != id && flag && flag2)
{
num2 -= (float)array[1] + 10f;
}
}
return new Rect(num, num2, size.x, size.y);
}
private static float Bottom(float windowRight, int frame)
{
float num = 1060f;
if (AppDomain.CurrentDomain.GetData("OnTogetherMods.IconBar.Rect") is double[] array && (double)frame - array[4] <= 2.0)
{
float num2 = 1080f / (float)Screen.height;
if (array[0] * (double)num2 < (double)(windowRight + 10f))
{
num = Mathf.Min(num, (float)array[1] * num2 - 10f);
}
}
return num;
}
public static Matrix4x4 Begin(out float width)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
float num = (float)Screen.height / 1080f;
Matrix4x4 matrix = GUI.matrix;
GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
width = (float)Screen.width / num;
return matrix;
}
public static void End(Matrix4x4 previous)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
GUI.matrix = previous;
}
public static GUIStyle MakeStyle(TextAnchor alignment)
{
//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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_003f: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
GUIStyle val = new GUIStyle(GUI.skin.box)
{
alignment = alignment,
fontSize = 15,
richText = true,
wordWrap = false,
padding = new RectOffset(12, 12, 10, 10)
};
val.normal.textColor = Color.white;
return val;
}
private static Hashtable Panels()
{
Hashtable hashtable = AppDomain.CurrentDomain.GetData("OnTogetherMods.PanelStack.Panels") as Hashtable;
if (hashtable == null)
{
hashtable = new Hashtable();
AppDomain.CurrentDomain.SetData("OnTogetherMods.PanelStack.Panels", hashtable);
}
return hashtable;
}
}
internal static class IconBar
{
public enum State
{
Plain,
Open,
On,
Off
}
public enum Click
{
None,
Left,
Right
}
private struct Metrics
{
public float Unit;
public int Art;
public int Button;
public int Gap;
public int Margin;
}
private static class Patches
{
private static Action<InputManager, bool> _setMouse0Down;
private static Action<InputManager, bool> _setMouse1;
private static Action<InputManager, bool> _setMouse1Up;
private static FieldRef<QuadPainterGPU, Vector2> _previousUV;
private static bool _leftOnBar;
private static bool _rightOnBar;
public static void Apply(Harmony harmony)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Expected O, but got Unknown
_setMouse0Down = Setter("IsMouseButton0Down");
_setMouse1 = Setter("IsMouseButton1");
_setMouse1Up = Setter("IsMouseButton1Up");
harmony.Patch((MethodBase)AccessTools.Method(typeof(InputManager), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patches), "InputPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
_previousUV = AccessTools.FieldRefAccess<QuadPainterGPU, Vector2>("previousUV");
harmony.Patch((MethodBase)AccessTools.Method(typeof(QuadPainterGPU), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Patches), "PaintPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
private static void InputPostfix(InputManager __instance)
{
bool mouseOver = MouseOver;
if (Input.GetMouseButtonDown(0))
{
_leftOnBar = mouseOver;
}
if (Input.GetMouseButtonDown(1))
{
_rightOnBar = mouseOver;
}
if (mouseOver)
{
_setMouse0Down(__instance, arg2: false);
}
if (_rightOnBar)
{
_setMouse1(__instance, arg2: false);
_setMouse1Up(__instance, arg2: false);
}
if (!Input.GetMouseButton(0))
{
_leftOnBar = false;
}
if (!Input.GetMouseButton(1))
{
_rightOnBar = false;
}
}
private static bool PaintPrefix(QuadPainterGPU __instance)
{
if (__instance.IsActive && (_leftOnBar || MouseOver))
{
_previousUV.Invoke(__instance).x = -1f;
return false;
}
return true;
}
private static Action<InputManager, bool> Setter(string property)
{
return (Action<InputManager, bool>)Delegate.CreateDelegate(typeof(Action<InputManager, bool>), AccessTools.PropertySetter(typeof(InputManager), property));
}
}
public const int PhotoModeOrder = 0;
public const int EmoteSyncOrder = 10;
public const int TeleportSpotsOrder = 20;
public const int NameDesignerOrder = 30;
public const int DeskSnapOrder = 40;
public const int FocusAnywhereOrder = 50;
public const int SongPlayerOrder = 60;
public const int TraceOverlayOrder = 70;
public const int ChatRangeOrder = 80;
private const string RectKey = "OnTogetherMods.IconBar.Rect";
private const string TableKey = "OnTogetherMods.IconBar.Icons";
private const string PatchedKey = "OnTogetherMods.IconBar.Patched";
private const string BlockerKey = "OnTogetherMods.IconBar.Blocker";
private const string BlockerFrameKey = "OnTogetherMods.IconBar.BlockerFrame";
private const string HiddenKey = "OnTogetherMods.IconBar.HiddenUntil";
private const int WorldScene = 2;
private const int TooltipDepth = -100;
private static readonly Dictionary<char, Color32> Palette = new Dictionary<char, Color32>
{
{
'K',
new Color32((byte)42, (byte)36, (byte)51, byte.MaxValue)
},
{
'W',
new Color32((byte)247, (byte)243, (byte)234, byte.MaxValue)
},
{
'G',
new Color32((byte)201, (byte)198, (byte)207, byte.MaxValue)
},
{
'g',
new Color32((byte)143, (byte)138, (byte)153, byte.MaxValue)
},
{
'D',
new Color32((byte)87, (byte)82, (byte)95, byte.MaxValue)
},
{
'B',
new Color32((byte)168, (byte)107, (byte)60, byte.MaxValue)
},
{
'b',
new Color32((byte)217, (byte)160, (byte)102, byte.MaxValue)
},
{
'd',
new Color32((byte)110, (byte)67, (byte)37, byte.MaxValue)
},
{
'R',
new Color32((byte)224, (byte)90, (byte)90, byte.MaxValue)
},
{
'r',
new Color32((byte)168, (byte)58, (byte)70, byte.MaxValue)
},
{
'p',
new Color32((byte)246, (byte)165, (byte)165, byte.MaxValue)
},
{
'Y',
new Color32((byte)245, (byte)208, (byte)97, byte.MaxValue)
},
{
'y',
new Color32((byte)201, (byte)150, (byte)50, byte.MaxValue)
},
{
'O',
new Color32((byte)232, (byte)146, (byte)74, byte.MaxValue)
},
{
'L',
new Color32((byte)159, (byte)214, (byte)245, byte.MaxValue)
},
{
'U',
new Color32((byte)74, (byte)143, (byte)217, byte.MaxValue)
},
{
'u',
new Color32((byte)47, (byte)90, (byte)158, byte.MaxValue)
},
{
'N',
new Color32((byte)116, (byte)192, (byte)105, byte.MaxValue)
},
{
'n',
new Color32((byte)63, (byte)138, (byte)74, byte.MaxValue)
},
{
'P',
new Color32((byte)246, (byte)207, (byte)174, byte.MaxValue)
},
{
'V',
new Color32((byte)154, (byte)114, (byte)214, byte.MaxValue)
},
{
'v',
new Color32((byte)105, (byte)72, (byte)160, byte.MaxValue)
},
{
'S',
new Color32((byte)233, (byte)139, (byte)181, byte.MaxValue)
},
{
'H',
new Color32((byte)60, (byte)48, (byte)56, byte.MaxValue)
}
};
private static readonly Color32 ButtonFill = new Color32((byte)28, (byte)26, (byte)34, (byte)200);
private static readonly Color32 ButtonEdge = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)30);
private static readonly Color32 HoverFill = new Color32((byte)48, (byte)45, (byte)58, (byte)225);
private static readonly Color32 HoverEdge = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)80);
private static readonly Color32 OpenFill = new Color32((byte)70, (byte)64, (byte)88, (byte)235);
private static readonly Color32 OpenEdge = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)150);
private static readonly Color32 DotFill = new Color32((byte)140, (byte)220, (byte)120, byte.MaxValue);
private static readonly Color32 DotEdge = new Color32((byte)20, (byte)40, (byte)20, byte.MaxValue);
private static readonly Dictionary<string[], Texture2D[]> Icons = new Dictionary<string[], Texture2D[]>();
private static Texture2D _buttonTexture;
private static Texture2D _hoverTexture;
private static Texture2D _openTexture;
private static Texture2D _dotTexture;
private static GUIStyle _buttonStyle;
private static GUIStyle _tipStyle;
private static int _builtFor;
private static int _cachedFrame = -1;
private static bool _inWorld;
private static bool _visible;
private static int _pressedButton;
private static bool RowHidden
{
get
{
if (AppDomain.CurrentDomain.GetData("OnTogetherMods.IconBar.HiddenUntil") is int num)
{
return Time.frameCount <= num;
}
return false;
}
}
public static bool MouseOver
{
get
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
if (!(AppDomain.CurrentDomain.GetData("OnTogetherMods.IconBar.Rect") is double[] array) || array[5] < 0.5 || (double)Time.frameCount - array[4] > 2.0)
{
return false;
}
Vector3 mousePosition = Input.mousePosition;
Rect val = default(Rect);
((Rect)(ref val))..ctor((float)array[0], (float)array[1], (float)array[2], (float)array[3]);
return ((Rect)(ref val)).Contains(new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y));
}
}
public static Click Draw(string id, int order, string[] pixels, State state, string name, KeyCode key, string hint = null)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
int controlID = GUIUtility.GetControlID((FocusType)2);
Event current = Event.current;
Refresh();
if (!_inWorld)
{
Hide(controlID, current);
UpdateBlocker(shown: false, default(Rect));
return Click.None;
}
Rect bar;
Metrics m;
Rect icon = Place(id, order, out bar, out m);
Share(bar);
UpdateBlocker(_visible, bar);
if (!_visible)
{
Hide(controlID, current);
return Click.None;
}
Matrix4x4 matrix = GUI.matrix;
GUI.matrix = Matrix4x4.identity;
try
{
return Handle(controlID, current, icon, m, pixels, state, name, key, hint);
}
finally
{
GUI.matrix = matrix;
}
}
public static void HideRow()
{
AppDomain.CurrentDomain.SetData("OnTogetherMods.IconBar.HiddenUntil", Time.frameCount + 1);
}
public static string KeyText(KeyCode key)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if ((int)key != 0)
{
return $" ({key})";
}
return "";
}
private static Click Handle(int control, Event e, Rect icon, Metrics m, string[] pixels, State state, string name, KeyCode key, string hint)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected I4, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
bool flag = ((Rect)(ref icon)).Contains(e.mousePosition);
EventType typeForControl = e.GetTypeForControl(control);
switch ((int)typeForControl)
{
default:
{
if ((int)typeForControl != 7)
{
break;
}
BuildStyles(m);
bool flag2 = GUIUtility.hotControl == control;
_buttonStyle.normal.background = ((state == State.Open || (flag2 && flag)) ? _openTexture : (flag ? _hoverTexture : _buttonTexture));
_buttonStyle.Draw(icon, false, false, false, false);
Texture2D[] array = IconTextures(pixels);
GUI.DrawTexture(new Rect(((Rect)(ref icon)).x + (((Rect)(ref icon)).width - (float)m.Art) / 2f, ((Rect)(ref icon)).y + (((Rect)(ref icon)).height - (float)m.Art) / 2f, (float)m.Art, (float)m.Art), (Texture)(object)((state == State.Off) ? array[1] : array[0]));
if (state == State.On)
{
float num = Mathf.Max(1, Mathf.RoundToInt(2f * m.Unit));
float num2 = ((Texture)_dotTexture).width;
GUI.DrawTexture(new Rect(((Rect)(ref icon)).xMax - num - num2, ((Rect)(ref icon)).yMax - num - num2, num2, num2), (Texture)(object)_dotTexture);
}
int num3;
if (flag)
{
num3 = ((GUIUtility.hotControl == 0 || flag2) ? 1 : 0);
if (num3 != 0)
{
DrawTooltip(icon, m, Tooltip(state, name, key, hint));
}
}
else
{
num3 = 0;
}
GUI.depth = ((num3 != 0) ? (-100) : 0);
break;
}
case 0:
if (flag && (e.button == 0 || e.button == 1))
{
GUIUtility.hotControl = control;
_pressedButton = e.button;
e.Use();
}
break;
case 3:
if (GUIUtility.hotControl == control)
{
e.Use();
}
break;
case 1:
if (GUIUtility.hotControl != control)
{
break;
}
GUIUtility.hotControl = 0;
e.Use();
if (flag && e.button == _pressedButton)
{
if (e.button != 0)
{
return Click.Right;
}
return Click.Left;
}
break;
case 2:
break;
}
return Click.None;
}
private static string Tooltip(State state, string name, KeyCode key, string hint)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
string text = name + KeyText(key);
switch (state)
{
case State.On:
text += ": on";
break;
case State.Off:
text += ": off";
break;
}
if (hint == null)
{
return text;
}
return text + "\n" + hint;
}
private static void DrawTooltip(Rect icon, Metrics m, string text)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
GUIContent val = new GUIContent(text);
Vector2 val2 = _tipStyle.CalcSize(val);
float num = Mathf.Clamp(((Rect)(ref icon)).center.x - val2.x / 2f, (float)m.Margin, Mathf.Max((float)m.Margin, (float)(Screen.width - m.Margin) - val2.x));
float num2 = ((Rect)(ref icon)).y - (float)m.Gap - val2.y;
_tipStyle.Draw(new Rect(Mathf.Round(num), Mathf.Round(num2), val2.x, val2.y), val, false, false, false, false);
}
private static void Hide(int control, Event e)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
if (GUIUtility.hotControl == control)
{
GUIUtility.hotControl = 0;
}
if ((int)e.type == 7)
{
GUI.depth = 0;
}
}
private static Metrics Measure()
{
float num = (float)Screen.height / 1080f;
int num2 = Mathf.Max(1, Mathf.RoundToInt(2f * num));
int num3 = Mathf.Max(2, Mathf.RoundToInt(4f * num));
return new Metrics
{
Unit = num,
Art = 16 * num2,
Button = 16 * num2 + 2 * num3,
Gap = Mathf.Max(2, Mathf.RoundToInt(6f * num)),
Margin = Mathf.RoundToInt(20f * num)
};
}
private static Rect Place(string id, int order, out Rect bar, out Metrics m)
{
//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_0160: Unknown result type (might be due to invalid IL or missing references)
Hashtable hashtable = Table();
int frameCount = Time.frameCount;
if (hashtable[id] is double[] array)
{
array[0] = order;
array[1] = frameCount;
}
else
{
hashtable[id] = new double[2] { order, frameCount };
}
int num = 0;
int num2 = 0;
foreach (DictionaryEntry item in hashtable)
{
string text = (string)item.Key;
double[] array2 = (double[])item.Value;
if (!((double)frameCount - array2[1] > 2.0))
{
num2++;
if (text != id && (array2[0] < (double)order || (array2[0] == (double)order && string.CompareOrdinal(text, id) < 0)))
{
num++;
}
}
}
m = Measure();
int num3 = num2 * m.Button + (num2 - 1) * m.Gap;
int num4 = Screen.width - m.Margin - num3;
int num5 = Screen.height - m.Margin - m.Button;
bar = new Rect((float)num4, (float)num5, (float)num3, (float)m.Button);
return new Rect((float)(num4 + num * (m.Button + m.Gap)), (float)num5, (float)m.Button, (float)m.Button);
}
private static void Share(Rect bar)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
int frameCount = Time.frameCount;
if (!(currentDomain.GetData("OnTogetherMods.IconBar.Rect") is double[] array) || (int)array[4] != frameCount || !(array[2] >= (double)((Rect)(ref bar)).width))
{
currentDomain.SetData("OnTogetherMods.IconBar.Rect", new double[6]
{
((Rect)(ref bar)).x,
((Rect)(ref bar)).y,
((Rect)(ref bar)).width,
((Rect)(ref bar)).height,
frameCount,
_visible ? 1 : 0
});
}
}
private static Hashtable Table()
{
Hashtable hashtable = AppDomain.CurrentDomain.GetData("OnTogetherMods.IconBar.Icons") as Hashtable;
if (hashtable == null)
{
hashtable = new Hashtable();
AppDomain.CurrentDomain.SetData("OnTogetherMods.IconBar.Icons", hashtable);
}
return hashtable;
}
private static void Refresh()
{
//IL_0015: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Invalid comparison between Unknown and I4
int frameCount = Time.frameCount;
if (_cachedFrame != frameCount)
{
_cachedFrame = frameCount;
Scene activeScene = SceneManager.GetActiveScene();
_inWorld = ((Scene)(ref activeScene)).buildIndex == 2;
_visible = false;
if (_inWorld && !PanelStack.Hidden && !RowHidden)
{
TaskManager i = MonoSingleton<TaskManager>.I;
_visible = (Object)(object)i != (Object)null && ((int)i.LockState == 0 || (int)i.LockState == 5);
}
}
}
private static void UpdateBlocker(bool shown, Rect bar)
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
AppDomain currentDomain = AppDomain.CurrentDomain;
int frameCount = Time.frameCount;
if (currentDomain.GetData("OnTogetherMods.IconBar.BlockerFrame") is int num && num == frameCount)
{
return;
}
currentDomain.SetData("OnTogetherMods.IconBar.BlockerFrame", frameCount);
object? data = currentDomain.GetData("OnTogetherMods.IconBar.Blocker");
GameObject val = (GameObject)((data is GameObject) ? data : null);
if ((Object)(object)val == (Object)null)
{
if (!shown)
{
return;
}
val = CreateBlocker();
currentDomain.SetData("OnTogetherMods.IconBar.Blocker", val);
}
if (shown)
{
RectTransform val2 = (RectTransform)val.transform.GetChild(0);
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(((Rect)(ref bar)).x, (float)Screen.height - ((Rect)(ref bar)).yMax);
if (val2.anchoredPosition != val3)
{
val2.anchoredPosition = val3;
}
if (val2.sizeDelta != ((Rect)(ref bar)).size)
{
val2.sizeDelta = ((Rect)(ref bar)).size;
}
}
if (val.activeSelf != shown)
{
val.SetActive(shown);
}
}
private static GameObject CreateBlocker()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: 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)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("OnTogetherMods IconBar ClickBlocker");
Object.DontDestroyOnLoad((Object)(object)val);
Canvas obj = val.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 32767;
val.AddComponent<GraphicRaycaster>();
GameObject val2 = new GameObject("Area", new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(Image)
});
val2.transform.SetParent(val.transform, false);
((Graphic)val2.GetComponent<Image>()).color = Color.clear;
RectTransform val3 = (RectTransform)val2.transform;
val3.anchorMin = Vector2.zero;
val3.anchorMax = Vector2.zero;
val3.pivot = Vector2.zero;
val.SetActive(false);
return val;
}
public static void Patch()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
AppDomain currentDomain = AppDomain.CurrentDomain;
if (currentDomain.GetData("OnTogetherMods.IconBar.Patched") != null)
{
return;
}
currentDomain.SetData("OnTogetherMods.IconBar.Patched", true);
try
{
Patches.Apply(new Harmony("nelphei.ontogether.iconbar"));
}
catch (Exception arg)
{
Debug.LogError((object)$"[OnTogetherMods] Icon bar patches failed, so clicks on it may reach the game: {arg}");
}
}
private static Texture2D[] IconTextures(string[] pixels)
{
//IL_0093: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
if (Icons.TryGetValue(pixels, out var value) && (Object)(object)value[0] != (Object)null && (Object)(object)value[1] != (Object)null)
{
return value;
}
Color32[] array = (Color32[])(object)new Color32[256];
Color32[] array2 = (Color32[])(object)new Color32[256];
for (int i = 0; i < 16; i++)
{
string text = ((i < pixels.Length) ? pixels[i] : "");
for (int j = 0; j < 16; j++)
{
char key = ((j < text.Length) ? text[j] : '.');
Color32 value2;
Color32 val = (Color32)(Palette.TryGetValue(key, out value2) ? value2 : new Color32((byte)0, (byte)0, (byte)0, (byte)0));
int num = (15 - i) * 16 + j;
array[num] = val;
byte b = (byte)Mathf.RoundToInt(0.3f * (float)(int)val.r + 0.59f * (float)(int)val.g + 0.11f * (float)(int)val.b);
array2[num] = new Color32(b, b, b, (byte)((float)(int)val.a * 0.45f));
}
}
value = (Texture2D[])(object)new Texture2D[2]
{
NewTexture(16, 16, array, (FilterMode)0),
NewTexture(16, 16, array2, (FilterMode)0)
};
Icons[pixels] = value;
return value;
}
private static void BuildStyles(Metrics m)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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: Expected O, but got Unknown
//IL_0105: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
//IL_0119: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
if (_builtFor != Screen.height || _buttonStyle == null || !((Object)(object)_buttonTexture != (Object)null) || !((Object)(object)_dotTexture != (Object)null))
{
_builtFor = Screen.height;
int num = Mathf.Max(2, Mathf.RoundToInt(6f * m.Unit));
Destroy(_buttonTexture);
Destroy(_hoverTexture);
Destroy(_openTexture);
Destroy(_dotTexture);
_buttonTexture = RoundedBox(num, ButtonFill, ButtonEdge);
_hoverTexture = RoundedBox(num, HoverFill, HoverEdge);
_openTexture = RoundedBox(num, OpenFill, OpenEdge);
int num2 = Mathf.Max(2, Mathf.RoundToInt(3f * m.Unit));
_dotTexture = RoundedBox(num2, DotFill, DotEdge, 2 * num2);
int num3 = num + 1;
_buttonStyle = new GUIStyle
{
border = new RectOffset(num3, num3, num3, num3)
};
_tipStyle = new GUIStyle
{
border = new RectOffset(num3, num3, num3, num3),
padding = new RectOffset(Mathf.RoundToInt(10f * m.Unit), Mathf.RoundToInt(10f * m.Unit), Mathf.RoundToInt(6f * m.Unit), Mathf.RoundToInt(6f * m.Unit)),
fontSize = Mathf.Max(8, Mathf.RoundToInt(15f * m.Unit)),
alignment = (TextAnchor)3,
wordWrap = false,
richText = false
};
_tipStyle.normal.background = _hoverTexture;
_tipStyle.normal.textColor = Color.white;
}
}
private static Texture2D RoundedBox(int radius, Color32 fill, Color32 edge, int size = 0)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: 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)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
if (size <= 0)
{
size = 2 * radius + 4;
}
Color32[] array = (Color32[])(object)new Color32[size * size];
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
float num = (float)j + 0.5f;
float num2 = (float)i + 0.5f;
float num3 = Mathf.Max(Mathf.Max((float)radius - num, num - (float)(size - radius)), 0f);
float num4 = Mathf.Max(Mathf.Max((float)radius - num2, num2 - (float)(size - radius)), 0f);
float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4) - (float)radius;
float num6 = Mathf.Clamp01(0.5f - num5);
Color val = Color.Lerp(Color32.op_Implicit(fill), Color32.op_Implicit(edge), Mathf.Clamp01(num5 + 1.5f));
val.a *= num6;
array[i * size + j] = Color32.op_Implicit(val);
}
}
return NewTexture(size, size, array, (FilterMode)1);
}
private static Texture2D NewTexture(int width, int height, Color32[] pixels, FilterMode filter)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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)
//IL_002f: Expected O, but got Unknown
Texture2D val = new Texture2D(width, height, (TextureFormat)4, false)
{
filterMode = filter,
wrapMode = (TextureWrapMode)1,
hideFlags = (HideFlags)61
};
val.SetPixels32(pixels);
val.Apply(false, true);
return val;
}
private static void Destroy(Texture2D texture)
{
if ((Object)(object)texture != (Object)null)
{
Object.Destroy((Object)(object)texture);
}
}
}
}
namespace FocusAnywhere
{
internal sealed class Activity
{
public FocusType Type;
public Sprite Sprite;
public int Anim;
public PropType Prop;
public float CameraOffset;
public float CameraDesktopOffset;
public float CameraOrtographic;
public bool IsDesk;
public WaterPropType WaterProp;
public bool SummerDlc;
}
internal static class ActivityList
{
private static readonly FieldRef<GameSettings, List<Sprite>> LandSprites = F<List<Sprite>>("_focusSprites");
private static readonly FieldRef<GameSettings, List<FocusType>> LandTypes = F<List<FocusType>>("_focusTypes");
private static readonly FieldRef<GameSettings, List<int>> LandAnims = F<List<int>>("_animationStates");
private static readonly FieldRef<GameSettings, List<PropType>> LandProps = F<List<PropType>>("_propTypes");
private static readonly FieldRef<GameSettings, List<float>> LandCamera = F<List<float>>("_cameraOffsets");
private static readonly FieldRef<GameSettings, List<float>> LandCameraDesktop = F<List<float>>("_cameraDesktopOffsets");
private static readonly FieldRef<GameSettings, List<float>> LandCameraOrtho = F<List<float>>("_cameraOrtographics");
private static readonly FieldRef<GameSettings, List<bool>> LandIsDesk = F<List<bool>>("_isDesk");
private static readonly FieldRef<GameSettings, List<Sprite>> WaterSprites = F<List<Sprite>>("_focusSpritesWater");
private static readonly FieldRef<GameSettings, List<FocusType>> WaterTypes = F<List<FocusType>>("_focusTypesWater");
private static readonly FieldRef<GameSettings, List<int>> WaterAnims = F<List<int>>("_animationStatesWater");
private static readonly FieldRef<GameSettings, List<PropType>> WaterPropsList = F<List<PropType>>("_propTypesWater");
private static readonly FieldRef<GameSettings, List<float>> WaterCamera = F<List<float>>("_cameraOffsetsWater");
private static readonly FieldRef<GameSettings, List<float>> WaterCameraDesktop = F<List<float>>("_cameraDesktopOffsetsWater");
private static readonly FieldRef<GameSettings, List<float>> WaterCameraOrtho = F<List<float>>("_cameraOrtographicsWater");
private static readonly FieldRef<GameSettings, List<WaterPropType>> WaterFloaters = F<List<WaterPropType>>("_waterDlcPropTypes");
private static readonly FieldRef<GameSettings, List<bool>> WaterSummerDlc = F<List<bool>>("_isSummerDLC");
private static List<Activity> _landOriginal;
private static List<Activity> _waterOriginal;
private static int _seatListCount = -1;
private static bool _ownsSummer;
private static bool _broken;
public static bool Installed { get; private set; }
public static List<WaterPropType> LandWaterProps { get; private set; } = new List<WaterPropType>();
public static void Refresh()
{
if (!Plugin.Settings.Enabled.Value || !Plugin.Settings.AllActivities.Value || _broken)
{
return;
}
try
{
Install();
}
catch (Exception arg)
{
_broken = true;
Plugin.Log.LogError((object)$"Couldn't merge the focus activity lists: {arg}");
}
}
public static void Restore()
{
if (!Installed || _landOriginal == null || _waterOriginal == null)
{
return;
}
try
{
GameSettings i = ScriptableSingleton<GameSettings>.I;
if (!((Object)(object)i == (Object)null))
{
WriteLand(i, _landOriginal);
WriteWater(i, _waterOriginal);
LandWaterProps = new List<WaterPropType>();
Installed = false;
_seatListCount = -1;
Plugin.Log.LogInfo((object)"Focus menu: back to the game's own activities.");
}
}
catch (Exception arg)
{
_broken = true;
Plugin.Log.LogError((object)$"Couldn't put the game's focus activity lists back: {arg}");
}
}
private static void Install()
{
GameSettings i = ScriptableSingleton<GameSettings>.I;
DataManager i2 = MonoSingleton<DataManager>.I;
if ((Object)(object)i == (Object)null || (Object)(object)i2 == (Object)null)
{
return;
}
List<FocusAreaSettings> list = FindSeatLists();
bool isHaveSummerDLC = i2.IsHaveSummerDLC;
if (!Installed || list.Count != _seatListCount || isHaveSummerDLC != _ownsSummer)
{
if (_landOriginal == null)
{
_landOriginal = ReadLand(i);
_waterOriginal = ReadWater(i);
}
List<Activity> list2 = ReadSeats(list);
List<Activity> list3 = Merge(isHaveSummerDLC, _landOriginal, list2, _waterOriginal);
List<Activity> list4 = Merge(isHaveSummerDLC, _waterOriginal, _landOriginal, list2);
WriteLand(i, list3);
WriteWater(i, list4);
LandWaterProps = list3.Select((Activity a) => a.WaterProp).ToList();
_seatListCount = list.Count;
_ownsSummer = isHaveSummerDLC;
Installed = true;
Plugin.Log.LogInfo((object)($"Focus menu: {list3.Count} activities on land (was {_landOriginal.Count}), " + $"{list4.Count} in water (was {_waterOriginal.Count}), from {list.Count} seat lists."));
if (Plugin.Settings.DebugLog.Value)
{
LogCategories("land", list3);
LogCategories("water", list4);
}
}
}
public static int MostInOneCategory(List<FocusType> types)
{
if (types == null || types.Count == 0)
{
return 0;
}
return (from t in types
group t by t).Max((IGrouping<FocusType, FocusType> g) => g.Count());
}
private static List<FocusAreaSettings> FindSeatLists()
{
return (from s in Resources.FindObjectsOfTypeAll<FocusAreaSettings>()
where (Object)(object)s != (Object)null && s.FocusTypes != null
select s).OrderBy<FocusAreaSettings, string>((FocusAreaSettings s) => ((Object)s).name, StringComparer.Ordinal).ThenBy((FocusAreaSettings s) => ((Object)s).GetInstanceID()).ToList();
}
private static List<Activity> ReadLand(GameSettings s)
{
//IL_002c: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
List<FocusType> list = LandTypes.Invoke(s) ?? new List<FocusType>();
List<Activity> list2 = new List<Activity>();
for (int i = 0; i < list.Count; i++)
{
list2.Add(new Activity
{
Type = list[i],
Sprite = At(LandSprites.Invoke(s), i, null),
Anim = At(LandAnims.Invoke(s), i, 0),
Prop = At(LandProps.Invoke(s), i, (PropType)0),
CameraOffset = At(LandCamera.Invoke(s), i, 0.6f),
CameraDesktopOffset = At(LandCameraDesktop.Invoke(s), i, 0.91f),
CameraOrtographic = At(LandCameraOrtho.Invoke(s), i, 1.5f),
IsDesk = At(LandIsDesk.Invoke(s), i, fallback: false)
});
}
return list2;
}
private static List<Activity> ReadWater(GameSettings s)
{
//IL_002c: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
List<FocusType> list = WaterTypes.Invoke(s) ?? new List<FocusType>();
List<Activity> list2 = new List<Activity>();
for (int i = 0; i < list.Count; i++)
{
list2.Add(new Activity
{
Type = list[i],
Sprite = At(WaterSprites.Invoke(s), i, null),
Anim = At(WaterAnims.Invoke(s), i, 0),
Prop = At(WaterPropsList.Invoke(s), i, (PropType)0),
CameraOffset = At(WaterCamera.Invoke(s), i, 0.6f),
CameraDesktopOffset = At(WaterCameraDesktop.Invoke(s), i, 0.91f),
CameraOrtographic = At(WaterCameraOrtho.Invoke(s), i, 1.5f),
WaterProp = At(WaterFloaters.Invoke(s), i, (WaterPropType)0),
SummerDlc = At(WaterSummerDlc.Invoke(s), i, fallback: false)
});
}
return list2;
}
private static List<Activity> ReadSeats(List<FocusAreaSettings> seatLists)
{
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
HashSet<FocusAreaSettings> hashSet = new HashSet<FocusAreaSettings>();
FocusAreaController[] array = Object.FindObjectsByType<FocusAreaController>((FindObjectsInactive)1, (FindObjectsSortMode)0);
foreach (FocusAreaController val in array)
{
if ((Object)(object)val != (Object)null && val.IsClassroom && (Object)(object)val.FocusAreaSettings != (Object)null)
{
hashSet.Add(val.FocusAreaSettings);
}
}
List<Activity> list = new List<Activity>();
foreach (FocusAreaSettings seatList in seatLists)
{
for (int j = 0; j < seatList.FocusTypes.Count; j++)
{
list.Add(new Activity
{
Type = seatList.FocusTypes[j],
Sprite = At(seatList.FocusSprites, j, null),
Anim = At(seatList.AnimationStates, j, 0),
Prop = At(seatList.PropTypes, j, (PropType)0),
CameraOffset = At(seatList.CameraOffset, j, 0.6f),
CameraDesktopOffset = At(seatList.CameraDesktopOffsets, j, 0.91f),
CameraOrtographic = At(seatList.CameraOrtographics, j, 1.5f),
IsDesk = hashSet.Contains(seatList)
});
}
}
return list;
}
private static List<Activity> Merge(bool ownsSummer, params List<Activity>[] sources)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
HashSet<(FocusType, int, PropType)> hashSet = new HashSet<(FocusType, int, PropType)>();
List<Activity> list = new List<Activity>();
for (int i = 0; i < sources.Length; i++)
{
foreach (Activity item in sources[i])
{
if ((!item.SummerDlc || ownsSummer) && hashSet.Add((item.Type, item.Anim, item.Prop)))
{
list.Add(item);
}
}
}
return list;
}
private static void WriteLand(GameSettings s, List<Activity> land)
{
LandSprites.Invoke(s) = land.Select((Activity a) => a.Sprite).ToList();
LandTypes.Invoke(s) = land.Select((Activity a) => a.Type).ToList();
LandAnims.Invoke(s) = land.Select((Activity a) => a.Anim).ToList();
LandProps.Invoke(s) = land.Select((Activity a) => a.Prop).ToList();
LandCamera.Invoke(s) = land.Select((Activity a) => a.CameraOffset).ToList();
LandCameraDesktop.Invoke(s) = land.Select((Activity a) => a.CameraDesktopOffset).ToList();
LandCameraOrtho.Invoke(s) = land.Select((Activity a) => a.CameraOrtographic).ToList();
LandIsDesk.Invoke(s) = land.Select((Activity a) => a.IsDesk).ToList();
}
private static void WriteWater(GameSettings s, List<Activity> water)
{
WaterSprites.Invoke(s) = water.Select((Activity a) => a.Sprite).ToList();
WaterTypes.Invoke(s) = water.Select((Activity a) => a.Type).ToList();
WaterAnims.Invoke(s) = water.Select((Activity a) => a.Anim).ToList();
WaterPropsList.Invoke(s) = water.Select((Activity a) => a.Prop).ToList();
WaterCamera.Invoke(s) = water.Select((Activity a) => a.CameraOffset).ToList();
WaterCameraDesktop.Invoke(s) = water.Select((Activity a) => a.CameraDesktopOffset).ToList();
WaterCameraOrtho.Invoke(s) = water.Select((Activity a) => a.CameraOrtographic).ToList();
WaterFloaters.Invoke(s) = water.Select((Activity a) => a.WaterProp).ToList();
WaterSummerDlc.Invoke(s) = water.Select((Activity a) => a.SummerDlc).ToList();
}
private static void LogCategories(string where, List<Activity> list)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
foreach (IGrouping<FocusType, Activity> item in from a in list
group a by a.Type)
{
Plugin.Log.LogInfo((object)string.Format(" {0} {1}: {2} (anims {3})", where, item.Key, item.Count(), string.Join(", ", item.Select((Activity a) => a.Anim))));
}
}
private static T At<T>(List<T> list, int i, T fallback)
{
if (list == null || i >= list.Count)
{
return fallback;
}
return list[i];
}
private static FieldRef<GameSettings, T> F<T>(string field)
{
return AccessTools.FieldRefAccess<GameSettings, T>(field);
}
}
internal static class Game
{
public static readonly FieldRef<PlayerFocusController, bool> IsFocusChange = AccessTools.FieldRefAccess<PlayerFocusController, bool>("_isFocusChange");
public static readonly FieldRef<PlayerFocusController, List<FocusType>> MenuCategories = AccessTools.FieldRefAccess<PlayerFocusController, List<FocusType>>("_simpledFocusTypes");
public static readonly FieldRef<PlayerFocusController, int> MenuCategoryIndex = AccessTools.FieldRefAccess<PlayerFocusController, int>("_currentFocusMainIndex");
public static readonly FieldRef<PlayerFocusController, PlayerMovementController> Movement = AccessTools.FieldRefAccess<PlayerFocusController, PlayerMovementController>("_playerMovementController");
private static readonly Action<PlayerFocusController> OpenSelectorMethod = AccessTools.MethodDelegate<Action<PlayerFocusController>>(AccessTools.Method(typeof(PlayerFocusController), "OpenSelector", (Type[])null, (Type[])null), (object)null, true);
private static readonly Action<PlayerFocusController, FocusAreaController> SetCurrentFocusAreaMethod = AccessTools.MethodDelegate<Action<PlayerFocusController, FocusAreaController>>(AccessTools.PropertySetter(typeof(PlayerFocusController), "CurrentFocusAreaController"), (object)null, true);
private static readonly Action<PlayerFocusController, WaterPropType> SetWaterPropMethod = AccessTools.MethodDelegate<Action<PlayerFocusController, WaterPropType>>(AccessTools.PropertySetter(typeof(PlayerFocusController), "WaterProp"), (object)null, true);
public static void OpenSelector(PlayerFocusController focus)
{
OpenSelectorMethod(focus);
}
public static void SetCurrentFocusArea(PlayerFocusController focus, FocusAreaController area)
{
SetCurrentFocusAreaMethod(focus, area);
}
public static void SetWaterProp(PlayerFocusController focus, WaterPropType prop)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
SetWaterPropMethod(focus, prop);
}
}
internal static class Icon
{
public static readonly string[] Pixels = new string[16]
{
"......KKKK......", ".....KHHHHK.....", ".....KHPPPK.....", ".....KPPPPK.....", "......KKKK......", ".....KVVVVK.....", "....KVVVVVVK....", "...KVKVVVVKVK...", "..KPKKVVVVKKPK..", "..KuuuuPPuuuuK..",
"...KKKKKKKKKK...", "................", "....WW...WWW....", "..WWWWWWWWWWWW..", ".WWWWWWWWWWWWWW.", "...GGGGGGGGGG..."
};
}
internal sealed class IconButton : MonoBehaviour
{
private bool _clicked;
private static Settings S => Plugin.Settings;
private void Update()
{
if (_clicked)
{
_clicked = false;
S.Enabled.Value = !S.Enabled.Value;
Plugin.Log.LogInfo((object)(S.Enabled.Value ? "Focus Anywhere on." : "Focus Anywhere off."));
}
}
private void OnGUI()
{
if (S.ShowIcon.Value && IconBar.Draw("FocusAnywhere", 50, Icon.Pixels, S.Enabled.Value ? IconBar.State.On : IconBar.State.Off, "Focus Anywhere", (KeyCode)0, "Every activity, on any ground or in the air") == IconBar.Click.Left)
{
_clicked = true;
}
}
}
internal static class MenuSlots
{
private const int GameSlots = 11;
public static void EnsureSlots(int needed)
{
UIManager i = MonoSingleton<UIManager>.I;
RectTransform val = (((Object)(object)i != (Object)null) ? i.FocusSubItemParent : null);
if (!((Object)(object)val == (Object)null) && ((Transform)val).childCount >= 11)
{
while (((Transform)val).childCount < needed)
{
AddSlot(val);
}
}
}
public static void HideExtraSlots()
{
UIManager i = MonoSingleton<UIManager>.I;
RectTransform val = (((Object)(object)i != (Object)null) ? i.FocusSubItemParent : null);
if (!((Object)(object)val == (Object)null))
{
for (int j = 11; j < ((Transform)val).childCount; j++)
{
((Component)((Transform)val).GetChild(j)).gameObject.SetActive(false);
}
}
}
private static void AddSlot(RectTransform parent)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
Transform child = ((Transform)parent).GetChild(10);
GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject, (Transform)(object)parent, false);
int index = ((Transform)parent).childCount - 1;
((Object)val).name = $"{((Object)child).name} (Focus Anywhere {index})";
val.SetActive(false);
int num = 0;
string wiring = "";
Button component = val.GetComponent<Button>();
if ((Object)(object)component != (Object)null)
{
num += SwitchOffSetFocus((UnityEventBase)(object)component.onClick, ref wiring);
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
Pick(index);
});
}
EventTrigger val2 = val.GetComponent<EventTrigger>() ?? val.AddComponent<EventTrigger>();
foreach (Entry trigger in val2.triggers)
{
num += SwitchOffSetFocus((UnityEventBase)(object)trigger.callback, ref wiring);
}
AddTrigger(val2, (EventTriggerType)0, delegate
{
Highlight(parent, index);
});
AddTrigger(val2, (EventTriggerType)1, delegate
{
SetHighlight(((Transform)parent).GetChild(index), on: false);
});
if (num == 0)
{
Plugin.Log.LogWarning((object)($"Added focus menu button {index + 1}, but couldn't find its copied click call " + "(saved calls:" + wiring + "). It may start the wrong activity."));
}
else
{
Plugin.Log.LogInfo((object)($"Added focus menu button {index + 1}." + (Plugin.Settings.DebugLog.Value ? (" Saved calls:" + wiring) : "")));
}
}
private static void Pick(int index)
{
try
{
MonoSingleton<UIManager>.I.ButtonSetFocus(index);
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
private static void Highlight(RectTransform parent, int index)
{
for (int i = 0; i < ((Transform)parent).childCount; i++)
{
SetHighlight(((Transform)parent).GetChild(i), i == index);
}
}
private static void SetHighlight(Transform slot, bool on)
{
if (slot.childCount > 1)
{
((Component)slot.GetChild(1)).gameObject.SetActive(on);
}
}
private static int SwitchOffSetFocus(UnityEventBase unityEvent, ref string wiring)
{
int num = 0;
for (int i = 0; i < unityEvent.GetPersistentEventCount(); i++)
{
string text = unityEvent.GetPersistentMethodName(i) ?? "";
Object persistentTarget = unityEvent.GetPersistentTarget(i);
wiring = wiring + " " + ((persistentTarget != (Object)null) ? ((object)persistentTarget).GetType().Name : "null") + "." + text;
if (text.Contains("SetFocus"))
{
unityEvent.SetPersistentListenerState(i, (UnityEventCallState)0);
num++;
}
}
return num;
}
private static void AddTrigger(EventTrigger trigger, EventTriggerType type, Action action)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
Entry val = new Entry
{
eventID = type
};
((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
{
try
{
action();
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
});
trigger.triggers.Add(val);
}
}
internal static class MidAir
{
[HarmonyPatch(typeof(PlayerMovementController), "Fall")]
internal static class FallPatch
{
private static bool Prefix(PlayerMovementController __instance)
{
if (!_holding)
{
return true;
}
try
{
PlayerFocusController mainFocusController = NetworkSingleton<TextChannelManager>.I.MainFocusController;
if ((Object)(object)mainFocusController == (Object)null || !mainFocusController.IsSelectorOpened)
{
_holding = false;
return true;
}
__instance.SpeedY = 0f;
return false;
}
catch (Exception ex)
{
_holding = false;
Plugin.Log.LogError((object)ex);
return true;
}
}
}
private static bool _holding;
public static bool IsAirborne(PlayerMovementController movement)
{
//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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
MovementState movementState = movement.MovementState;
if ((int)movement.GroundState == 0 && (int)movementState != 3)
{
return (int)movementState == 4;
}
return true;
}
public static void OnMenuOpened(PlayerFocusController focus)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Invalid comparison between Unknown and I4
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
_holding = false;
if (!Plugin.Settings.Enabled.Value || !Plugin.Settings.MidAir.Value || focus.IsFocus)
{
return;
}
PlayerMovementController val = Game.Movement.Invoke(focus);
if (!((Object)(object)val == (Object)null) && (int)val.MovementState != 2 && IsAirborne(val))
{
_holding = true;
val.SpeedY = 0f;
if ((int)val.MovementState == 4)
{
val.SetUmbrella(false);
}
if (Plugin.Settings.DebugLog.Value)
{
Plugin.Log.LogInfo((object)$"Focus menu opened in the air ({val.GroundState}, {val.MovementState}): holding you here.");
}
}
}
}
[HarmonyPatch(typeof(PlayerFocusController), "Update")]
internal static class UpdatePatch
{
private static void Prefix(PlayerFocusController __instance, out bool __state)
{
__state = ((NetworkIdentity)__instance).isOwner && !__instance.IsSelectorOpened && !__instance.IsFocus;
}
private static void Postfix(PlayerFocusController __instance, bool __state)
{
if (!((NetworkIdentity)__instance).isOwner)
{
return;
}
try
{
if (!Plugin.Settings.Enabled.Value)
{
if (ActivityList.Installed && !__instance.IsFocus && !__instance.IsSelectorOpened)
{
ActivityList.Restore();
}
return;
}
if (!ActivityList.Installed)
{
ActivityList.Refresh();
}
if (__state && Plugin.Settings.AnyGround.Value)
{
OpenWhereTheGameWouldNot(__instance);
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
private static void OpenWhereTheGameWouldNot(PlayerFocusController focus)
{
if (focus.IsSelectorOpened || focus.IsFocus)
{
return;
}
InputManager i = MonoSingleton<InputManager>.I;
if ((Object)(object)i == (Object)null || !i.IsFocusKeyDown)
{
return;
}
TextChannelManager i2 = NetworkSingleton<TextChannelManager>.I;
FocusAreaManager i3 = NetworkSingleton<FocusAreaManager>.I;
if (!((Object)(object)i2 == (Object)null) && !((Object)(object)i2.MainPlayer == (Object)null) && !((Object)(object)i3 == (Object)null) && i3.AreaIndexes != null)
{
PlayerMovementController val = Game.Movement.Invoke(focus);
if (!((Object)(object)val == (Object)null) && IsFreeToFocus(val))
{
FocusAreaController area = (MidAir.IsAirborne(val) ? FreeSeatNearby(focus, val, i3) : null);
Game.SetCurrentFocusArea(focus, area);
Game.IsFocusChange.Invoke(focus) = false;
Game.OpenSelector(focus);
}
}
}
private static bool IsFreeToFocus(PlayerMovementController movement)
{
//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_0036: 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_003b: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Invalid comparison between Unknown and I4
//IL_008f: 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)
//IL_0094: Invalid comparison between Unknown and I4
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
TaskManager i = MonoSingleton<TaskManager>.I;
BasketBallManager i2 = NetworkSingleton<BasketBallManager>.I;
FishingManager i3 = MonoSingleton<FishingManager>.I;
if ((Object)(object)i == (Object)null || (Object)(object)i2 == (Object)null || (Object)(object)i3 == (Object)null)
{
return false;
}
LockState lockState = i.LockState;
if ((int)lockState != 0 && (int)lockState != 3 && (int)lockState != 2 && (int)lockState != 4)
{
return false;
}
if (i.IsWriting || i2.IsInBasketBallCourtColorful || (int)i3.FishingState != 0 || movement.IsAnimation || movement.IsStair)
{
return false;
}
bool value = Plugin.Settings.MidAir.Value;
MovementState movementState = movement.MovementState;
if ((int)movementState > 1)
{
if (movementState - 3 <= 1)
{
return value;
}
return false;
}
if (!value)
{
return (int)movement.GroundState == 0;
}
return true;
}
private static FocusAreaController FreeSeatNearby(PlayerFocusController focus, PlayerMovementController movement, FocusAreaManager areas)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (focus.FocusAreaControllers.Count == 0 || movement.IsLake)
{
return null;
}
FocusAreaController val = null;
float num = float.MaxValue;
foreach (FocusAreaController focusAreaController in focus.FocusAreaControllers)
{
if (!((Object)(object)focusAreaController == (Object)null))
{
Vector3 val2 = ((Component)focusAreaController).transform.position - ((Component)focus).transform.position;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
val = focusAreaController;
}
}
}
if (!((Object)(object)val != (Object)null) || !areas.IsAreaEmpty(val.ID))
{
return null;
}
return val;
}
}
[HarmonyPatch(typeof(PlayerFocusController), "OpenSelector")]
internal static class OpenSelectorPatch
{
private static void Postfix(PlayerFocusController __instance)
{
try
{
if (((NetworkIdentity)__instance).isOwner && __instance.IsSelectorOpened)
{
MidAir.OnMenuOpened(__instance);
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
private static void Prefix(PlayerFocusController __instance)
{
try
{
ActivityList.Refresh();
FocusAreaController currentFocusAreaController = __instance.CurrentFocusAreaController;
MenuSlots.EnsureSlots(ActivityList.MostInOneCategory(((Object)(object)currentFocusAreaController == (Object)null) ? ScriptableSingleton<GameSettings>.I.FocusTypes : (((Object)(object)currentFocusAreaController.FocusAreaSettings != (Object)null) ? currentFocusAreaController.FocusAreaSettings.FocusTypes : null)));
MenuSlots.HideExtraSlots();
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
}
[HarmonyPatch(typeof(PlayerFocusController), "ButtonFocusItem")]
internal static class ButtonFocusItemPatch
{
private static void Prefix()
{
try
{
MenuSlots.HideExtraSlots();
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
}
[HarmonyPatch(typeof(PlayerFocusController), "SetFocus")]
internal static class SetFocusPatch
{
private static void Prefix(PlayerFocusController __instance, int subIndex, out int __state)
{
__state = -1;
try
{
if (ActivityList.Installed && !((Object)(object)__instance.CurrentFocusAreaController != (Object)null))
{
PlayerMovementController val = Game.Movement.Invoke(__instance);
if (!((Object)(object)val == (Object)null) && !val.IsInWater)
{
__state = FindLandIndex(__instance, subIndex);
}
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
private static void Postfix(PlayerFocusController __instance, int __state)
{
//IL_0021: 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)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Invalid comparison between Unknown and I4
if (__state < 0 || __state >= ActivityList.LandWaterProps.Count || !__instance.IsFocus)
{
return;
}
try
{
WaterPropType val = ActivityList.LandWaterProps[__state];
Game.SetWaterProp(__instance, val);
Dictionary<OutfitType, SkinnedMeshRenderer> outfitMeshRenderers = __instance._PlayerCustomizationController.OutfitMeshRenderers;
if (outfitMeshRenderers.TryGetValue((OutfitType)12, out var value) && (Object)(object)value != (Object)null)
{
((Component)value).gameObject.SetActive((int)val == 2);
}
if (outfitMeshRenderers.TryGetValue((OutfitType)11, out var value2) && (Object)(object)value2 != (Object)null)
{
((Component)value2).gameObject.SetActive((int)val == 1);
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
private static int FindLandIndex(PlayerFocusController focus, int subIndex)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_004f: Unknown result type (might be due to invalid IL or missing references)
List<FocusType> list = Game.MenuCategories.Invoke(focus);
int num = Game.MenuCategoryIndex.Invoke(focus);
if (list == null || num < 0 || num >= list.Count)
{
return -1;
}
FocusType val = list[num];
List<FocusType> focusTypes = ScriptableSingleton<GameSettings>.I.FocusTypes;
int num2 = 0;
for (int i = 0; i < focusTypes.Count; i++)
{
if (focusTypes[i] == val)
{
if (num2 == subIndex)
{
return i;
}
num2++;
}
}
return -1;
}
}
[BepInPlugin("nelphei.ontogether.focusanywhere", "Focus Anywhere", "0.3.1")]
public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "nelphei.ontogether.focusanywhere";
public const string PluginName = "Focus Anywhere";
public const string PluginVersion = "0.3.1";
internal static ManualLogSource Log;
internal static Settings Settings;
private GameObject _host;
private void Awake()
{
//IL_0020: 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_003f: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Settings = new Settings(((BaseUnityPlugin)this).Config);
new Harmony("nelphei.ontogether.focusanywhere").PatchAll();
IconBar.Patch();
_host = new GameObject("FocusAnywhere");
((Object)_host).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)_host);
_host.AddComponent<IconButton>();
Log.LogInfo((object)(string.Format("{0} {1} loaded. On: {2}, every activity: ", "Focus Anywhere", "0.3.1", Settings.Enabled.Value) + $"{Settings.AllActivities.Value}, any ground: {Settings.AnyGround.Value}, mid-air: {Settings.MidAir.Value}."));
}
private void OnDestroy()
{
if ((Object)(object)_host != (Object)null)
{
Object.Destroy((Object)(object)_host);
}
}
}
internal sealed class Settings
{
public readonly ConfigEntry<bool> Enabled;
public readonly ConfigEntry<bool> AllActivities;
public readonly ConfigEntry<bool> AnyGround;
public readonly ConfigEntry<bool> MidAir;
public readonly ConfigEntry<bool> ShowIcon;
public readonly ConfigEntry<bool> DebugLog;
public Settings(ConfigFile config)
{
Enabled = config.Bind<bool>("Focus", "Enabled", true, "Switches the whole mod on or off. The mod's icon at the bottom-right changes this, and it's remembered between games. Switched off, the focus menu goes back to the game's own activities the next time you're not focusing.");
AllActivities = config.Bind<bool>("Focus", "AllActivities", true, "The focus menu shows every activity in the game: the normal ones, the water ones, and the ones from seat spots (play tower, bean bag, tree hanger...). Seat spots keep their own menu.");
AnyGround = config.Bind<bool>("Focus", "AnyGround", true, "The focus key opens the menu on any ground, near the music hill, and next to a seat someone else is using. The basketball court stays off limits.");
MidAir = config.Bind<bool>("Focus", "MidAir", true, "The focus key works in the air too: you stop where you are and focus floating there. Closing the menu without picking, or standing up, lets you fall again. Needs AnyGround on (or BlueSage QoL's own Focus Anywhere).");
ShowIcon = config.Bind<bool>("Display", "ShowIcon", true, "Show an icon in the row of mod icons at the bottom-right, with a green dot while the mod is on. Clicking it switches Enabled.");
DebugLog = config.Bind<bool>("Debug", "DebugLog", false, "Write extra details to the BepInEx log (the activity lists and the menu buttons).");
}
}
}