(client) feat:实现实体动态创建,实体右键菜单

Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com>
Reviewed-on: Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite#41
This commit is contained in:
2025-07-25 19:16:58 +08:00
parent 28ddcda9a0
commit 82dc89c890
55 changed files with 2964 additions and 747 deletions

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Data;
using UnityEngine;
using UnityEngine.UI;
@ -47,6 +48,8 @@ namespace UI
{
var button=InstantiatePrefab(buttonTemplate, menuContent.transform);
button.Label = def.label;
var pawnDef = def;
button.AddListener(() => GenerateEntityCallback(pawnDef));
}
}
/// <summary>
@ -78,6 +81,10 @@ namespace UI
return instantiatedComponent;
}
void GenerateEntityCallback(PawnDef pawnDef)
{
Managers.EntityManage.Instance.GenerateEntity(pawnDef, new(0, 0));
}
}
}