diff --git a/ExtremeRoles.Test/ExtremeRoles.Test.csproj b/ExtremeRoles.Test/ExtremeRoles.Test.csproj
index 69ab0bea7..d2061e293 100644
--- a/ExtremeRoles.Test/ExtremeRoles.Test.csproj
+++ b/ExtremeRoles.Test/ExtremeRoles.Test.csproj
@@ -22,7 +22,7 @@
-
+
diff --git a/ExtremeRoles.Test/GameTestRunner.cs b/ExtremeRoles.Test/GameTestRunner.cs
index 01275b53d..8b04a6171 100644
--- a/ExtremeRoles.Test/GameTestRunner.cs
+++ b/ExtremeRoles.Test/GameTestRunner.cs
@@ -19,6 +19,7 @@
using ExtremeRoles.GameMode.Option.ShipGlobal;
using UnityResource = UnityEngine.Resources;
+using ExtremeRoles.Module.CustomOption;
namespace ExtremeRoles.Test;
@@ -33,7 +34,7 @@ public override void Run()
GameMudderEndTestingBehaviour.Instance.Logger = this.Log;
GameMudderEndTestingBehaviour.Instance.StartCoroutine(
GameMudderEndTestingBehaviour.Instance.Run(
- new("Random", 3),
+ new("Random", 256),
new("IRoleAbilityRole", 5,
[
ExtremeRoleId.Carpenter,
@@ -62,7 +63,9 @@ public override void Run()
() =>
{
GameUtility.UpdateExROption(
- new((int)GlobalOption.IsSameNeutralSameWin, 1));
+ OptionTab.General,
+ (int)ShipGlobalOptionCategory.NeutralWinOption,
+ new RequireOption((int)NeutralWinOption.IsSame, 1));
}),
new("NeutralWin", 100,
[
@@ -73,7 +76,9 @@ public override void Run()
() =>
{
GameUtility.UpdateExROption(
- new((int)GlobalOption.IsSameNeutralSameWin, 1));
+ OptionTab.General,
+ (int)ShipGlobalOptionCategory.NeutralWinOption,
+ new RequireOption((int)NeutralWinOption.IsSame, 1));
GameUtility.UpdateAmongUsOption(
new RequireOption(
Int32OptionNames.NumImpostors, 0));
@@ -82,7 +87,9 @@ public override void Run()
() =>
{
GameUtility.UpdateExROption(
- new((int)GlobalOption.IsSameNeutralSameWin, 0));
+ OptionTab.General,
+ (int)ShipGlobalOptionCategory.NeutralWinOption,
+ new RequireOption((int)NeutralWinOption.IsSame, 1));
GameUtility.UpdateAmongUsOption(
new RequireOption(
Int32OptionNames.NumImpostors, 3));
@@ -149,16 +156,21 @@ private IEnumerator runTestCase(GameTestRunner.TestCase testCase)
if (this.count > waitCount)
{
- this.Logger.LogInfo("Wait for 30s");
+ this.Logger.LogInfo("Wait for 10s");
GC.Collect();
Resources.Loader.ResetCache();
yield return UnityResource.UnloadUnusedAssets();
- yield return new WaitForSeconds(30.0f);
+ yield return new WaitForSeconds(10.0f);
this.count = 0;
}
yield return GameUtility.StartGame(this.Logger);
+ while (IntroCutscene.Instance != null)
+ {
+ yield return new WaitForSeconds(10.0f);
+ }
+
while (GameUtility.IsContinue)
{
var player = CachedPlayerControl.AllPlayerControls.OrderBy(x => RandomGenerator.Instance.Next()).First();
diff --git a/ExtremeRoles.Test/Helper/GameUtility.cs b/ExtremeRoles.Test/Helper/GameUtility.cs
index 63304789b..96eaa6bf9 100644
--- a/ExtremeRoles.Test/Helper/GameUtility.cs
+++ b/ExtremeRoles.Test/Helper/GameUtility.cs
@@ -6,13 +6,12 @@
using UnityEngine;
using BepInEx.Logging;
using AmongUs.GameOptions;
-
-using ExtremeRoles.GameMode.RoleSelector;
using ExtremeRoles.Helper;
-using ExtremeRoles.Module.CustomOption;
using ExtremeRoles.Roles;
using ExtremeRoles.Roles.API;
+using ExtremeRoles.Module.CustomOption;
+
namespace ExtremeRoles.Test.Helper;
public sealed record RequireOption(T OptionId, W Velue)
@@ -29,8 +28,13 @@ public static class GameUtility
public static void ChangePresetTo(int newPreset)
{
- OptionManager.Instance.GetIOption(0).UpdateSelection(newPreset);
- OptionManager.Instance.SwitchPreset(newPreset);
+ var mng = OptionManager.Instance;
+ if (!mng.TryGetCategory(OptionTab.General, (int)OptionCreator.CommonOption.PresetOption, out var presetCate))
+ {
+ return;
+ }
+ var option = presetCate.Get(0);
+ mng.Update(presetCate, option, newPreset);
}
public static IEnumerator StartGame(ManualLogSource logger)
@@ -64,22 +68,34 @@ public static void PrepereGameWithRandom(ManualLogSource logger)
{
logger.LogInfo("Update Option....");
// オプションを適当にアプデ
- foreach (var opt in OptionManager.Instance.GetAllIOption())
+ var mng = OptionManager.Instance;
+ foreach (var tab in Enum.GetValues())
{
- if (opt.Id == 0) { continue; }
-
- int newIndex = RandomGenerator.Instance.Next(0, opt.ValueCount);
- string name = opt.Name;
-
- if (name.Contains(RoleCommonOption.AssignWeight.ToString()))
+ if (!mng.TryGetTab(tab, out var tabObj))
{
- newIndex = 5;
+ continue;
}
- else if (name.Contains(RoleCommonOption.SpawnRate.ToString()))
+
+ foreach (var cate in tabObj.Category)
{
- newIndex = 0;
+ if (cate.Id == 0) { continue; }
+
+ foreach (var opt in cate.Options)
+ {
+ int newIndex = RandomGenerator.Instance.Next(0, opt.Range);
+ string name = opt.Info.Name;
+
+ if (name.Contains(RoleCommonOption.AssignWeight.ToString()))
+ {
+ newIndex = 5;
+ }
+ else if (name.Contains(RoleCommonOption.SpawnRate.ToString()))
+ {
+ newIndex = 0;
+ }
+ mng.Update(cate, opt, newIndex);
+ }
}
- opt.UpdateSelection(newIndex);
}
disableXion();
@@ -103,38 +119,51 @@ public static void PrepereGameWithRole(ManualLogSource logger, HashSet())
{
- if (opt.Id == 0) { continue; }
-
- int length = opt.ValueCount;
- int newIndex = RandomGenerator.Instance.Next(0, length);
- string name = opt.Name;
-
- if (
- ids.Any(x => name.Contains(x.ToString())) &&
- (
- name.Contains(RoleCommonOption.SpawnRate.ToString()) ||
- name.Contains(RoleCommonOption.AssignWeight.ToString())
- ))
- {
- newIndex = length - 1;
- }
- else if (
- ids.Any(x => name.Contains(x.ToString())) &&
- name.Contains(RoleCommonOption.RoleNum.ToString()))
+ if (!mng.TryGetTab(tab, out var tabObj))
{
- newIndex = RandomGenerator.Instance.Next(1, ((15 - 3) / ids.Count));
+ continue;
}
- else if (name.Contains(RoleCommonOption.AssignWeight.ToString()))
- {
- newIndex = 5;
- }
- else if (name.Contains(RoleCommonOption.SpawnRate.ToString()))
+
+ foreach (var cate in tabObj.Category)
{
- newIndex = 0;
+ if (cate.Id == 0) { continue; }
+
+ foreach (var opt in cate.Options)
+ {
+ int length = opt.Range;
+ int newIndex = RandomGenerator.Instance.Next(0, length);
+ string name = opt.Info.Name;
+
+ if (
+ ids.Any(x => name.Contains(x.ToString())) &&
+ (
+ name.Contains(RoleCommonOption.SpawnRate.ToString()) ||
+ name.Contains(RoleCommonOption.AssignWeight.ToString())
+ ))
+ {
+ newIndex = length - 1;
+ }
+ else if (
+ ids.Any(x => name.Contains(x.ToString())) &&
+ name.Contains(RoleCommonOption.RoleNum.ToString()))
+ {
+ newIndex = RandomGenerator.Instance.Next(1, ((15 - 3) / ids.Count));
+ }
+ else if (name.Contains(RoleCommonOption.AssignWeight.ToString()))
+ {
+ newIndex = 5;
+ }
+ else if (name.Contains(RoleCommonOption.SpawnRate.ToString()))
+ {
+ newIndex = 0;
+ }
+ mng.Update(cate, opt, newIndex);
+ }
}
- opt.UpdateSelection(newIndex);
}
disableXion();
@@ -149,11 +178,12 @@ public static void PrepereGameWithRole(ManualLogSource logger, HashSet option)
+ public static void UpdateExROption(OptionTab tab, int categoryId, in RequireOption option)
{
- OptionManager.Instance.GetIOption(
- option.OptionId).UpdateSelection(
- option.Velue);
+ if (OptionManager.Instance.TryGetCategory(tab, categoryId, out var category))
+ {
+ OptionManager.Instance.Update(category, option.OptionId, option.Velue);
+ }
}
public static void UpdateAmongUsOption(in RequireOption option)
@@ -180,23 +210,38 @@ public static void UpdateAmongUsOption(in RequireOption
private static void disableXion()
{
- OptionManager.Instance.GetIOption(
- (int)RoleGlobalOption.UseXion).UpdateSelection(0);
+ if (OptionManager.Instance.TryGetCategory(
+ OptionTab.General,
+ ExtremeRoleManager.GetRoleGroupId(ExtremeRoleId.Xion),
+ out var category))
+ {
+ OptionManager.Instance.Update(category, 0, 0);
+ }
}
private static void enableRandomNormalRole(ManualLogSource logger)
{
SingleRoleBase role = RandomRoleProvider.GetNormalRole();
- int optionId = role.GetRoleOptionId(RoleCommonOption.SpawnRate);
- OptionManager.Instance.GetIOption(optionId).UpdateSelection(
- OptionCreator.SpawnRate.Length - 1);
+
+ if (OptionManager.Instance.TryGetCategory(
+ role.Tab,
+ ExtremeRoleManager.GetRoleGroupId(role.Id),
+ out var category))
+ {
+ OptionManager.Instance.Update(category, (int)RoleCommonOption.SpawnRate, 9);
+ }
logger.LogInfo($"Enable:{role.Id}");
}
private static void enableRandomCombRole(ManualLogSource logger)
{
- CombinationRoleManagerBase role = RandomRoleProvider.GetCombRole();
- int optionId = role.GetRoleOptionId(RoleCommonOption.SpawnRate);
- OptionManager.Instance.GetIOption(optionId).UpdateSelection(1);
+ CombinationRoleType role = (CombinationRoleType)RandomRoleProvider.GetCombRole();
+ if (OptionManager.Instance.TryGetCategory(
+ OptionTab.Combination,
+ ExtremeRoleManager.GetCombRoleGroupId(role),
+ out var category))
+ {
+ OptionManager.Instance.Update(category, (int)RoleCommonOption.SpawnRate, 9);
+ }
logger.LogInfo($"Enable:{role}");
}
}
diff --git a/ExtremeRoles.Test/Helper/RandomRoleProvider.cs b/ExtremeRoles.Test/Helper/RandomRoleProvider.cs
index d4da3e2d4..8bc2d9584 100644
--- a/ExtremeRoles.Test/Helper/RandomRoleProvider.cs
+++ b/ExtremeRoles.Test/Helper/RandomRoleProvider.cs
@@ -9,6 +9,6 @@ public static class RandomRoleProvider
{
public static SingleRoleBase GetNormalRole()
=> ExtremeRoleManager.NormalRole.Values.OrderBy(x => RandomGenerator.Instance.Next()).First();
- public static CombinationRoleManagerBase GetCombRole()
- => ExtremeRoleManager.CombRole.Values.OrderBy(x => RandomGenerator.Instance.Next()).First();
+ public static byte GetCombRole()
+ => ExtremeRoleManager.CombRole.Keys.OrderBy(x => RandomGenerator.Instance.Next()).First();
}
diff --git a/ExtremeRoles.Test/OptionRunner.cs b/ExtremeRoles.Test/OptionRunner.cs
index e8889c052..87ead4771 100644
--- a/ExtremeRoles.Test/OptionRunner.cs
+++ b/ExtremeRoles.Test/OptionRunner.cs
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
+using ExtremeRoles.Module.CustomOption;
+
using ExtremeRoles.GameMode.Option.ShipGlobal;
using ExtremeRoles.GhostRoles;
-using ExtremeRoles.Module.CustomOption;
using ExtremeRoles.Roles;
+using ExtremeRoles.Roles.API;
namespace ExtremeRoles.Test;
@@ -42,26 +44,35 @@ public override void Run()
this.Log.LogInfo($"Load.GhostRole.Iteration.{i}");
loadGhostRole();
-
- this.Log.LogInfo($"Load.HudString.Iteration.{i}");
- this.hudString();
}
}
private void updateRandom()
{
- foreach (var opt in OptionManager.Instance.GetAllIOption())
+ var mng = OptionManager.Instance;
+ foreach (var tab in Enum.GetValues())
{
- if (opt.Id == 0) { continue; }
-
- int newIndex = RandomGenerator.Instance.Next(0, opt.ValueCount);
- try
+ if (!mng.TryGetTab(tab, out var tabObj))
{
- opt.UpdateSelection(newIndex);
+ continue;
}
- catch (Exception ex)
+
+ foreach (var cate in tabObj.Category)
{
- this.Log.LogError($"{opt.Name} : {newIndex} {ex.Message}");
+ if (cate.Id == 0) { continue; }
+
+ foreach (var opt in cate.Options)
+ {
+ int newIndex = RandomGenerator.Instance.Next(0, opt.Range);
+ try
+ {
+ mng.UpdateToStep(cate, opt, newIndex);
+ }
+ catch (Exception ex)
+ {
+ this.Log.LogError($"{opt.Info.Name} : {newIndex} {ex.Message}");
+ }
+ }
}
}
}
@@ -158,22 +169,4 @@ private void loadGhostRole()
}
}
}
- private void hudString()
- {
- foreach (var opt in OptionManager.Instance.GetAllIOption())
- {
- try
- {
- string hudStr = opt.ToHudString();
- if (!opt.Enabled && !opt.IsHidden && string.IsNullOrEmpty(hudStr))
- {
- throw new Exception("Invalid HudString");
- }
- }
- catch (Exception ex)
- {
- this.Log.LogError($"{opt.Name} {ex.Message}");
- }
- }
- }
}
diff --git a/ExtremeRoles.Test/Patch/RoleManagerPatch.cs b/ExtremeRoles.Test/Patch/RoleManagerPatch.cs
index 8c92d6178..d5b1bb177 100644
--- a/ExtremeRoles.Test/Patch/RoleManagerPatch.cs
+++ b/ExtremeRoles.Test/Patch/RoleManagerPatch.cs
@@ -9,7 +9,7 @@ namespace ExtremeRoles.Test.Patches.Manager;
[HarmonyPatch(typeof(RoleManager), nameof(RoleManager.SelectRoles))]
public static class RoleManagerSelectRolesPatch
{
-
+ [HarmonyPriority(Priority.First)]
public static void Prefix()
{
if (!GameMudderEndTestingBehaviour.Enable) { return; }
@@ -24,7 +24,7 @@ public static void Prefix()
int adjustedNumImpostors = currentOption.GetAdjustedNumImpostors(allPlayer.Count);
- var il2CppListPlayer = new Il2CppSystem.Collections.Generic.List();
+ var il2CppListPlayer = new Il2CppSystem.Collections.Generic.List();
foreach (PlayerControl player in allPlayer)
{
diff --git a/ExtremeRoles.sln b/ExtremeRoles.sln
index 17b4063b7..309ef1688 100644
--- a/ExtremeRoles.sln
+++ b/ExtremeRoles.sln
@@ -14,7 +14,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExtremeBepInExInstaller", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtremeVoiceEngine", "ExtremeVoiceEngine\ExtremeVoiceEngine.csproj", "{2A0828AD-9A1F-4E07-BD5F-E3CFDF6773B2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtremeRoles.Test", "ExtremeRoles.Test\ExtremeRoles.Test.csproj", "{F845C15F-674A-4F12-9B3D-699804ECBF63}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtremeRoles.Test", "ExtremeRoles.Test\ExtremeRoles.Test.csproj", "{F845C15F-674A-4F12-9B3D-699804ECBF63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/ExtremeRoles/Compat/CompatModManager.cs b/ExtremeRoles/Compat/CompatModManager.cs
index 8d04a7c4b..d057f0536 100644
--- a/ExtremeRoles/Compat/CompatModManager.cs
+++ b/ExtremeRoles/Compat/CompatModManager.cs
@@ -11,7 +11,8 @@
using ExtremeRoles.Compat.Interface;
using ExtremeRoles.Compat.ModIntegrator;
-using OptionFactory = ExtremeRoles.Module.CustomOption.Factories.SequentialOptionFactory;
+
+
namespace ExtremeRoles.Compat;
@@ -98,16 +99,17 @@ private CompatModManager()
internal void CreateIntegrateOption(int startId)
{
- var optionFactory = new OptionFactory(startId);
-
foreach (var (mod, index) in this.loadedMod.Values.Select((value, index) => (value, index)))
{
- optionFactory.NamePrefix = mod.Name;
- mod.CreateIntegrateOption(optionFactory);
+ using (var factory = OptionManager.CreateSequentialOptionCategory(
+ startId + index, mod.Name))
+ {
+ mod.CreateIntegrateOption(factory);
+ }
}
this.startOptionId = startId;
- this.endOptionId = optionFactory.EndId;
+ this.endOptionId = startId + this.loadedMod.Count - 1;
}
internal string GetIntegrateOptionHudString()
@@ -115,12 +117,11 @@ internal string GetIntegrateOptionHudString()
StringBuilder builder = new StringBuilder();
for (int id = this.startOptionId; id <= this.endOptionId; ++id)
{
- var option = OptionManager.Instance.GetIOption(id);
- string optionStr = option.ToHudString();
- if (optionStr != string.Empty)
+ if (!OptionManager.Instance.TryGetCategory(OptionTab.General, id, out var cate))
{
- builder.AppendLine(optionStr);
+ continue;
}
+ cate.AddHudString(builder);
}
return builder.ToString().Trim('\r', '\n');
}
diff --git a/ExtremeRoles/Compat/Interface/IMapMod.cs b/ExtremeRoles/Compat/Interface/IMapMod.cs
index 4286b4038..c765773b1 100644
--- a/ExtremeRoles/Compat/Interface/IMapMod.cs
+++ b/ExtremeRoles/Compat/Interface/IMapMod.cs
@@ -31,13 +31,13 @@ public interface IMapMod
public bool IsCustomCalculateLightRadius { get; }
public void Awake(ShipStatus map);
public void Destroy();
- public float CalculateLightRadius(GameData.PlayerInfo player, bool neutral, bool neutralImpostor);
- public float CalculateLightRadius(GameData.PlayerInfo player, float visionMod, bool applayVisionEffects = true);
+ public float CalculateLightRadius(NetworkedPlayerInfo player, bool neutral, bool neutralImpostor);
+ public float CalculateLightRadius(NetworkedPlayerInfo player, float visionMod, bool applayVisionEffects = true);
public bool IsCustomSabotageNow();
public bool IsCustomSabotageTask(TaskTypes saboTask);
public bool IsCustomVentUse(Vent vent);
public (float, bool, bool) IsCustomVentUseResult(
- Vent vent, GameData.PlayerInfo player, bool isVentUse);
+ Vent vent, NetworkedPlayerInfo player, bool isVentUse);
public void RpcRepairCustomSabotage();
public void RpcRepairCustomSabotage(TaskTypes saboTask);
public void RepairCustomSabotage();
diff --git a/ExtremeRoles/Compat/ModIntegrator/ModIntegratorBase.cs b/ExtremeRoles/Compat/ModIntegrator/ModIntegratorBase.cs
index 174a93250..147cd5278 100644
--- a/ExtremeRoles/Compat/ModIntegrator/ModIntegratorBase.cs
+++ b/ExtremeRoles/Compat/ModIntegrator/ModIntegratorBase.cs
@@ -5,7 +5,7 @@
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
-using OptionFactory = ExtremeRoles.Module.CustomOption.Factories.SequentialOptionFactory;
+using OptionFactory = ExtremeRoles.Module.CustomOption.Factory.SequentialOptionCategoryFactory;
namespace ExtremeRoles.Compat.ModIntegrator;
diff --git a/ExtremeRoles/Compat/ModIntegrator/SubmergedMap.cs b/ExtremeRoles/Compat/ModIntegrator/SubmergedMap.cs
index 780e37c96..7d8fa57c4 100644
--- a/ExtremeRoles/Compat/ModIntegrator/SubmergedMap.cs
+++ b/ExtremeRoles/Compat/ModIntegrator/SubmergedMap.cs
@@ -13,14 +13,15 @@
using ExtremeRoles.Helper;
using ExtremeRoles.Extension.Il2Cpp;
-using ExtremeRoles.Module.CustomOption.Factories;
using ExtremeRoles.Compat.Interface;
using ExtremeRoles.Performance;
using ExtremeRoles.Performance.Il2Cpp;
using UnityObject = UnityEngine.Object;
-using ExtremeRoles.GameMode.Option.ShipGlobal;
+
+using ExtremeRoles.Module.CustomOption.Implemented;
+using OptionFactory = ExtremeRoles.Module.CustomOption.Factory.SequentialOptionCategoryFactory;
#nullable enable
@@ -74,7 +75,7 @@ public enum ElevatorSelection
public ShipStatus.MapType MapType => (ShipStatus.MapType)MapId;
public bool CanPlaceCamera => false;
public bool IsCustomCalculateLightRadius => true;
- public SpawnSetting Spawn => (SpawnSetting)this.enableSubMergedRandomSpawn.GetValue();
+ public SpawnSetting Spawn => (SpawnSetting)this.enableSubMergedRandomSpawn.Value;
public TaskTypes RetrieveOxygenMask;
@@ -169,15 +170,17 @@ public void Awake(ShipStatus map)
replaceDoorMinigame();
}
- public override void CreateIntegrateOption(SequentialOptionFactory factory)
+ public override void CreateIntegrateOption(OptionFactory factory)
{
// どうせ作っても5個程度なので参照を持つようにする 8byte * 5 = 40byte程度
- this.elevatorOption = factory.CreateSelectionOption(SubmergedOption.EnableElevator, isHeader: true);
+ this.elevatorOption = factory.CreateSelectionOption(SubmergedOption.EnableElevator);
this.replaceDoorMinigameOption = factory.CreateBoolOption(SubmergedOption.ReplaceDoorMinigame, false);
+ /*
var randomSpawnOpt = OptionManager.Instance.Get((int)GlobalOption.EnableSpecialSetting);
this.enableSubMergedRandomSpawn = factory.CreateSelectionOption(
SubmergedOption.SubmergedSpawnSetting, randomSpawnOpt, invert: true);
+ */
}
public void Destroy()
@@ -190,7 +193,7 @@ public void Destroy()
curOption.SetFloat(FloatOptionNames.ImpostorLightMod, impostorVision);
}
- public float CalculateLightRadius(GameData.PlayerInfo player, bool neutral, bool neutralImpostor)
+ public float CalculateLightRadius(NetworkedPlayerInfo player, bool neutral, bool neutralImpostor)
{
object? value = calculateLightRadiusMethod.Invoke(
this.submarineStatus, new object?[] { null, neutral, neutralImpostor });
@@ -198,7 +201,7 @@ public float CalculateLightRadius(GameData.PlayerInfo player, bool neutral, bool
}
public float CalculateLightRadius(
- GameData.PlayerInfo player, float visionMod, bool applayVisionEffects = true)
+ NetworkedPlayerInfo player, float visionMod, bool applayVisionEffects = true)
{
// サブマージドの視界計算のロジックは「クルーだと停電効果受ける、インポスターだと受けないので」
// 1. まずはデフォルトの視界をMOD側で用意した視界の広さにリプレイス
@@ -234,7 +237,7 @@ public void ChangeFloor(PlayerControl player, int floor)
MonoBehaviour? floorHandler = getFloorHandler(player);
if (floorHandler == null) { return; }
- object[] args = new object[] { floor == 1 };
+ object[] args = [ floor == 1 ];
this.rpcRequestChangeFloorMethod.Invoke(floorHandler, args);
this.registerFloorOverrideMethod.Invoke(floorHandler, args);
@@ -362,7 +365,7 @@ public bool IsCustomVentUse(Vent vent)
}
public (float, bool, bool) IsCustomVentUseResult(
- Vent vent, GameData.PlayerInfo player, bool isVentUse)
+ Vent vent, NetworkedPlayerInfo player, bool isVentUse)
{
object? valueObj = inTransitionField.GetValue(null);
@@ -540,7 +543,7 @@ protected override void PatchAll(Harmony harmony)
#pragma warning restore CS8604
// このコメントに沿って関数調整:https://github.com/SubmergedAmongUs/Submerged/issues/123#issuecomment-1783889792
- GameData.PlayerInfo? info = null;
+ NetworkedPlayerInfo? info = null;
bool tie = false;
Type exileControllerPatches = ClassType.First(
t => t.Name == "ExileControllerPatches");
@@ -611,7 +614,7 @@ protected override void PatchAll(Harmony harmony)
private void disableElevator()
{
- var useElevator = (ElevatorSelection)this.elevatorOption.GetValue();
+ var useElevator = (ElevatorSelection)this.elevatorOption.Value;
switch (useElevator)
{
@@ -649,7 +652,7 @@ private void disableElevator()
private void replaceDoorMinigame()
{
- if (!this.replaceDoorMinigameOption.GetValue() || CachedShipStatus.Instance == null)
+ if (!this.replaceDoorMinigameOption.Value || CachedShipStatus.Instance == null)
{ return; }
object? transformValue = this.submarineStatusReference.GetValue(this.submarineStatus);
diff --git a/ExtremeRoles/Compat/Patches/SubmergedPatch.cs b/ExtremeRoles/Compat/Patches/SubmergedPatch.cs
index 24a7202f9..1c9b019ce 100644
--- a/ExtremeRoles/Compat/Patches/SubmergedPatch.cs
+++ b/ExtremeRoles/Compat/Patches/SubmergedPatch.cs
@@ -20,7 +20,7 @@ namespace ExtremeRoles.Compat.Patches;
public static class ExileControllerPatchesPatch
{
- public static bool ExileController_BeginPrefix(ExileController __instance, GameData.PlayerInfo exiled, bool tie)
+ public static bool ExileController_BeginPrefix(ExileController __instance, NetworkedPlayerInfo exiled, bool tie)
{
return ExtremeRoles.Patches.Controller.ExileControllerBeginePatch.PrefixRun(__instance, exiled, tie);
}
@@ -111,8 +111,7 @@ public static void Postfix(object __instance)
var spawnOpt = ExtremeGameModeManager.Instance.ShipOption.Spawn;
// ランダムスポーンが有効かつ自動選択がオフだけ処理飛ばす
- if (spawnOpt == null ||
- (spawnOpt.EnableSpecialSetting && submergedMod!.Spawn is SpawnPoint.DefaultSpawn && !spawnOpt.IsAutoSelectRandom)) { return; }
+ if (spawnOpt.EnableSpecialSetting && submergedMod!.Spawn is SpawnPoint.DefaultSpawn && !spawnOpt.IsAutoSelectRandom) { return; }
submarineSpawnInSystemTimer.SetValue(__instance, 0.0f);
}
@@ -213,7 +212,7 @@ public static void Prefix(ref bool upperSelected)
var spawnOpt = ExtremeGameModeManager.Instance.ShipOption.Spawn;
var spawnPoint = submergedMod!.Spawn;
- if (spawnOpt == null || spawnPoint is SpawnPoint.DefaultSpawn)
+ if (spawnPoint is SpawnPoint.DefaultSpawn)
{
return;
}
diff --git a/ExtremeRoles/CustomRegion.cs b/ExtremeRoles/CustomRegion.cs
index 13f356bfc..9252cfb43 100644
--- a/ExtremeRoles/CustomRegion.cs
+++ b/ExtremeRoles/CustomRegion.cs
@@ -3,6 +3,8 @@
using ExtremeRoles.Extension.Manager;
using ExtremeRoles.Module;
+
+
namespace ExtremeRoles;
public static class CustomRegion
diff --git a/ExtremeRoles/Extension/CategoryHeaderMaskedExtension.cs b/ExtremeRoles/Extension/CategoryHeaderMaskedExtension.cs
new file mode 100644
index 000000000..68255dca6
--- /dev/null
+++ b/ExtremeRoles/Extension/CategoryHeaderMaskedExtension.cs
@@ -0,0 +1,12 @@
+namespace ExtremeRoles.Extension.Option;
+
+public static class CategoryHeaderMaskedExtension
+{
+ public static void ReplaceExRText(this CategoryHeaderMasked masked, string txt, int maskLayer)
+ {
+ masked.Title.text = txt;
+ masked.Background.material.SetInt(PlayerMaterial.MaskLayer, maskLayer);
+ masked.Title.fontMaterial.SetFloat("_StencilComp", 3f);
+ masked.Title.fontMaterial.SetFloat("_Stencil", maskLayer);
+ }
+}
diff --git a/ExtremeRoles/Extension/EnumExtension.cs b/ExtremeRoles/Extension/EnumExtension.cs
new file mode 100644
index 000000000..5e713b501
--- /dev/null
+++ b/ExtremeRoles/Extension/EnumExtension.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace ExtremeRoles.Extension;
+
+public static class EnumExtension
+{
+ public static int FastInt(this T value) where T : Enum
+ {
+ int result = Unsafe.As(ref value);
+ return result;
+ }
+}
diff --git a/ExtremeRoles/Extension/Il2CppExtension.cs b/ExtremeRoles/Extension/Il2CppExtension.cs
index 7a51baed4..f6d97d301 100644
--- a/ExtremeRoles/Extension/Il2CppExtension.cs
+++ b/ExtremeRoles/Extension/Il2CppExtension.cs
@@ -6,6 +6,7 @@
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppType = Il2CppSystem.Type;
+using System.Diagnostics.CodeAnalysis;
#nullable enable
@@ -21,7 +22,8 @@ public static class Il2CppExtension
.MakeGenericMethod(type)
.Invoke(self, Array.Empty