public override void Load() { DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023); IRegionInfo customRegion = new DnsRegionInfo(Ip.Value, "Custom", StringNames.NoTranslation, Ip.Value, Port.Value).Cast <IRegionInfo>(); ServerManager serverManager = DestroyableSingleton <ServerManager> .CHNDKKBEIDG; IRegionInfo[] regions = ServerManager.DefaultRegions; regions = regions.Concat(new IRegionInfo[] { customRegion }).ToArray(); ServerManager.DefaultRegions = regions; serverManager.AGFAPIKFOFF = regions; serverManager.SaveServers(); CEIOGGEDKAN.LMADJLEGIMH = CEIOGGEDKAN.IJGNCMMDGDI = Enumerable.Repeat(3, 16).ToArray(); // Max Imp = Recommended Imp = 3 CEIOGGEDKAN.JMEMPINECJN = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4 DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); Harmony.PatchAll(); }
public override void Load() { DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); StreamerMode = Config.Bind("Custom", "Enable Streamer Mode", false); GhostsSeeTasks = Config.Bind("Custom", "Ghosts See Remaining Tasks", true); GhostsSeeRoles = Config.Bind("Custom", "Ghosts See Roles", true); HostSeesVotesLog = Config.Bind("Custom", "Host Sees Votes Log", false); StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles"); StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF"); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023); defaultRegions = ServerManager.DefaultRegions; UpdateRegions(); GameOptionsData.RecommendedImpostors = GameOptionsData.MaxImpostors = Enumerable.Repeat(3, 16).ToArray(); // Max Imp = Recommended Imp = 3 GameOptionsData.MinPlayers = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4 DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); CustomColors.Load(); Harmony.PatchAll(); }
public override void Load() { DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); StreamerMode = Config.Bind("Custom", "Enable Streamer Mode", false); StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles"); StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF"); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023); CustomRegion = new DnsRegionInfo(Ip.Value, "Custom", StringNames.NoTranslation, Ip.Value, Port.Value); ServerManager serverManager = DestroyableSingleton <ServerManager> .Instance; IRegionInfo[] regions = ServerManager.DefaultRegions; regions = regions.Concat(new IRegionInfo[] { CustomRegion.Cast <IRegionInfo>() }).ToArray(); ServerManager.DefaultRegions = regions; serverManager.AvailableRegions = regions; serverManager.SaveServers(); GameOptionsData.RecommendedImpostors = GameOptionsData.MaxImpostors = Enumerable.Repeat(3, 16).ToArray(); // Max Imp = Recommended Imp = 3 GameOptionsData.MinPlayers = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4 DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); CustomColors.Load(); Harmony.PatchAll(); }
public override void Load() { DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); Harmony.PatchAll(); }
public override void Load() { ModTranslation.Load(); Logger = Log; DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); StreamerMode = Config.Bind("Custom", "Enable Streamer Mode", false); GhostsSeeTasks = Config.Bind("Custom", "Ghosts See Remaining Tasks", true); GhostsSeeRoles = Config.Bind("Custom", "Ghosts See Roles", true); GhostsSeeVotes = Config.Bind("Custom", "Ghosts See Votes", true); ShowRoleSummary = Config.Bind("Custom", "Show Role Summary", true); HideNameplates = Config.Bind("Custom", "Hide Nameplates", false); ShowLighterDarker = Config.Bind("Custom", "Show Lighter / Darker", false); HideTaskArrows = Config.Bind("Custom", "Hide Task Arrows", false); ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0"); StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles GM"); StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF"); DebugRepo = Config.Bind("Custom", "Debug Hat Repo", ""); Ip = Config.Bind("Custom", "Custom Server IP", "127.0.0.1"); Port = Config.Bind("Custom", "Custom Server Port", (ushort)22023); defaultRegions = ServerManager.DefaultRegions; UpdateRegions(); GameOptionsData.RecommendedImpostors = Enumerable.Repeat(3, 16).ToArray(); GameOptionsData.MaxImpostors = Enumerable.Repeat(15, 16).ToArray(); // Max Imp = Recommended Imp = 3 GameOptionsData.MinPlayers = Enumerable.Repeat(4, 15).ToArray(); // Min Players = 4 DebugMode = Config.Bind("Custom", "Enable Debug Mode", false); Instance = this; CustomOptionHolder.Load(); RoleInfo.Load(); CustomColors.Load(); RandomGenerator.Initialize(); Harmony.PatchAll(); Patches.SubmergedPatch.Patch(); SubmergedCompatibility.Initialize(); }
public static bool initializeOverlays() { HudManager hudManager = DestroyableSingleton <HudManager> .Instance; if (hudManager == null) { return(false); } if (helpButton == null) { helpButton = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HelpButton.png", 115f); } if (colorBG == null) { colorBG = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.White.png", 100f); } if (meetingUnderlay == null) { meetingUnderlay = UnityEngine.Object.Instantiate(hudManager.FullScreen, hudManager.transform); meetingUnderlay.transform.localPosition = new Vector3(0f, 0f, 20f); meetingUnderlay.gameObject.SetActive(true); meetingUnderlay.enabled = false; } if (infoUnderlay == null) { infoUnderlay = UnityEngine.Object.Instantiate(meetingUnderlay, hudManager.transform); infoUnderlay.transform.localPosition = new Vector3(0f, 0f, -900f); infoUnderlay.gameObject.SetActive(true); infoUnderlay.enabled = false; } if (infoOverlayRules == null) { infoOverlayRules = UnityEngine.Object.Instantiate(hudManager.TaskText, hudManager.transform); infoOverlayRules.fontSize = infoOverlayRules.fontSizeMin = infoOverlayRules.fontSizeMax = 1.15f; infoOverlayRules.autoSizeTextContainer = false; infoOverlayRules.enableWordWrapping = false; infoOverlayRules.alignment = TMPro.TextAlignmentOptions.TopLeft; infoOverlayRules.transform.position = Vector3.zero; infoOverlayRules.transform.localPosition = new Vector3(-2.5f, 1.15f, -910f); infoOverlayRules.transform.localScale = Vector3.one; infoOverlayRules.color = Palette.White; infoOverlayRules.enabled = false; } if (infoOverlayRoles == null) { infoOverlayRoles = UnityEngine.Object.Instantiate(infoOverlayRules, hudManager.transform); infoOverlayRoles.maxVisibleLines = 28; infoOverlayRoles.fontSize = infoOverlayRoles.fontSizeMin = infoOverlayRoles.fontSizeMax = 1.15f; infoOverlayRoles.outlineWidth += 0.02f; infoOverlayRoles.autoSizeTextContainer = false; infoOverlayRoles.enableWordWrapping = false; infoOverlayRoles.alignment = TMPro.TextAlignmentOptions.TopLeft; infoOverlayRoles.transform.position = Vector3.zero; infoOverlayRoles.transform.localPosition = infoOverlayRules.transform.localPosition + new Vector3(2.5f, 0.0f, 0.0f); infoOverlayRoles.transform.localScale = Vector3.one; infoOverlayRoles.color = Palette.White; infoOverlayRoles.enabled = false; } if (roleUnderlay == null) { roleUnderlay = UnityEngine.Object.Instantiate(meetingUnderlay, hudManager.transform); roleUnderlay.transform.localPosition = new Vector3(0f, 0f, -900f); roleUnderlay.gameObject.SetActive(true); roleUnderlay.enabled = false; } if (roleOverlayList == null) { roleOverlayList = new TMPro.TextMeshPro[3]; } for (var i = 0; i < roleOverlayList.Length; i++) { if (roleOverlayList[i] == null) { if (i == 0) { roleOverlayList[i] = UnityEngine.Object.Instantiate(hudManager.TaskText, hudManager.transform); initializeRoleOverlay(roleOverlayList[i]); roleOverlayList[i].transform.localPosition = new Vector3(-3.5f, 1.2f, -910f); } else { roleOverlayList[i] = UnityEngine.Object.Instantiate(roleOverlayList[i - 1], hudManager.transform); initializeRoleOverlay(roleOverlayList[i]); roleOverlayList[i].transform.localPosition = roleOverlayList[i - 1].transform.localPosition + new Vector3(3.1f, 0.0f, 0.0f); } } } if (roleDatas == null) { roleDatas = new List <string>(); StringBuilder entry = new StringBuilder(); List <string> entries = new List <string>(); // First add the presets and the role counts entries.Add(GameOptionsDataPatch.optionToString(CustomOptionHolder.presetSelection)); var optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("crewmateRoles")); var min = CustomOptionHolder.crewmateRolesCountMin.getSelection(); var max = CustomOptionHolder.crewmateRolesCountMax.getSelection(); if (min > max) { min = max; } var optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; entry.AppendLine($"{optionName}: {optionValue}"); optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("neutralRoles")); min = CustomOptionHolder.neutralRolesCountMin.getSelection(); max = CustomOptionHolder.neutralRolesCountMax.getSelection(); if (min > max) { min = max; } optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; entry.AppendLine($"{optionName}: {optionValue}"); optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("impostorRoles")); min = CustomOptionHolder.impostorRolesCountMin.getSelection(); max = CustomOptionHolder.impostorRolesCountMax.getSelection(); if (min > max) { min = max; } optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; entry.AppendLine($"{optionName}: {optionValue}"); entries.Add(entry.ToString().Trim('\r', '\n')); int maxLines = 28; foreach (CustomOption option in CustomOption.options) { if ((option == CustomOptionHolder.presetSelection) || (option == CustomOptionHolder.crewmateRolesCountMin) || (option == CustomOptionHolder.crewmateRolesCountMax) || (option == CustomOptionHolder.neutralRolesCountMin) || (option == CustomOptionHolder.neutralRolesCountMax) || (option == CustomOptionHolder.impostorRolesCountMin) || (option == CustomOptionHolder.impostorRolesCountMax)) { continue; } if (option.parent == null) { if (!option.enabled) { continue; } entry = new StringBuilder(); if (!option.isHidden) { entry.AppendLine(GameOptionsDataPatch.optionToString(option)); } addChildren(option, ref entry, !option.isHidden); // 1つのオプションが最大行を越えていた場合、最大行までで分割する int lines = entry.ToString().Trim('\r', '\n').Count(c => c == '\n') + 1; while (lines > maxLines) { var line = 0; var newEntry = new StringBuilder(); var entryLines = entry.ToString().Trim('\r', '\n').Split(new[] { "\r\n", "\n", "\r" }, StringSplitOptions.None); foreach (var entryLine in entryLines) { newEntry.AppendLine(entryLine); entry.Remove(0, entryLine.Length + Environment.NewLine.Length); line++; if (maxLines <= line) { break; } } entries.Add(newEntry.ToString().Trim('\r', '\n')); lines -= maxLines; } entries.Add(entry.ToString().Trim('\r', '\n')); } } int lineCount = 0; string page = ""; foreach (var e in entries) { int lines = e.Count(c => c == '\n') + 1; if (lineCount + lines > maxLines) { roleDatas.Add(page); page = ""; lineCount = 0; } page = page + e + "\n\n"; lineCount += lines + 1; } page = page.Trim('\r', '\n'); if (page != "") { roleDatas.Add(page); } maxRolePage = ((roleDatas.Count - 1) / 3) + 1; } return(true); }
private static void Postfix(ref string __result) { StringBuilder sb = new StringBuilder(__result); foreach (CustomOption option in CustomOption.options) { if (option.parent == null) { if (option == CustomOptionHolder.crewmateRolesCountMin) { var optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Crewmate Roles"); var min = CustomOptionHolder.crewmateRolesCountMin.getSelection(); var max = CustomOptionHolder.crewmateRolesCountMax.getSelection(); if (min > max) { min = max; } var optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; sb.AppendLine($"{optionName}: {optionValue}"); } else if (option == CustomOptionHolder.neutralRolesCountMin) { var optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Neutral Roles"); var min = CustomOptionHolder.neutralRolesCountMin.getSelection(); var max = CustomOptionHolder.neutralRolesCountMax.getSelection(); if (min > max) { min = max; } var optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; sb.AppendLine($"{optionName}: {optionValue}"); } else if (option == CustomOptionHolder.impostorRolesCountMin) { var optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Impostor Roles"); var min = CustomOptionHolder.impostorRolesCountMin.getSelection(); var max = CustomOptionHolder.impostorRolesCountMax.getSelection(); if (min > max) { min = max; } var optionValue = (min == max) ? $"{max}" : $"{min} - {max}"; sb.AppendLine($"{optionName}: {optionValue}"); } else if ((option == CustomOptionHolder.crewmateRolesCountMax) || (option == CustomOptionHolder.neutralRolesCountMax) || (option == CustomOptionHolder.impostorRolesCountMax)) { continue; } else { sb.AppendLine($"{option.name}: {option.selections[option.selection].ToString()}"); } } } CustomOption parent = null; foreach (CustomOption option in CustomOption.options) { if (option.parent != null) { if (option.parent != parent) { sb.AppendLine(); parent = option.parent; } sb.AppendLine($"{option.name}: {option.selections[option.selection].ToString()}"); } } var hudString = sb.ToString(); int defaultSettingsLines = 19; int roleSettingsLines = defaultSettingsLines + 32; int detailedSettingsP1 = roleSettingsLines + 34; int detailedSettingsP2 = detailedSettingsP1 + 36; int end1 = hudString.TakeWhile(c => (defaultSettingsLines -= (c == '\n' ? 1 : 0)) > 0).Count(); int end2 = hudString.TakeWhile(c => (roleSettingsLines -= (c == '\n' ? 1 : 0)) > 0).Count(); int end3 = hudString.TakeWhile(c => (detailedSettingsP1 -= (c == '\n' ? 1 : 0)) > 0).Count(); int end4 = hudString.TakeWhile(c => (detailedSettingsP2 -= (c == '\n' ? 1 : 0)) > 0).Count(); int counter = TheOtherRolesPlugin.optionsPage; if (counter == 0) { hudString = hudString.Substring(0, end1) + "\n"; } else if (counter == 1) { hudString = hudString.Substring(end1 + 1, end2 - end1); // Temporary fix, should add a new CustomOption for spaces int gap = 1; int index = hudString.TakeWhile(c => (gap -= (c == '\n' ? 1 : 0)) > 0).Count(); hudString = hudString.Insert(index, "\n"); gap = 5; index = hudString.TakeWhile(c => (gap -= (c == '\n' ? 1 : 0)) > 0).Count(); hudString = hudString.Insert(index, "\n"); gap = 16; index = hudString.TakeWhile(c => (gap -= (c == '\n' ? 1 : 0)) > 0).Count(); hudString = hudString.Insert(index + 1, "\n"); gap = 20; index = hudString.TakeWhile(c => (gap -= (c == '\n' ? 1 : 0)) > 0).Count(); hudString = hudString.Insert(index + 1, "\n"); } else if (counter == 2) { hudString = hudString.Substring(end2 + 1, end3 - end2); } else if (counter == 3) { hudString = hudString.Substring(end3 + 1, end4 - end3); } else if (counter == 4) { hudString = hudString.Substring(end4 + 1); } hudString += $"\n Press tab for more... ({counter+1}/5)"; __result = hudString; }