Skip to content

Commit

Permalink
oh my god
Browse files Browse the repository at this point in the history
  • Loading branch information
LolaLollipop committed Dec 30, 2023
1 parent 17eef8f commit b836c83
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 37 deletions.
8 changes: 4 additions & 4 deletions RueI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ Global
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Debug Exiled|Any CPU.ActiveCfg = Debug|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Debug|Any CPU.Build.0 = Release|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Release Exiled|Any CPU.ActiveCfg = Debug|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Release Exiled|Any CPU.Build.0 = Debug|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A7DFDD8-78E1-418F-928B-AA4BC1289AA9}.Release|Any CPU.Build.0 = Release|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug Exiled|Any CPU.ActiveCfg = Debug|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug Exiled|Any CPU.Build.0 = Debug|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Debug|Any CPU.Build.0 = Release|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Release Exiled|Any CPU.ActiveCfg = Release|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Release Exiled|Any CPU.Build.0 = Release|Any CPU
{91D7C5BF-1273-4E70-BE19-7EC8907E2DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
3 changes: 3 additions & 0 deletions RueI/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/// <summary>
/// Represents the main class for RueI.
/// </summary>
/// <remarks>
/// The <see cref="RueIMain"/> class is responsible for properly initializing all of RueI. It handles

Check warning on line 17 in RueI/Main.cs

View workflow job for this annotation

GitHub Actions / build_and_test (Release)

Check warning on line 17 in RueI/Main.cs

View workflow job for this annotation

GitHub Actions / build_and_test (Release)

/// </remarks>
public static class RueIMain
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions RueI/RueI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Platforms>AnyCPU;x64</Platforms>
<Title>RueI</Title>
<Copyright>CC0 1.0</Copyright>

<Version>2.0.2</Version>
<Authors>Rue &lt;3, Override (some help)</Authors>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
Expand Down
4 changes: 3 additions & 1 deletion RueI/RueI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
/// <summary>
/// Provides a variety of constant values.
/// </summary>
/// <remarks>This class is mosty designed for internal use within RueI. However, they can still be useful for external use.</remarks>
/// <remarks>
/// This class is mosty designed for internal use within RueI. However, they can still be useful for external use.
/// </remarks>
public static class Constants
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion RueI/RueI/Displays/AutoGiving/AutoGivers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public AutoElement UpdateEvery(TimeSpan span, int priority = 35)
/// <param name="core">The <see cref="DisplayCore"/> to give to.</param>
protected virtual void GiveTo(DisplayCore core)
{
ServerConsole.AddLog("Hello");
if (element != null)
{
core.AddAsReference(reference, element);
Expand Down
2 changes: 0 additions & 2 deletions RueI/RueI/Displays/DisplayCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public static IElemReference<T> GetReference<T>()
/// <param name="priority">The priority of the update - defaults to 100.</param>
public void Update(int priority = 100)
{
ServerConsole.AddLog("updating");
if (IgnoreUpdate)
{
return;
Expand Down Expand Up @@ -169,7 +168,6 @@ public void RemoveReference<T>(IElemReference<T> reference)
internal void InternalUpdate()
{
string text = ElemCombiner.Combine(GetAllElements());
ServerConsole.AddLog(text);
UnityAlternative.Provider.ShowHint(Hub, text);
Events.Events.OnDisplayUpdated(new(this));
}
Expand Down
13 changes: 7 additions & 6 deletions RueI/RueI/Displays/ElemCombiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
/// <summary>
/// Provides a means of combining <see cref="Element"/>s.
/// </summary>
/// <remarks>
/// The <see cref="ElemCombiner"/> is a helper class that combines all of the <see cref="Element"/>s for a <see cref="DisplayCore"/> into a single string,
/// to be displayed as a hint.
/// </remarks>
public static class ElemCombiner
{
/// <summary>
Expand All @@ -20,7 +24,6 @@ public static class ElemCombiner
/// <returns>A <see cref="string"/> with all of the combined <see cref="Element"/>s.</returns>
public static string Combine(IEnumerable<Element> enumElems)
{
ServerConsole.AddLog("hello world!!!");
List<Element> elements = ListPool<Element>.Shared.Rent(enumElems);

if (!elements.Any())
Expand All @@ -33,15 +36,15 @@ public static string Combine(IEnumerable<Element> enumElems)

float lastPosition = 0;
float lastOffset = 0;
ServerConsole.AddLog("im kind of a big deal");

elements.Sort(CompareElement);

for (int i = 0; i < elements.Count; i++)
{
Element curElement = elements[i];
ServerConsole.AddLog(curElement.ZIndex.ToString());

ParsedData parsedData = curElement.GetParsedData();
ServerConsole.AddLog(curElement.ZIndex.ToString());

float funcPos = curElement.GetFunctionalPosition();
if (curElement.Options.HasFlagFast(Elements.Enums.ElementOptions.PreserveSpacing))
{
Expand All @@ -64,13 +67,11 @@ public static string Combine(IEnumerable<Element> enumElems)
totalOffset += parsedData.Offset;
lastPosition = funcPos;
lastOffset = parsedData.Offset;
ServerConsole.AddLog("What the fuck");
}

ListPool<Element>.Shared.Return(elements);
sb.Insert(0, $"<line-height={totalOffset}px>\n</line-height>");
sb.Append(Constants.ZeroWidthSpace);
ServerConsole.AddLog(sb.ToString());
return StringBuilderPool.Shared.ToStringReturn(sb);
}

Expand Down
2 changes: 1 addition & 1 deletion RueI/RueI/Displays/Scheduling/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void UpdateBatches()
}

TimeSpan performAt = (currentBatches.First().PerformAt - Now).MaxIf(rateLimiter.Active, rateLimiter.TimeLeft);
ServerConsole.AddLog("Starting");

performTask.Start(performAt, PerformFirstBatch);
}

Expand Down
2 changes: 0 additions & 2 deletions RueI/RueI/Parsing/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ public static bool GetTagAttributes(string content, out Dictionary<string, strin
/// <returns>A <see cref="ParsedData"/> containing information about the string.</returns>
public ParsedData Parse(string text, ElementOptions options = ElementOptions.Default)
{
ServerConsole.AddLog("what");
ParserState currentState = ParserState.CollectingTags;

StringBuilder tagBuffer = StringBuilderPool.Shared.Rent(Constants.MAXTAGNAMESIZE);
Expand Down Expand Up @@ -272,7 +271,6 @@ void FailTagMatch() // not a tag, unload buffer
char[] chars = text.ToCharArray();
for (int i = 0; i < chars.Length; i++)
{
ServerConsole.AddLog(chars[i].ToString());
char ch = chars[i];

if (ch == '\\')
Expand Down
1 change: 0 additions & 1 deletion RueI/RueI/Parsing/ParserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public void AddEndingTag<T>(bool allowDuplicates = false)
public void RemoveEndingTag<T>()
where T : NoParamsTag, new()
{
ServerConsole.AddLog("doing the thing lol");
endingTags.Remove(SharedTag<T>.Singleton);
}

Expand Down
4 changes: 4 additions & 0 deletions RueI/RueI/Parsing/Tags/RichTextTagAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
/// <summary>
/// Defines a <see cref="RichTextTag"/> for RueI.
/// </summary>
/// <remarks>
/// You can apply this <see cref="Attribute"/> to classes that inherit from <see cref="RichTextTag"/> to define a custom <see cref="RichTextTag"/> easily.
/// This attribute is used exclusive by the <see cref="ParserBuilder.AddFromAssembly(System.Reflection.Assembly)"/> method.

Check warning on line 8 in RueI/RueI/Parsing/Tags/RichTextTagAttribute.cs

View workflow job for this annotation

GitHub Actions / build_and_test (Release)

/// </remarks>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class RichTextTagAttribute : Attribute
{
Expand Down
4 changes: 4 additions & 0 deletions RueI/RueI/Patches/HintPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
/// <summary>
/// Patches <see cref="HintDisplay.Show"/> to detect when hints are shown.
/// </summary>
/// <remarks>
/// RueI patches the <see cref="HintDisplay.Show"/> method so that it can get an accurate state of the player's hint display at any given time.
/// When a hint outside of RueI is shown, it schedules an update that occurs after 3 seconds.
/// </remarks>
[HarmonyPatch(typeof(HintDisplay), nameof(HintDisplay.Show))]
public static class HintPatch
{
Expand Down
24 changes: 7 additions & 17 deletions RueI/UnityAlternative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
/// <summary>
/// Defines the base class for a provider of methods that may or may not use Unity.
/// </summary>
/// <remarks>
/// The <see cref="UnityAlternative"/> class is primarily intended for internal use within RueI. This enables certain features
/// to work even outside of SCP:SL and Unity, which is utilized primarily for unit-testing.
/// </remarks>
public abstract class UnityAlternative
{
/// <summary>
Expand All @@ -18,7 +22,7 @@ public abstract class UnityAlternative
public interface IAsyncOperation : IDisposable
{
/// <summary>
/// Gets a value indicating whether or not this operation is handling.
/// Gets a value indicating whether or not this operation is currently running.
/// </summary>
public bool IsRunning { get; }

Expand Down Expand Up @@ -70,7 +74,7 @@ private static UnityAlternative GetProvider()
{
try
{
_ = Object.FindObjectOfType<ReferenceHub>();
_ = Object.FindObjectOfType<ReferenceHub>(); // errors if not in unity
return new UnityProvider();
}
catch(Exception)
Expand Down Expand Up @@ -158,21 +162,7 @@ public class UnityProvider : UnityAlternative
public override IAsyncOperation PerformAsync(TimeSpan span, Action action) => new MECAsyncOperation(span, action);

/// <inheritdoc/>
internal override void ShowHint(ReferenceHub hub, string message)
{
ServerConsole.AddLog("Showing");

string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

// Append text to an existing file named "WriteLines.txt".
using (StreamWriter outputFile = new(Path.Combine(docPath, "hello.txt"), true))
{
outputFile.WriteLine(message);
}

hub.connectionToClient.Send(new HintMessage(new TextHint(message, new HintParameter[] { new StringHintParameter(message) }, null, 99999)));
Log(message);
} // HintEffectPresets.FadeIn(0, 0, 1)
internal override void ShowHint(ReferenceHub hub, string message) => hub.connectionToClient.Send(new HintMessage(new TextHint(message, new HintParameter[] { new StringHintParameter(message) }, new HintEffect[] { HintEffectPresets.FadeIn(0, 0, 1) }, 99999)));

/// <summary>
/// Represents an async operation using a <see cref="Task"/>.
Expand Down
3 changes: 1 addition & 2 deletions RueI/docs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
<code>
Display display = new(referenceHub); // Create a new display from a ReferenceHub

SetElement helloElem = new(300, zIndex: 10, "hello").AddTo(display);
SetElement helloElem = new(300, zIndex: 10, "hello").AddTo(display);
SetElement worldElem = new(250, zIndex: 10, "world").AddTo(display);
display.Elements.Add(helloElem, worldElem);

display.Update(); // Update the display
</code>
Expand Down

0 comments on commit b836c83

Please sign in to comment.