Feat: 场景视图mod,UI框架更换标题
This commit is contained in:
60
SceneView/CanvasControl.cs
Normal file
60
SceneView/CanvasControl.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public class CanvasControl : MonoBehaviour
|
||||
{
|
||||
public SceneViewPanel? sceneViewPanel;
|
||||
|
||||
public static Vector2 panelSize = new Vector2(500, 800);
|
||||
|
||||
public const string ViewCanvasName = "_SceneViewCanvas";
|
||||
public const string ShowAim = "LOGO";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitCanvas();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.F2))
|
||||
{
|
||||
Debug.Log("切换");
|
||||
sceneViewPanel.gameObject.SetActive(!sceneViewPanel.gameObject.activeSelf);
|
||||
if (sceneViewPanel.gameObject.activeSelf)
|
||||
{
|
||||
sceneViewPanel.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitCanvas()
|
||||
{
|
||||
var canvasObj = new GameObject(ViewCanvasName);
|
||||
var canvas = canvasObj.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvas.sortingOrder = 1000;
|
||||
canvasObj.AddComponent<CanvasScaler>();
|
||||
canvasObj.AddComponent<GraphicRaycaster>();
|
||||
DontDestroyOnLoad(canvasObj);
|
||||
|
||||
sceneViewPanel=CreateSceneViewPanel(canvasObj.transform);
|
||||
}
|
||||
public static SceneViewPanel CreateSceneViewPanel(Transform parent)
|
||||
{
|
||||
var panelObj = new GameObject("SceneViewPanel");
|
||||
panelObj.transform.SetParent(parent, false);
|
||||
var sceneViewPanel = panelObj.AddComponent<SceneViewPanel>();
|
||||
var panelImage = panelObj.AddComponent<Image>();
|
||||
panelImage.color = new Color(0.5f, 0.5f, 0.5f, 0.3f);
|
||||
|
||||
var rectTransform = panelObj.GetComponent<RectTransform>();
|
||||
rectTransform.sizeDelta = panelSize;
|
||||
|
||||
return sceneViewPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
432
SceneView/ControlUtilities.cs
Normal file
432
SceneView/ControlUtilities.cs
Normal file
@@ -0,0 +1,432 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
[Serializable]
|
||||
public struct RectTransformConfig
|
||||
{
|
||||
public Vector2 AnchorMin;
|
||||
public Vector2 AnchorMax;
|
||||
public Vector2 AnchoredPosition;
|
||||
public Vector2 SizeDelta;
|
||||
public Vector2 OffsetMin;
|
||||
public Vector2 OffsetMax;
|
||||
public Vector2 Pivot;
|
||||
|
||||
// 默认配置
|
||||
public static readonly RectTransformConfig Default = new RectTransformConfig(
|
||||
anchorMin: new Vector2(0, 1),
|
||||
anchorMax: new Vector2(0, 1),
|
||||
anchoredPosition: Vector2.zero,
|
||||
sizeDelta: Vector2.zero,
|
||||
offsetMin: Vector2.zero,
|
||||
offsetMax: Vector2.zero,
|
||||
pivot: new Vector2(0.5f, 0.5f) // 默认居中轴心点
|
||||
);
|
||||
|
||||
public RectTransformConfig(
|
||||
Vector2 anchorMin,
|
||||
Vector2 anchorMax,
|
||||
Vector2 anchoredPosition,
|
||||
Vector2 sizeDelta,
|
||||
Vector2 offsetMin,
|
||||
Vector2 offsetMax,
|
||||
Vector2 pivot)
|
||||
{
|
||||
AnchorMin = anchorMin;
|
||||
AnchorMax = anchorMax;
|
||||
AnchoredPosition = anchoredPosition;
|
||||
SizeDelta = sizeDelta;
|
||||
OffsetMin = offsetMin;
|
||||
OffsetMax = offsetMax;
|
||||
Pivot = pivot;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct ButtonConfig
|
||||
{
|
||||
public RectTransformConfig RectConfig;
|
||||
public Color BackgroundColor;
|
||||
public string Text;
|
||||
public int FontSize;
|
||||
public Color TextColor;
|
||||
public bool RaycastTarget;
|
||||
|
||||
public static readonly ButtonConfig Default = new ButtonConfig(
|
||||
rectConfig: RectTransformConfig.Default,
|
||||
backgroundColor: new Color(0.2f, 0.2f, 0.2f, 1f),
|
||||
text: "Button",
|
||||
fontSize: 18,
|
||||
textColor: Color.white,
|
||||
raycastTarget: true
|
||||
);
|
||||
|
||||
public ButtonConfig(
|
||||
RectTransformConfig rectConfig,
|
||||
Color backgroundColor,
|
||||
string text,
|
||||
int fontSize,
|
||||
Color textColor,
|
||||
bool raycastTarget = true)
|
||||
{
|
||||
RectConfig = rectConfig;
|
||||
BackgroundColor = backgroundColor;
|
||||
Text = text;
|
||||
FontSize = fontSize;
|
||||
TextColor = textColor;
|
||||
RaycastTarget = raycastTarget;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct TextConfig
|
||||
{
|
||||
public RectTransformConfig RectConfig;
|
||||
public string Text;
|
||||
public int FontSize;
|
||||
public Color TextColor;
|
||||
public TextAlignmentOptions Alignment;
|
||||
public bool RaycastTarget;
|
||||
|
||||
public static readonly TextConfig Default = new TextConfig(
|
||||
rectConfig: RectTransformConfig.Default,
|
||||
text: "New Text",
|
||||
fontSize: 18,
|
||||
textColor: Color.white,
|
||||
alignment: TextAlignmentOptions.Center,
|
||||
raycastTarget: false
|
||||
);
|
||||
|
||||
public TextConfig(
|
||||
string text,
|
||||
int fontSize,
|
||||
Color textColor,
|
||||
TextAlignmentOptions alignment,
|
||||
bool raycastTarget,
|
||||
RectTransformConfig rectConfig)
|
||||
{
|
||||
RectConfig = rectConfig;
|
||||
Text = text;
|
||||
FontSize = fontSize;
|
||||
TextColor = textColor;
|
||||
Alignment = alignment;
|
||||
RaycastTarget = raycastTarget;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct ScrollViewConfig
|
||||
{
|
||||
public Vector2 SizeDelta; // ScrollView 的尺寸
|
||||
public bool Vertical;
|
||||
public bool Horizontal;
|
||||
public Color BackgroundColor;
|
||||
public Vector2 ContentPadding; // 内容区域的内边距(上下左右)
|
||||
|
||||
public static readonly ScrollViewConfig Default = new ScrollViewConfig
|
||||
{
|
||||
SizeDelta = new Vector2(400, 300),
|
||||
Vertical = true,
|
||||
Horizontal = false,
|
||||
BackgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.8f),
|
||||
ContentPadding = new Vector2(10, 10) // (horizontal, vertical)
|
||||
};
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct InputFieldConfig
|
||||
{
|
||||
public RectTransformConfig RectConfig;
|
||||
public Color BackgroundColor;
|
||||
public string PlaceholderText;
|
||||
public int PlaceholderFontSize;
|
||||
public Color PlaceholderTextColor;
|
||||
public Color TextColor;
|
||||
public int FontSize;
|
||||
public TextAlignmentOptions TextAlignment;
|
||||
public TMP_InputField.CharacterValidation CharacterValidation;
|
||||
public int CharacterLimit;
|
||||
public static readonly InputFieldConfig Default = new InputFieldConfig(
|
||||
rectConfig: RectTransformConfig.Default,
|
||||
backgroundColor: new Color(0.2f, 0.2f, 0.2f, 1f),
|
||||
placeholderText: "Enter text here",
|
||||
placeholderFontSize: 14,
|
||||
placeholderTextColor: new Color(0.7f, 0.7f, 0.7f, 1f),
|
||||
textColor: Color.white,
|
||||
fontSize: 18,
|
||||
textAlignment: TextAlignmentOptions.Left,
|
||||
characterValidation: TMP_InputField.CharacterValidation.None,
|
||||
characterLimit: 0
|
||||
);
|
||||
public InputFieldConfig(
|
||||
RectTransformConfig rectConfig,
|
||||
Color backgroundColor,
|
||||
string placeholderText,
|
||||
int placeholderFontSize,
|
||||
Color placeholderTextColor,
|
||||
Color textColor,
|
||||
int fontSize,
|
||||
TextAlignmentOptions textAlignment,
|
||||
TMP_InputField.CharacterValidation characterValidation = TMP_InputField.CharacterValidation.None,
|
||||
int characterLimit = 0)
|
||||
{
|
||||
RectConfig = rectConfig;
|
||||
BackgroundColor = backgroundColor;
|
||||
PlaceholderText = placeholderText;
|
||||
PlaceholderFontSize = placeholderFontSize;
|
||||
PlaceholderTextColor = placeholderTextColor;
|
||||
TextColor = textColor;
|
||||
FontSize = fontSize;
|
||||
TextAlignment = textAlignment;
|
||||
CharacterValidation = characterValidation;
|
||||
CharacterLimit = characterLimit;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ControlUtilities
|
||||
{
|
||||
// 通用方法:将 RectTransformConfig 应用于 RectTransform
|
||||
private static void ApplyRectTransformConfig(RectTransform rectTransform, RectTransformConfig config)
|
||||
{
|
||||
rectTransform.anchorMin = config.AnchorMin;
|
||||
rectTransform.anchorMax = config.AnchorMax;
|
||||
rectTransform.pivot = config.Pivot;
|
||||
|
||||
var isStretched = config.SizeDelta == Vector2.zero;
|
||||
|
||||
if (isStretched)
|
||||
{
|
||||
rectTransform.offsetMin = config.OffsetMin;
|
||||
rectTransform.offsetMax = config.OffsetMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.anchoredPosition = config.AnchoredPosition;
|
||||
rectTransform.sizeDelta = config.SizeDelta;
|
||||
}
|
||||
}
|
||||
|
||||
// ========================
|
||||
// 按钮创建
|
||||
// ========================
|
||||
public static (Button? button, TextMeshProUGUI? text) CreateButton(RectTransform? parent, ButtonConfig config,
|
||||
UnityAction? onClick)
|
||||
{
|
||||
var btnObj = new GameObject(config.Text + "Button");
|
||||
var btnRect = btnObj.AddComponent<RectTransform>();
|
||||
btnRect.SetParent(parent, false);
|
||||
|
||||
ApplyRectTransformConfig(btnRect, config.RectConfig);
|
||||
|
||||
var button = btnObj.AddComponent<Button>();
|
||||
var image = btnObj.AddComponent<Image>();
|
||||
image.color = config.BackgroundColor;
|
||||
button.image = image;
|
||||
|
||||
// 创建文本子对象
|
||||
var txtObj = new GameObject("Text (TMP)");
|
||||
var txtRect = txtObj.AddComponent<RectTransform>();
|
||||
txtRect.SetParent(btnRect, false);
|
||||
|
||||
// 文本始终填满按钮(常见做法)
|
||||
ApplyRectTransformConfig(txtRect, new RectTransformConfig(
|
||||
anchorMin: Vector2.zero,
|
||||
anchorMax: Vector2.one,
|
||||
anchoredPosition: Vector2.zero,
|
||||
sizeDelta: Vector2.zero,
|
||||
offsetMin: Vector2.zero,
|
||||
offsetMax: Vector2.zero,
|
||||
pivot: new Vector2(0.5f, 0.5f)
|
||||
));
|
||||
|
||||
var tmpText = txtObj.AddComponent<TextMeshProUGUI>();
|
||||
tmpText.text = config.Text;
|
||||
tmpText.color = config.TextColor;
|
||||
tmpText.alignment = TextAlignmentOptions.Center;
|
||||
tmpText.fontSize = config.FontSize;
|
||||
tmpText.raycastTarget = config.RaycastTarget;
|
||||
if (onClick != null)
|
||||
button.onClick.AddListener(onClick);
|
||||
return (button, tmpText);
|
||||
}
|
||||
|
||||
// ========================
|
||||
// 文本创建(重载)
|
||||
// ========================
|
||||
public static TextMeshProUGUI CreateText(Transform parent, string text)
|
||||
{
|
||||
var config = TextConfig.Default;
|
||||
config.Text = text;
|
||||
return CreateText(parent, config);
|
||||
}
|
||||
|
||||
public static TextMeshProUGUI CreateText(Transform parent, TextConfig config)
|
||||
{
|
||||
var textObj = new GameObject(config.Text + "Text");
|
||||
var textRect = textObj.AddComponent<RectTransform>();
|
||||
textRect.SetParent(parent, false);
|
||||
|
||||
ApplyRectTransformConfig(textRect, config.RectConfig);
|
||||
|
||||
var tmpText = textObj.AddComponent<TextMeshProUGUI>();
|
||||
tmpText.text = config.Text;
|
||||
tmpText.color = config.TextColor;
|
||||
tmpText.alignment = config.Alignment;
|
||||
tmpText.fontSize = config.FontSize;
|
||||
tmpText.raycastTarget = config.RaycastTarget;
|
||||
|
||||
return tmpText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ========================
|
||||
// 滚动视图创建
|
||||
// ========================
|
||||
public static (ScrollRect scrollRect, RectTransform content) CreateScrollView(
|
||||
Transform parent,
|
||||
ScrollViewConfig config)
|
||||
{
|
||||
// 1. ScrollView 根对象
|
||||
var scrollViewObj = new GameObject("ScrollView");
|
||||
var scrollViewRect = scrollViewObj.AddComponent<RectTransform>();
|
||||
scrollViewRect.SetParent(parent, false);
|
||||
scrollViewRect.sizeDelta = config.SizeDelta;
|
||||
|
||||
var scrollView = scrollViewObj.AddComponent<ScrollRect>();
|
||||
var scrollViewImage = scrollViewObj.AddComponent<Image>();
|
||||
scrollViewImage.color = config.BackgroundColor;
|
||||
scrollViewImage.raycastTarget = true;
|
||||
|
||||
// 2. Viewport 子对象
|
||||
var viewportObj = new GameObject("Viewport");
|
||||
var viewportRect = viewportObj.AddComponent<RectTransform>();
|
||||
viewportRect.SetParent(scrollViewRect, false);
|
||||
viewportRect.anchorMin = Vector2.zero;
|
||||
viewportRect.anchorMax = Vector2.one;
|
||||
viewportRect.offsetMin = Vector2.zero;
|
||||
viewportRect.offsetMax = Vector2.zero;
|
||||
viewportRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
|
||||
var viewportMask = viewportObj.AddComponent<RectMask2D>(); // 或 Mask,但 RectMask2D 性能更好
|
||||
var viewportImage = viewportObj.AddComponent<Image>();
|
||||
viewportImage.color = Color.clear; // 透明背景
|
||||
|
||||
// 3. Content 子对象
|
||||
var contentObj = new GameObject("Content");
|
||||
var contentRect = contentObj.AddComponent<RectTransform>();
|
||||
contentRect.SetParent(viewportRect, false);
|
||||
|
||||
// 设置 Content 的锚点:根据滚动方向决定
|
||||
if (config.Vertical && !config.Horizontal)
|
||||
{
|
||||
// 垂直滚动:宽度拉满,高度自适应
|
||||
contentRect.anchorMin = new Vector2(0, 1);
|
||||
contentRect.anchorMax = new Vector2(1, 1);
|
||||
contentRect.pivot = new Vector2(0.5f, 1);
|
||||
contentRect.anchoredPosition = new Vector2(0, -config.ContentPadding.y);
|
||||
contentRect.sizeDelta = new Vector2(-2 * config.ContentPadding.x, 0); // 左右留边距
|
||||
}
|
||||
else if (config.Horizontal && !config.Vertical)
|
||||
{
|
||||
// 水平滚动:高度拉满,宽度自适应
|
||||
contentRect.anchorMin = new Vector2(0, 0);
|
||||
contentRect.anchorMax = new Vector2(0, 1);
|
||||
contentRect.pivot = new Vector2(0, 0.5f);
|
||||
contentRect.anchoredPosition = new Vector2(config.ContentPadding.x, 0);
|
||||
contentRect.sizeDelta = new Vector2(0, -2 * config.ContentPadding.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 双向滚动:自由布局
|
||||
contentRect.anchorMin = Vector2.zero;
|
||||
contentRect.anchorMax = Vector2.zero;
|
||||
contentRect.pivot = new Vector2(0, 1);
|
||||
contentRect.anchoredPosition = Vector2.zero;
|
||||
contentRect.sizeDelta = Vector2.zero;
|
||||
}
|
||||
|
||||
// 4. 关联 ScrollRect
|
||||
scrollView.viewport = viewportRect;
|
||||
scrollView.content = contentRect;
|
||||
scrollView.vertical = config.Vertical;
|
||||
scrollView.horizontal = config.Horizontal;
|
||||
scrollView.movementType = ScrollRect.MovementType.Elastic;
|
||||
scrollView.inertia = true;
|
||||
scrollView.decelerationRate = 0.135f; // 默认值
|
||||
|
||||
return (scrollView, contentRect);
|
||||
}
|
||||
|
||||
// ========================
|
||||
// 文本编辑器创建
|
||||
// ========================
|
||||
public static (TMP_InputField inputField, TextMeshProUGUI text) CreateInputField(Transform parent,
|
||||
InputFieldConfig config)
|
||||
{
|
||||
var inputFieldObj = new GameObject("InputField");
|
||||
var inputFieldRect = inputFieldObj.AddComponent<RectTransform>();
|
||||
inputFieldRect.SetParent(parent, false);
|
||||
ApplyRectTransformConfig(inputFieldRect, config.RectConfig);
|
||||
var inputField = inputFieldObj.AddComponent<TMP_InputField>();
|
||||
// 背景图像
|
||||
var backgroundImage = inputFieldObj.AddComponent<Image>();
|
||||
backgroundImage.sprite = Resources.Load<Sprite>("UI/Skins/Background");
|
||||
backgroundImage.type = Image.Type.Sliced;
|
||||
backgroundImage.color = config.BackgroundColor;
|
||||
// 输入框文本组件
|
||||
var textObj = new GameObject("Text (TMP)");
|
||||
var textRect = textObj.AddComponent<RectTransform>();
|
||||
textRect.SetParent(inputFieldRect, false);
|
||||
// 文本始终填满输入框
|
||||
ApplyRectTransformConfig(textRect, new RectTransformConfig(
|
||||
anchorMin: Vector2.zero,
|
||||
anchorMax: Vector2.one,
|
||||
anchoredPosition: Vector2.zero,
|
||||
sizeDelta: Vector2.zero,
|
||||
offsetMin: Vector2.zero,
|
||||
offsetMax: Vector2.zero,
|
||||
pivot: new Vector2(0.5f, 0.5f)
|
||||
));
|
||||
var tmpText = textObj.AddComponent<TextMeshProUGUI>();
|
||||
tmpText.text = "";
|
||||
tmpText.color = config.TextColor;
|
||||
tmpText.alignment = config.TextAlignment;
|
||||
tmpText.fontSize = config.FontSize;
|
||||
tmpText.raycastTarget = false;
|
||||
inputField.textComponent = tmpText;
|
||||
// 占位符文本组件
|
||||
var placeholderObj = new GameObject("Placeholder");
|
||||
var placeholderRect = placeholderObj.AddComponent<RectTransform>();
|
||||
placeholderRect.SetParent(inputFieldRect, false);
|
||||
// 占位符文本始终填满输入框
|
||||
ApplyRectTransformConfig(placeholderRect, new RectTransformConfig(
|
||||
anchorMin: Vector2.zero,
|
||||
anchorMax: Vector2.one,
|
||||
anchoredPosition: Vector2.zero,
|
||||
sizeDelta: Vector2.zero,
|
||||
offsetMin: Vector2.zero,
|
||||
offsetMax: Vector2.zero,
|
||||
pivot: new Vector2(0.5f, 0.5f)
|
||||
));
|
||||
var placeholderText = placeholderObj.AddComponent<TextMeshProUGUI>();
|
||||
placeholderText.text = config.PlaceholderText;
|
||||
placeholderText.color = config.PlaceholderTextColor;
|
||||
placeholderText.alignment = config.TextAlignment;
|
||||
placeholderText.fontSize = config.PlaceholderFontSize;
|
||||
placeholderText.raycastTarget = false;
|
||||
inputField.placeholder = placeholderText;
|
||||
// 配置输入字段属性
|
||||
inputField.characterValidation = config.CharacterValidation;
|
||||
inputField.characterLimit = config.CharacterLimit;
|
||||
return (inputField, tmpText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
67
SceneView/FontUtilities.cs
Normal file
67
SceneView/FontUtilities.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.LowLevel;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public static class FontUtilities
|
||||
{
|
||||
private static readonly Dictionary<string, TMP_FontAsset> _fontCache = new Dictionary<string, TMP_FontAsset>();
|
||||
|
||||
/// <summary>
|
||||
/// 根据字体名称从操作系统加载字体,并创建 TMP_FontAsset(带缓存)
|
||||
/// 非常遗憾,用不了
|
||||
/// </summary>
|
||||
/// <param name="fontName">系统字体名称,如 "Arial", "Microsoft YaHei" 等</param>
|
||||
/// <returns>对应的 TMP_FontAsset,失败则返回 null</returns>
|
||||
public static TMP_FontAsset? GetOrCreateTMPFont(string fontName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fontName))
|
||||
return null;
|
||||
|
||||
if (_fontCache.TryGetValue(fontName, out var cached))
|
||||
return cached;
|
||||
|
||||
var baseFont = Font.CreateDynamicFontFromOSFont(fontName, 12); // 12 是临时大小,不影响 TMP 字体质量
|
||||
|
||||
if (baseFont == null || baseFont.dynamic == false)
|
||||
{
|
||||
Debug.LogWarning($"Font '{fontName}' not found in OS.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 创建 TMP 字体资源
|
||||
var tmpFont = TMP_FontAsset.CreateFontAsset(
|
||||
baseFont,
|
||||
samplingPointSize: 72,
|
||||
atlasPadding: 4,
|
||||
renderMode: GlyphRenderMode.SDFAA,
|
||||
atlasWidth: 1024,
|
||||
atlasHeight: 1024,
|
||||
atlasPopulationMode: AtlasPopulationMode.Dynamic,
|
||||
enableMultiAtlasSupport: true
|
||||
);
|
||||
|
||||
if (tmpFont != null)
|
||||
{
|
||||
_fontCache[fontName] = tmpFont;
|
||||
Debug.Log($"Loaded TMP font: {fontName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Failed to create TMP_FontAsset from font: {fontName}");
|
||||
}
|
||||
|
||||
return tmpFont;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空缓存(谨慎使用,通常不需要)
|
||||
/// </summary>
|
||||
public static void ClearCache()
|
||||
{
|
||||
_fontCache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
56
SceneView/ModBehaviour.cs
Normal file
56
SceneView/ModBehaviour.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public class ModBehaviour:Duckov.Modding.ModBehaviour
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
protected override void OnBeforeDeactivate()
|
||||
{
|
||||
RemoveComponents();
|
||||
if (harmony != null)
|
||||
{
|
||||
harmony.UnpatchAll(harmony.Id);
|
||||
}
|
||||
|
||||
harmony = null;
|
||||
}
|
||||
|
||||
private void CreateComponents()
|
||||
{
|
||||
if(component==null)
|
||||
{
|
||||
component = new GameObject("SceneViewControl");
|
||||
myCanvas= component.AddComponent<CanvasControl>();
|
||||
component.SetActive(true);
|
||||
DontDestroyOnLoad(component);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveComponents()
|
||||
{
|
||||
if (component != null)
|
||||
{
|
||||
GameObject.Destroy(component);
|
||||
component = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
SceneView/PatchGameObjectStart.cs
Normal file
14
SceneView/PatchGameObjectStart.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
// [HarmonyPatch(typeof(GameObject), "Internal_CreateGameObject")]
|
||||
// public class PatchGameObjectStart
|
||||
// {
|
||||
// static void Postfix(GameObject __instance)
|
||||
// {
|
||||
// Debug.Log($"{__instance.name}初始化了");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
15
SceneView/PatchObjectDestroy.cs
Normal file
15
SceneView/PatchObjectDestroy.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
[HarmonyPatch(typeof(Object), nameof(Object.Destroy), new Type[] { typeof(Object)})]
|
||||
public class PatchObjectDestroy
|
||||
{
|
||||
private static void Postfix(Object __instance)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
SceneView/SceneView.csproj
Normal file
25
SceneView/SceneView.csproj
Normal file
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<DuckovPath>D:\steam\steamapps\common\Escape from Duckov</DuckovPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Mods\SceneView</OutputPath>
|
||||
<GenerateDependencyFile>false</GenerateDependencyFile>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\TeamSoda.*" Private="False" />
|
||||
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\ItemStatsSystem.dll" Private="False" />
|
||||
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\Unity*" Private="False" />
|
||||
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\FMODUnity.dll" Private="False" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Lib.Harmony" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
220
SceneView/SceneViewPanel.cs
Normal file
220
SceneView/SceneViewPanel.cs
Normal file
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public class SceneViewPanel : MonoBehaviour, IDragHandler, IBeginDragHandler
|
||||
{
|
||||
public const float titleHeight = 50;
|
||||
|
||||
private Vector2 shift;
|
||||
public ScrollRect? scrollRect;
|
||||
|
||||
private TreeViewNode? treeViewNode;
|
||||
|
||||
public string currentAimObj;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
currentAimObj = CanvasControl.ShowAim;
|
||||
CreateUI();
|
||||
}
|
||||
|
||||
private void CreateUI()
|
||||
{
|
||||
CreateTitleBar();
|
||||
var scrollConfig = ScrollViewConfig.Default;
|
||||
scrollConfig.Horizontal = true;
|
||||
scrollConfig.SizeDelta = CanvasControl.panelSize - new Vector2(0, titleHeight);
|
||||
var scrollRectArr = ControlUtilities.CreateScrollView(transform, scrollConfig);
|
||||
scrollRect = scrollRectArr.scrollRect;
|
||||
if (scrollRect == null)
|
||||
{
|
||||
Debug.LogError("Failed to create ScrollView.");
|
||||
return;
|
||||
}
|
||||
|
||||
var scrollRectRectTransform = scrollRect.GetComponent<RectTransform>();
|
||||
if (scrollRectRectTransform == null)
|
||||
{
|
||||
Debug.LogError("Failed to get RectTransform for ScrollView.");
|
||||
return;
|
||||
}
|
||||
|
||||
scrollRectRectTransform.anchorMin = new Vector2(0, 0);
|
||||
scrollRectRectTransform.anchorMax = new Vector2(1, 1);
|
||||
scrollRectRectTransform.offsetMin = Vector2.zero;
|
||||
scrollRectRectTransform.offsetMax = new Vector2(0, -titleHeight);
|
||||
|
||||
var content = scrollRect.content.gameObject;
|
||||
if (content == null)
|
||||
{
|
||||
Debug.LogError("Failed to get content for ScrollView.");
|
||||
return;
|
||||
}
|
||||
// var contentRectTransform = content.GetComponent<RectTransform>();
|
||||
// contentRectTransform.anchorMin = Vector2.up;
|
||||
// contentRectTransform.anchorMax = Vector2.one;
|
||||
// contentRectTransform.sizeDelta = Vector2.zero;
|
||||
// contentRectTransform.offsetMin = Vector2.zero;
|
||||
// contentRectTransform.offsetMax = new Vector2(0, 0);
|
||||
|
||||
// var root = new GameObject("root");
|
||||
// root.AddComponent<RectTransform>();
|
||||
// root.transform.SetParent(content.transform, false);
|
||||
|
||||
treeViewNode = content.AddComponent<TreeViewNode>();
|
||||
treeViewNode.UpdateHeight();
|
||||
|
||||
// var vLayout = content.AddComponent<VerticalLayoutGroup>();
|
||||
// vLayout.padding = new RectOffset(2, 2, 2, 2);
|
||||
// vLayout.spacing = 5;
|
||||
// vLayout.childControlWidth = true;
|
||||
// vLayout.childControlHeight = false;
|
||||
// var size= content.AddComponent<ContentSizeFitter>();
|
||||
// size.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
// size.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
|
||||
|
||||
var inputConfig = InputFieldConfig.Default;
|
||||
inputConfig.RectConfig.AnchorMin = Vector2.zero;
|
||||
inputConfig.RectConfig.AnchorMax = Vector2.right;
|
||||
inputConfig.RectConfig.Pivot = new Vector2(0.5f, 1);
|
||||
inputConfig.RectConfig.SizeDelta = new Vector2(0, titleHeight);
|
||||
inputConfig.PlaceholderText = "输入搜索对象";
|
||||
var inputObj = ControlUtilities.CreateInputField(transform, inputConfig);
|
||||
inputObj.inputField.onEndEdit.AddListener(s =>
|
||||
{
|
||||
currentAimObj = s;
|
||||
Refresh();
|
||||
});
|
||||
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void CreateTitleBar()
|
||||
{
|
||||
var titleBar = new GameObject("TitleBar").AddComponent<RectTransform>();
|
||||
titleBar.transform.SetParent(transform, false);
|
||||
if (titleBar == null)
|
||||
{
|
||||
Debug.LogError("Failed to create TitleBar RectTransform.");
|
||||
return;
|
||||
}
|
||||
|
||||
titleBar.anchorMin = new Vector2(0, 1);
|
||||
titleBar.anchorMax = new Vector2(1, 1);
|
||||
titleBar.pivot = new Vector2(0.5f, 1);
|
||||
titleBar.sizeDelta = new Vector2(0, titleHeight);
|
||||
titleBar.anchoredPosition = Vector2.zero;
|
||||
|
||||
var titleTextConfig = TextConfig.Default;
|
||||
titleTextConfig.Text = "场景视图";
|
||||
titleTextConfig.RectConfig.AnchorMin = Vector2.zero;
|
||||
titleTextConfig.RectConfig.AnchorMax = Vector2.one;
|
||||
|
||||
var titleText = ControlUtilities.CreateText(titleBar, titleTextConfig);
|
||||
if (titleText == null)
|
||||
{
|
||||
Debug.LogError("Failed to create TitleText.");
|
||||
}
|
||||
|
||||
var refreshButtonConfig = ButtonConfig.Default;
|
||||
refreshButtonConfig.Text = "刷新";
|
||||
refreshButtonConfig.BackgroundColor = Color.yellow;
|
||||
refreshButtonConfig.RectConfig.SizeDelta = new Vector2(60, 40);
|
||||
refreshButtonConfig.RectConfig.AnchoredPosition = new Vector2(35, -25);
|
||||
var refreshButton = ControlUtilities.CreateButton(titleBar, refreshButtonConfig, Refresh);
|
||||
|
||||
var closeButtonConfig = ButtonConfig.Default;
|
||||
closeButtonConfig.Text = "X";
|
||||
closeButtonConfig.BackgroundColor = Color.red;
|
||||
closeButtonConfig.RectConfig.AnchorMax = Vector2.one;
|
||||
closeButtonConfig.RectConfig.AnchorMin = Vector2.one;
|
||||
closeButtonConfig.RectConfig.SizeDelta = new Vector2(30, 30);
|
||||
closeButtonConfig.RectConfig.AnchoredPosition = new Vector2(-25, -25);
|
||||
ControlUtilities.CreateButton(titleBar, closeButtonConfig, () => gameObject.SetActive(false));
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (treeViewNode)
|
||||
{
|
||||
var canvas = FindIncludingHidden(currentAimObj);
|
||||
if (!canvas)
|
||||
{
|
||||
Debug.LogError($"{currentAimObj} not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
StartCoroutine(treeViewNode.DisplayGameObjectStructureCoroutine(canvas));
|
||||
// treeViewNode.DisplayGameObjectStructure(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
transform.position = eventData.position + shift;
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
shift = transform.position - new Vector3(eventData.position.x, eventData.position.y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按名称查找场景中的GameObject,包括隐藏(非激活)对象和DontDestroyOnLoad对象。
|
||||
/// 此方法会遍历所有当前加载到内存中的GameObject实例。
|
||||
///
|
||||
/// **重要提示:**
|
||||
/// 1. **性能开销较大:** 该方法会遍历所有已加载的GameObject,性能开销相对较高。
|
||||
/// 因此,**不建议在Update、FixedUpdate等帧循环中频繁调用。**
|
||||
/// 2. **适用场景:** 更适合在初始化、加载场景、调试或不频繁的查找操作中使用。
|
||||
/// 3. **同名对象:** 如果场景中存在多个同名对象,此方法将返回它遇到的第一个匹配项。
|
||||
/// 4. **DontDestroyOnLoad:** 自动包含在DontDestroyOnLoad根下的对象。
|
||||
/// 5. **隐藏对象:** 自动包含Hierarchy中非激活(隐藏)的对象。
|
||||
/// </summary>
|
||||
/// <param name="name">要查找的GameObject的名称。</param>
|
||||
/// <returns>找到的第一个GameObject,如果未找到则返回null。</returns>
|
||||
public static GameObject FindIncludingHidden(string name)
|
||||
{
|
||||
// 1. 验证名称 - 处理null, empty, 或只包含空白字符的名称
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
Debug.LogWarning("FindIncludingHidden: Provided name is null, empty, or whitespace. Returning null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 2. 获取所有已加载的GameObject
|
||||
// Resources.FindObjectsOfTypeAll<GameObject>() 是实现需求的关键。
|
||||
// 它会找到所有当前加载到内存中的GameObject实例,不论它们是否激活,属于哪个场景(包括 DontDestroyOnLoad 场景),
|
||||
// 甚至可能包括一些编辑器内部使用的隐藏GameObject。
|
||||
GameObject[] allGameObjects = Resources.FindObjectsOfTypeAll<GameObject>();
|
||||
// 3. 遍历并比较名称
|
||||
foreach (GameObject obj in allGameObjects)
|
||||
{
|
||||
// Unity中存在许多内部GameObject(例如:场景视图的相机、光照探头组等),
|
||||
// 它们的hideFlags属性可能被设置为HideInHierarchy、HideAndDontSave等。
|
||||
// 题目要求“包括隐藏”,并未明确排除这些内部或编辑器对象。
|
||||
// 因此,这里我们采取最宽松的策略:只要GameObject的name属性与传入的name匹配,就返回。
|
||||
// 如果未来需要排除特定类型的隐藏对象(例如只查找用户创建的游戏对象),
|
||||
// 可以根据 obj.scene.name 来过滤 DontDestroyOnLoad 场景中的对象,
|
||||
// 或者根据 obj.hideFlags 来排除编辑器内部对象。
|
||||
if (obj.name == name)
|
||||
{
|
||||
return obj; // 4. 返回第一个匹配项
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 未找到则返回 null
|
||||
// 通常,查找函数在未找到结果时静默返回null是更常见的API行为。
|
||||
// 调用方可以根据返回值自行决定是否输出日志。
|
||||
// Debug.LogWarning($"FindIncludingHidden: GameObject with name '{name}' not found. Returning null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
450
SceneView/TreeViewNode.cs
Normal file
450
SceneView/TreeViewNode.cs
Normal file
@@ -0,0 +1,450 @@
|
||||
using System.Collections;
|
||||
using SceneView;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SceneView
|
||||
{
|
||||
public class TreeViewNode : MonoBehaviour
|
||||
{
|
||||
public TreeViewNode? parent = null;
|
||||
|
||||
public RectTransform? rectTransform;
|
||||
public TextMeshProUGUI? text;
|
||||
public Button? label;
|
||||
public GameObject? child;
|
||||
public RectTransform? childRectTransform;
|
||||
public VerticalLayoutGroup? verticalLayout;
|
||||
public Button? objectEnable;
|
||||
public TextMeshProUGUI? objectText;
|
||||
|
||||
public float buttonHeight = 50;
|
||||
|
||||
private string originalText = "";
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CreateUI();
|
||||
}
|
||||
|
||||
[ContextMenu("CreateUI")]
|
||||
public void CreateUI()
|
||||
{
|
||||
// 获取 RectTransform 组件,如果不存在则添加
|
||||
if (rectTransform == null)
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
if (rectTransform == null)
|
||||
{
|
||||
rectTransform = gameObject.AddComponent<RectTransform>();
|
||||
}
|
||||
|
||||
if (rectTransform == null)
|
||||
{
|
||||
Debug.LogError("Failed to add RectTransform to the GameObject.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rectTransform.sizeDelta = new Vector2(0, buttonHeight);
|
||||
rectTransform.anchorMin = Vector2.up;
|
||||
rectTransform.anchorMax = Vector2.one;
|
||||
|
||||
var buttonConfig = ButtonConfig.Default;
|
||||
buttonConfig.RectConfig.Pivot = new Vector2(0.5f, 1);
|
||||
buttonConfig.RectConfig.AnchorMin = new Vector2(0, 1);
|
||||
buttonConfig.RectConfig.AnchorMax = new Vector2(1, 1);
|
||||
buttonConfig.RectConfig.SizeDelta = new Vector2(0, buttonHeight);
|
||||
|
||||
// 创建按钮并检查是否已存在
|
||||
if (label == null)
|
||||
{
|
||||
var button = ControlUtilities.CreateButton(rectTransform, buttonConfig, Expand);
|
||||
label = button.button;
|
||||
text = button.text;
|
||||
if (text == null)
|
||||
{
|
||||
Debug.LogError("Failed to get button text.");
|
||||
return;
|
||||
}
|
||||
|
||||
text.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
}
|
||||
|
||||
if (objectEnable == null)
|
||||
{
|
||||
var button = ControlUtilities.CreateButton(rectTransform, buttonConfig, null);
|
||||
objectEnable = button.button;
|
||||
objectText= button.text;
|
||||
button.text.text = "-";
|
||||
button.button.image.color = Color.yellow;
|
||||
var rect=objectEnable.GetComponent<RectTransform>();
|
||||
rect.anchorMin = Vector2.one;
|
||||
rect.anchorMax = Vector2.one;
|
||||
rect.pivot = Vector2.one / 2;
|
||||
rect.sizeDelta = new Vector2(30, 30);
|
||||
rect.anchoredPosition = new Vector2(-25, -25);
|
||||
}
|
||||
|
||||
// 检查子对象是否存在
|
||||
child = transform.Find("content")?.gameObject;
|
||||
if (child == null)
|
||||
{
|
||||
child = new GameObject("content");
|
||||
child.transform.SetParent(rectTransform, false);
|
||||
if (child == null)
|
||||
{
|
||||
Debug.LogError("Failed to create or set parent for child content.");
|
||||
return;
|
||||
}
|
||||
|
||||
childRectTransform = child.AddComponent<RectTransform>();
|
||||
if (childRectTransform == null)
|
||||
{
|
||||
Debug.LogError("Failed to add RectTransform to the child content.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
childRectTransform = child.GetComponent<RectTransform>();
|
||||
if (childRectTransform == null)
|
||||
{
|
||||
Debug.LogError("Failed to get RectTransform for the child content.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
childRectTransform.anchorMin = new Vector2(0, 1);
|
||||
childRectTransform.anchorMax = new Vector2(1, 1);
|
||||
childRectTransform.pivot = new Vector2(0.5f, 1);
|
||||
childRectTransform.offsetMax = new Vector2(0, -buttonHeight);
|
||||
childRectTransform.offsetMin = new Vector2(0, 0);
|
||||
|
||||
verticalLayout = child.GetComponent<VerticalLayoutGroup>();
|
||||
var sizeFitter = child.GetComponent<ContentSizeFitter>();
|
||||
|
||||
if (verticalLayout == null)
|
||||
{
|
||||
verticalLayout = child.AddComponent<VerticalLayoutGroup>();
|
||||
if (verticalLayout == null)
|
||||
{
|
||||
Debug.LogError("Failed to add VerticalLayoutGroup to the child content.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeFitter == null)
|
||||
{
|
||||
sizeFitter = child.AddComponent<ContentSizeFitter>();
|
||||
if (sizeFitter == null)
|
||||
{
|
||||
Debug.LogError("Failed to add ContentSizeFitter to the child content.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
verticalLayout.padding.top = 2;
|
||||
verticalLayout.padding.bottom = 4;
|
||||
verticalLayout.spacing = 2;
|
||||
verticalLayout.childControlHeight = false;
|
||||
verticalLayout.childControlWidth = true;
|
||||
|
||||
sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
|
||||
}
|
||||
|
||||
public void InsertChild(RectTransform childRectTransform)
|
||||
{
|
||||
if (child != null && childRectTransform != null)
|
||||
{
|
||||
// 将子节点添加到 content 容器中
|
||||
childRectTransform.SetParent(child.transform, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Expand()
|
||||
{
|
||||
if (child == null)
|
||||
{
|
||||
Debug.LogError("Child content not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
child.SetActive(!child.activeSelf);
|
||||
|
||||
UpdateHeight();
|
||||
|
||||
// 更新名称以模拟动画效果
|
||||
if (child.activeSelf)
|
||||
{
|
||||
if (text != null) text.text = originalText + " ↓"; // 下三角符号
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text != null) text.text = originalText + " →"; // 右三角符号
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateHeight()
|
||||
{
|
||||
if (child == null || childRectTransform == null || rectTransform == null)
|
||||
{
|
||||
Debug.LogError("Failed to update height. Child, ChildRectTransform, or RectTransform is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (child.activeSelf)
|
||||
{
|
||||
rectTransform.sizeDelta =
|
||||
new Vector2(rectTransform.sizeDelta.x, buttonHeight + childRectTransform.sizeDelta.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, buttonHeight);
|
||||
}
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(parent.childRectTransform);
|
||||
parent.UpdateHeight();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator DisplayGameObjectStructureCoroutine(GameObject targetObject, int depth = 0)
|
||||
{
|
||||
if (targetObject == null)
|
||||
{
|
||||
Debug.LogError("Target object is null.");
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (targetObject.name == CanvasControl.ViewCanvasName)
|
||||
yield break;
|
||||
|
||||
|
||||
ClearChildNodes();
|
||||
originalText = GetIndentedName(targetObject.name, depth);
|
||||
if (text != null) text.text = originalText;
|
||||
objectEnable.onClick.AddListener(() => OnObjectEnable(targetObject, objectEnable, objectText));
|
||||
UpdateObjButton(targetObject,objectEnable,objectText);
|
||||
|
||||
|
||||
var components = targetObject.GetComponents<Behaviour>();
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (childRectTransform == null)
|
||||
{
|
||||
Debug.LogError("childRectTransform is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
var config = ButtonConfig.Default;
|
||||
config.RectConfig.SizeDelta = new Vector2(0, 40);
|
||||
config.BackgroundColor = Color.green;
|
||||
config.Text = new string(' ', (depth + 1) * 2) + component.GetType().Name;
|
||||
var buttonBack = ControlUtilities.CreateButton(childRectTransform, config, null);
|
||||
if (buttonBack.button == null)
|
||||
{
|
||||
Debug.LogError("buttonBack.button is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
var button = buttonBack.button;
|
||||
var comp = component;
|
||||
buttonBack.button.onClick.AddListener(() => OnButtonClick(button, comp));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 计数器,用于跟踪子协程的数量
|
||||
var childCount = targetObject.transform.childCount;
|
||||
var completedChildren = 0;
|
||||
|
||||
var allChildrenExpanded = false;
|
||||
|
||||
// 遍历目标对象的所有子对象
|
||||
foreach (Transform childTransform in targetObject.transform)
|
||||
{
|
||||
if (childTransform == null)
|
||||
{
|
||||
Debug.LogError("Child transform is null.");
|
||||
continue;
|
||||
}
|
||||
|
||||
var childNode = new GameObject($"{childTransform.gameObject.name}").AddComponent<TreeViewNode>();
|
||||
childNode.transform.SetParent(childRectTransform, false);
|
||||
childNode.parent = this;
|
||||
childNode.CreateUI();
|
||||
|
||||
StartCoroutine(childNode.DisplayGameObjectStructureCoroutine(childTransform.gameObject, depth + 1, () =>
|
||||
{
|
||||
completedChildren++;
|
||||
if (completedChildren == childCount)
|
||||
{
|
||||
allChildrenExpanded = true;
|
||||
}
|
||||
}));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 等待所有子协程完成
|
||||
while (!allChildrenExpanded && childCount > 0)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 在所有子节点初始化完毕后调用Expand
|
||||
Expand();
|
||||
}
|
||||
|
||||
public IEnumerator DisplayGameObjectStructureCoroutine(GameObject targetObject, int depth,
|
||||
System.Action onComplete)
|
||||
{
|
||||
if (targetObject == null)
|
||||
{
|
||||
Debug.LogError("Target object is null.");
|
||||
yield break;
|
||||
}
|
||||
|
||||
ClearChildNodes();
|
||||
originalText = GetIndentedName(targetObject.name, depth);
|
||||
if (text != null) text.text = originalText;
|
||||
objectEnable.onClick.AddListener(() => OnObjectEnable(targetObject, objectEnable, objectText));
|
||||
UpdateObjButton(targetObject,objectEnable,objectText);
|
||||
var components = targetObject.GetComponents<Behaviour>();
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (childRectTransform == null)
|
||||
{
|
||||
Debug.LogError("childRectTransform is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
var config = ButtonConfig.Default;
|
||||
config.RectConfig.SizeDelta = new Vector2(0, 40);
|
||||
config.BackgroundColor = Color.green;
|
||||
config.Text = new string(' ', (depth + 1) * 2) + component.GetType().Name;
|
||||
var buttonBack = ControlUtilities.CreateButton(childRectTransform, config, null);
|
||||
if (buttonBack.button == null)
|
||||
{
|
||||
Debug.LogError("buttonBack.button is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
var button = buttonBack.button;
|
||||
var comp = component;
|
||||
buttonBack.button.onClick.AddListener(() => OnButtonClick(button, comp));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 计数器,用于跟踪子协程的数量
|
||||
var childCount = targetObject.transform.childCount;
|
||||
var completedChildren = 0;
|
||||
|
||||
var allChildrenExpanded = false;
|
||||
|
||||
// 遍历目标对象的所有子对象
|
||||
foreach (Transform childTransform in targetObject.transform)
|
||||
{
|
||||
if (childTransform == null)
|
||||
{
|
||||
Debug.LogError("Child transform is null.");
|
||||
continue;
|
||||
}
|
||||
|
||||
var childNode = new GameObject($"{childTransform.gameObject.name}").AddComponent<TreeViewNode>();
|
||||
childNode.transform.SetParent(childRectTransform, false);
|
||||
childNode.parent = this;
|
||||
childNode.CreateUI();
|
||||
|
||||
StartCoroutine(childNode.DisplayGameObjectStructureCoroutine(childTransform.gameObject, depth + 1, () =>
|
||||
{
|
||||
completedChildren++;
|
||||
if (completedChildren == childCount)
|
||||
{
|
||||
allChildrenExpanded = true;
|
||||
}
|
||||
}));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 等待所有子协程完成
|
||||
while (!allChildrenExpanded && childCount > 0)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 在所有子节点初始化完毕后调用Expand
|
||||
Expand();
|
||||
|
||||
// 调用完成回调
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
|
||||
private string GetIndentedName(string name, int depth)
|
||||
{
|
||||
var indent = "";
|
||||
for (int i = 0; i < depth; i++)
|
||||
{
|
||||
indent += $"{i}_";
|
||||
}
|
||||
return $"{indent}_{name}";
|
||||
}
|
||||
|
||||
public void ClearChildNodes()
|
||||
{
|
||||
if (childRectTransform != null)
|
||||
foreach (Transform childRectTransform in this.childRectTransform)
|
||||
{
|
||||
Destroy(childRectTransform.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnButtonClick(Button button, Behaviour component)
|
||||
{
|
||||
if (button == null)
|
||||
{
|
||||
Debug.LogError("button is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (component == null)
|
||||
{
|
||||
Debug.LogError("component is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// 切换组件的启用状态
|
||||
var isEnabled = !component.enabled;
|
||||
component.enabled = isEnabled;
|
||||
// 根据组件的启用状态修改按钮背景颜色
|
||||
button.image.color = isEnabled ? Color.green : Color.red;
|
||||
}
|
||||
|
||||
private void OnObjectEnable(GameObject gameObject, Button button, TMP_Text text)
|
||||
{
|
||||
Debug.Log($"设置{gameObject.name}={!gameObject.activeSelf}");
|
||||
gameObject.SetActive(!gameObject.activeSelf);
|
||||
UpdateObjButton(gameObject, button, text);
|
||||
}
|
||||
|
||||
private void UpdateObjButton(GameObject gameObject, Button button, TMP_Text text)
|
||||
{
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
button.image.color = Color.green;
|
||||
text.text = "√";
|
||||
}
|
||||
else
|
||||
{
|
||||
button.image.color = Color.red;
|
||||
text.text = "×";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
22
SceneView/obj/Debug/SceneView.AssemblyInfo.cs
Normal file
22
SceneView/obj/Debug/SceneView.AssemblyInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+786025f720c05ae486c8c66d3a6114633ccd0dbf")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
1
SceneView/obj/Debug/SceneView.AssemblyInfoInputs.cache
Normal file
1
SceneView/obj/Debug/SceneView.AssemblyInfoInputs.cache
Normal file
@@ -0,0 +1 @@
|
||||
aa136efc39beffbdc5220893902c448939a7627fda773846b8971cca38a3094b
|
||||
@@ -0,0 +1,8 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = SceneView
|
||||
build_property.ProjectDir = D:\vs_project\DuckovMods\SceneView\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.CsWinRTUseWindowsUIXamlProjections = false
|
||||
build_property.EffectiveAnalysisLevelStyle =
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
BIN
SceneView/obj/Debug/SceneView.assets.cache
Normal file
BIN
SceneView/obj/Debug/SceneView.assets.cache
Normal file
Binary file not shown.
BIN
SceneView/obj/Debug/SceneView.csproj.AssemblyReference.cache
Normal file
BIN
SceneView/obj/Debug/SceneView.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
22
SceneView/obj/Release/SceneView.AssemblyInfo.cs
Normal file
22
SceneView/obj/Release/SceneView.AssemblyInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+786025f720c05ae486c8c66d3a6114633ccd0dbf")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
1
SceneView/obj/Release/SceneView.AssemblyInfoInputs.cache
Normal file
1
SceneView/obj/Release/SceneView.AssemblyInfoInputs.cache
Normal file
@@ -0,0 +1 @@
|
||||
e56036f0838e710ef74c4ebdd97d630a82ce4f293e0f56fdc74ce4c87f1ae5a4
|
||||
@@ -0,0 +1,8 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = SceneView
|
||||
build_property.ProjectDir = D:\vs_project\DuckovMods\SceneView\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.CsWinRTUseWindowsUIXamlProjections = false
|
||||
build_property.EffectiveAnalysisLevelStyle =
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
BIN
SceneView/obj/Release/SceneView.assets.cache
Normal file
BIN
SceneView/obj/Release/SceneView.assets.cache
Normal file
Binary file not shown.
BIN
SceneView/obj/Release/SceneView.csproj.AssemblyReference.cache
Normal file
BIN
SceneView/obj/Release/SceneView.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2db483d989a5a869a86b32f19fd026cf473776d04114d97e11aed9c79ee12fd1
|
||||
@@ -0,0 +1,7 @@
|
||||
D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Mods\SceneView\SceneView.dll
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.csproj.AssemblyReference.cache
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.AssemblyInfoInputs.cache
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.AssemblyInfo.cs
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.csproj.CoreCompileInputs.cache
|
||||
D:\vs_project\DuckovMods\SceneView\obj\Release\SceneView.dll
|
||||
BIN
SceneView/obj/Release/SceneView.dll
Normal file
BIN
SceneView/obj/Release/SceneView.dll
Normal file
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+786025f720c05ae486c8c66d3a6114633ccd0dbf")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("SceneView")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
e56036f0838e710ef74c4ebdd97d630a82ce4f293e0f56fdc74ce4c87f1ae5a4
|
||||
@@ -0,0 +1,8 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = SceneView
|
||||
build_property.ProjectDir = D:\vs_project\DuckovMods\SceneView\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.CsWinRTUseWindowsUIXamlProjections = false
|
||||
build_property.EffectiveAnalysisLevelStyle =
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
BIN
SceneView/obj/Release/netstandard2.1/SceneView.assets.cache
Normal file
BIN
SceneView/obj/Release/netstandard2.1/SceneView.assets.cache
Normal file
Binary file not shown.
79
SceneView/obj/SceneView.csproj.nuget.dgspec.json
Normal file
79
SceneView/obj/SceneView.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj",
|
||||
"projectName": "SceneView",
|
||||
"projectPath": "D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj",
|
||||
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\vs_project\\DuckovMods\\SceneView\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"D:\\vsShare\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"netstandard2.1"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"dependencies": {
|
||||
"Lib.Harmony": {
|
||||
"target": "Package",
|
||||
"version": "[2.4.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"NETStandard.Library": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
SceneView/obj/SceneView.csproj.nuget.g.props
Normal file
16
SceneView/obj/SceneView.csproj.nuget.g.props
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Lenovo\.nuget\packages\;D:\vsShare\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Lenovo\.nuget\packages\" />
|
||||
<SourceRoot Include="D:\vsShare\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
2
SceneView/obj/SceneView.csproj.nuget.g.targets
Normal file
2
SceneView/obj/SceneView.csproj.nuget.g.targets
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
239
SceneView/obj/project.assets.json
Normal file
239
SceneView/obj/project.assets.json
Normal file
@@ -0,0 +1,239 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
".NETStandard,Version=v2.1": {
|
||||
"Lib.Harmony/2.4.1": {
|
||||
"type": "package",
|
||||
"dependencies": {
|
||||
"Lib.Harmony.Ref": "2.4.1"
|
||||
},
|
||||
"compile": {
|
||||
"lib/netstandard2.0/_._": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/_._": {}
|
||||
}
|
||||
},
|
||||
"Lib.Harmony.Ref/2.4.1": {
|
||||
"type": "package",
|
||||
"dependencies": {
|
||||
"System.Reflection.Emit": "4.7.0"
|
||||
},
|
||||
"compile": {
|
||||
"ref/netstandard2.0/0Harmony.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reflection.Emit/4.7.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"ref/netstandard2.1/_._": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/_._": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Lib.Harmony/2.4.1": {
|
||||
"sha512": "iLTZi/kKKB18jYEIwReZSx2xXyVUh4J1swReMgvYBBBn4tzA1Nd0PJlVyntY5BDdSiXSxzmvjc/3OYfFs0YwFg==",
|
||||
"type": "package",
|
||||
"path": "lib.harmony/2.4.1",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"HarmonyLogo.png",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib.harmony.2.4.1.nupkg.sha512",
|
||||
"lib.harmony.nuspec",
|
||||
"lib/net35/0Harmony.dll",
|
||||
"lib/net35/0Harmony.pdb",
|
||||
"lib/net35/0Harmony.xml",
|
||||
"lib/net452/0Harmony.dll",
|
||||
"lib/net452/0Harmony.pdb",
|
||||
"lib/net452/0Harmony.xml",
|
||||
"lib/net472/0Harmony.dll",
|
||||
"lib/net472/0Harmony.pdb",
|
||||
"lib/net472/0Harmony.xml",
|
||||
"lib/net48/0Harmony.dll",
|
||||
"lib/net48/0Harmony.pdb",
|
||||
"lib/net48/0Harmony.xml",
|
||||
"lib/net5.0/0Harmony.dll",
|
||||
"lib/net5.0/0Harmony.pdb",
|
||||
"lib/net5.0/0Harmony.xml",
|
||||
"lib/net6.0/0Harmony.dll",
|
||||
"lib/net6.0/0Harmony.pdb",
|
||||
"lib/net6.0/0Harmony.xml",
|
||||
"lib/net7.0/0Harmony.dll",
|
||||
"lib/net7.0/0Harmony.pdb",
|
||||
"lib/net7.0/0Harmony.xml",
|
||||
"lib/net8.0/0Harmony.dll",
|
||||
"lib/net8.0/0Harmony.pdb",
|
||||
"lib/net8.0/0Harmony.xml",
|
||||
"lib/net9.0/0Harmony.dll",
|
||||
"lib/net9.0/0Harmony.pdb",
|
||||
"lib/net9.0/0Harmony.xml",
|
||||
"lib/netcoreapp3.0/0Harmony.dll",
|
||||
"lib/netcoreapp3.0/0Harmony.pdb",
|
||||
"lib/netcoreapp3.0/0Harmony.xml",
|
||||
"lib/netcoreapp3.1/0Harmony.dll",
|
||||
"lib/netcoreapp3.1/0Harmony.pdb",
|
||||
"lib/netcoreapp3.1/0Harmony.xml",
|
||||
"lib/netstandard2.0/_._"
|
||||
]
|
||||
},
|
||||
"Lib.Harmony.Ref/2.4.1": {
|
||||
"sha512": "+u1y2Qd6OlSUQ8JtrsrSo3adnAsrXMJ2YPYtbW+FAmdPI5yw34M9VX4bKl8ZwRuUzaGzZIz+oGMbn/yS4fWtZw==",
|
||||
"type": "package",
|
||||
"path": "lib.harmony.ref/2.4.1",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"HarmonyLogo.png",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib.harmony.ref.2.4.1.nupkg.sha512",
|
||||
"lib.harmony.ref.nuspec",
|
||||
"ref/netstandard2.0/0Harmony.dll",
|
||||
"ref/netstandard2.0/0Harmony.xml"
|
||||
]
|
||||
},
|
||||
"System.Reflection.Emit/4.7.0": {
|
||||
"sha512": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ==",
|
||||
"type": "package",
|
||||
"path": "system.reflection.emit/4.7.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"LICENSE.TXT",
|
||||
"THIRD-PARTY-NOTICES.TXT",
|
||||
"lib/MonoAndroid10/_._",
|
||||
"lib/MonoTouch10/_._",
|
||||
"lib/net45/_._",
|
||||
"lib/netcore50/System.Reflection.Emit.dll",
|
||||
"lib/netcoreapp2.0/_._",
|
||||
"lib/netstandard1.1/System.Reflection.Emit.dll",
|
||||
"lib/netstandard1.1/System.Reflection.Emit.xml",
|
||||
"lib/netstandard1.3/System.Reflection.Emit.dll",
|
||||
"lib/netstandard2.0/System.Reflection.Emit.dll",
|
||||
"lib/netstandard2.0/System.Reflection.Emit.xml",
|
||||
"lib/netstandard2.1/_._",
|
||||
"lib/xamarinios10/_._",
|
||||
"lib/xamarinmac20/_._",
|
||||
"lib/xamarintvos10/_._",
|
||||
"lib/xamarinwatchos10/_._",
|
||||
"ref/MonoAndroid10/_._",
|
||||
"ref/MonoTouch10/_._",
|
||||
"ref/net45/_._",
|
||||
"ref/netcoreapp2.0/_._",
|
||||
"ref/netstandard1.1/System.Reflection.Emit.dll",
|
||||
"ref/netstandard1.1/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/de/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/es/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/fr/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/it/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/ja/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/ko/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/ru/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml",
|
||||
"ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml",
|
||||
"ref/netstandard2.0/System.Reflection.Emit.dll",
|
||||
"ref/netstandard2.0/System.Reflection.Emit.xml",
|
||||
"ref/netstandard2.1/_._",
|
||||
"ref/xamarinios10/_._",
|
||||
"ref/xamarinmac20/_._",
|
||||
"ref/xamarintvos10/_._",
|
||||
"ref/xamarinwatchos10/_._",
|
||||
"runtimes/aot/lib/netcore50/System.Reflection.Emit.dll",
|
||||
"runtimes/aot/lib/netcore50/System.Reflection.Emit.xml",
|
||||
"system.reflection.emit.4.7.0.nupkg.sha512",
|
||||
"system.reflection.emit.nuspec",
|
||||
"useSharedDesignerContext.txt",
|
||||
"version.txt"
|
||||
]
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
".NETStandard,Version=v2.1": [
|
||||
"Lib.Harmony >= 2.4.1"
|
||||
]
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\Lenovo\\.nuget\\packages\\": {},
|
||||
"D:\\vsShare\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj",
|
||||
"projectName": "SceneView",
|
||||
"projectPath": "D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj",
|
||||
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\vs_project\\DuckovMods\\SceneView\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"D:\\vsShare\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"netstandard2.1"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"dependencies": {
|
||||
"Lib.Harmony": {
|
||||
"target": "Package",
|
||||
"version": "[2.4.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"NETStandard.Library": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
SceneView/obj/project.nuget.cache
Normal file
12
SceneView/obj/project.nuget.cache
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "79Mvphj8pgU=",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\Lenovo\\.nuget\\packages\\lib.harmony\\2.4.1\\lib.harmony.2.4.1.nupkg.sha512",
|
||||
"C:\\Users\\Lenovo\\.nuget\\packages\\lib.harmony.ref\\2.4.1\\lib.harmony.ref.2.4.1.nupkg.sha512",
|
||||
"C:\\Users\\Lenovo\\.nuget\\packages\\system.reflection.emit\\4.7.0\\system.reflection.emit.4.7.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
1
SceneView/obj/project.packagespec.json
Normal file
1
SceneView/obj/project.packagespec.json
Normal file
@@ -0,0 +1 @@
|
||||
"restore":{"projectUniqueName":"D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj","projectName":"SceneView","projectPath":"D:\\vs_project\\DuckovMods\\SceneView\\SceneView.csproj","outputPath":"D:\\vs_project\\DuckovMods\\SceneView\\obj\\","projectStyle":"PackageReference","fallbackFolders":["D:\\vsShare\\NuGetPackages"],"originalTargetFrameworks":["netstandard2.1"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","dependencies":{"Lib.Harmony":{"target":"Package","version":"[2.4.1, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"NETStandard.Library":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"}}
|
||||
1
SceneView/obj/rider.project.model.nuget.info
Normal file
1
SceneView/obj/rider.project.model.nuget.info
Normal file
@@ -0,0 +1 @@
|
||||
17623567760496572
|
||||
1
SceneView/obj/rider.project.restore.info
Normal file
1
SceneView/obj/rider.project.restore.info
Normal file
@@ -0,0 +1 @@
|
||||
17623567760496572
|
||||
Reference in New Issue
Block a user