feat:场景视图添加属性编辑,添加轮廓显示
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public class ModBehaviour:Duckov.Modding.ModBehaviour
|
||||
public class ModBehaviour : Duckov.Modding.ModBehaviour
|
||||
{
|
||||
public const string MOD_ID="SceneView";
|
||||
private Harmony? harmony;
|
||||
|
||||
// public const string MOD_ID="SceneView";
|
||||
// private Harmony? harmony;
|
||||
|
||||
private GameObject? component;
|
||||
private CanvasControl myCanvas;
|
||||
|
||||
|
||||
protected override void OnAfterSetup()
|
||||
{
|
||||
CreateComponents();
|
||||
if (harmony == null)
|
||||
{
|
||||
harmony=new Harmony(MOD_ID);
|
||||
}
|
||||
harmony.PatchAll();
|
||||
// if (harmony == null)
|
||||
// {
|
||||
// harmony=new Harmony(MOD_ID);
|
||||
// }
|
||||
// harmony.PatchAll();
|
||||
}
|
||||
|
||||
protected override void OnBeforeDeactivate()
|
||||
{
|
||||
RemoveComponents();
|
||||
if (harmony != null)
|
||||
{
|
||||
harmony.UnpatchAll(harmony.Id);
|
||||
}
|
||||
|
||||
harmony = null;
|
||||
// if (harmony != null)
|
||||
// {
|
||||
// harmony.UnpatchAll(harmony.Id);
|
||||
// }
|
||||
//
|
||||
// harmony = null;
|
||||
}
|
||||
|
||||
private void CreateComponents()
|
||||
{
|
||||
if(component==null)
|
||||
if (component == null)
|
||||
{
|
||||
component = new GameObject("SceneViewControl");
|
||||
myCanvas= component.AddComponent<CanvasControl>();
|
||||
myCanvas = component.AddComponent<CanvasControl>();
|
||||
component.SetActive(true);
|
||||
DontDestroyOnLoad(component);
|
||||
}
|
||||
@@ -48,7 +46,7 @@ namespace SceneView
|
||||
{
|
||||
if (component != null)
|
||||
{
|
||||
GameObject.Destroy(component);
|
||||
Destroy(component);
|
||||
component = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user