AI补足注释(已经快看不懂了)
实现i18n 优化部分模块的逻辑以优化性能 修复物品展示框打开时按下ESC唤出暂停菜单但没有暂停的bug Signed-off-by: Eicy <im@crash.work>
This commit is contained in:
@@ -6,8 +6,10 @@ namespace Items.Abstract
|
||||
{
|
||||
public abstract class ItemBase : MonoBehaviour
|
||||
{
|
||||
public int index;
|
||||
public int index; // 对话索引
|
||||
public string itemNameKey; //物体本地化key
|
||||
|
||||
#region 相机交互事件订阅
|
||||
private void OnEnable()
|
||||
{
|
||||
EventManager.Instance.CameraInterAct += ReceiveEvent;
|
||||
@@ -17,13 +19,16 @@ namespace Items.Abstract
|
||||
{
|
||||
EventManager.Instance.CameraInterAct -= ReceiveEvent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// 收到相机交互事件
|
||||
protected virtual void ReceiveEvent(CameraInterActArgs item)
|
||||
{
|
||||
if (item.Item != gameObject) return;
|
||||
ActivateItem();
|
||||
}
|
||||
|
||||
//物体逻辑
|
||||
protected virtual void ActivateItem()
|
||||
{
|
||||
//Debug.Log("Item is activated");
|
||||
|
||||
@@ -4,13 +4,19 @@ using Items.Interface;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
// 测试物品类,继承自 ItemBase 并实现 IItem 接口
|
||||
public class TestItem : ItemBase, IItem
|
||||
{
|
||||
// 重写物品激活方法
|
||||
protected override void ActivateItem()
|
||||
{
|
||||
// 调用基类的激活方法
|
||||
base.ActivateItem();
|
||||
//EventManager.Instance.OnDialogPop(index);
|
||||
EventManager.Instance.OnItemDialog(gameObject.name);
|
||||
|
||||
// 触发物品对话事件,使用物品名称作为参数
|
||||
EventManager.Instance.OnItemDialog(itemNameKey);
|
||||
EventManager.Instance.OnDialogPop(index);
|
||||
// 销毁当前物体
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user