Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / mapEditorCreateMark / MarkObjectCell.cs
@小李xl 小李xl on 10 Aug 2023 874 bytes 创建房间标记, 开发中
using Config;

namespace UI.MapEditorCreateMark;

public class MarkObjectCell : UiCell<MapEditorCreateMark.MarkObject, ExcelConfig.ActivityObject>
{
    public override void OnInit()
    {
        CellNode.L_CenterContainer.L_DeleteButton.Instance.Pressed += OnDeleteClick;
    }

    public override void OnSetData(ExcelConfig.ActivityObject data)
    {
        if (string.IsNullOrEmpty(data.Icon))
        {
            CellNode.L_Icon.Instance.Visible = false;
        }
        else
        {
            CellNode.L_Icon.Instance.Visible = true;
            CellNode.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon);
        }

        CellNode.L_IdLabel.Instance.Text = data.Id;
        CellNode.L_NameLabel.Instance.Text = data.Name;
    }

    //点击删除按钮
    private void OnDeleteClick()
    {
        Grid.RemoveByIndex(Index);
    }
}