Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / mapEditorMapTile / CombinationCell.cs
@小李xl 小李xl on 17 Jan 2024 1 KB TileMap读取组合数据
namespace UI.MapEditorMapTile;

public class CombinationCell : UiCell<MapEditorMapTile.CellButton, ImportCombinationData>
{
    public override void OnInit()
    {
        CellNode.L_SelectTexture.Instance.Visible = false;
    }
    
    public override void OnSetData(ImportCombinationData data)
    {
        CellNode.L_CellName.Instance.Text = data.CombinationInfo.Name;
        CellNode.L_PreviewImage.Instance.Texture = data.PreviewTexture;
    }
    
    public override void OnDisable()
    {
        if (Data.PreviewTexture != null)
        {
            Data.PreviewTexture.Dispose();
            Data.PreviewTexture = null;
        }
    }

    public override void OnDestroy()
    {
        if (Data.PreviewTexture != null)
        {
            Data.PreviewTexture.Dispose();
            Data.PreviewTexture = null;
        }
    }
    
    public override void OnSelect()
    {
        CellNode.L_SelectTexture.Instance.Visible = true;
        
    }

    public override void OnUnSelect()
    {
        CellNode.L_SelectTexture.Instance.Visible = false;
    }
}