OSDN Git Service

Merge branch 'vgd' of into Split_renderers
[automap/automap.git] / Automap / Data / EntitiesOfInterest.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using System.IO;
5 using System.Linq;
6
7 using Vintagestory.API.Common.Entities;
8 using Vintagestory.API.MathTools;
9 using Vintagestory.API.Client;
10
11 using ProtoBuf;
12
13 using Newtonsoft.Json;
14
15 namespace Automap
16 {
17         /// <summary>
18         /// Basically the same as a POI but for an entity
19         /// </summary>
20         [ProtoContract]
21         public struct EntityOfInterest
22         {
23                 
24                 [ProtoMember(1)]
25                 public string Name;
26                 
27                 [DisplayName(1, "Notes")]
28                 [ProtoMember(2)]
29                 public string Notes;
30
31                 [DisplayName(0, "Loc.")]
32                 [ProtoMember(3)]
33                 public BlockPos Location;
34
35                 [DisplayName(2, "Time")]
36                 [ProtoMember(4)]
37                 public DateTime Timestamp;
38
39                 [DisplayName(3, "ID")]
40                 [ProtoMember(5)]
41                 public long EntityId;
42
43
44         }
45
46         /// <summary>
47         /// Entities of interest.
48         /// </summary>
49         /// <remarks>Tracked by ID - these never leave.</remarks>
50         public class EntitiesOfInterest : KeyedCollection<long, EntityOfInterest>
51         {
52                 protected override long GetKeyForItem(EntityOfInterest item)
53                         => item.EntityId;
54
55                 internal void AddReplace(EntityOfInterest entity)
56                 {
57                         if (Contains(entity.EntityId))
58                                 Remove(entity.EntityId);
59
60                         Add(entity);
61                 }
62
63         }
64 }
65