Beispiel #1
0
        //---------------------------------------------- Init ----------------------------------------------
        public Commander()
        {
            isLaunch = true;
            Console.CursorVisible = false;
            Console.Title         = "TeamCommander";

            int currWindowWidth  = screenSizeDivider.x <= 100? Console.LargestWindowWidth - 1 : (int)(Console.LargestWindowWidth / ((float)(screenSizeDivider.x) / 100)),
                currWindowHeight = screenSizeDivider.y <= 100 ? Console.LargestWindowHeight - 1 : (int)(Console.LargestWindowHeight / ((float)(screenSizeDivider.y) / 100));

            if (currWindowWidth < minScreenSize.x)
            {
                currWindowWidth = minScreenSize.x;
            }
            if (currWindowHeight < minScreenSize.y)
            {
                currWindowHeight = minScreenSize.y;
            }

            screen = new Output.Output(new Support.Coord(0, 0), new Support.Coord(currWindowWidth, currWindowHeight));
            for (short ii = 0; ii < screen.screenSize.y; ++ii)
            {
                for (short jj = 0; jj < screen.screenSize.x; ++jj)
                {
                    screen[ii, jj] = new Output.OutputObj(' ', new Output.DColor(ConsoleColor.Black, ConsoleColor.DarkGray));
                }
            }

            headDirector  = new Elements.ElementsDirector(screen);
            downDirector  = new Elements.ElementsDirector(screen);
            leftDirector  = new Elements.ElementsDirector(screen);
            rightDirector = new Elements.ElementsDirector(screen);

            headDirector.Init();

            leftWindow  = new CommanderWindowAllInfo(leftDirector, new Coord(0, 1), new Coord(screen.screenSize.x / 2 - 1, screen.screenSize.y - 3));
            rightWindow = new CommanderWindowAllInfo(rightDirector, new Coord(screen.screenSize.x / 2, 1), new Coord(screen.screenSize.x - 1, screen.screenSize.y - 3));

            currWindow = leftWindow;

            CreateBackGround();
        }
Beispiel #2
0
        public CommanderWindowAllInfo(ElementsDirector Director, Coord LeftUpCorner, Coord RightDownCorner)
        {
            if (RightDownCorner.y - LeftUpCorner.y - 6 <= 0)
            {
                throw new CommanderWindowException();
            }

            director        = Director;
            leftUpCorner    = LeftUpCorner;
            rightDownCorner = RightDownCorner;
            ++leftUpCorner.x;
            ++leftUpCorner.y;
            --rightDownCorner.x;
            --rightDownCorner.y;

            files = new Element[RightDownCorner.y - LeftUpCorner.y - 3];
            for (ushort i = 0; i < files.Length; ++i)
            {
                files[i] = new Elements.ElementText("file " + i.ToString(), new Coord(LeftUpCorner.x, LeftUpCorner.y + i), (ushort)(i + 5));
                director.AddElement(files[i]);
            }
        }