Colony Tab Interface

Properties panel supports read/write properties
Colony tab is now populated with colony data when a colony is selected
This commit is contained in:
hyperion51 2020-06-01 03:11:04 +01:00
commit a99b4e82f3
30 changed files with 7598 additions and 3280 deletions

View file

@ -32,12 +32,16 @@ public interface INamedEntry
Union(11, typeof(Player)),
Union(12, typeof(Corporation)),
Union(13, typeof(MegaCorporation)),
Union(14, typeof(StationData)),
Union(14, typeof(OrbitalEntity)),
Union(15, typeof(OrbitData)),
Union(16, typeof(PlanetData)),
Union(17, typeof(PersonalityAttribute)),
Union(18, typeof(AgentTask)),
Union(19, typeof(LoadoutData)),
Union(20, typeof(Ship)),
Union(21, typeof(Mining)),
Union(22, typeof(StationTowing)),
Union(23, typeof(Survey)),
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<DatabaseEntry>))]
//[Union(21, typeof(ContractData))]
//[Union(22, typeof(Station))]

View file

@ -15,19 +15,50 @@ using static Unity.Mathematics.math;
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<Entity>))]
public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackReceiver, INamedEntry
{
[JsonProperty("temperature"), Key(1)] public float Temperature;
[JsonProperty("energy"), Key(2)] public float Energy;
[JsonProperty("position"), Key(3)] public float2 Position;
[JsonProperty("direction"), Key(4)] public float2 Direction = float2(0,1);
[JsonProperty("velocity"), Key(5)] public float2 Velocity;
[JsonProperty("cargo"), Key(6)] public readonly List<Guid> Cargo; // Type: ItemInstance
[JsonProperty("equipment"), Key(7)] public readonly List<Guid> EquippedItems; // Type: Gear
[JsonProperty("parent"), Key(8)] public Guid Parent; // Type: Entity
[JsonProperty("children"), Key(9)] public List<Guid> Children = new List<Guid>(); // Type: Entity
[JsonProperty("hull"), Key(10)] public Guid Hull; // Type: Gear
[JsonProperty("persistedBehaviorData"), Key(11)] public Dictionary<Guid, PersistentBehaviorData[]> PersistedBehaviors;
[JsonProperty("corporation"), Key(12)] public Guid Corporation;
[JsonProperty("name"), Key(13)] public string Name;
[JsonProperty("temperature"), Key(1)]
public float Temperature;
[JsonProperty("energy"), Key(2)]
public float Energy;
[JsonProperty("position"), Key(3)]
public float2 Position;
[JsonProperty("direction"), Key(4)]
public float2 Direction = float2(0,1);
[JsonProperty("velocity"), Key(5)]
public float2 Velocity;
[JsonProperty("cargo"), Key(6)]
public readonly List<Guid> Cargo; // Type: ItemInstance
[JsonProperty("equipment"), Key(7)]
public readonly List<Guid> EquippedItems; // Type: Gear
[JsonProperty("parent"), Key(8)]
public Guid Parent; // Type: Entity
[JsonProperty("children"), Key(9)]
public List<Guid> Children = new List<Guid>(); // Type: Entity
[JsonProperty("hull"), Key(10)]
public Guid Hull; // Type: Gear
[JsonProperty("persistedBehaviorData"), Key(11)]
public Dictionary<Guid, PersistentBehaviorData[]> PersistedBehaviors;
[JsonProperty("corporation"), Key(12)]
public Guid Corporation;
[JsonProperty("name"), Key(13)]
public string Name;
[JsonProperty("population"), Key(14)]
public int Population;
[JsonProperty("personality"), Key(15)]
public Dictionary<Guid, float> Personality = new Dictionary<Guid, float>();
// [IgnoreMember] protected List<IBehavior> Behaviors;
[IgnoreMember] public Guid Zone;

View file

@ -745,8 +745,12 @@ public class GameContext
cargo.Select(c => c.ID).Concat(simpleCargo.Select(c => c.ID)), orbit.ID, zone, corporation)
{
Name = $"{loadoutData.Name} {Random.NextInt(1,255):X}",
Temperature = 293
Temperature = 293,
Population = 1
};
var parentCorp = Cache.Get<MegaCorporation>(corpData.Parent);
foreach (var attribute in parentCorp.Personality)
entity.Personality[attribute.Key] = attribute.Value;
Cache.Add(entity);
ZoneEntities[zone][entity.ID] = entity;

View file

@ -40,37 +40,37 @@ public class ZoneData : DatabaseEntry, INamedEntry
}
}
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class StationData : DatabaseEntry, INamedEntry
{
[JsonProperty("name"), Key(1)]
public string Name;
// Can be Planet or Orbit
[JsonProperty("parent"), Key(2)]
public Guid Parent;
[JsonProperty("owner"), Key(3)]
public Guid Owner;
[JsonProperty("inventory"), Key(4)]
public List<ItemInstance> Inventory = new List<ItemInstance>();
[JsonProperty("buying"), Key(5)]
public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
[JsonProperty("selling"), Key(6)]
public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
[JsonProperty("zone"), Key(7)]
public Guid Zone;
[IgnoreMember] public string EntryName
{
get => Name;
set => Name = value;
}
}
// [RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
// public class StationData : DatabaseEntry, INamedEntry
// {
// [JsonProperty("name"), Key(1)]
// public string Name;
//
// // Can be Planet or Orbit
// [JsonProperty("parent"), Key(2)]
// public Guid Parent;
//
// [JsonProperty("owner"), Key(3)]
// public Guid Owner;
//
// [JsonProperty("inventory"), Key(4)]
// public List<ItemInstance> Inventory = new List<ItemInstance>();
//
// [JsonProperty("buying"), Key(5)]
// public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
//
// [JsonProperty("selling"), Key(6)]
// public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
//
// [JsonProperty("zone"), Key(7)]
// public Guid Zone;
//
// [IgnoreMember] public string EntryName
// {
// get => Name;
// set => Name = value;
// }
// }
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class PlanetData : DatabaseEntry, INamedEntry