コード例 #1
0
        static void Main(string[] args)
        {
            PixDrawer.SetFullScreen(false);


            //CardParser.test2();

            //return;
            //PixDrawer p = PixDrawer.FromPalette("dd");
            //p.drawRectangle(new Rectangle(5, 6, 15, 10), Color.DarkCyan, PixDrawer.rectangleStyleWithBorder);
            //Console.ReadLine();
            //PixDrawer.testPixDrawer();

            //PicGenerator.test();
            //PicGenerator.byScreenAndName();
            //SpawnUnit.showCaseAllUnits();

            DeckBuilder db = new DeckBuilder();

            PlayerHuman bonnie = new PlayerHuman("Bonnie"), ark = new PlayerHuman("Ark");
            PlayerAI    bot = new PlayerAI("A-Bot");
            Deck        bonnieDeck = db.Load("WSkellige"), enemyDeck = db.Load("Learner");

            db.Edit(bonnie, bonnieDeck);

            Match newgame = new Match(
                new List <Player>()
            {
                bonnie, bot
            },
                new List <Deck>()
            {
                bonnieDeck, enemyDeck
            });
            FieldDrawer fd = new FieldDrawer(newgame, bonnie);

            fd.setAllCardPositions();
            fd.redraw();

            newgame.Start();
        }
コード例 #2
0
        public static int deckCreatingDialog(
            List <Card> deckCards,
            List <Card> collectionCads,
            ConsoleWindowText deckWindow,
            ConsoleWindowText collectionWindow,
            ConsoleWindowText descriptionWindow,
            ConsoleWindowText console)
        {
            CardChoiseContext choiseCollection =
                CardChoiseContext.WithNoneOption(collectionCads, "COLLECTION", "Finish deck building");
            CardChoiseContext choiseDeck =
                CardChoiseContext.WithNoneOption(deckCards, "DECK", "Save deck");

            // turning a deck into Card and Count

            Console.CursorVisible = false;

            PreviewType wasPreviewType = previewType;

            previewType = PreviewType.inCollection;

            collectionWindow.ClearLogWindow();
            collectionWindow.AddLog((choiseCollection.Question.Length == 0 ? "Make a descision:" : (choiseCollection.Question + ":")).PadRight(collectionWindow.Width), ConsoleColor.Yellow, ConsoleColor.DarkGreen);
            int collectionSelected = 0, collectionFromIndex = 0, deckSelected = 0, deckFromIndex = 0;

            RedrawScrollCollection(null, choiseCollection.ChoiseOptions, 0, 0, collectionWindow);
            RedrawScrollCollection(null, choiseDeck.ChoiseOptions, 0, 0, deckWindow);
            while (true)
            {
                RedrawScrollCollection(null, choiseCollection.ChoiseOptions, collectionSelected, collectionFromIndex, collectionWindow, true);
                RedrawScrollCollection(null, choiseDeck.ChoiseOptions, deckSelected, deckFromIndex, deckWindow, false);
                ScrollChooser(ref collectionSelected, ref collectionFromIndex, choiseCollection, collectionWindow, descriptionWindow, ConsoleKey.Tab, ConsoleKey.LeftArrow,
                              RedrawScrollCollection,
                              () =>
                {
                    if (collectionSelected == 0)
                    {
                        return;
                    }
                    deckCards.Add(collectionCads[collectionSelected - 1].spawnCard());
                    choiseDeck = CardChoiseContext.WithNoneOption(deckCards, "DECK", "Save deck");
                    RedrawScrollCollection(null, choiseDeck.ChoiseOptions, deckSelected, deckFromIndex, deckWindow, false);
                    DeckBuilder.Check(deckCards, console);
                });
                RedrawScrollCollection(null, choiseCollection.ChoiseOptions, collectionSelected, collectionFromIndex, collectionWindow, false);
                RedrawScrollCollection(null, choiseDeck.ChoiseOptions, deckSelected, deckFromIndex, deckWindow, true);
                ScrollChooser(ref deckSelected, ref deckFromIndex, choiseDeck, deckWindow, descriptionWindow, ConsoleKey.Tab, ConsoleKey.RightArrow,
                              RedrawScrollCollection,
                              () =>
                {
                    if (deckSelected == 0)
                    {
                        return;
                    }
                    choiseDeck.RemoveAt(deckSelected);
                    if (deckSelected >= choiseDeck.OptionsCount)
                    {
                        deckSelected = choiseDeck.OptionsCount - 1;
                    }
                    deckWindow.ClearLogWindow();
                    RedrawScrollCollection(null, choiseDeck.ChoiseOptions, deckSelected, deckFromIndex, deckWindow);
                    DeckBuilder.Check(deckCards, console);
                });
            }
            choiseCollection.HighlightSelected(-1);
            collectionWindow.ClearLogWindow();

            previewType = wasPreviewType;
            return(collectionSelected);
        }