41 lines
1004 B
C#
41 lines
1004 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Passer.Control
|
|
{
|
|
|
|
public class CoreThing
|
|
{
|
|
public Client client;
|
|
public byte networkId;
|
|
public byte id;
|
|
public CoreThing parent;
|
|
public byte type;
|
|
public string name;
|
|
public string modelUrl;
|
|
//protected Sensor sensor;
|
|
|
|
protected virtual void Init()
|
|
{
|
|
}
|
|
|
|
public CoreThing(Client client, byte networkId, byte thingId, byte thingType = 0)
|
|
{
|
|
this.client = client;
|
|
this.id = thingId;
|
|
this.type = thingType;
|
|
this.networkId = networkId;
|
|
this.Init();
|
|
allThings.Add(this);
|
|
}
|
|
|
|
private static readonly List<CoreThing> allThings = new();
|
|
|
|
public static CoreThing Get(byte networkId, byte thingId)
|
|
{
|
|
CoreThing thing = allThings.Find(aThing => aThing.networkId == networkId && aThing.id == thingId);
|
|
return thing;
|
|
}
|
|
|
|
}
|
|
}
|