-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelHandler.cs
More file actions
52 lines (50 loc) · 1.59 KB
/
LevelHandler.cs
File metadata and controls
52 lines (50 loc) · 1.59 KB
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
using System;
namespace PR2_Client
{
class LevelHandler
{
private Level[] m_Levels;
public LevelHandler(Level[] levels)
{
m_Levels = levels;
}
public void updateLevelSlot(short slot, string name, int level, int level_id)
{
Level m_Level = Array.Find(m_Levels, m => m.level_id == level_id);
if(m_Level != null && level != -1)
{
m_Level.slots[slot] = level + name;
} else {
m_Level.slots[slot] = "";
}
WriteLevels(true);
}
public void WriteLevels(bool clearTerm)
{
if(clearTerm)
Console.Clear();
int size = (int)Math.Sqrt(m_Levels.Length);
for(int l = 0; l < size; l++)
{
int i = l*size;
Console.Write(m_Levels[i].title + "\t" + m_Levels[i+1].title + "\t" + m_Levels[i+2].title + "\n");
for(int j = 0; j < 4; j++)
{
for(int k = 0; k < size; k++)
{
if(m_Levels[i+k].slots[j] != "")
{
Console.Write("[");
Console.Write(m_Levels[k + i].slots[j]);
Console.Write("]" + "\t");
} else {
Console.Write("[]" + "\t");
}
}
Console.Write("\n");
}
Console.Write("\n");
}
}
}
}