2020-05-18 03:19:16 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using Gamecraft.Blocks.GUI;
|
2020-07-10 22:30:58 +00:00
|
|
|
|
using RobocraftX.Common;
|
2020-05-18 03:19:16 +00:00
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
using Unity.Mathematics;
|
|
|
|
|
|
|
|
|
|
using GamecraftModdingAPI;
|
|
|
|
|
using GamecraftModdingAPI.Utility;
|
|
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.Blocks
|
|
|
|
|
{
|
2020-08-23 13:59:13 +00:00
|
|
|
|
public class TextBlock : SignalingBlock
|
2020-05-18 03:19:16 +00:00
|
|
|
|
{
|
|
|
|
|
public TextBlock(EGID id) : base(id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-09 21:18:25 +00:00
|
|
|
|
public TextBlock(uint id) : base(new EGID(id, CommonExclusiveGroups.TEXT_BLOCK_GROUP))
|
2020-05-18 03:19:16 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// custom text block properties
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The text block's current text.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Text
|
|
|
|
|
{
|
2020-07-15 19:58:24 +00:00
|
|
|
|
get => BlockEngine.GetBlockInfo(this, (TextBlockDataStruct st) => st.textCurrent);
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2020-10-02 15:06:06 +00:00
|
|
|
|
if (value == null) value = "";
|
2020-07-15 19:58:24 +00:00
|
|
|
|
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
|
|
|
|
|
{
|
|
|
|
|
tbds.textCurrent.Set(val);
|
|
|
|
|
tbds.textStored.Set(val);
|
|
|
|
|
}, value);
|
|
|
|
|
BlockEngine.SetBlockInfo(this,
|
|
|
|
|
(ref TextBlockNetworkDataStruct st, string val) => st.newTextBlockStringContent.Set(val), value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-18 03:19:16 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-07-15 19:58:24 +00:00
|
|
|
|
/// The text block's current text block ID (used in ChangeTextBlockCommand).
|
2020-05-18 03:19:16 +00:00
|
|
|
|
/// </summary>
|
2020-07-15 19:58:24 +00:00
|
|
|
|
public string TextBlockId
|
2020-05-18 03:19:16 +00:00
|
|
|
|
{
|
2020-07-15 19:58:24 +00:00
|
|
|
|
get => BlockEngine.GetBlockInfo(this, (TextBlockDataStruct st) => st.textBlockID);
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2020-10-02 15:06:06 +00:00
|
|
|
|
if (value == null) value = "";
|
2020-07-15 19:58:24 +00:00
|
|
|
|
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
|
|
|
|
|
tbds.textBlockID.Set(val), value);
|
|
|
|
|
BlockEngine.SetBlockInfo(this,
|
|
|
|
|
(ref TextBlockNetworkDataStruct st, string val) => st.newTextBlockID.Set(val), value);
|
|
|
|
|
}
|
2020-05-18 03:19:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|