using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using SFQoL;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("SessionScoreboard")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+562f2a5697c435654782039a6e570db5445afc1f")]
[assembly: AssemblyProduct("SessionScoreboard")]
[assembly: AssemblyTitle("SessionScoreboard")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace SFQoL
{
internal static class Compat
{
private static bool searched;
private static FieldInfo roundsActive;
private static PropertyInfo roundsArmed;
private static FieldInfo cardPicking;
private static bool cardSearched;
public static bool Rounds
{
get
{
Find();
try
{
if ((object)roundsArmed != null && (bool)roundsArmed.GetValue(null, null))
{
return true;
}
if ((object)roundsActive != null && (bool)roundsActive.GetValue(null))
{
return true;
}
}
catch
{
}
return false;
}
}
public static bool CardScreen
{
get
{
if (!cardSearched)
{
Type type = RoundsType("StickRounds.CardPick");
cardSearched = (object)type != null || Time.frameCount > 1;
if ((object)type != null)
{
cardPicking = type.GetField("Picking", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
}
try
{
return (object)cardPicking != null && (bool)cardPicking.GetValue(null);
}
catch
{
return false;
}
}
}
public static bool RoundsMatch
{
get
{
Find();
try
{
return (object)roundsActive != null && (bool)roundsActive.GetValue(null) && !GameManager.stillInMenu;
}
catch
{
return false;
}
}
}
private static Type RoundsType(string name)
{
if (!Chainloader.PluginInfos.TryGetValue("stickfight.stickrounds", out var value) || (Object)(object)value.Instance == (Object)null)
{
return null;
}
return ((object)value.Instance).GetType().Assembly.GetType(name, throwOnError: false);
}
private static void Find()
{
if (!searched)
{
Type type = RoundsType("StickRounds.RoundsMode");
searched = (object)type != null || Time.frameCount > 1;
if ((object)type != null)
{
roundsActive = type.GetField("Active", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
roundsArmed = type.GetProperty("Armed", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
}
}
public static bool IsBotDevice(InputDevice d)
{
if (d != null)
{
return ((object)d).GetType().Name == "BotDevice";
}
return false;
}
}
internal static class QolConfig
{
public static ConfigEntry<bool> Enabled(ConfigFile config, string section, string description)
{
return config.Bind<bool>(section, "Enabled", true, description);
}
private static Dictionary<ConfigDefinition, string> Orphans(ConfigFile config)
{
return Traverse.Create((object)config).Property("OrphanedEntries", (object[])null).GetValue<Dictionary<ConfigDefinition, string>>();
}
public static string Old(ConfigFile config, string section, string key)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
if (dictionary == null || !dictionary.TryGetValue(new ConfigDefinition(section, key), out var value))
{
return null;
}
return value;
}
public static void SetOld(ConfigFile config, string section, string key, string value)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
if (dictionary != null)
{
dictionary[new ConfigDefinition(section, key)] = value;
}
}
public static void DropOld(ConfigFile config)
{
Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
if (dictionary != null && dictionary.Count != 0)
{
dictionary.Clear();
config.Save();
}
}
}
internal static class Ui
{
public static readonly Color Panel = new Color(0.176f, 0.176f, 0.176f);
public static readonly Color Strip = new Color(0.147f, 0.147f, 0.147f);
public static readonly Color Item = new Color(0.265f, 0.265f, 0.265f);
public static readonly Color Grey = new Color(0.6f, 0.6f, 0.6f);
private static TMP_FontAsset font;
private static Sprite box;
private static bool boxSearched;
private static Camera menuCam;
private static float menuCamSearchAt;
public static TMP_FontAsset Font
{
get
{
if ((Object)(object)font == (Object)null)
{
GameManager instance = GameManager.Instance;
if ((Object)(object)instance != (Object)null && (Object)(object)instance.winText != (Object)null)
{
font = ((TMP_Text)instance.winText).font;
}
if ((Object)(object)font == (Object)null)
{
TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
foreach (TMP_FontAsset val in array)
{
if (((Object)val).name.StartsWith("Anton"))
{
font = val;
break;
}
}
}
}
return font;
}
}
public static Sprite BoxSprite
{
get
{
if ((Object)(object)box == (Object)null && !boxSearched)
{
boxSearched = true;
Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>();
foreach (Sprite val in array)
{
if (((Object)val).name == "box")
{
box = val;
break;
}
}
}
return box;
}
}
public static int MenuLayer
{
get
{
int num = LayerMask.NameToLayer("MENU");
if (num < 0)
{
return 31;
}
return num;
}
}
public static void Attach(Canvas c)
{
//IL_00dd: 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_00aa: Invalid comparison between Unknown and I4
if ((Object)(object)c == (Object)null)
{
return;
}
if (((Object)(object)menuCam == (Object)null || !((Behaviour)menuCam).isActiveAndEnabled) && Time.unscaledTime >= menuCamSearchAt)
{
menuCamSearchAt = Time.unscaledTime + 1f;
menuCam = null;
Camera[] allCameras = Camera.allCameras;
foreach (Camera val in allCameras)
{
if (((Object)val).name == "Camera_Pause" && (val.cullingMask & (1 << MenuLayer)) != 0)
{
menuCam = val;
break;
}
}
}
if ((Object)(object)menuCam != (Object)null && ((Behaviour)menuCam).isActiveAndEnabled)
{
if ((int)c.renderMode != 1 || (Object)(object)c.worldCamera != (Object)(object)menuCam)
{
c.renderMode = (RenderMode)1;
c.worldCamera = menuCam;
c.planeDistance = 1f;
}
}
else if ((int)c.renderMode != 0)
{
c.renderMode = (RenderMode)0;
}
}
public static Canvas MakeCanvas(string name, int order)
{
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0017: 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)
GameObject val = new GameObject(name)
{
layer = MenuLayer
};
Object.DontDestroyOnLoad((Object)val);
Canvas val2 = val.AddComponent<Canvas>();
val2.renderMode = (RenderMode)0;
val2.sortingOrder = order;
Attach(val2);
CanvasScaler obj = val.AddComponent<CanvasScaler>();
obj.uiScaleMode = (ScaleMode)1;
obj.referenceResolution = new Vector2(1920f, 1080f);
obj.matchWidthOrHeight = 0.5f;
return val2;
}
public static RectTransform Rect(Transform parent, string name)
{
//IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0042: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0076: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) })
{
layer = ((Component)parent).gameObject.layer
};
val.transform.SetParent(parent, false);
RectTransform val2 = (RectTransform)val.transform;
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(0.5f, 0.5f);
val2.anchorMax = val3;
val2.anchorMin = val3;
val2.pivot = new Vector2(0.5f, 0.5f);
return val2;
}
public static Image Box(Transform parent, string name, Color color, Vector2 pos, Vector2 size, bool rounded = false)
{
//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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = Rect(parent, name);
obj.anchoredPosition = pos;
obj.sizeDelta = size;
Image val = ((Component)obj).gameObject.AddComponent<Image>();
((Graphic)val).color = color;
((Graphic)val).raycastTarget = false;
if (rounded && (Object)(object)BoxSprite != (Object)null)
{
val.sprite = BoxSprite;
Vector4 border = BoxSprite.border;
if (((Vector4)(ref border)).sqrMagnitude > 0f)
{
val.type = (Type)1;
}
}
return val;
}
public static void Fill(RectTransform rt, float inset)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0028: Unknown result type (might be due to invalid IL or missing references)
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = new Vector2(inset, inset);
rt.offsetMax = new Vector2(0f - inset, 0f - inset);
}
public static TextMeshProUGUI Text(Transform parent, string name, string text, float size, Color color, TextAlignmentOptions align)
{
//IL_0032: 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)
TextMeshProUGUI val = ((Component)Rect(parent, name)).gameObject.AddComponent<TextMeshProUGUI>();
if ((Object)(object)Font != (Object)null)
{
((TMP_Text)val).font = Font;
}
((TMP_Text)val).fontSize = size;
((Graphic)val).color = color;
((TMP_Text)val).alignment = align;
((TMP_Text)val).enableWordWrapping = false;
((TMP_Text)val).richText = true;
((Graphic)val).raycastTarget = false;
((TMP_Text)val).text = text;
return val;
}
public static Color PlayerColor(Controller c)
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)c != (Object)null)
{
SpriteRenderer componentInChildren = ((Component)c).GetComponentInChildren<SpriteRenderer>();
SetColorWhenDamaged val = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).GetComponent<SetColorWhenDamaged>() : null);
if ((Object)(object)val == (Object)null)
{
val = ((Component)c).GetComponentInChildren<SetColorWhenDamaged>(true);
}
if ((Object)(object)val != (Object)null && val.startColor.a > 0f)
{
Color startColor = val.startColor;
startColor.a = 1f;
return startColor;
}
ControllerHandler instance = ControllerHandler.Instance;
if ((Object)(object)instance != (Object)null && instance.colors != null && c.playerID >= 0 && c.playerID < instance.colors.Length && (Object)(object)instance.colors[c.playerID] != (Object)null)
{
return instance.colors[c.playerID].color;
}
}
return Color.white;
}
public static Color SlotColor(int id)
{
//IL_0052: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
ControllerHandler instance = ControllerHandler.Instance;
if ((Object)(object)instance != (Object)null && instance.colors != null && id >= 0 && id < instance.colors.Length && (Object)(object)instance.colors[id] != (Object)null)
{
Color color = instance.colors[id].color;
color.a = 1f;
return color;
}
return Color.white;
}
public static string Hex(Color c)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
return "#" + ((int)(Mathf.Clamp01(c.r) * 255f)).ToString("X2") + ((int)(Mathf.Clamp01(c.g) * 255f)).ToString("X2") + ((int)(Mathf.Clamp01(c.b) * 255f)).ToString("X2");
}
public static string Colored(string text, Color c)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
return "<color=" + Hex(c) + ">" + text + "</color>";
}
public static Color WithAlpha(Color c, float a)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
c.a = a;
return c;
}
}
}
namespace SessionScoreboard
{
[BepInPlugin("stickfight.sessionscoreboard", "Scoreboard", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public const string Guid = "stickfight.sessionscoreboard";
public const string Name = "Scoreboard";
public const string Version = "1.0.2";
internal static ManualLogSource Log;
internal static ConfigEntry<bool> Enabled;
private void Awake()
{
//IL_0049: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
Enabled = QolConfig.Enabled(((BaseUnityPlugin)this).Config, "Scoreboard", "Counts wins, kills and deaths per colour. Off = nothing is counted or shown. Saved scores are kept.");
QolConfig.DropOld(((BaseUnityPlugin)this).Config);
Scores.Load(Path.Combine(Paths.ConfigPath, "SessionScoreboard.txt"));
new Harmony("stickfight.sessionscoreboard").PatchAll(typeof(Plugin).Assembly);
SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if ((int)mode == 0)
{
TakeDamagePatch.LastRocket.Clear();
RocketCredit.Reset();
}
};
GameObject val = new GameObject("SessionScoreboard");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<Board>();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Scoreboard 1.0.2 loaded.");
}
}
internal static class Scores
{
public const int Slots = 4;
public static readonly int[] Wins = new int[4];
public static readonly int[] Kills = new int[4];
public static readonly int[] Deaths = new int[4];
public static int Version;
private static string file;
public static bool Counting
{
get
{
if (Plugin.Enabled.Value && !MatchmakingHandler.IsNetworkMatch)
{
return !GameManager.stillInMenu;
}
return false;
}
}
public static bool Any(int id)
{
return Wins[id] + Kills[id] + Deaths[id] > 0;
}
public static void Load(string path)
{
file = path;
try
{
if (!File.Exists(path))
{
return;
}
string[] array = File.ReadAllLines(path);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[1] { ' ' });
if (array2.Length >= 4 && int.TryParse(array2[0], out var result) && result >= 0 && result < 4 && int.TryParse(array2[1], out var result2) && int.TryParse(array2[2], out var result3) && int.TryParse(array2[3], out var result4))
{
Wins[result] = result2;
Kills[result] = result3;
Deaths[result] = result4;
}
}
}
catch (Exception ex)
{
Plugin.Log.LogWarning((object)("Couldn't read the scoreboard: " + ex.Message));
}
Version++;
}
private static void Save()
{
Version++;
try
{
StringBuilder stringBuilder = new StringBuilder("# slot wins kills deaths\n");
for (int i = 0; i < 4; i++)
{
stringBuilder.Append(i).Append(' ').Append(Wins[i])
.Append(' ')
.Append(Kills[i])
.Append(' ')
.Append(Deaths[i])
.Append('\n');
}
File.WriteAllText(file, stringBuilder.ToString());
}
catch (Exception ex)
{
Plugin.Log.LogWarning((object)("Couldn't save the scoreboard: " + ex.Message));
}
}
private static bool Valid(Controller c)
{
if ((Object)(object)c != (Object)null && !c.isAI && c.playerID >= 0 && c.playerID < 4)
{
if (c.PlayerActions != null)
{
return !Compat.IsBotDevice(((PlayerActionSet)c.PlayerActions).Device);
}
return true;
}
return false;
}
public static void Won(Controller c)
{
if (Valid(c))
{
Wins[c.playerID]++;
Save();
}
}
public static void Died(Controller victim, Controller killer)
{
bool flag = false;
if (Valid(victim))
{
Deaths[victim.playerID]++;
flag = true;
}
if (Valid(killer) && (Object)(object)killer != (Object)(object)victim)
{
Kills[killer.playerID]++;
flag = true;
}
if (flag)
{
Save();
}
}
public static void Reset()
{
Array.Clear(Wins, 0, 4);
Array.Clear(Kills, 0, 4);
Array.Clear(Deaths, 0, 4);
Save();
Plugin.Log.LogInfo((object)"Scoreboard reset.");
}
}
[HarmonyPatch(typeof(HealthHandler), "TakeDamage", new Type[]
{
typeof(float),
typeof(Controller),
typeof(DamageType),
typeof(bool),
typeof(Vector3),
typeof(Vector3)
})]
internal static class TakeDamagePatch
{
public static readonly Dictionary<Controller, Controller> LastRocket = new Dictionary<Controller, Controller>();
private static void Prefix(HealthHandler __instance, Controller damager)
{
Controller component = ((Component)__instance).GetComponent<Controller>();
if (!((Object)(object)component == (Object)null))
{
if ((Object)(object)damager == (Object)null && (Object)(object)RocketCredit.Current != (Object)null)
{
LastRocket[component] = RocketCredit.Current;
}
else
{
LastRocket.Remove(component);
}
}
}
}
[HarmonyPatch(typeof(GameManager), "KillPlayer")]
internal static class KillPlayerPatch
{
private static void Prefix(Controller playerToKill)
{
if (!((Object)(object)playerToKill == (Object)null))
{
Controller value;
bool flag = TakeDamagePatch.LastRocket.TryGetValue(playerToKill, out value);
TakeDamagePatch.LastRocket.Remove(playerToKill);
if (Scores.Counting && GameManager.inFight)
{
Scores.Died(playerToKill, flag ? value : playerToKill.damager);
}
}
}
}
[HarmonyPatch(typeof(GameManager), "AllButOnePlayersDied")]
internal static class RoundOverPatch
{
[HarmonyPriority(200)]
private static void Prefix(GameManager __instance, bool __runOriginal)
{
if (!Scores.Counting || !__runOriginal)
{
return;
}
foreach (Controller item in __instance.playersAlive)
{
if ((Object)(object)item != (Object)null)
{
Scores.Won(item);
break;
}
}
}
}
internal class Board : MonoBehaviour
{
private const float HoldTime = 2f;
private const string Probe = "P1 WINS KILLS DEATHS 0123456789";
private Vector2 boardTopLeft = new Vector2(-862.9f, 469.2f);
private float boardWidth = 453f;
private float boardFont = 28.06f;
private float lobbyScale = 1f;
private float hintGap = 18.9f;
private Vector3 lastCamPos;
private float lastOrtho;
private int lastScreenW;
private int lastScreenH;
private Canvas canvas;
private CanvasGroup group;
private TextMeshProUGUI table;
private TextMeshProUGUI hint;
private float captureAt;
private int drawn = -1;
private int drawnPlayers = -1;
private float held;
private bool waitRelease;
private PauseManager pause;
private const string LobbyLine = "KILL YOUR FRIENDS TO START";
private const float WallWidth = 8.4f;
private TextMeshPro wall;
private TextMeshPro wallHint;
private bool wallDrawn;
private float wallSearchAt;
private float resetAt = -10f;
private Color wallGrey = new Color(0.204f, 0.204f, 0.204f, 1f);
private string drawnLook = "";
private readonly TextMeshProUGUI[] panelPatterns = (TextMeshProUGUI[])(object)new TextMeshProUGUI[4];
private readonly TextMeshPro[] wallPatterns = (TextMeshPro[])(object)new TextMeshPro[4];
private static Func<Controller, Material, Material> paintText;
private static bool paintLooked;
private static readonly Color PanelHintGrey = new Color(0.44f, 0.44f, 0.44f);
private Color HintGrey => wallGrey;
private void LateUpdate()
{
if ((Object)(object)canvas == (Object)null)
{
Build();
}
Ui.Attach(canvas);
bool flag = !MatchmakingHandler.IsNetworkMatch && Plugin.Enabled.Value;
if (flag && GameManager.stillInMenu && (Object)(object)wall == (Object)null)
{
MakeWall();
}
if ((Object)(object)wall != (Object)null && ((Component)wall).gameObject.activeSelf != flag)
{
((Component)wall).gameObject.SetActive(flag);
if ((Object)(object)wallHint != (Object)null)
{
((Component)wallHint).gameObject.SetActive(flag);
}
}
if ((Object)(object)pause == (Object)null && (Object)(object)GameManager.Instance != (Object)null)
{
pause = ((Component)GameManager.Instance).GetComponent<PauseManager>();
}
bool flag2 = (Object)(object)pause == (Object)null || ((Object)(object)pause.pauseAnim != (Object)null && !pause.pauseAnim.state1);
bool flag3 = flag && PauseManager.isPaused && flag2;
group.alpha = Mathf.MoveTowards(group.alpha, flag3 ? 1f : 0f, Time.unscaledDeltaTime * 6f);
int num = PlayersMask();
string text = Looks(num);
if (drawn != Scores.Version || drawnPlayers != num || wallDrawn != ((Object)(object)wall != (Object)null) || text != drawnLook)
{
drawnLook = text;
Draw(num);
}
SyncWallPatterns();
if (GameManager.stillInMenu && (Object)(object)wall != (Object)null && Time.unscaledTime >= captureAt)
{
captureAt = Time.unscaledTime + 0.5f;
Capture();
}
bool flag4 = flag && (flag3 || (GameManager.stillInMenu && (Object)(object)wall != (Object)null)) && Holding();
if (!flag4)
{
waitRelease = false;
}
held = ((flag4 && !waitRelease) ? (held + Time.unscaledDeltaTime) : 0f);
if (held >= 2f)
{
Scores.Reset();
held = 0f;
waitRelease = true;
resetAt = Time.unscaledTime;
}
AnimateWallHint();
}
private void MakeWall()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
if (Time.unscaledTime < wallSearchAt)
{
return;
}
wallSearchAt = Time.unscaledTime + 1f;
TextMeshPro val = null;
TextMeshPro[] array = Object.FindObjectsOfType<TextMeshPro>();
foreach (TextMeshPro val2 in array)
{
if (((TMP_Text)val2).text == "KILL YOUR FRIENDS TO START")
{
val = val2;
break;
}
}
if (!((Object)(object)val == (Object)null))
{
wallGrey = ((Graphic)val).color;
wall = Copy(val, "SessionScoreboard");
((TMP_Text)wall).fontSize = 5.2f;
((TMP_Text)wall).alignment = (TextAlignmentOptions)257;
((TMP_Text)wall).lineSpacing = -8f;
((TMP_Text)wall).rectTransform.sizeDelta = new Vector2(8.4f, 8f);
((TMP_Text)wall).rectTransform.pivot = new Vector2(0.5f, 1f);
wall.transform.position = new Vector3(val.transform.position.x, 8.7f, 11.8f);
wallHint = Copy(val, "SessionScoreboardHint");
((TMP_Text)wallHint).fontSize = 2.6f;
((TMP_Text)wallHint).alignment = (TextAlignmentOptions)258;
((TMP_Text)wallHint).rectTransform.sizeDelta = new Vector2(8.4f, 1.5f);
((TMP_Text)wallHint).rectTransform.pivot = new Vector2(0.5f, 1f);
((TMP_Text)wallHint).text = "HOLD BOTH STICKS TO RESET";
wallDrawn = false;
}
}
private static TextMeshPro Copy(TextMeshPro source, string name)
{
TextMeshPro obj = Object.Instantiate<TextMeshPro>(source, source.transform.parent);
((Object)obj).name = name;
((TMP_Text)obj).enableWordWrapping = false;
((TMP_Text)obj).richText = true;
return obj;
}
private void AnimateWallHint()
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
string text = "HOLD BOTH STICKS TO RESET";
float num = 0f;
float num2 = Time.unscaledTime - resetAt;
if (num2 < 1.6f)
{
text = "SCORES RESET";
num = 1f - Mathf.Clamp01((num2 - 0.8f) / 0.8f);
}
else if (held > 0f)
{
text = "RESETTING...";
num = held / 2f;
}
Color val = default(Color);
((Color)(ref val))..ctor(0.75f, 0.32f, 0.3f, 1f);
if (((TMP_Text)hint).text != text)
{
((TMP_Text)hint).text = text;
}
((Graphic)hint).color = Color.Lerp(PanelHintGrey, val, num);
if (!((Object)(object)wallHint == (Object)null) && !((Object)(object)wall == (Object)null))
{
Vector3 position = wall.transform.position;
wallHint.transform.position = new Vector3(position.x, position.y - ((TMP_Text)wall).preferredHeight - 0.35f, position.z);
if (((TMP_Text)wallHint).text != text)
{
((TMP_Text)wallHint).text = text;
}
((Graphic)wallHint).color = Color.Lerp(HintGrey, val, num);
}
}
private string Dim(Color c)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
return Ui.Hex(Color.Lerp(wallGrey, c, 0.38f));
}
private static bool Holding()
{
if (Input.GetKey((KeyCode)127))
{
return true;
}
foreach (InputDevice device in InputManager.Devices)
{
if (device != null && ((OneAxisInputControl)device.LeftStickButton).IsPressed && ((OneAxisInputControl)device.RightStickButton).IsPressed)
{
return true;
}
}
return false;
}
private static int PlayersMask()
{
int num = 0;
ControllerHandler instance = ControllerHandler.Instance;
if ((Object)(object)instance != (Object)null)
{
foreach (Controller player in instance.players)
{
if ((Object)(object)player != (Object)null && player.playerID >= 0 && player.playerID < 4)
{
num |= 1 << player.playerID;
}
}
}
return num;
}
private void Draw(int players)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
drawn = Scores.Version;
drawnPlayers = players;
((TMP_Text)table).text = BoardText(players, panelColours: true);
Layout();
wallDrawn = (Object)(object)wall != (Object)null;
if (!((Object)(object)wall == (Object)null))
{
((Graphic)wall).color = wallGrey;
((TMP_Text)wall).text = BoardText(players, panelColours: false);
((TMP_Text)wall).ForceMeshUpdate();
DrawPatterns(players);
}
}
private static Controller PlayerIn(int slot)
{
ControllerHandler instance = ControllerHandler.Instance;
if ((Object)(object)instance != (Object)null)
{
foreach (Controller player in instance.players)
{
if ((Object)(object)player != (Object)null && player.playerID == slot)
{
return player;
}
}
}
return null;
}
private static Color PlayerColor(int slot)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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)
Controller val = PlayerIn(slot);
CharacterInformation val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<CharacterInformation>() : null);
if ((Object)(object)val2 != (Object)null && (Object)(object)val2.myMaterial != (Object)null)
{
Color color = val2.myMaterial.color;
color.a = 1f;
return color;
}
return Ui.SlotColor(slot);
}
private static Material PatternFor(int slot, Material font)
{
Controller val = PlayerIn(slot);
if (!((Object)(object)val != (Object)null) || !((Object)(object)font != (Object)null))
{
return null;
}
return PatternedText(val, font);
}
private string Looks(int players)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < 4; i++)
{
if ((players & (1 << i)) != 0)
{
stringBuilder.Append(Ui.Hex(PlayerColor(i)));
Material val = PatternFor(i, ((Object)(object)table != (Object)null) ? ((TMP_Text)table).fontSharedMaterial : null);
stringBuilder.Append(((Object)(object)val != (Object)null) ? ((Object)val).GetInstanceID() : 0).Append(',');
}
}
return stringBuilder.ToString();
}
private void DrawPatterns(int players)
{
//IL_0075: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: 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)
for (int i = 0; i < 4; i++)
{
bool num = (players & (1 << i)) != 0;
Material val = (num ? PatternFor(i, ((TMP_Text)table).fontSharedMaterial) : null);
if ((Object)(object)val != (Object)null && (Object)(object)panelPatterns[i] == (Object)null)
{
TextMeshProUGUI val2 = Ui.Text((Transform)(object)((TMP_Text)table).rectTransform, "Pattern" + i, "", ((TMP_Text)table).fontSize, Color.white, (TextAlignmentOptions)257);
RectTransform rectTransform = ((TMP_Text)val2).rectTransform;
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero);
rectTransform.offsetMin = offsetMin;
rectTransform.pivot = ((TMP_Text)table).rectTransform.pivot;
((Transform)rectTransform).localScale = Vector3.one;
panelPatterns[i] = val2;
}
if ((Object)(object)panelPatterns[i] != (Object)null)
{
TextMeshProUGUI val3 = panelPatterns[i];
((Component)val3).gameObject.SetActive((Object)(object)val != (Object)null);
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val3).font = ((TMP_Text)table).font;
((TMP_Text)val3).fontSize = ((TMP_Text)table).fontSize;
((TMP_Text)val3).lineSpacing = ((TMP_Text)table).lineSpacing;
((TMP_Text)val3).characterSpacing = ((TMP_Text)table).characterSpacing;
((TMP_Text)val3).wordSpacing = ((TMP_Text)table).wordSpacing;
((TMP_Text)val3).enableWordWrapping = false;
((TMP_Text)val3).alignment = (TextAlignmentOptions)257;
if ((Object)(object)((TMP_Text)val3).fontSharedMaterial != (Object)(object)val)
{
((TMP_Text)val3).fontSharedMaterial = val;
}
((Graphic)val3).color = Color.white;
((TMP_Text)val3).text = BoardText(players, panelColours: true, i);
((TMP_Text)val3).ForceMeshUpdate();
}
}
Material val4 = ((num && (Object)(object)wall != (Object)null) ? PatternFor(i, ((TMP_Text)wall).fontSharedMaterial) : null);
if ((Object)(object)val4 != (Object)null && (Object)(object)wallPatterns[i] == (Object)null)
{
wallPatterns[i] = Copy(wall, "SessionScoreboardPattern" + i);
}
if (!((Object)(object)wallPatterns[i] != (Object)null))
{
continue;
}
TextMeshPro val5 = wallPatterns[i];
((Component)val5).gameObject.SetActive((Object)(object)val4 != (Object)null);
if ((Object)(object)val4 != (Object)null)
{
if ((Object)(object)((TMP_Text)val5).fontSharedMaterial != (Object)(object)val4)
{
((TMP_Text)val5).fontSharedMaterial = val4;
}
((Graphic)val5).color = Color.Lerp(wallGrey, Color.white, 0.38f);
((TMP_Text)val5).text = BoardText(players, panelColours: false, i);
((TMP_Text)val5).ForceMeshUpdate();
}
}
SyncWallPatterns();
}
private void SyncWallPatterns()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_006d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_010c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)wall == (Object)null)
{
return;
}
TextMeshPro[] array = wallPatterns;
foreach (TextMeshPro val in array)
{
if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeSelf)
{
val.transform.position = wall.transform.position - wall.transform.forward * 0.01f;
val.transform.rotation = wall.transform.rotation;
val.transform.localScale = wall.transform.localScale;
((TMP_Text)val).fontSize = ((TMP_Text)wall).fontSize;
((TMP_Text)val).alignment = ((TMP_Text)wall).alignment;
((TMP_Text)val).lineSpacing = ((TMP_Text)wall).lineSpacing;
((TMP_Text)val).rectTransform.sizeDelta = ((TMP_Text)wall).rectTransform.sizeDelta;
((TMP_Text)val).rectTransform.pivot = ((TMP_Text)wall).rectTransform.pivot;
}
}
}
private static Material PatternedText(Controller player, Material font)
{
if (!paintLooked)
{
paintLooked = true;
if (Chainloader.PluginInfos.TryGetValue("stickfight.paintcan", out var value) && (Object)(object)value.Instance != (Object)null)
{
MethodInfo methodInfo = ((object)value.Instance).GetType().Assembly.GetType("PaintCan.PaintCanApi")?.GetMethod("PatternedText", BindingFlags.Static | BindingFlags.Public);
if ((object)methodInfo != null)
{
paintText = (Func<Controller, Material, Material>)Delegate.CreateDelegate(typeof(Func<Controller, Material, Material>), methodInfo);
}
}
}
if (paintText == null)
{
return null;
}
return paintText(player, font);
}
private string BoardText(int players, bool panelColours, int onlySlot = -1)
{
//IL_0068: 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_00ca: 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)
bool flag = onlySlot >= 0;
if (flag)
{
panelColours = false;
}
StringBuilder stringBuilder = new StringBuilder();
if (flag)
{
stringBuilder.Append("<alpha=#00>");
}
if (panelColours)
{
stringBuilder.Append("<color=#9A9A9A>");
}
stringBuilder.Append("<size=55%><pos=24%>WINS<pos=49%>KILLS<pos=74%>DEATHS</size>");
if (panelColours)
{
stringBuilder.Append("</color>");
}
int num = 0;
for (int i = 0; i < 4; i++)
{
if ((players & (1 << i)) != 0)
{
num++;
Color c = PlayerColor(i);
if (flag)
{
stringBuilder.Append((i == onlySlot) ? ("\n<alpha=#FF>P" + (i + 1) + "<alpha=#00>") : ("\nP" + (i + 1)));
}
else
{
stringBuilder.Append("\n<color=").Append(panelColours ? Ui.Hex(c) : Dim(c)).Append(">P")
.Append(i + 1)
.Append("</color>");
}
stringBuilder.Append("<pos=24%>").Append(Scores.Wins[i]).Append("<pos=49%>")
.Append(Scores.Kills[i])
.Append("<pos=74%>")
.Append(Scores.Deaths[i]);
}
}
if (num == 0 && flag)
{
return "";
}
if (num == 0)
{
stringBuilder.Append(panelColours ? "\n<color=#9A9A9A><size=55%>NOBODY HAS JOINED</size></color>" : "\n<size=55%>NOBODY HAS JOINED</size>");
}
return stringBuilder.ToString();
}
private unsafe void Capture()
{
//IL_0044: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: 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_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if ((Object)(object)main == (Object)null || (Object)(object)wall == (Object)null || (Object)(object)wallHint == (Object)null || !((Component)wall).gameObject.activeInHierarchy)
{
return;
}
Vector3 position = ((Component)main).transform.position;
Vector3 val = position - lastCamPos;
bool num = ((Vector3)(ref val)).sqrMagnitude < 0.0001f && Mathf.Abs(main.orthographicSize - lastOrtho) < 0.001f && Screen.width == lastScreenW && Screen.height == lastScreenH;
lastCamPos = position;
lastOrtho = main.orthographicSize;
lastScreenW = Screen.width;
lastScreenH = Screen.height;
if (!num)
{
return;
}
RectTransform val2 = (RectTransform)((Component)canvas).transform;
Camera ui = (((int)canvas.renderMode == 0) ? null : canvas.worldCamera);
Vector3[] array = (Vector3[])(object)new Vector3[4];
((TMP_Text)wall).rectTransform.GetWorldCorners(array);
Vector2 val3 = ToCanvas(val2, main, ui, array[1]);
Vector2 val4 = ToCanvas(val2, main, ui, array[2]);
Vector2 val5 = val4 - val3;
float magnitude = ((Vector2)(ref val5)).magnitude;
if (magnitude < 10f)
{
return;
}
Rect rect = ((TMP_Text)wall).rectTransform.rect;
if (((Rect)(ref rect)).width <= 0f)
{
return;
}
Rect rect2 = val2.rect;
if (((Rect)(ref rect2)).Contains(val3) && ((Rect)(ref rect2)).Contains(val4))
{
float num2 = magnitude;
rect = ((TMP_Text)wall).rectTransform.rect;
float num3 = num2 / ((Rect)(ref rect)).width;
Match(table, wall);
Match(hint, wallHint);
float fontSize = ((TMP_Text)table).fontSize;
((TMP_Text)table).fontSize = ((TMP_Text)wall).fontSize;
float x = ((TMP_Text)table).GetPreferredValues("P1 WINS KILLS DEATHS 0123456789").x;
float num4 = ((x > 0f) ? (((TMP_Text)wall).GetPreferredValues("P1 WINS KILLS DEATHS 0123456789").x / x) : 1f);
((TMP_Text)table).fontSize = fontSize;
float num5 = Mathf.Max(0.0001f, wall.transform.lossyScale.y);
float num6 = ((TMP_Text)wall).fontSize * num4 * num3;
val5 = val3 - boardTopLeft;
bool num7 = ((Vector2)(ref val5)).sqrMagnitude > 0.25f || Mathf.Abs(num6 - boardFont) > 0.05f || Mathf.Abs(magnitude - boardWidth) > 0.5f;
boardTopLeft = val3;
boardWidth = magnitude;
boardFont = num6;
lobbyScale = num5;
hintGap = 0.35f * num3 / num5;
if (num7)
{
ManualLogSource log = Plugin.Log;
string[] obj = new string[10] { "Lobby board on screen: top left ", null, null, null, null, null, null, null, null, null };
val5 = val3;
obj[1] = ((object)(*(Vector2*)(&val5))/*cast due to .constrained prefix*/).ToString();
obj[2] = ", width ";
obj[3] = magnitude.ToString("F1");
obj[4] = ", font ";
obj[5] = num6.ToString("F2");
obj[6] = ", scale ";
obj[7] = num5.ToString("F3");
obj[8] = ", hint gap ";
obj[9] = hintGap.ToString("F1");
log.LogDebug((object)string.Concat(obj));
Layout();
}
}
}
private static void Match(TextMeshProUGUI to, TextMeshPro from)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)to).font = ((TMP_Text)from).font;
((TMP_Text)to).fontStyle = ((TMP_Text)from).fontStyle;
((TMP_Text)to).characterSpacing = ((TMP_Text)from).characterSpacing;
((TMP_Text)to).wordSpacing = ((TMP_Text)from).wordSpacing;
((TMP_Text)to).lineSpacing = ((TMP_Text)from).lineSpacing;
}
private static Vector2 ToCanvas(RectTransform canvasRt, Camera world, Camera ui, Vector3 p)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_0016: Unknown result type (might be due to invalid IL or missing references)
Vector2 result = default(Vector2);
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRt, Vector2.op_Implicit(world.WorldToScreenPoint(p)), ui, ref result);
return result;
}
private void Layout()
{
//IL_004f: 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_00d6: 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)
TextMeshProUGUI[] array = panelPatterns;
foreach (TextMeshProUGUI val in array)
{
if ((Object)(object)val != (Object)null)
{
((TMP_Text)val).fontSize = boardFont;
}
}
RectTransform rectTransform = ((TMP_Text)table).rectTransform;
((TMP_Text)table).fontSize = boardFont;
rectTransform.anchoredPosition = boardTopLeft;
rectTransform.sizeDelta = new Vector2(boardWidth, boardFont * 8f);
((TMP_Text)table).ForceMeshUpdate();
float preferredHeight = ((TMP_Text)table).preferredHeight;
float num = boardTopLeft.y - (preferredHeight / lobbyScale + hintGap);
((TMP_Text)hint).fontSize = boardFont * 0.5f;
((TMP_Text)hint).rectTransform.anchoredPosition = new Vector2(boardTopLeft.x, num);
((TMP_Text)hint).rectTransform.sizeDelta = new Vector2(boardWidth, boardFont);
}
private void Build()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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)
canvas = Ui.MakeCanvas("SessionScoreboardCanvas", 4);
group = ((Component)canvas).gameObject.AddComponent<CanvasGroup>();
group.alpha = 0f;
group.blocksRaycasts = false;
group.interactable = false;
table = Ui.Text(((Component)canvas).transform, "Table", "", boardFont, Color.white, (TextAlignmentOptions)257);
((TMP_Text)table).rectTransform.pivot = new Vector2(0f, 1f);
((TMP_Text)table).lineSpacing = -8f;
hint = Ui.Text(((Component)canvas).transform, "Hint", "HOLD BOTH STICKS TO RESET", boardFont * 0.5f, PanelHintGrey, (TextAlignmentOptions)258);
((TMP_Text)hint).rectTransform.pivot = new Vector2(0f, 1f);
}
}
internal static class RocketCredit
{
private struct Blast
{
public Vector3 Pos;
public Controller Owner;
public float At;
}
private static readonly List<Blast> blasts = new List<Blast>();
public static Controller Current;
public static void Reset()
{
blasts.Clear();
Current = null;
}
public static Controller OwnerOf(Component c)
{
DamagerHolder componentInParent = c.GetComponentInParent<DamagerHolder>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.damager != (Object)null)
{
return componentInParent.damager;
}
TeamHolder componentInParent2 = c.GetComponentInParent<TeamHolder>();
ControllerHandler instance = ControllerHandler.Instance;
if ((Object)(object)componentInParent2 == (Object)null || (Object)(object)instance == (Object)null || instance.players == null)
{
return null;
}
for (int i = 0; i < instance.players.Count; i++)
{
Controller val = instance.players[i];
if ((Object)(object)val != (Object)null && !val.isAI && val.playerID == componentInParent2.team)
{
return val;
}
}
return null;
}
public static void GoesOff(SpawnObject s)
{
//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)
Controller val = OwnerOf((Component)(object)s);
if ((Object)(object)val == (Object)null)
{
return;
}
float time = Time.time;
for (int num = blasts.Count - 1; num >= 0; num--)
{
if (time - blasts[num].At > 2f)
{
blasts.RemoveAt(num);
}
}
blasts.Add(new Blast
{
Pos = ((Component)s).transform.position,
Owner = val,
At = time
});
}
public static Controller Find(Vector3 p)
{
//IL_0039: 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_003f: 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)
float time = Time.time;
for (int num = blasts.Count - 1; num >= 0; num--)
{
if (time - blasts[num].At < 1.5f)
{
Vector3 val = blasts[num].Pos - p;
if (((Vector3)(ref val)).sqrMagnitude < 2.25f)
{
return blasts[num].Owner;
}
}
}
return null;
}
}
[HarmonyPatch(typeof(SpawnObject), "GO")]
internal static class RocketGoesOffPatch
{
private static void Prefix(SpawnObject __instance)
{
try
{
RocketCredit.GoesOff(__instance);
}
catch
{
}
}
}
[HarmonyPatch(typeof(Explosion), "Explode")]
internal static class RocketBlastPatch
{
private static void Prefix(Explosion __instance)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
RocketCredit.Current = null;
try
{
if ((Object)(object)__instance.damager == (Object)null)
{
RocketCredit.Current = RocketCredit.Find(((Component)__instance).transform.position);
}
}
catch
{
}
}
private static Exception Finalizer(Exception __exception)
{
RocketCredit.Current = null;
return __exception;
}
}
[HarmonyPatch(typeof(CollisionDamage), "OnCollisionEnter")]
internal static class RocketImpactPatch
{
private static void Prefix(CollisionDamage __instance)
{
RocketCredit.Current = null;
try
{
RocketCredit.Current = RocketCredit.OwnerOf((Component)(object)__instance);
}
catch
{
}
}
private static Exception Finalizer(Exception __exception)
{
RocketCredit.Current = null;
return __exception;
}
}
}