Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / ui / tileSetEditorCombination / leftTop / CombinationCell.cs
@小李xl 小李xl on 16 Dec 2023 757 bytes 组合图块, 开发中
  1. using Godot;
  2.  
  3. namespace UI.TileSetEditorCombination;
  4.  
  5. public partial class CombinationCell : Sprite2D
  6. {
  7. public override void _Ready()
  8. {
  9. Centered = false;
  10. RegionEnabled = true;
  11. }
  12.  
  13. /// <summary>
  14. /// 初始化数据, 设置纹理和显示的区域
  15. /// </summary>
  16. public void InitData(Texture2D texture, Vector2I texturePos)
  17. {
  18. Texture = texture;
  19. RegionRect = new Rect2(texturePos * GameConfig.TileCellSize, GameConfig.TileCellSizeVector2I);
  20. }
  21.  
  22. /// <summary>
  23. /// 从指定的组合单元克隆数据
  24. /// </summary>
  25. public void CloneFrom(CombinationCell combinationCell)
  26. {
  27. Texture = combinationCell.Texture;
  28. RegionRect = combinationCell.RegionRect;
  29. }
  30. }