Skip to content

Commit

Permalink
Overhaul how triggers work and clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurihaia committed Mar 3, 2021
1 parent e4ed329 commit 4ba3dfc
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 131 deletions.
Binary file added JsonNet/Newtonsoft.Json.dll
Binary file not shown.
Binary file added JsonNet/System.Runtime.Serialization.dll
Binary file not shown.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ Loading the file (default keybind `num9`) will read that same file. This is done
The timer also shows a personal best that is tied to a set of waypoints.
These are saved in `hktimer_triggers.json` and measured in microseconds (1000 per millisecond).
The PB is loaded when you load the triggers, so if you need to edit/reset it just edit the file.
The PB will be wiped when you change the trigger positioning, and has to be saved using the save triggers button.
The PB will be wiped when you change the trigger positioning, and has to be saved using the save triggers button.

### Manual Trigger File Editing
TBD - Just look in the save file its fairly self explanatory
14 changes: 1 addition & 13 deletions src/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ public class Settings
public string load_triggers = "[9]";
public string save_triggers = "[6]";
public float timerAnchorX = 0.15f;
public float timerAnchorY = 0.1f;
}

[Serializable]
public class Triggers
{
public long pbTicks;
public string startScene;
public float startX;
public float startY;
public string endScene;
public float endX;
public float endY;
public float timerAnchorY = 0.2f;
}
}
4 changes: 3 additions & 1 deletion src/FrameCount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class FrameCount : MonoBehaviour
public void ShowDisplay()
{
if(frameDisplayObject != null) {
GameObject.Destroy(frameDisplayObject);
GameObject.DestroyImmediate(frameDisplayObject);
}
frameDisplayObject = CanvasUtil.CreateCanvas(UnityEngine.RenderMode.ScreenSpaceOverlay, 100);
CanvasUtil.CreateFonts();
Expand Down Expand Up @@ -47,12 +47,14 @@ public void Update()
if (Input.GetKeyDown(HKTimer.instance.settings.pause))
{
timerActive ^= true;
HKTimer.instance.targetManager.OnTimerPauseManual();
}
if (Input.GetKeyDown(HKTimer.instance.settings.reset))
{
time = TimeSpan.Zero;
timerActive = false;
updateTimer = true;
HKTimer.instance.targetManager.OnTimerResetManual();
}
if (timerActive && !TimerShouldBePaused())
{
Expand Down
27 changes: 15 additions & 12 deletions src/HKTimer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ProjectGuid>{E3E4D0B7-656C-6C50-7567-696E2E57696E}</ProjectGuid>
<TargetFramework>net35</TargetFramework>
<AssemblyTitle>HKTimer</AssemblyTitle>
<AssemblyVersion>0.0.2</AssemblyVersion>
<AssemblyVersion>0.0.3</AssemblyVersion>
<Product>HKTimer</Product>
<DebugType>portable</DebugType>
<Copyright>Copyright © 2021</Copyright>
Expand All @@ -21,20 +21,23 @@
<HintPath>D:\DepotDownloader\depots\367521\1221_modded\hollow_knight_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\JsonNet\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="CopyMod" AfterTargets="PostBuildEvent">
<Copy
SourceFiles="$(TargetPath)"
DestinationFolder="D:\\DepotDownloader\\depots\\367521\\1221_modded\\hollow_knight_Data\\Managed\\Mods\\"
SkipUnchangedFiles="false"
/>
<Copy SourceFiles="$(TargetPath)" DestinationFolder="D:\\DepotDownloader\\depots\\367521\\1221_modded\\hollow_knight_Data\\Managed\\Mods\\" SkipUnchangedFiles="false" />
<Copy SourceFiles="$(SolutionDir)/JsonNet/Newtonsoft.Json.dll" DestinationFolder="D:\\DepotDownloader\\depots\\367521\\1221_modded\\hollow_knight_Data\\Managed\\Mods\\" SkipUnchangedFiles="false" />
<Copy SourceFiles="$(SolutionDir)/JsonNet/System.Runtime.Serialization.dll" DestinationFolder="D:\\DepotDownloader\\depots\\367521\\1221_modded\\hollow_knight_Data\\Managed\\Mods\\" SkipUnchangedFiles="false" />
</Target>
<Target Name="CreateReleaseZip" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<MakeDir Directories="$(ProjectDir)Output"/>
<Delete Files="$(ProjectDir)/HKTimer.zip"/>
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ProjectDir)/Output/"/>
<Copy SourceFiles="$(SolutionDir)/README.md" DestinationFolder="$(ProjectDir)/Output/"/>
<ZipDirectory DestinationFile="$(ProjectDir)/HKTimer.zip" SourceDirectory="$(ProjectDir)/Output"/>
<RemoveDir Directories="$(ProjectDir)Output"/>
<MakeDir Directories="$(ProjectDir)Output" />
<Delete Files="$(ProjectDir)/HKTimer.zip" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ProjectDir)/Output/" />
<Copy SourceFiles="$(SolutionDir)/JsonNet/Newtonsoft.Json.dll" DestinationFolder="$(ProjectDir)/Output/" />
<Copy SourceFiles="$(SolutionDir)/JsonNet/System.Runtime.Serialization.dll" DestinationFolder="$(ProjectDir)/Output/" />
<Copy SourceFiles="$(SolutionDir)/README.md" DestinationFolder="$(ProjectDir)/Output/" />
<ZipDirectory DestinationFile="$(ProjectDir)/HKTimer.zip" SourceDirectory="$(ProjectDir)/Output" />
<RemoveDir Directories="$(ProjectDir)Output" />
</Target>
</Project>
Loading

0 comments on commit 4ba3dfc

Please sign in to comment.