AAAAA

AAAAA

Ясек

using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace EbacBolna

{

  public class MAIN

  {

    static void Main()

    {

      Start go = new Start();

      go.main();

    }

  }


  class Start : GUI{


    Mainn Smain = new Mainn();

    Settings Ssettings = new Settings();



    public void main()

    {


      while (menu)

      {

        Smain.main();

      }


      while (game)

      {

        menu = true;

        main();

      }


       while (settings)

      {

        Ssettings.main();

        menu = true;

        main();

      }

    }

  }


  class Mainn : GUI

  {

    public void main()

    {

      Setup();

      while (menu)

      {

        Draw();

        Input();

        Logic();


        Console.Clear();

      }

    }


    void Setup() {

      choiceL = choice.Length;


      Console.WriteLine(choiceL);

      Console.ReadKey();


      ichoice = 0;

      choice[ichoice] = '#';

    }


    void Draw()

    {

      Console.WriteLine(choice[0] + "Start");

      Console.WriteLine(choice[1] + "Settings");

      Console.WriteLine(choice[2] + "Exit");

    }


    void Logic()

    {

      for (int i = 0; i < choiceL; i++)

        choice[i] = ' ';



      switch (dir)

      {

        case Direction.UP:

          try

          {

            ichoice--;

            choice[ichoice] = '#';

          }

          catch

          {

            IChoice = ichoice;

            choice[ichoice] = '#';

          }

          break;


        case Direction.DOWN:

          try

          {

            ichoice++;

            choice[ichoice] = '#';

          }

          catch

          {

            IChoice = ichoice;

            choice[ichoice] = '#';

          }

          break;


        case Direction.ENTER:

          menu = false;

          switch (ichoice)

          {

            case 0:

              game = true;

              break;

            case 1:

              settings = true;

              break;

          }

          break;


        case Direction.ESCAPE:

          menu = false;

          break;


      }

    }

  }


  class Settings : GUI

  {

    Start back = new Start();


    public void main()

    {

      Setup();

      while (settings)

      {

        Draw();

        Input();

        Logic();


        Console.Clear();

      }

    }


    void Setup()

    {

      choiceL = choice.Length;

      ichoice = 0;

      choice[ichoice] = '#';

    }


    void Draw()

    {

      Console.WriteLine(choice[0] + " Settings in developing ");

      Console.WriteLine(choice[1] + " Back");

    }


    void Logic()

    {

      for (int i = 0; i < choiceL; i++)

        choice[i] = ' ';



      switch (dir)

      {

        case Direction.UP:

          try

          {

            ichoice--;

            choice[ichoice] = '#';

          }

          catch

          {

            IChoice = ichoice;

            choice[ichoice] = '#';

          }

          break;


        case Direction.DOWN:

          try

          {

            ichoice++;

            choice[ichoice] = '#';

          }

          catch

          {

            IChoice = ichoice;

            choice[ichoice] = '#';

          }

          break;


        case Direction.ENTER:

          settings = false;

          switch (ichoice)

          {

            case 0:

              settings = true;

              choice[ichoice] = '#';

              break;

            case 1:

              settings = false;

              break;

          }

          break;


        case Direction.ESCAPE:

          settings = false;

          break;


      }

      back.main();

    }

  }


  public class GUI

  {

    public char[] choice = new char[3];


    public enum Direction { UP, DOWN, LEFT, RIGHT, ENTER, ESCAPE };

    public Direction dir;

    public ConsoleKeyInfo key;


    public int choiceL;

    public int ichoice;


    public bool menu;

    public bool game;

    public bool settings;


    public void Input()

    {

    origin:

      key = Console.ReadKey(true);


      switch (key.Key)

      {

        case ConsoleKey.W:

          dir = Direction.UP;

          break;

        case ConsoleKey.S:

          dir = Direction.DOWN;

          break;

        case ConsoleKey.Enter:

          dir = Direction.ENTER;

          break;

        case ConsoleKey.Escape:

          dir = Direction.ESCAPE;

          break;

        default:

          goto origin;

      }

    }


    public int IChoice

    {

      get

      {

        return ichoice;

      }

      set

      {

        if (value < 0)

        {

          ichoice = choiceL - 1;

        }

        else if (ichoice > choiceL - 1)

        {

          ichoice = 0;

        }

      }

    }

  }

}


Report Page