feat: 受击音效更新类别控制
This commit is contained in:
@@ -1,19 +1,69 @@
|
||||
using System;
|
||||
using Duckov.Modding;
|
||||
using Duckov.Options.UI;
|
||||
using Duckov.UI;
|
||||
using Duckov.UI.Animations;
|
||||
using Duckov.Utilities;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UIFrame
|
||||
{
|
||||
public class ModBehaviour:Duckov.Modding.ModBehaviour
|
||||
{
|
||||
private const string MOD_ID="UIFrame";
|
||||
|
||||
private GameObject? workerObject;
|
||||
|
||||
private Harmony? harmony;
|
||||
|
||||
protected override void OnAfterSetup()
|
||||
{
|
||||
Debug.Log("OnAfterSetup");
|
||||
|
||||
CreateAPIObject();
|
||||
if (harmony == null)
|
||||
{
|
||||
harmony=new HarmonyLib.Harmony(MOD_ID);
|
||||
}
|
||||
harmony.PatchAll();
|
||||
Test();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnBeforeDeactivate()
|
||||
{
|
||||
Debug.Log("OnBeforeDeactivate");
|
||||
ClearAPIObject();
|
||||
harmony?.UnpatchAll(MOD_ID);
|
||||
harmony = null;
|
||||
}
|
||||
|
||||
private void CreateAPIObject()
|
||||
{
|
||||
if(workerObject)
|
||||
return;
|
||||
workerObject = new GameObject($"{MOD_ID}_APIObject");
|
||||
workerObject.AddComponent<UIFrameWorker>();
|
||||
}
|
||||
|
||||
private void ClearAPIObject()
|
||||
{
|
||||
if(!workerObject)
|
||||
return;
|
||||
Destroy(workerObject);
|
||||
workerObject = null;
|
||||
}
|
||||
|
||||
private void Test()
|
||||
{
|
||||
if(!UIFrameAPI.Initialize())
|
||||
return;
|
||||
if (UIFrameAPI.SetGameTitle(@"C:\Users\Lenovo\Pictures\异噬.png"))
|
||||
{
|
||||
Debug.Log("设置标题完成");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("标题设置失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user