Skip to content

Commit

Permalink
0.0.11 업데이트
Browse files Browse the repository at this point in the history
- Node.js 의존성 제거
- PlayerControl_Update 대신 Update에서 텍스트 업데이트
- 자동 리로드 추가
- UnityModManager 업데이트 지원
  • Loading branch information
wjdgustn committed Mar 27, 2024
1 parent b231504 commit 1f19e8c
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 3,320 deletions.
4 changes: 2 additions & 2 deletions MusicTimestamp/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"Id": "MusicTimestamp",
"DisplayName": "MusicTimestamp",
"Author": "HYONSU",
"Version": "0.0.10",
"Version": "0.0.11",
"AssemblyName": "MusicTimestamp.dll",
"EntryMethod": "MusicTimestamp.Main.Load",
"Repository": ""
"Repository": "https://bot.adofai.gg/api/mods/MusicTimestamp/Repository.json"
}
22 changes: 22 additions & 0 deletions MusicTimestamp/Main.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Reflection;
using HarmonyLib;
using MusicTimestamp.MainPatch;
using System.IO;
using UnityEngine;
using UnityModManagerNet;

Expand Down Expand Up @@ -36,10 +37,31 @@ internal static class Main {

return true;
}

#if DEBUG
private static FileSystemWatcher watcher;
private static void OnDllChanged(object source, FileSystemEventArgs e) {
Mod.Logger.Log($"{Mod.Info.Id} mod change detected! Reloading...");
watcher.Changed -= OnDllChanged;
watcher.Dispose();
watcher = null;
Mod.GetType().GetMethod("Reload", BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(Mod, null);
}
#endif

private static void Start() {
_harmony = new Harmony(Mod.Info.Id);
_harmony.PatchAll(Assembly.GetExecutingAssembly());

#if DEBUG
watcher = new FileSystemWatcher(Mod.Path);
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Filter = "*.dll";

watcher.Changed += OnDllChanged;

watcher.EnableRaisingEvents = true;
#endif

text = new GameObject().AddComponent<Text>();
Object.DontDestroyOnLoad(text);
Expand Down
5 changes: 2 additions & 3 deletions MusicTimestamp/MainPatch.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using HarmonyLib;
using System;
using UnityEngine;

namespace MusicTimestamp.MainPatch {
public class Text : MonoBehaviour {
public static string Content = "";
Expand All @@ -25,7 +24,7 @@ public class Text : MonoBehaviour {
}
}

[HarmonyPatch(typeof(scrController), "PlayerControl_Update")]
[HarmonyPatch(typeof(scrController), "Update")]

internal static class ChangeText {
private static void Prefix(scrController __instance) {
Expand Down
1,951 changes: 76 additions & 1,875 deletions MusicTimestamp/MusicTimestamp.csproj

Large diffs are not rendered by default.

61 changes: 0 additions & 61 deletions MusicTimestamp/build.js

This file was deleted.

Loading

0 comments on commit 1f19e8c

Please sign in to comment.