OSDN Git Service

Metadata collection capability, added tooltips on map
[automap/automap.git] / Automap / Designators / DefaultDesignators.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Drawing;
4
5 using Vintagestory.API.Client;
6 using Vintagestory.API.Common;
7 using Vintagestory.API.MathTools;
8 using Vintagestory.GameContent;
9
10 namespace Automap
11 {
12         public static class DefaultDesignators
13         {
14                 public static Designator Roads =
15                          new Designator(
16                                 new AssetLocation("game", "stonepath"),
17                                 Color.Yellow,
18                                 EnumBlockMaterial.Gravel
19                         );
20
21                 public static Designator GroundSigns =
22                          new Designator(
23                                 new AssetLocation("game", "sign-ground"),
24                                 Color.Teal,
25                                 EnumBlockMaterial.Wood,
26                                 DecodeSign
27                         );
28
29                 public static Designator WallSigns =
30                          new Designator(
31                                 new AssetLocation("game", "sign-wall"),
32                                 Color.Teal,
33                                 EnumBlockMaterial.Wood,
34                                 DecodeSign
35                         );
36
37                 public static Designator PostSigns =
38                          new Designator(
39                                 new AssetLocation("game", "signpost"),
40                                 Color.Teal,
41                                 EnumBlockMaterial.Wood,
42                                 DecodePostSign
43                         );
44
45                 public static Designator Translocators =
46                          new Designator(
47                                 new AssetLocation("game", "statictranslocator-normal"),
48                                 Color.Violet,
49                                 EnumBlockMaterial.Metal
50                                 //DecodeTranslocator
51                         );
52
53                 internal static void DecodeSign(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block)
54                 {
55                 clientAPI.Logger.VerboseDebug("Sign Designator Invoked!");
56                 //sign Text into a POI field...
57                 BlockEntitySign signEntity = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntitySign;
58                 
59                 if (signEntity != null && !String.IsNullOrEmpty(signEntity.text))
60                 {
61                 
62                 poi.AddReplace(
63                                         new PointOfInterest {
64                                                 Location = posn.Copy( ),
65                                                 Notes = signEntity.text,
66                                                 Timestamp = DateTimeOffset.UtcNow,
67                                         }
68                                         );
69                 
70                 }
71
72                 }
73
74
75                 internal static void DecodePostSign(ICoreClientAPI clientAPI, PointsOfInterest poi, BlockPos posn, Block block)
76                 {
77                 clientAPI.Logger.VerboseDebug("Post-sign Designator Invoked!");
78                 //sign post Text into a POI field...
79                 BlockEntitySignPost signEntity = clientAPI.World.BlockAccessor.GetBlockEntity(posn) as BlockEntitySignPost;
80
81                 if (signEntity != null && signEntity.textByCardinalDirection?.Length > 0 ) {
82
83                 poi.AddReplace(
84                                         new PointOfInterest {
85                                                 Location = posn.Copy( ),
86                                                 Notes = string.Join(",", signEntity.textByCardinalDirection),
87                                                 Timestamp = DateTimeOffset.UtcNow,
88                                         }
89                                         );
90
91                 }
92                 }
93
94
95
96         }
97 }
98