mirror of
https://github.com/MoltenMods/Unify.git
synced 2026-10-20 11:40:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ab366ccef | ||
|
|
6620784255 | ||
|
|
0bafcc4c6b | ||
|
|
e651954ba7 | ||
|
|
3c5dc2566a | ||
|
|
3feb94b45d | ||
|
|
216a639303 | ||
|
|
7b4a916d84 |
No files matched your search
+6
-1
@@ -64,6 +64,11 @@ library then selecting `Manage > Browse local files`.
|
||||
|
||||
## Installing Reactor
|
||||
|
||||
> If you're using version 2021.5.10 or newer, download the Reactor
|
||||
> located here instead:
|
||||
> https://github.com/DaemonBeast/Reactor/releases/tag/0.6.0, then
|
||||
> skip to step 4 below.
|
||||
|
||||
1. Go to the
|
||||
[Reactor CI](https://github.com/NuclearPowered/Reactor/actions)
|
||||
page.
|
||||
@@ -74,4 +79,4 @@ library then selecting `Manage > Browse local files`.
|
||||
5. Launch the game. The top left of the game menu should look
|
||||
something like this:
|
||||
|
||||

|
||||

|
||||
@@ -1,8 +1,11 @@
|
||||
> This mod is not affiliated with Among Us or Innersloth LLC, and the content contained therein is not endorsed or otherwise sponsored by Innersloth LLC. Portions of the materials contained herein are property of Innersloth LLC. © Innersloth LLC.
|
||||
|
||||
# Unify
|
||||
|
||||
An Among Us mod to add extra regions to the regions menu.
|
||||
An Among Us mod to add extra regions to the region menu.
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
# Table of Contents
|
||||
- [Features](#features)
|
||||
@@ -15,6 +18,7 @@ The following regions have been added:
|
||||
- [skeld.net](https://skeld.net/)
|
||||
- localhost *(for playing on a server running on your computer)*
|
||||
- matux.fr
|
||||
- Przebot (may be unreliable or outdated)
|
||||
|
||||
Regions can be connected to directly using an IP address.
|
||||
|
||||
@@ -22,13 +26,13 @@ Custom regions can be added as detailed below in the
|
||||
[configuration](#configuration) section.
|
||||
|
||||
Other mods can add regions via the
|
||||
`AddRegion(string name, string ip, ushort port)` method.
|
||||
`AddRegion(string name, string ip, ushort port)` API method.
|
||||
|
||||
## Installation
|
||||
|
||||
> **⚠ WARNING**
|
||||
>
|
||||
> This mod only has compiled releases for the steam release of the game.
|
||||
> This mod is compiled against the steam edition of the game, but should work on any edition on a version between 2021.5.10 and 2021.5.25.2, including the Itch and Epic Games editions.
|
||||
|
||||
> If you are still using 2020.12.9s and Reactor fails to load, try using the Reactor version located
|
||||
> here: https://github.com/NuclearPowered/Reactor/actions/runs/593649307.
|
||||
@@ -36,6 +40,9 @@ Other mods can add regions via the
|
||||
> If you are still using 2021.3.5s and Reactor fails to load, try using the Reactor version located
|
||||
> here: https://github.com/NuclearPowered/Reactor/actions/runs/636023321.
|
||||
|
||||
> If you are still using 2021.4.12s-2021.4.14s and Reactor fails to load, try using the Reactor
|
||||
> version located here: https://github.com/NuclearPowered/Reactor/actions/runs/827746360
|
||||
|
||||
1. Ensure that BepInEx and Reactor (Reactor is not required for pre releases) are installed
|
||||
([installation guide](INSTALLATION.md)).
|
||||
2. Download the latest mod on the [releases](https://github.com/DaemonBeast/Unify/releases) page
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Reactor.Extensions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Unify.Controls
|
||||
{
|
||||
public class Button
|
||||
{
|
||||
private static readonly TaskCompletionSource<bool> Initialized = new TaskCompletionSource<bool>();
|
||||
private static GameObject _instance;
|
||||
|
||||
private readonly SpriteRenderer _spriteRenderer;
|
||||
private readonly BoxCollider2D _boxCollider2D;
|
||||
|
||||
public GameObject GameObject { get; }
|
||||
public TextMeshPro Text { get; }
|
||||
public Vector2 Size
|
||||
{
|
||||
get => _spriteRenderer.size;
|
||||
set
|
||||
{
|
||||
Text.rectTransform.sizeDelta = value;
|
||||
_spriteRenderer.size = value;
|
||||
_boxCollider2D.size = value;
|
||||
}
|
||||
}
|
||||
public AspectPosition Position { get; }
|
||||
public UnityEngine.UI.Button.ButtonClickedEvent OnClick { get; }
|
||||
|
||||
private Button(string text)
|
||||
{
|
||||
GameObject = Object.Instantiate(_instance).DontDestroy();
|
||||
|
||||
Text = GameObject.GetComponentInChildren<TextMeshPro>();
|
||||
Position = GameObject.GetComponent<AspectPosition>();
|
||||
OnClick = GameObject.GetComponent<PassiveButton>().OnClick;
|
||||
_spriteRenderer = GameObject.GetComponent<SpriteRenderer>();
|
||||
_boxCollider2D = GameObject.GetComponent<BoxCollider2D>();
|
||||
|
||||
var size = new Vector2(Text.preferredWidth, Text.preferredHeight);
|
||||
|
||||
Text.text = text;
|
||||
Text.rectTransform.sizeDelta = size;
|
||||
Position.DistanceFromEdge =
|
||||
new Vector3(Text.preferredWidth / 2f + 0.1f, Text.preferredHeight / 2f + 0.1f, -100f);
|
||||
_spriteRenderer.size = size;
|
||||
_boxCollider2D.size = size;
|
||||
}
|
||||
|
||||
public static async Task<Button> Create(string text)
|
||||
{
|
||||
await Initialized.Task;
|
||||
|
||||
return new Button(text);
|
||||
}
|
||||
|
||||
public Button SetText(string newText)
|
||||
{
|
||||
Text.text = newText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Button SetSize(Vector2 newSize)
|
||||
{
|
||||
Size = newSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Button SetDistanceFromEdge(Vector2 newPosition)
|
||||
{
|
||||
Position.DistanceFromEdge = new Vector3(newPosition.x, newPosition.y, -100f);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Button SetAlignment(AspectPosition.EdgeAlignments newAlignment)
|
||||
{
|
||||
Position.Alignment = newAlignment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static void InitializeBaseButton()
|
||||
{
|
||||
BaseButton.Initialize();
|
||||
}
|
||||
|
||||
private static class BaseButton
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) OnSceneLoaded);
|
||||
}
|
||||
|
||||
private static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
Instantiate();
|
||||
|
||||
SceneManager.remove_sceneLoaded((Action<Scene, LoadSceneMode>) OnSceneLoaded);
|
||||
}
|
||||
|
||||
private static void Instantiate()
|
||||
{
|
||||
if (Initialized.Task.IsCompleted) return;
|
||||
|
||||
var exitButton = GameObject.Find("ExitGameButton");
|
||||
if (!exitButton) return;
|
||||
|
||||
_instance = Object.Instantiate(exitButton).DontDestroy();
|
||||
_instance.SetActive(false);
|
||||
_instance.name = "Button";
|
||||
|
||||
_instance.GetComponent<PassiveButton>().OnClick = new UnityEngine.UI.Button.ButtonClickedEvent();
|
||||
_instance.GetComponent<SceneChanger>().Destroy();
|
||||
_instance.GetComponent<ConditionalHide>().Destroy();
|
||||
_instance.GetComponentInChildren<TextTranslatorTMP>().Destroy();
|
||||
_instance.GetComponentInChildren<TextMeshPro>().text = "Button";
|
||||
|
||||
Initialized.SetResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+197
-26
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using Reactor.Extensions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using Object = UnityEngine.Object;
|
||||
using String = System.String;
|
||||
|
||||
@@ -12,30 +13,32 @@ namespace Unify.Patches
|
||||
{
|
||||
public static class RegionsPatch
|
||||
{
|
||||
private static IRegionInfo[] _oldRegions { get; } = ServerManager.DefaultRegions;
|
||||
internal static IRegionInfo[] OldRegions { get; } = ServerManager.DefaultRegions;
|
||||
|
||||
private static IRegionInfo[] _newRegions { get; } = new IRegionInfo[]
|
||||
internal static IRegionInfo[] NewRegions { get; } = new IRegionInfo[]
|
||||
{
|
||||
new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115", 22023)
|
||||
.Cast<IRegionInfo>(),
|
||||
new DnsRegionInfo("localhost", "localhost", StringNames.NoTranslation, "127.0.0.1", 22023)
|
||||
.Cast<IRegionInfo>(),
|
||||
new DnsRegionInfo("152.228.160.91", "matux.fr", StringNames.NoTranslation, "152.228.160.91", 22023)
|
||||
.Cast<IRegionInfo>(),
|
||||
new DnsRegionInfo("77.55.217.159", "Przebot", StringNames.NoTranslation, "77.55.217.159", 22023)
|
||||
.Cast<IRegionInfo>()
|
||||
};
|
||||
|
||||
public static List<IRegionInfo> ModRegions { get; } = new List<IRegionInfo>();
|
||||
internal static List<IRegionInfo> ModRegions { get; } = new List<IRegionInfo>();
|
||||
|
||||
public static IRegionInfo DirectRegion { get; set; }
|
||||
|
||||
private static TextBoxTMP DirectConnect { get; set; }
|
||||
internal static TextBoxTMP DirectConnect { get; set; }
|
||||
|
||||
public static void Patch()
|
||||
{
|
||||
ServerManager serverManager = ServerManager.Instance;
|
||||
|
||||
IRegionInfo[] patchedRegions = _oldRegions
|
||||
.AddRangeToArray(_newRegions)
|
||||
IRegionInfo[] patchedRegions = OldRegions
|
||||
.AddRangeToArray(NewRegions)
|
||||
.AddRangeToArray(ModRegions.ToArray())
|
||||
.AddRangeToArray(LoadCustomUserRegions());
|
||||
if (DirectRegion != null) patchedRegions = patchedRegions.AddToArray(DirectRegion);
|
||||
@@ -60,7 +63,7 @@ namespace Unify.Patches
|
||||
if (String.IsNullOrWhiteSpace(regionIp.Value)) continue;
|
||||
|
||||
IRegionInfo regionInfo = new DnsRegionInfo(
|
||||
regionIp.Value, $"{regionName.Value}\n{regionIp.Value} {regionPort.Value}",
|
||||
regionIp.Value, regionName.Value,
|
||||
StringNames.NoTranslation, regionIp.Value, regionPort.Value)
|
||||
.Cast<IRegionInfo>();
|
||||
|
||||
@@ -113,13 +116,87 @@ namespace Unify.Patches
|
||||
{
|
||||
[HarmonyPatch(nameof(RegionMenu.Open))]
|
||||
[HarmonyPostfix]
|
||||
public static void DirectConnectButtonPatch(RegionMenu __instance)
|
||||
public static void DirectConnectButtonPatch()
|
||||
{
|
||||
RefreshDirectConnectButton();
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(RegionMenu.Open))]
|
||||
[HarmonyPostfix]
|
||||
public static void RegionMenuLayoutPatch()
|
||||
{
|
||||
RefreshRegionMenu();
|
||||
}
|
||||
|
||||
internal static void RefreshRegionMenu()
|
||||
{
|
||||
if (!GameObject.Find("RegionMenu")) return;
|
||||
|
||||
var regionButtons = DestroyableSingleton<RegionMenu>.Instance.ButtonPool.activeChildren.ToArray();
|
||||
var defaultRegions = ServerManager.DefaultRegions;
|
||||
var showOfficials = UnifyPlugin.ShowOfficialRegions.Value;
|
||||
var showExtras = UnifyPlugin.ShowExtraRegions.Value;
|
||||
|
||||
for (int i = 0; i < regionButtons.Length; i++)
|
||||
{
|
||||
ServerListButton regionButton = regionButtons[i].Cast<ServerListButton>();
|
||||
IRegionInfo region = defaultRegions[i];
|
||||
|
||||
var textTranslatorTemp = regionButton.GetComponentInChildren<TextTranslatorTMP>();
|
||||
if (textTranslatorTemp) textTranslatorTemp.Destroy();
|
||||
|
||||
int extraRegionCount = OldRegions.Length + NewRegions.Length + ModRegions.Count;
|
||||
bool isCustomRegion = i >= OldRegions.Length;
|
||||
bool isCustomUserRegion = i >= extraRegionCount;
|
||||
float x = (!isCustomRegion && !showExtras ? 3f : 0) + (isCustomRegion ? 3f : 0) +
|
||||
(isCustomUserRegion ? 3f : 0) - 4.25f - (!showOfficials || OldRegions.Length == 0 ? 1.5f : 0) -
|
||||
(!showExtras || extraRegionCount == 0 ? 1.5f : 0);
|
||||
float y = i - (isCustomRegion ? OldRegions.Length : 0) -
|
||||
(isCustomUserRegion ? NewRegions.Length + ModRegions.Count : 0);
|
||||
|
||||
var regionButtonPosition = new Vector3(1.25f + x, 2f - 0.5f * y, 0);
|
||||
regionButton.transform.localPosition = regionButtonPosition;
|
||||
|
||||
regionButton.gameObject.SetActive(
|
||||
(showOfficials || i >= OldRegions.Length) &&
|
||||
(showExtras || !isCustomRegion || isCustomUserRegion));
|
||||
|
||||
var buttonRolloverHandler = regionButton.GetComponent<ButtonRolloverHandler>();
|
||||
|
||||
if (RegionsEditor.IsActive)
|
||||
{
|
||||
buttonRolloverHandler.OverColor =
|
||||
ServerManager.Instance.CurrentRegion.Name == region.Name ? Color.white : Color.black;
|
||||
regionButton.Text.color = Color.gray;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonRolloverHandler.OverColor = Color.green;
|
||||
regionButton.Text.color = Color.white;
|
||||
}
|
||||
|
||||
if (isCustomUserRegion)
|
||||
{
|
||||
regionButton.Text.text =
|
||||
RegionsEditor.IsActive ? $"{region.Name}\n{region.PingServer} {region.Servers[0].Port}" :
|
||||
region.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RefreshDirectConnectButton()
|
||||
{
|
||||
if (!GameObject.Find("RegionMenu")) return;
|
||||
|
||||
if (DirectConnect) DirectConnect.gameObject.Destroy();
|
||||
|
||||
RegionMenu regionMenu = DestroyableSingleton<RegionMenu>.Instance;
|
||||
JoinGameButton joinGameButton = DestroyableSingleton<JoinGameButton>.Instance;
|
||||
|
||||
DirectConnect = Object.Instantiate(joinGameButton.GameIdText, __instance.transform);
|
||||
DirectConnect = Object.Instantiate(joinGameButton.GameIdText, regionMenu.transform);
|
||||
DirectConnect.GetComponentInChildren<TextTranslatorTMP>().Destroy();
|
||||
DirectConnect.GetComponent<JoinGameButton>().Destroy();
|
||||
DirectConnect.outputText.text = "Enter IP";
|
||||
DirectConnect.IpMode = true;
|
||||
DirectConnect.characterLimit = 15;
|
||||
DirectConnect.ClearOnFocus = false;
|
||||
@@ -127,28 +204,122 @@ namespace Unify.Patches
|
||||
DirectConnect.OnEnter = new Button.ButtonClickedEvent();
|
||||
DirectConnect.OnEnter.AddListener((Action) UpdateRegion);
|
||||
|
||||
int offset = _newRegions.Length + ModRegions.Count;
|
||||
int offset = NewRegions.Length + ModRegions.Count;
|
||||
DirectConnect.transform.localPosition = new Vector3(0, 1f - (offset / 2f), -100f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static class RegionsEditor
|
||||
{
|
||||
private static Controls.Button _switchButton;
|
||||
|
||||
private static Controls.Button _toggleOfficialsButton;
|
||||
private static Controls.Button _toggleExtrasButton;
|
||||
|
||||
[HarmonyPatch(nameof(RegionMenu.Open))]
|
||||
[HarmonyPostfix]
|
||||
public static void RegionMenuLayoutPatch(RegionMenu __instance)
|
||||
internal static bool IsActive;
|
||||
|
||||
internal static async void SetUp()
|
||||
{
|
||||
await SetUpSwitchButton();
|
||||
await SetUpToggleOfficialsButton();
|
||||
await SetUpToggleExtrasButton();
|
||||
}
|
||||
|
||||
private static void SetRegionsEditorVisibility(bool visible)
|
||||
{
|
||||
IsActive = visible;
|
||||
_toggleOfficialsButton.GameObject.SetActive(visible);
|
||||
_toggleExtrasButton.GameObject.SetActive(visible);
|
||||
|
||||
RegionsPatch.RegionMenuPatches.RefreshRegionMenu();
|
||||
|
||||
if (visible)
|
||||
{
|
||||
var regionButtons = __instance.ButtonPool.activeChildren.ToArray();
|
||||
_switchButton.Text.text = "Back";
|
||||
RegionsPatch.DirectConnect.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchButton.Text.text = "Edit";
|
||||
RegionsPatch.RegionMenuPatches.RefreshDirectConnectButton();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < regionButtons.Length; i++)
|
||||
{
|
||||
ServerListButton regionButton = regionButtons[i].Cast<ServerListButton>();
|
||||
private static async Task SetUpSwitchButton()
|
||||
{
|
||||
_switchButton = await Controls.Button.Create("Edit");
|
||||
_switchButton.SetSize(new Vector2(0.8f, 0.4f)).SetDistanceFromEdge(new Vector2(0.5f, 0.3f));
|
||||
|
||||
_switchButton.OnClick.AddListener((Action) (() =>
|
||||
{
|
||||
SetRegionsEditorVisibility(!IsActive);
|
||||
}));
|
||||
}
|
||||
|
||||
bool isCustomRegion = i >= _oldRegions.Length;
|
||||
bool isCustomUserRegion = i >= _oldRegions.Length + _newRegions.Length + ModRegions.Count;
|
||||
float x = (isCustomRegion ? 3f : 0) + (isCustomUserRegion ? 3f : 0) - 4.25f;
|
||||
float y = i - (isCustomRegion ? _oldRegions.Length : 0) -
|
||||
(isCustomUserRegion ? _newRegions.Length + ModRegions.Count : 0);
|
||||
|
||||
regionButton.transform.localPosition = new Vector3(1.25f + x, 2f - 0.5f * y, 0f);
|
||||
}
|
||||
private static async Task SetUpToggleOfficialsButton()
|
||||
{
|
||||
_toggleOfficialsButton = await Controls.Button.Create("Toggle Official Regions");
|
||||
_toggleOfficialsButton.SetSize(new Vector2(2f, 0.4f)).SetDistanceFromEdge(new Vector2(1.1f, 1.3f));
|
||||
|
||||
_toggleOfficialsButton.OnClick.AddListener((Action) (() =>
|
||||
{
|
||||
UnifyPlugin.ShowOfficialRegions.Value = !UnifyPlugin.ShowOfficialRegions.Value;
|
||||
RegionsPatch.RegionMenuPatches.RefreshRegionMenu();
|
||||
}));
|
||||
}
|
||||
|
||||
private static async Task SetUpToggleExtrasButton()
|
||||
{
|
||||
_toggleExtrasButton = await Controls.Button.Create("Toggle Extra Regions");
|
||||
_toggleExtrasButton.SetSize(new Vector2(2f, 0.4f)).SetDistanceFromEdge(new Vector2(1.1f, 1.8f));
|
||||
|
||||
_toggleExtrasButton.OnClick.AddListener((Action) (() =>
|
||||
{
|
||||
UnifyPlugin.ShowExtraRegions.Value = !UnifyPlugin.ShowExtraRegions.Value;
|
||||
RegionsPatch.RegionMenuPatches.RefreshRegionMenu();
|
||||
}));
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(RegionMenu), nameof(RegionMenu.Open))]
|
||||
public static class OpenRegionsEditorPatch
|
||||
{
|
||||
public static void Postfix()
|
||||
{
|
||||
if (!GameObject.Find("RegionMenu")) return;
|
||||
|
||||
_switchButton.GameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(RegionMenu))]
|
||||
public static class HideRegionsEditorPatch
|
||||
{
|
||||
[HarmonyPatch(nameof(RegionMenu.Close))]
|
||||
[HarmonyPostfix]
|
||||
public static void HideOnClosePatch()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(RegionMenu.ChooseOption))]
|
||||
[HarmonyPrefix]
|
||||
public static bool DisableRegionButtonsPatch()
|
||||
{
|
||||
if (IsActive) return false;
|
||||
|
||||
Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void Hide()
|
||||
{
|
||||
if (!RegionsPatch.DirectConnect) return;
|
||||
|
||||
SetRegionsEditorVisibility(false);
|
||||
|
||||
_switchButton.GameObject.SetActive(false);
|
||||
RegionsPatch.DirectConnect.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-14
@@ -8,6 +8,7 @@ using BepInEx.IL2CPP;
|
||||
using HarmonyLib;
|
||||
using Hazel.Udp;
|
||||
using Reactor;
|
||||
using Unify.Controls;
|
||||
using Unify.Patches;
|
||||
|
||||
namespace Unify
|
||||
@@ -20,32 +21,32 @@ namespace Unify
|
||||
{
|
||||
public const string Id = "daemon.unify";
|
||||
private const string Name = "Unify";
|
||||
private const string Version = "4.1.0";
|
||||
private const string Version = "5.0.0";
|
||||
|
||||
public static ConfigFile ConfigFile { get; private set; }
|
||||
|
||||
internal static ConfigEntry<bool> ShowOfficialRegions;
|
||||
internal static ConfigEntry<bool> ShowExtraRegions;
|
||||
|
||||
public Harmony Harmony { get; } = new Harmony(Id);
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
// ===== For compatibility reasons =====
|
||||
string oldConfigPath = Path.Combine(Paths.ConfigPath, "daemon.unify.reactor.cfg");
|
||||
string newConfigPath = Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg");
|
||||
bool oldConfigExists = File.Exists(oldConfigPath);
|
||||
if (oldConfigExists)
|
||||
{
|
||||
File.Copy(oldConfigPath, newConfigPath, true);
|
||||
File.Delete(oldConfigPath);
|
||||
}
|
||||
|
||||
ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true);
|
||||
// =====================================
|
||||
FixCompatibility();
|
||||
|
||||
ShowOfficialRegions = ConfigFile.Bind("Preferences", "Show Official Regions", true,
|
||||
"If the official regions should be shown when displaying the regions menu");
|
||||
ShowExtraRegions = ConfigFile.Bind("Preferences", "Show Extra Regions", true,
|
||||
"If the extra regions added by default in Unify should be shown when displaying the regions menu");
|
||||
|
||||
// Unpatches the modded handshake, because Impostor is STILL not fully updated yet
|
||||
Harmony.Unpatch(typeof(UdpConnection).GetMethod("HandleSend"), HarmonyPatchType.Prefix,
|
||||
ReactorPlugin.Id);
|
||||
|
||||
Harmony.PatchAll();
|
||||
|
||||
Button.InitializeBaseButton();
|
||||
RegionsEditor.SetUp();
|
||||
}
|
||||
|
||||
public static IRegionInfo AddRegion(string name, string ip, ushort port)
|
||||
@@ -56,7 +57,7 @@ namespace Unify
|
||||
ServerManager.DefaultRegions.ToArray().FirstOrDefault(region => region.PingServer == ip);
|
||||
if (existingRegion != null) return existingRegion;
|
||||
|
||||
IRegionInfo newRegion = new DnsRegionInfo(ip, $"{name}\n{ip} {port}", StringNames.NoTranslation, ip, port)
|
||||
IRegionInfo newRegion = new DnsRegionInfo(ip, name, StringNames.NoTranslation, ip, port)
|
||||
.Cast<IRegionInfo>();
|
||||
|
||||
RegionsPatch.ModRegions.Add(newRegion);
|
||||
@@ -79,5 +80,19 @@ namespace Unify
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void FixCompatibility()
|
||||
{
|
||||
string oldConfigPath = Path.Combine(Paths.ConfigPath, "daemon.unify.reactor.cfg");
|
||||
string newConfigPath = Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg");
|
||||
bool oldConfigExists = File.Exists(oldConfigPath);
|
||||
if (oldConfigExists)
|
||||
{
|
||||
File.Copy(oldConfigPath, newConfigPath, true);
|
||||
File.Delete(oldConfigPath);
|
||||
}
|
||||
|
||||
ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -1,20 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Version>4.1.0</Version>
|
||||
<Mappings>NuclearPowered/Mappings:0.4.0</Mappings>
|
||||
<Version>5.0.0</Version>
|
||||
<Mappings>DaemonBeast/Mappings:0.5.0</Mappings>
|
||||
|
||||
<Description>Region mod</Description>
|
||||
<Authors>Daemon</Authors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
|
||||
<GameVersion>2021.4.12s</GameVersion>
|
||||
<GameVersion>2021.5.10s</GameVersion>
|
||||
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
|
||||
<GameVersion>2021.4.12i</GameVersion>
|
||||
<GameVersion>2021.5.10i</GameVersion>
|
||||
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -32,7 +32,5 @@
|
||||
<Target Name="Copy" AfterTargets="Reobfuscate">
|
||||
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" />
|
||||
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="../build/" />
|
||||
|
||||
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(NewAmongUs)/" />
|
||||
</Target>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 268 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 296 KiB |
Reference in new issue
Block a user