This commit is contained in:
2025-10-21 20:09:31 +08:00
commit 2a79a885eb
21 changed files with 1309 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<!-- This should be the folder that contains Duckov.exe -->
<!-- 下面这行里填写你的鸭科夫安装路径这样编译器就能找到相关的dll文件 -->
<DuckovPath>Path/To/Your/Duckov/</DuckovPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\TeamSoda.*" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\ItemStatsSystem.dll" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\Unity*" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisplayItemValue", "DisplayItemValue.csproj", "{784BCDB1-58EF-470D-56B7-EE39393A307C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{784BCDB1-58EF-470D-56B7-EE39393A307C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{784BCDB1-58EF-470D-56B7-EE39393A307C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{784BCDB1-58EF-470D-56B7-EE39393A307C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{784BCDB1-58EF-470D-56B7-EE39393A307C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C5F3569-CECB-482D-B101-BA6C0384A647}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,58 @@
using Duckov.UI;
using Duckov.Utilities;
using ItemStatsSystem;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace DisplayItemValue
{
public class ModBehaviour : Duckov.Modding.ModBehaviour
{
TextMeshProUGUI _text = null;
TextMeshProUGUI Text
{
get
{
if (_text == null)
{
_text = Instantiate(GameplayDataSettings.UIStyle.TemplateTextUGUI);
}
return _text;
}
}
void Awake()
{
Debug.Log("DisplayItemValue Loaded!!!");
}
void OnDestroy()
{
if (_text != null)
Destroy(_text);
}
void OnEnable()
{
ItemHoveringUI.onSetupItem += OnSetupItemHoveringUI;
}
void OnDisable()
{
ItemHoveringUI.onSetupItem -= OnSetupItemHoveringUI;
}
private void OnSetupItemHoveringUI(ItemHoveringUI uiInstance, Item item)
{
if (item == null)
{
Text.gameObject.SetActive(false);
return;
}
Text.gameObject.SetActive(true);
Text.transform.SetParent(uiInstance.LayoutParent);
Text.transform.localScale = Vector3.one;
Text.text = $"${item.GetTotalRawValue() / 2}";
Text.fontSize = 20f;
}
}
}

View File

@@ -0,0 +1,5 @@
name = DisplayItemValue
displayName = 显示物品价值
description = 能够显示物品的价值by xvrsl
publishedFileId = 3532400883

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB