Skip to content

immcrab/Lasting-Utilla

Ownership not verified 1
Open on GitHub

Viewing main at commit a6a25ac430“Add files via upload”· 11 months ago

51 lines · 1.7 KBRaw on GitHub
// Decompiled with JetBrains decompiler
// Type: Utilla.Patches.GameModeSelectorPatch
// Assembly: Utilla, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: FDD08D98-E155-49FA-85BC-1930928C3BAA
// Assembly location: C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\Utilla\Utilla.dll

using GorillaTag;
using HarmonyLib;
using System;
using UnityEngine;
using Utilla.Behaviours;

#nullable disable
namespace Utilla.Patches;

[HarmonyPatch(typeof (GameModeSelectorButtonLayout))]
internal class GameModeSelectorPatch
{
  [HarmonyPatch("OnEnable")]
  [HarmonyPrefix]
  public static bool OnEnablePatch(GameModeSelectorButtonLayout __instance)
  {
    __instance.SetupButtons();
    UtillaGamemodeSelector gamemodeSelector;
    if (((Component) __instance).TryGetComponent<UtillaGamemodeSelector>(ref gamemodeSelector))
    {
      gamemodeSelector.CheckGameMode();
      gamemodeSelector.ShowPage();
    }
    else
      ComponentUtils.AddComponent<UtillaGamemodeSelector>((Component) __instance);
    return false;
  }

  [HarmonyPatch("SetupButtons")]
  [HarmonyPrefix]
  public static void SetupButtonsPrefix(GameModeSelectorButtonLayout __instance)
  {
    NetworkSystem instance = NetworkSystem.Instance;
    instance.OnJoinedRoomEvent = DelegateListProcessorPlusMinus<DelegateListProcessor, Action>.op_Subtraction((DelegateListProcessorPlusMinus<DelegateListProcessor, Action>) instance.OnJoinedRoomEvent, new Action(__instance.SetupButtons));
    SetGameModePatch.PreventSettingMode = true;
  }

  [HarmonyPatch("SetupButtons")]
  [HarmonyPostfix]
  public static void SetupButtonsPostfix(GameModeSelectorButtonLayout __instance)
  {
    SetGameModePatch.PreventSettingMode = false;
  }
}

Code is shown from GitHub as-is. Linking a repository doesn’t prove that a release file on Canopy was built from it.