コード例 #1
0
 public ColorWaypointDrawer(Color startColor, Color endColor, WaypointMap map, Point scale)
 {
     myScale = scale;
     StartColor = startColor;
     EndColor = endColor;
     Map = map;
 }
コード例 #2
0
        private void ControlEvent(LuaEventArgs args)
        {
            if (args.Args[0] == "add")
            {
                if (!positions.Any())
                {
                    mapId = me.Memory.ReadInt32(IntPtr.Zero + Offset.MapId);
                    Console.WriteLine($"First mark, setting current map id: {mapId}");
                }

                var pos = me.Player.Coordinates;
                Console.WriteLine($"Added coord: {pos}");
                positions.Add(pos);
            }
            else if (args.Args[0] == "clear")
            {
                Console.WriteLine($"Clearing current mapping");
                positions.Clear();
                mapId = 0;
            }
            else if (args.Args[0] == "save")
            {
                Console.WriteLine($"Saving current mapping to file {args.Args[1]}");

                var map = new WaypointMap
                {
                    mapId     = this.mapId,
                    waypoints = positions
                };

                File.WriteAllText(args.Args[1], JsonConvert.SerializeObject(map));
            }
            else if (args.Args[0] == "load")
            {
                Console.WriteLine($"Loading map from file {args.Args[1]}");

                var mapSerialized = File.ReadAllText(args.Args[1]);
                var map           = JsonConvert.DeserializeObject <WaypointMap>(mapSerialized);

                positions = map.waypoints;
                mapId     = map.mapId;

                Console.WriteLine($"map id: {mapId}");
                Console.WriteLine($"waypoints count: {positions.Count}");
            }
        }