Skip to content

Commit 7896571

Browse files
authored
Merge pull request #1157 from erdelf/master
Multiboxing made public
2 parents 539346f + eb47e39 commit 7896571

1 file changed

Lines changed: 44 additions & 26 deletions

File tree

AutoDuty/Windows/Config.cs

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public bool UpdatePathsOnStartup
9696
internal bool multiBox = false;
9797
public bool MultiBox
9898
{
99-
get => Plugin.isDev && this.multiBox;
99+
get => this.multiBox;
100100
set
101101
{
102102
if (this.multiBox == value)
@@ -1265,6 +1265,7 @@ public class ConsumableItem
12651265
private static readonly Sounds[] _validSounds = ((Sounds[])Enum.GetValues(typeof(Sounds))).Where(s => s != Sounds.None && s != Sounds.Unknown).ToArray();
12661266

12671267
private static bool overlayHeaderSelected = false;
1268+
private static bool multiboxHeaderSelected = false;
12681269
private static bool devHeaderSelected = false;
12691270
private static bool dutyConfigHeaderSelected = false;
12701271
private static bool bmaiSettingHeaderSelected = false;
@@ -1528,31 +1529,6 @@ public static void Draw()
15281529
if (ImGui.Checkbox("Update Paths on startup", ref ConfigurationMain.Instance.updatePathsOnStartup))
15291530
Configuration.Save();
15301531

1531-
bool multiBox = ConfigurationMain.Instance.multiBox;
1532-
if (ImGui.Checkbox(nameof(ConfigurationMain.MultiBox), ref multiBox))
1533-
{
1534-
ConfigurationMain.Instance.MultiBox = multiBox;
1535-
Configuration.Save();
1536-
}
1537-
1538-
if (ImGui.Checkbox(nameof(ConfigurationMain.host), ref ConfigurationMain.Instance.host))
1539-
Configuration.Save();
1540-
1541-
if(ConfigurationMain.Instance.MultiBox && ConfigurationMain.Instance.host)
1542-
{
1543-
ImGui.Indent();
1544-
for (int i = 0; i < ConfigurationMain.MultiboxUtility.Server.MAX_SERVERS; i++)
1545-
{
1546-
ConfigurationMain.MultiboxUtility.Server.ClientInfo? info = ConfigurationMain.MultiboxUtility.Server.clients[i];
1547-
1548-
ImGuiEx.Text(info != null ?
1549-
$"Client {i}: {(PartyHelper.IsPartyMember(info.CID) ? "in party" : "no party")} | {DateTime.Now.Subtract(ConfigurationMain.MultiboxUtility.Server.keepAlives[i]).TotalSeconds:F3}s ago" :
1550-
$"Client {i}: No Info");
1551-
}
1552-
ImGui.Unindent();
1553-
}
1554-
1555-
15561532
if (ImGui.Button("Print mod list"))
15571533
Svc.Log.Info(string.Join("\n", PluginInterface.InstalledPlugins.Where(pl => pl.IsLoaded).GroupBy(pl => pl.Manifest.InstalledFromUrl).OrderByDescending(g => g.Count()).Select(g => g.Key+"\n\t"+string.Join("\n\t", g.Select(pl => pl.Name)))));
15581534
unsafe
@@ -3047,6 +3023,48 @@ public static void Draw()
30473023
}
30483024
}
30493025

3026+
ImGui.Separator();
3027+
ImGui.Spacing();
3028+
ImGui.PushStyleVar(ImGuiStyleVar.SelectableTextAlign, new Vector2(0.5f, 0.5f));
3029+
3030+
ImGui.SetItemAllowOverlap();
3031+
if (ImGui.Selectable("Multiboxing", multiboxHeaderSelected, ImGuiSelectableFlags.DontClosePopups))
3032+
multiboxHeaderSelected = !multiboxHeaderSelected;
3033+
3034+
ImGui.PopStyleVar();
3035+
if (ImGui.IsItemHovered())
3036+
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
3037+
3038+
if (multiboxHeaderSelected)
3039+
{
3040+
ImGui.TextColored(GradientColor.Get(ImGuiHelper.ExperimentalColor, ImGuiHelper.ExperimentalColor2, 500), "EXTREMELY EXPERIMENTAL");
3041+
3042+
bool multiBox = ConfigurationMain.Instance.multiBox;
3043+
if (ImGui.Checkbox(nameof(ConfigurationMain.MultiBox), ref multiBox))
3044+
{
3045+
ConfigurationMain.Instance.MultiBox = multiBox;
3046+
Configuration.Save();
3047+
}
3048+
3049+
if (ImGui.Checkbox(nameof(ConfigurationMain.host), ref ConfigurationMain.Instance.host))
3050+
Configuration.Save();
3051+
3052+
if (ConfigurationMain.Instance.MultiBox && ConfigurationMain.Instance.host)
3053+
{
3054+
ImGui.Indent();
3055+
for (int i = 0; i < ConfigurationMain.MultiboxUtility.Server.MAX_SERVERS; i++)
3056+
{
3057+
ConfigurationMain.MultiboxUtility.Server.ClientInfo? info = ConfigurationMain.MultiboxUtility.Server.clients[i];
3058+
3059+
ImGuiEx.Text(info != null ?
3060+
$"Client {i}: {(PartyHelper.IsPartyMember(info.CID) ? "in party" : "no party")} | {DateTime.Now.Subtract(ConfigurationMain.MultiboxUtility.Server.keepAlives[i]).TotalSeconds:F3}s ago" :
3061+
$"Client {i}: No Info");
3062+
}
3063+
3064+
ImGui.Unindent();
3065+
}
3066+
}
3067+
30503068
void MakeCommands(string checkbox, ref bool execute, ref List<string> commands, ref string curCommand)
30513069
{
30523070
if (ImGui.Checkbox($"{checkbox}{(execute ? ":" : string.Empty)} ", ref execute))

0 commit comments

Comments
 (0)