Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
feat: better game options menu
Browse files Browse the repository at this point in the history
  • Loading branch information
NotSugden committed Aug 7, 2021
1 parent 53beddd commit cf89422
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 448 deletions.
16 changes: 11 additions & 5 deletions source/Patches/CustomOption/Base.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;

namespace TownOfUs.CustomOption
{
public class CustomOption
{
public static List<CustomOption> AllOptions = new List<CustomOption>();
public static int ShownOptions()
{
return AllOptions.Count(option => option.ShouldShow());
}

public readonly int ID;

public Func<object, string> Format;
Expand All @@ -32,7 +38,8 @@ protected internal CustomOption(int id, string name, CustomOptionType type, obje
public object DefaultValue { get; set; }

public static bool LobbyTextScroller { get; set; } = true;

public Func<bool> ShouldShow { get; set; } = () => true;
public CustomNumberOption Parent { get; set; } = null;
protected internal bool Indent { get; set; }

public override string ToString()
Expand All @@ -48,12 +55,11 @@ public virtual void OptionCreated()

protected internal void Set(object value, bool SendRpc = true)
{
System.Console.WriteLine($"{Name} set to {value}");

Value = value;

if (Setting != null && AmongUsClient.Instance.AmHost && SendRpc) Rpc.SendRpc(this);


try
{
if (Setting is ToggleOption toggle)
Expand Down Expand Up @@ -82,4 +88,4 @@ protected internal void Set(object value, bool SendRpc = true)
}
}
}
}
}
Loading

0 comments on commit cf89422

Please sign in to comment.