-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapHelper.cs
76 lines (62 loc) · 2.1 KB
/
MapHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TextEngine.Models;
namespace TextEngine
{
class MapHelper
{
public static void DrawMap()
{
using (var context = new TextEngineContext())
{
int map_radius = 2;
int z = Program.character.CurrentRoom.Z;
int xMin = Program.character.CurrentRoom.X - map_radius;
int xMax = Program.character.CurrentRoom.X + map_radius;
int yMin = Program.character.CurrentRoom.Y - map_radius;
int yMax = Program.character.CurrentRoom.Y + map_radius;
for(int y = yMin; y <= yMax; y++)
{
for (int x = xMin; x <= xMax; x++)
{
}
// ending a row
}
}
}
public static string GetMapRow(int xMin, int xMax, int y, int z, int padLength)
{
using (var context = new TextEngineContext())
{
var rooms = context.Rooms
.Where(r => r.Z == z
&& r.Y == y
&& r.X >= xMin
&& r.X <= xMax)
.OrderBy(o => o.X);
string padString = new string(' ', padLength);
string[] rows = Enumerable.Repeat(string.Empty, 5).ToArray();
for (int x = xMin; x <= xMax; ++x)
{
Room room = rooms.Where(r => r.X == x).FirstOrDefault();
int rowLength = 15;
if (room == null)
{
for (int i = 0; i < rows.Length; i++)
{
rows[i] = new string(' ', padLength + rowLength++);
}
}
else
{
// first string
}
}
}
return "";
}
}
}