初次提交

This commit is contained in:
m0_75251201
2025-07-12 11:30:22 +08:00
commit 7700703099
1156 changed files with 21532 additions and 0 deletions

45
Script/Item/BagItem.cs Normal file
View File

@ -0,0 +1,45 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class BagItem
{
public ItemResource itemResource;
public int amount;
public string ItemName
{
get
{
return itemResource?.ItemName ?? "Unknown"; // 防止空引用
}
}
public string Description
{
get
{
return itemResource?.Description ?? "No description"; // 防止空引用
}
}
public void AddAmount(int value)
{
if (value < 0)
{
GD.PrintErr("Cannot add negative amount to BagItem.");
return;
}
amount += value;
}
public void RemoveAmount(int value)
{
if (value < 0 || value > amount)
{
GD.PrintErr("Invalid amount to remove from BagItem.");
return;
}
amount -= value;
}
}