A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3KB

  1. using System;
  2. using Gamecraft.Blocks.GUI;
  3. using RobocraftX.Common;
  4. using Svelto.ECS;
  5. using Unity.Mathematics;
  6. using TechbloxModdingAPI;
  7. using TechbloxModdingAPI.Utility;
  8. namespace TechbloxModdingAPI.Blocks
  9. {
  10. public class TextBlock : SignalingBlock
  11. {
  12. public TextBlock(EGID id) : base(id)
  13. {
  14. }
  15. public TextBlock(uint id) : base(new EGID(id, CommonExclusiveGroups.TEXT_BLOCK_GROUP))
  16. {
  17. }
  18. // custom text block properties
  19. /// <summary>
  20. /// The text block's current text.
  21. /// </summary>
  22. public string Text
  23. {
  24. get => BlockEngine.GetBlockInfo<TextBlockDataStruct>(this).textCurrent;
  25. set
  26. {
  27. if (value == null) value = "";
  28. var tbds = BlockEngine.GetBlockInfo<TextBlockDataStruct>(this);
  29. tbds.textCurrent.Set(value);
  30. tbds.textStored.Set(value, true);
  31. }
  32. }
  33. /// <summary>
  34. /// The text block's current text block ID (used in ChangeTextBlockCommand).
  35. /// </summary>
  36. public string TextBlockId
  37. {
  38. get => BlockEngine.GetBlockInfo<TextBlockDataStruct>(this).textBlockID;
  39. set
  40. {
  41. if (value == null) value = "";
  42. BlockEngine.GetBlockInfo<TextBlockDataStruct>(this).textBlockID.Set(value);
  43. }
  44. }
  45. }
  46. }