Split project
This commit is contained in:
54
Ports/DataPorts/DataPort.cs
Normal file
54
Ports/DataPorts/DataPort.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Enigmos.Cables;
|
||||
using Godot;
|
||||
using Nocturnis.Enigmos.Ports;
|
||||
using TabulaSmaragdina;
|
||||
|
||||
namespace Enigmos.Ports.DataPorts;
|
||||
|
||||
public abstract partial class DataPort : BasePort, IDataPort
|
||||
{
|
||||
public new DataPort ConnectedPort
|
||||
{
|
||||
get => base.ConnectedPort as DataPort;
|
||||
set => base.ConnectedPort = value;
|
||||
}
|
||||
protected Sprite2D DataTypeTexture { get; set; }
|
||||
public StringName DataType { get; set; }
|
||||
public override void Init()
|
||||
{
|
||||
Console.WriteLine("XY");
|
||||
DataTypeTexture = GetNode<Sprite2D>("DataTypeTexture");
|
||||
DataTypeTexture.Visible = false;
|
||||
base.Init();
|
||||
}
|
||||
|
||||
|
||||
public void SetDataType(StringName val)
|
||||
{
|
||||
if(Connected && val != ConnectedPort.DataType)
|
||||
Disconnect();
|
||||
DataType = val;
|
||||
DataTypeTexture.Texture = GlobalProvider.EnigmosProvider.DataPortTypeMap[val];
|
||||
}
|
||||
|
||||
private void MouseEnterHandler() => DataTypeTexture.Visible = true;
|
||||
private void MouseExitHandler() => DataTypeTexture.Visible = false;
|
||||
|
||||
public override BaseCable MakeCable(IBasePort other)
|
||||
{
|
||||
BaseCable res = GlobalProvider.EnigmosProvider.DataCableScene.Instantiate<BaseCable>();
|
||||
res.Init();
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void SetStatusNormal() =>
|
||||
TextureNormal = GlobalProvider.EnigmosProvider.DataPortStatusNormal;
|
||||
|
||||
public override void SetStatusPending() =>
|
||||
TextureNormal = GlobalProvider.EnigmosProvider.DataPortStatusPending;
|
||||
|
||||
public override void SetStatusConnected() =>
|
||||
TextureNormal = GlobalProvider.EnigmosProvider.DataPortStatusConnected;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user