Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Formation
- {
- static public Dictionary<string, char[,]> formationDB;
- static ConsoleColor[] colorPool;
- //A tetris alakzatokat tároló mátrix, ez alapján történik a rajzolás
- char[,] matrix;
- int id;
- ConsoleColor color;
- string name;
- public char[,] Matrix {
- get { return matrix; }
- }
- public int ID {
- get { return id; }
- set {
- try {
- SetID(value);
- }
- catch(IDAlreadySetException ia) {
- ConsoleColor def = Console.ForegroundColor;
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(ia.Message);
- Console.ForegroundColor = def;
- }
- }
- }
- public ConsoleColor Color {
- get { return color; }
- }
- public string Name {
- get { return name; }
- }
- //static const a tetris alakzat bázis felépítéséhez
- static Formation() {
- formationDB.Add("quad", new char[,] { { '1', '1' }, { '1', '1' } });
- formationDB.Add("line", new char[,] { { '1' }, { '1' }, { '1' }, { '1' } });
- formationDB.Add("line_90", new char[,] { { '1', '1', '1', '1' } });
- formationDB.Add("S", new char[,] { { '0', '1', '1'}, { '1', '1', '0' } });
- formationDB.Add("S_90", new char[,] { { '1', '0'}, { '1', '1' }, { '0', '1' } });
- formationDB.Add("Z", new char[,] { { '1', '1', '0' }, { '0', '1', '1' } });
- formationDB.Add("Z_90", new char[,] { { '0', '1'}, { '1', '1' }, { '1', '0' } });
- formationDB.Add("L", new char[,] { { '1', '0' }, { '1', '0' }, { '1', '1' } });
- formationDB.Add("L_90", new char[,] { { '1', '1', '1' }, { '1', '0', '0' } });
- formationDB.Add("L_180", new char[,] { { '1', '1' }, { '0', '1' }, { '0', '1' } });
- formationDB.Add("L_270", new char[,] { { '0', '0', '1' }, { '1', '1', '1' } });
- formationDB.Add("RL", new char[,] { { '0', '1' }, { '0', '1' }, { '1', '1' } });
- formationDB.Add("RL_90", new char[,] { { '1', '0', '0' }, { '1', '1', '1' } });
- formationDB.Add("RL_180", new char[,] { { '1','1' }, { '1', '0' }, { '1', '0' } });
- formationDB.Add("RL_270", new char[,] { { '1', '1', '1' }, { '0', '0', '1' } });
- formationDB.Add("T", new char[,] { { '1', '1', '1' }, { '0', '1', '0' } });
- formationDB.Add("T_90", new char[,] { { '0', '1' }, { '1', '1' }, { '0', '1' } });
- formationDB.Add("T_180", new char[,] { { '0', '1', '0' }, { '1', '1', '1' } });
- formationDB.Add("T_270", new char[,] { { '1', '0' }, { '1', '1' }, { '1', '0' } });
- colorPool = (ConsoleColor[])ConsoleColor.GetValues(typeof(ConsoleColor));
- }
- //default const
- public Formation(string formationName) {
- try {
- GenerateFormation(formationName);
- }
- catch(WrongFormationNameException wf) {
- Console.WriteLine(wf.Message);
- }
- name = formationName;
- this.id = -1;
- GenerateColor();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement