TechbloxModdingAPI/GamecraftModdingAPI/Blocks/TextBlock.cs
Norbi Peti a7f6a16231 Update to Gamecraft 2020.12.16.14.19 and custom block stuff
- Fixed the crash on second time start
- Tweaked more stuff about the block

Breaking changes coming from FMOD 2.0:
- Audio[int index] changed to Audio[PARAMETER_ID index]
- Audio.Parameters removed
2020-12-17 02:34:36 +01:00

59 lines
1.4 KiB
C#

using System;
using Gamecraft.Blocks.GUI;
using RobocraftX.Common;
using Svelto.ECS;
using Unity.Mathematics;
using GamecraftModdingAPI;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Blocks
{
public class TextBlock : SignalingBlock
{
public TextBlock(EGID id) : base(id)
{
}
public TextBlock(uint id) : base(new EGID(id, CommonExclusiveGroups.TEXT_BLOCK_GROUP))
{
}
// custom text block properties
/// <summary>
/// The text block's current text.
/// </summary>
public string Text
{
get => BlockEngine.GetBlockInfo(this, (TextBlockDataStruct st) => st.textCurrent);
set
{
if (value == null) value = "";
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
{
tbds.textCurrent.Set(val);
tbds.textStored.Set(val, true);
}, value);
}
}
/// <summary>
/// The text block's current text block ID (used in ChangeTextBlockCommand).
/// </summary>
public string TextBlockId
{
get => BlockEngine.GetBlockInfo(this, (TextBlockDataStruct st) => st.textBlockID);
set
{
if (value == null) value = "";
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
tbds.textBlockID.Set(val), value);
}
}
}
}