Skip to content

Commit

Permalink
Fixed an issue
Browse files Browse the repository at this point in the history
Repaired the git history, no one let me code at 4 am anymore, please.
  • Loading branch information
dvoyer committed Mar 7, 2021
1 parent 74cdff0 commit d321144
Show file tree
Hide file tree
Showing 60 changed files with 47 additions and 40 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
*.sln
*.csproj
*.xml
*.dll
*.xml
19 changes: 11 additions & 8 deletions GrassyKnight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/System.dll</HintPath>
Expand All @@ -46,29 +46,32 @@
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.Physics2DModule.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UI.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.UI.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<HintPath>/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/UnityEngine.UIModule.dll</HintPath>
<HintPath>..\..\..\Desktop\Hollow Knight\hollow_knight_Data\Managed\UnityEngine.UIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -95,4 +98,4 @@
<PropertyGroup>
<PostBuildEvent>cp "$(TargetPath)" "/Users/johnsullivan/Library/Application Support/Steam/steamapps/common/Hollow Knight/hollow_knight.app/Contents/Resources/Data/Managed/Mods/"</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
Binary file added GrassyKnight.dll
Binary file not shown.
63 changes: 34 additions & 29 deletions StatusBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@

namespace GrassyKnight
{
class StatusBar {
private const int _FONT_SIZE = 21;
private const int _MARGIN_TOP = 10;
class StatusBar
{
// If non-null, this'll be used as the global total regardless of what
// GrassStats values are given.
public int? GlobalTotalOverride = null;

private const int _FONT_SIZE = 36;
private const int _MARGIN_TOP = 20;

private GameObject _canvas;
private GameObject _textOnCanvas;

public bool Visible {
public bool Visible
{
get => _canvas.GetComponent<Canvas>().enabled;
set => _canvas.GetComponent<Canvas>().enabled = value;
}

public StatusBar() {
_canvas = new GameObject("GrassyKnight StatusBar Canvas",
public StatusBar()
{
_canvas = new GameObject("GrassPls StatusBar Canvas",
typeof(Canvas));
UnityEngine.Object.DontDestroyOnLoad(_canvas);

Expand All @@ -27,51 +34,49 @@ public StatusBar() {
canvasComponent.enabled = false;

_textOnCanvas = new GameObject(
"GrassyKnight StatusBar",
"GrassPls StatusBar",
typeof(Text),
typeof(CanvasRenderer));
UnityEngine.Object.DontDestroyOnLoad(_textOnCanvas);
_textOnCanvas.transform.parent = canvasComponent.transform;
_textOnCanvas.transform.localPosition =
new Vector3(
0,
// Aligns the vertical center to top of screen
canvasComponent.pixelRect.height / 2
// Adjusts downwards so top of text is now along top
// of screen.
- _FONT_SIZE / 2
// Finally some margin space to taste. uwu.
- _MARGIN_TOP,
-1 * canvasComponent.pixelRect.width / 2.5f + _FONT_SIZE / 3.25f,
canvasComponent.pixelRect.height / 3.25f - _FONT_SIZE / 2 - _MARGIN_TOP,
0);

Text textComponent = _textOnCanvas.GetComponent<Text>();
textComponent.font = Modding.CanvasUtil.TrajanBold;
textComponent.text = "Loading GrassyKnight...";
textComponent.text = "Loading GrassPls...";
textComponent.fontSize = _FONT_SIZE;
textComponent.alignment = TextAnchor.MiddleCenter;
textComponent.horizontalOverflow = HorizontalWrapMode.Overflow;
}

private string PrettyStats(GrassStats stats) {
private string PrettyStats(GrassStats stats, int? totalOverride = null)
{
int struck = stats[GrassState.Cut] + stats[GrassState.ShouldBeCut];
string result = $"{struck}/{stats.Total()}";
if (stats[GrassState.ShouldBeCut] > 0) {
result += $" ({stats[GrassState.ShouldBeCut]} shameful)";
}
string result = $"{struck}/{totalOverride ?? stats.Total()}";
return result;
}

public void Update(GrassStats scene, GrassStats global) {
public void Update(GrassStats scene, GrassStats global)
{
string statusText = "";

if (scene == null) {
statusText += $"(not in a room) ";
} else {
statusText += $"in room: {PrettyStats(scene)} ";
if (scene == null)
{
statusText += $"Pls...";
}
else if (scene[GrassState.Cut] + scene[GrassState.ShouldBeCut] - scene.Total() == 0)
{
statusText += $"";
}
else
{
statusText += $"{PrettyStats(scene)} ";
}

statusText += $"-- globally: {PrettyStats(global)}";

statusText += $"\n{PrettyStats(global, GlobalTotalOverride)} ";
_textOnCanvas.GetComponent<Text>().text = statusText;
}
}
Expand Down
Binary file added bin/Debug/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added bin/Debug/Assembly-CSharp.dll
Binary file not shown.
Binary file added bin/Debug/GrassyKnight.dll
Binary file not shown.
Binary file added bin/Debug/GrassyKnight.pdb
Binary file not shown.
Binary file added bin/Debug/PlayMaker.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AIModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ARModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AccessibilityModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AnimationModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AssetBundleModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.AudioModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ClothModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ClusterInputModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ClusterRendererModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.CrashReportingModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.DirectorModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.GameCenterModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.GridModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.IMGUIModule.dll
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.InputModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.JSONSerializeModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ParticleSystemModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ParticlesLegacyModule.dll
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.Physics2DModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.ScreenCaptureModule.dll
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.SpriteMaskModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.SpriteShapeModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.StyleSheetsModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.TerrainModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.TerrainPhysicsModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.TextRenderingModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.TilemapModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UI.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UIElementsModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UIModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UNETModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UnityAnalyticsModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UnityConnectModule.dll
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.UnityWebRequestModule.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/Debug/UnityEngine.VRModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.VehiclesModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.VideoModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.WebModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.WindModule.dll
Binary file not shown.
Binary file added bin/Debug/UnityEngine.dll
Binary file not shown.
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions obj/Debug/GrassyKnight.csproj.CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2b23b4b99b7ef2f9386ac538bd9f4fd0c076ba9e
Binary file added obj/Debug/GrassyKnight.dll
Binary file not shown.

0 comments on commit d321144

Please sign in to comment.