#테트리스.디버깅.단계(1)-Console출력및 테스트
using System;
using System.IO;
using System.Timers;
namespace tris_is_package
{
class Program
{
public static void Main(string[] args)
{
tris_is_overloading_debug nm = new tris_is_overloading_debug();
nm.running();
}
}
class tris_is_overloading_debug
{
//Definition
const int D_RIGHT =2000;
const int D_LEFT =2001;
const int D_DOWN =2002;
const int MAPY =18;
const int MAPX =18;
const int MAXDESIGNARR=4;
const int MAXDESIGN=7;
//Properties
int rc;
int xpos,ypos;
int[,] tris = new int[MAPY,MAPX];
int[,] design = new int[MAXDESIGNARR,MAXDESIGNARR];
int[,,] realdesign = new int[,,]
{
{{0,1,0,0},{0,1,0,0},{0,1,0,0},{0,1,0,0}},
{{0,0,0,0},{0,1,1,0},{0,1,1,0},{0,0,0,0}},
{{0,0,0,0},{0,1,0,0},{1,1,1,0},{0,0,0,0}},
{{0,0,1,0},{0,1,1,0},{0,1,0,0},{0,0,0,0}},
{{0,1,0,0},{0,1,1,0},{0,0,1,0},{0,0,0,0}},
{{0,0,0,0},{0,1,0,0},{0,1,1,1},{0,0,0,0}},
{{0,0,0,0},{0,1,1,1},{0,1,0,0},{0,0,0,0}}
};
DateTime nw;
Timer tm;
ConsoleKeyInfo keyinfo;
//Method
public tris_is_overloading_debug(){}
public void running()
{
init();
while(true)
{
keyinfo=Console.ReadKey(true);
if(keyinfo.Key==ConsoleKey.RightArrow)
{
rc=check_t_tris(D_RIGHT,ref ypos,ref xpos);
if(rc != 0){stop(); Environment.Exit(0);}
}
if(keyinfo.Key==ConsoleKey.LeftArrow)
{
rc=check_t_tris(D_LEFT,ref ypos,ref xpos);
if(rc != 0){stop(); Environment.Exit(0);}
}
if(keyinfo.Key==ConsoleKey.DownArrow)
{
rc=check_t_tris(D_DOWN,ref ypos,ref xpos);
if(rc != 0){stop(); Environment.Exit(0);}
}
if(keyinfo.Key==ConsoleKey.Escape) break;
logg("Key", keyinfo);
}
stop();
}
void init(){}
void stop(){}
int check_t_tris(int direction, ref int y, ref int x){}
void ____time_tick(object sender, ElapsedEventArgs e){}
//overloading
//overloading
void logg(string msg)
{
nw=DateTime.Now;
Console.WriteLine(">>Pos:[" + ypos.ToString("000") + "," + xpos.ToString("000") + "]" +
" Event:" + msg);
}
void logg(string msg, ConsoleKeyInfo keytmp)
{
nw=DateTime.Now;
Console.WriteLine(">>Pos:[" + ypos.ToString("000") + "," + xpos.ToString("000") + "]" +
" KeyName:[" + keytmp.Key.ToString() + "]" +
" Event:" + msg);
}
void logg(string msg, bool idx)
{
nw=DateTime.Now;
Console.Write("[" + msg + "]");
}
}
}
#File Attach
'c# 언어' 카테고리의 다른 글
문제 풀이 : Lv1. 숫자 문자열과 영단어 (0) | 2021.10.18 |
---|---|
Console 3*3 tris game source (0) | 2021.10.05 |
데이타 읽고,쓰기 속성 선언및 사용방법(get/set) (0) | 2021.09.07 |
Console Time Handling & Log Overloading (0) | 2021.08.27 |
public enum ConsoleKey (0) | 2021.08.09 |