public ItemTestingInterface()
            : base()
        {
            Title interfaceTitle = new Title(this, "Item Testing", GraphicConsole.Instance.BufferWidth / 2, 0, Title.TextAlignModes.Center);

            generateButton        = new Button(this, "Generate", 72, 1);
            generateButton.Click += generateButton_Click;
            infoBox           = new TextBox(this, 72, 5, 40, 37);
            infoBox.FillColor = new Color4(25, 25, 25, 255);

            itemGenList           = new ScrollingList(this, 1, 2, 70, 40);
            itemGenList.FillColor = new Color4(25, 25, 25, 255);
            itemGenList.Selected += itemGenList_Selected;
        }
示例#2
0
        private bool hasItem(ScrollingList list, TradingListItem item, out TradingListItem offeredItem)
        {
            for (int i = 0; i < list.Items.Count; i++)
            {
                if ((list.Items[i] as TradingListItem).Item == item.Item)
                {
                    offeredItem = (TradingListItem)list.Items[i];
                    return(true);
                }
            }

            offeredItem = null;
            return(false);
        }
示例#3
0
        /// <summary>
        /// Title screen constructor.
        /// </summary>
        public IntroScreen(GameMain parent)
        {
            _font = GameContent.LoadContent <SpriteFont>("fonts/DefaultFont");

            _parent = parent;

            _input = new Input();

            _credits = new List <string>();
            _credits.Add("A long time ago, an distant kingdom lived in peace");
            _credits.Add("thanks to a magic crown. The peace was kept until ");
            _credits.Add("one day, when a Evil Wizard stole the crown.");
            _credits.Add("The Prince couldn't let the worst happen,");
            _credits.Add("and saved the day, killing the villain.");
            _credits.Add("");
            _credits.Add("Two hundred years have passed since then.");
            _credits.Add("A group of cultists stole the crown and");
            _credits.Add("captured the king, so they could");
            _credits.Add("get enough power to ressurrect the wizard.");
            _credits.Add("");
            _credits.Add("Now, all of the kingdom's hopes rest on");
            _credits.Add("the shoulders of the king's bodyguard.");
            _credits.Add("He needs to get the sacred weapons to");
            _credits.Add("destroy the evil cult, saving the king,");
            _credits.Add("the kingdom and the crown.");
            _credits.Add("");
            _credits.Add("But first... he would need a sword.");

            _titleList = new ComponentList();
            _titleList.AddComponent(new Label("Diogo Muller & João Vitor present..."));
            _titleList.Position = new Rectangle(20, 20, parent.Window.ClientBounds.Width - 40, parent.Window.ClientBounds.Height - 40);

            _list = new ScrollingList();

            _list.ComponentHeight = 50;

            foreach (string st in _credits)
            {
                _list.AddComponent(new Label(st));
            }

            _list.Position = new Rectangle(20, 20, parent.Window.ClientBounds.Width - 40, parent.Window.ClientBounds.Height - 40);
            _list.ResetPosition();

            _showningTime = ShowTime;
            _fadingTime   = FadeTime;
        }
        public StockMarketScreen(InterfaceManager manager)
            : base(manager)
        {
            //Titles
            Title screenTitle      = new Title(null, "Galactic Stock Market", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center);
            Title factionListTitle = new Title(null, "Factions", 10, 2, Title.TextAlignModes.Center);

            //Lists
            factionList           = new ScrollingList(null, 1, 3, 21, 23);
            factionList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            //Textboxes
            descriptionBox           = new TextBox(null, 23, 3, 65, 23);
            descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            //Buttons
            Button backButton         = new Button(null, "Back", 0, 0, 6, 1);
            Button buildMarketButton  = new Button(null, "Build Market", 1, 27);
            Button buildStationButton = new Button(null, "Build Station", 1, 30);
            Button buildFactoryButton = new Button(null, "Build Factory", 1, 33);

            //Other
            chart           = new StockMarketChart(null, 23, 27, 66, 9);
            chart.FillColor = new Color4(0.1f, 0.1f, 0.1f, 1f);

            /* UI EVENTS */
            factionList.Selected += (sender, e) =>
            {
                Faction faction = (Faction)factionList.GetSelection();

                descriptionBox.Text = getFactionDescription(faction);
                chart.SetFaction(faction);

                InterfaceManager.DrawStep();
            };

            backButton.Click += (sender, e) =>
            {
                InterfaceManager.ChangeInterface("System");
            };
            buildMarketButton.Click += (sender, e) =>
            {
            };
            buildStationButton.Click += (sender, e) =>
            {
            };
            buildFactoryButton.Click += (sender, e) =>
            {
            };
            /* END UI EVENTS */

            //Control Register
            RegisterControl(screenTitle);
            RegisterControl(factionListTitle);
            RegisterControl(factionList);
            RegisterControl(descriptionBox);
            RegisterControl(backButton);
            RegisterControl(buildMarketButton);
            RegisterControl(buildStationButton);
            RegisterControl(buildFactoryButton);
            RegisterControl(chart);
        }
        /// <summary>
        /// Title screen constructor.
        /// </summary>
        public CreditsScreen(GameMain parent)
        {
            _logo = GameContent.LoadContent <Texture2D>("images/title.png");

            _font = GameContent.LoadContent <SpriteFont>("fonts/DefaultFont");

            _window = Rectangle.Empty;

            _parent = parent;

            _input = new Input();

            _credits = new List <string>();
            _credits.Add("Students:");
            _credits.Add("    Diogo Muller de Miranda");
            _credits.Add("    João Vitor Pietsiaki Moraes");
            _credits.Add("");
            _credits.Add("Tecnicas de Implementacao de Jogos");
            _credits.Add("Teacher: Fabio Binder");
            _credits.Add("");
            _credits.Add("PROGRAMMING:");
            _credits.Add("      João Vitor Pietsiaki Moraes");
            _credits.Add("      Diogo Muller de Miranda");
            _credits.Add("");
            _credits.Add("ART:");
            _credits.Add("      Tilesets by David Gervais, licensed under Creative Commons 3.0");
            _credits.Add("      Website: http://pousse.rapiere.free.fr/tome/");
            _credits.Add("");
            _credits.Add("      Zombie and Skelleton - Reemax and artisticdude - http://opengameart.org/");
            _credits.Add("");
            _credits.Add("      Baldric (Main Character) and Mage - By Stephen 'Redshrike' Challener, ");
            _credits.Add("      design by Zi Ye - www.OpenGameArt.org");
            _credits.Add("");
            _credits.Add("      Slime and Slimeworm based on Slime by Xenoyia");
            _credits.Add("      http://gmc.yoyogames.com/index.php?showtopic=330208");
            _credits.Add("      Edited by Diogo Muller de Miranda.");
            _credits.Add("");
            _credits.Add("      Crab - Free for personal use");
            _credits.Add("      Found on: http://www.rpgmakervx.net/lofiversion/index.php/t28829.html");
            _credits.Add("");
            _credits.Add("      Bat by Diogo Muller de Miranda.");
            _credits.Add("");
            _credits.Add("      Goon (Male Orc)");
            _credits.Add("      http://opengameart.org/");
            _credits.Add("      Done by Matthew Krohn.");
            _credits.Add("      Walkcycle, Hurt, Slash, and Spellcast animations by Stephen Challener (AKA Redshrike), ");
            _credits.Add("      Shooting and Thrusting animations by Johannes Sjölund, Male and female orc heads by ");
            _credits.Add("      MadMarcel and based on Stephen Challener's Sinbad.");
            _credits.Add("      Master Goon edit based on this characted, made by Diogo Muller de Miranda.");
            _credits.Add("");
            _credits.Add("      Oldman:");
            _credits.Add("      Done by Tap, from OpenGameArt.Org");
            _credits.Add("");
            _credits.Add("      Water Dragon by Tana: ");
            _credits.Add("      http://www.rpgmakervx.net/index.php?showtopic=23956");
            _credits.Add("");
            _credits.Add("      Fire Dragon in Grayman Sprites:");
            _credits.Add("      http://kootation.com/grayman-sprites-rpg-maker-vx-community.html");
            _credits.Add("");
            _credits.Add("MUSIC:");
            _credits.Add("      All music by Kevin MacLeod");
            _credits.Add("      http://incompetech.com/");
            _credits.Add("");
            _credits.Add("      Brittle Rille");
            _credits.Add("      Call to Adventure");
            _credits.Add("      Easy Lemon");
            _credits.Add("      Five Armies");
            _credits.Add("      Heroic Age");
            _credits.Add("      Moonlight Hall");
            _credits.Add("      Rising Game");
            _credits.Add("      Suvaco do Cristo");
            _credits.Add("      Tenebrous Brothers Carnival - Act One");
            _credits.Add("      Tenebrous Brothers Carnival - Act Two");
            _credits.Add("      Brittle Rille");
            _credits.Add("");
            _credits.Add("SOUND EFFECTS:");
            _credits.Add("      Sword and Bow by Qat from http://www.freesound.org");
            _credits.Add("      All other sounds by Diogo Muller de Miranda.");
            _credits.Add("");
            _credits.Add("LEVEL DESIGN:");
            _credits.Add("      Diogo Muller de Miranda");
            _credits.Add("");
            _credits.Add("WEAPON DESIGN:");
            _credits.Add("      Diogo Muller de Miranda");
            _credits.Add("      João Vitor Pietsiaki Moraes");
            _credits.Add("");
            _credits.Add("ENEMY AND CHARACTER AI:");
            _credits.Add("      João Vitor Pietsiaki Moraes");
            _credits.Add("");
            _credits.Add("SPECIAL THANKS:");
            _credits.Add("      Enzo Augusto Marchiorato");
            _credits.Add("      Orlando Stein Junior");
            _credits.Add("      Luis Fernando Sobrejero Rigoni");
            _credits.Add("      Melanie Young Yee");
            _credits.Add("");
            _credits.Add("Made using MonoGame.");
            _credits.Add("http://www.monogame.net/");

            _list = new ScrollingList();

            _list.ComponentHeight = 50;

            foreach (string st in _credits)
            {
                _list.AddComponent(new Label(st));
            }
        }
示例#6
0
        public CharacterCreation()
        {
            mainTitle  = new Title(this, "Character Creation", GraphicConsole.Instance.BufferWidth / 2, 1, Title.TextAlignModes.Center);
            backButton = new Button(this, "X", GraphicConsole.Instance.BufferWidth - 1, 0, 1, 1)
            {
                KeyShortcut = Key.Escape
            };
            backButton.Click += backButton_Click;

            itemLists           = new ScrollingList(this, 35, 4, 25, 34);
            itemLists.Selected += itemLists_Selected;
            informationBox      = new TextBox(this, 88, 4, 35, 34);
            detailedStatBox     = new TextBox(this, 63, 4, 22, 34);

            nextButton         = new Button(this, "Next", GraphicConsole.Instance.BufferWidth - 6, GraphicConsole.Instance.BufferHeight - 4, 6, 3);
            nextButton.Click  += nextButton_Click;
            resetButton        = new Button(this, "Reset", nextButton.Position.X - 8, GraphicConsole.Instance.BufferHeight - 4, 7, 3);
            resetButton.Click += resetButton_Click;

            #region General Box
            nameTitle    = new Title(this, "Name: ", 3, 4, Title.TextAlignModes.Left);
            raceTitle    = new Title(this, "Race: ", 3, 5, Title.TextAlignModes.Left);
            cultureTitle = new Title(this, "Culture: ", 3, 6, Title.TextAlignModes.Left);
            classTitle   = new Title(this, "Class: ", 3, 7, Title.TextAlignModes.Left);
            traitTitle   = new Title(this, "Trait: ", 3, 8, Title.TextAlignModes.Left);

            nameInput = new InputBox(this, 13, 4, 19, 1)
            {
                CharacterLimit = 18
            };
            raceSelect    = new Button(this, "[Choose Race]", 13, 5, 19, 1);
            cultureSelect = new Button(this, "[Choose Culture]", 13, 6, 19, 1);
            classSelect   = new Button(this, "[Choose Class]", 13, 7, 19, 1);
            traitSelect   = new Button(this, "[Choose Trait]", 13, 8, 19, 1);

            randomName        = new Button(this, "φ", 11, 4, 1, 1);
            randomName.Click += randomName_Click;

            raceSelect.Click    += raceSelect_Click;
            cultureSelect.Click += cultureSelect_Click;
            classSelect.Click   += classSelect_Click;
            traitSelect.Click   += traitSelect_Click;
            #endregion
            #region Stats Box
            physicalTitle = new Title(this, "Physical Stats", 16, 13, Title.TextAlignModes.Center)
            {
                TextColor = Color4.LightGray
            };
            spellTitle = new Title(this, "Spell Stats", 16, 21, Title.TextAlignModes.Center)
            {
                TextColor = Color4.LightGray
            };
            defenseTitle = new Title(this, "Defensive Stats", 16, 29, Title.TextAlignModes.Center)
            {
                TextColor = Color4.LightGray
            };
            freePointsTitle         = new Title(this, "Free Points: ##", 3, 37, Title.TextAlignModes.Left);
            statsResetButton        = new Button(this, "Reset Points", 20, 37, 12, 1);
            statsResetButton.Click += statsResetButton_Click;

            strButton = new Button(this, "-STR-", 3, 14, 5, 1); strButton.Click += strButton_Click;
            agiButton = new Button(this, "-AGI-", 3, 16, 5, 1); agiButton.Click += agiButton_Click;
            dexButton = new Button(this, "-DEX-", 3, 18, 5, 1); dexButton.Click += dexButton_Click;

            intButton = new Button(this, "-INT-", 3, 22, 5, 1); intButton.Click += intButton_Click;
            wilButton = new Button(this, "-WIL-", 3, 24, 5, 1); wilButton.Click += wilButton_Click;
            wisButton = new Button(this, "-WIS-", 3, 26, 5, 1); wisButton.Click += wisButton_Click;

            conButton = new Button(this, "-CON-", 3, 30, 5, 1); conButton.Click += conButton_Click;
            endButton = new Button(this, "-END-", 3, 32, 5, 1); endButton.Click += endButton_Click;
            frtButton = new Button(this, "-FRT-", 3, 34, 5, 1); frtButton.Click += frtButton_Click;

            strAdd = new Button(this, "+", 25, 14, 3, 1); strAdd.Click += strAdd_Click;
            strRem = new Button(this, "-", 28, 14, 3, 1); strRem.Click += strRem_Click;

            agiAdd = new Button(this, "+", 25, 16, 3, 1); agiAdd.Click += agiAdd_Click;
            agiRem = new Button(this, "-", 28, 16, 3, 1); agiRem.Click += agiRem_Click;

            dexAdd = new Button(this, "+", 25, 18, 3, 1); dexAdd.Click += dexAdd_Click;
            dexRem = new Button(this, "-", 28, 18, 3, 1); dexRem.Click += dexRem_Click;


            intAdd = new Button(this, "+", 25, 22, 3, 1); intAdd.Click += intAdd_Click;
            intRem = new Button(this, "-", 28, 22, 3, 1); intRem.Click += intRem_Click;

            wilAdd = new Button(this, "+", 25, 24, 3, 1); wilAdd.Click += wilAdd_Click;
            wilRem = new Button(this, "-", 28, 24, 3, 1); wilRem.Click += wilRem_Click;

            wisAdd = new Button(this, "+", 25, 26, 3, 1); wisAdd.Click += wisAdd_Click;
            wisRem = new Button(this, "-", 28, 26, 3, 1); wisRem.Click += wisRem_Click;


            conAdd = new Button(this, "+", 25, 30, 3, 1); conAdd.Click += conAdd_Click;
            conRem = new Button(this, "-", 28, 30, 3, 1); conRem.Click += conRem_Click;

            endAdd = new Button(this, "+", 25, 32, 3, 1); endAdd.Click += endAdd_Click;
            endRem = new Button(this, "-", 28, 32, 3, 1); endRem.Click += endRem_Click;

            frtAdd = new Button(this, "+", 25, 34, 3, 1); frtAdd.Click += frtAdd_Click;
            frtRem = new Button(this, "-", 28, 34, 3, 1); frtRem.Click += frtRem_Click;
            #endregion

            popupControl = new Popup(this);

            character = new TokenTile()
            {
                Token = '@', ForegroundColor = Color4.Black, BackgroundColor = Color4.Black
            };
            colorLeftButton  = new Button(this, "«", 8, 40, 2, 3);
            colorRightButton = new Button(this, "» ", 15, 40, 2, 3);

            colorLeftButton.Click  += colorLeftButton_Click;
            colorRightButton.Click += colorRightButton_Click;

            calculateStats();
        }
示例#7
0
        public ShipScreen(InterfaceManager manager)
            : base(manager)
        {
            shipDesignationTitle           = new Title(null, "USS Ravioli", 1, 1, Title.TextAlignModes.Left);
            shipDesignationTitle.TextColor = Color4.White;
            shipModelTitle           = new Title(null, "Disney Gummi mk1*", 1, 2, Title.TextAlignModes.Left);
            shipModelTitle.TextColor = Color4.Gray;

            backButton        = new Button(null, "Back", 0, GraphicConsole.BufferHeight - 3);
            backButton.Click += (sender, e) => InterfaceManager.ChangeInterface("Travel");

            equipButton   = new Button(null, "Equip", 14, GraphicConsole.BufferHeight - 3);
            unequipButton = new Button(null, "Unequip", 21, GraphicConsole.BufferHeight - 3);

            shipLayout          = new ShipLayout(null, 28, 19);
            shipLayout.Position = new System.Drawing.Point(1, GraphicConsole.BufferHeight - shipLayout.Size.Y - 3);

            previousShip = new Button(null, "◄", 1, shipLayout.Position.Y - 3);
            nextShip     = new Button(null, "►", shipLayout.Size.X - 2, shipLayout.Position.Y - 3);

            scrollingList            = new ScrollingList(null, 30, 2, GraphicConsole.BufferWidth - 31, 21);
            scrollingList.FillColor  = new Color4(50, 50, 50, 255);
            descriptionBox           = new TextBox(null, 30, 24, GraphicConsole.BufferWidth - 31, 12);
            descriptionBox.FillColor = new Color4(50, 50, 50, 255);

            Title inventoryTitle = new Title(null, "== Inventory ==", 30 + (GraphicConsole.BufferWidth - 31) / 2, 1, Title.TextAlignModes.Center);

            RegisterControl(inventoryTitle);

            shipAttackTitle  = new Title(null, " Attack: 0", 1, 4, Title.TextAlignModes.Left);
            shipDefenseTitle = new Title(null, "Defense: 0", 1, 5, Title.TextAlignModes.Left);
            shipCargoTitle   = new Title(null, "  Cargo: 0", 1, 6, Title.TextAlignModes.Left);
            shipJumpTitle    = new Title(null, "   Jump: 0", 1, 7, Title.TextAlignModes.Left);

            filterReset    = new Button(null, "Rst", 30, 1, 3, 1);
            materialFilter = new Button(null, "Min", 34, 1, 3, 1);
            modFilter      = new Button(null, "Mod", 38, 1, 3, 1);
            shipFilter     = new Button(null, "Ship", 42, 1, 4, 1);

            #region Control Events
            scrollingList.Selected += (sender, index) =>
            {
                //Selection can be an inventory item or a ship, check
                Type typeOfSelection = scrollingList.GetSelection().GetType();
                if (typeOfSelection == typeof(Ship))
                {
                    Ship ship = (Ship)scrollingList.GetSelection();
                    descriptionBox.Text = ship.Description;
                    shipLayout.SetShip(ship);

                    updateDisplayInfo();
                }
                else
                {
                    InventoryListItem selection = (InventoryListItem)scrollingList.GetSelection();
                    Item item = selection.InventorySlot.Item;

                    descriptionBox.Text = string.Format("-{0}-\nWeight: {1}/{2}\n\n{3}",
                                                        item.Name,
                                                        item.Weight,
                                                        selection.InventorySlot.TotalWeight,
                                                        item.Description);
                }
                InterfaceManager.DrawStep();
            };
            scrollingList.Deselected += (sender) =>
            {
                descriptionBox.Text = string.Empty;
                InterfaceManager.DrawStep();
            };
            shipLayout.NodeSelect += (sender, e) =>
            {
                ShipNode node = e.SelectedShipNode;
                setItemList(GameManager.PlayerShip.Inventory.GetInventoryList(node.ModType));
                inventoryTitle.Text = string.Format("== Inventory - Filter: {0} ==", node.ModType);

                //Display equipped Mod's description
                if (!node.Empty)
                {
                    descriptionBox.Text = string.Format("-{0}-\n{1}", node.Module.Name, node.Module.Description);
                }
                else
                {
                    descriptionBox.Text = string.Empty;
                }
            };
            equipButton.Click += (sender, e) =>
            {
                if (!scrollingList.HasSelection)
                {
                    return;
                }

                ListItem selectedItem = scrollingList.GetSelection();

                if (selectedItem.GetType() == typeof(Ship))
                {
                    Ship ship = (Ship)selectedItem;
                    GameManager.ChangePlayerShip(ship);

                    filterReset.Press(); //Trigger inventory reset
                }
                else
                {
                    InventorySlot slot = ((InventoryListItem)selectedItem).InventorySlot;
                    if (slot.Item.ItemType != ItemTypes.ShipMod)
                    {
                        return;
                    }

                    if (shipLayout.HasNodeSelected)
                    {
                        GameManager.PlayerShip.EquipModule(shipLayout.SelectedNode, (ShipMod)slot.Item, true);
                    }
                    else
                    {
                        GameManager.PlayerShip.EquipModule((ShipMod)slot.Item, true);
                    }

                    setItemList(GameManager.PlayerShip.Inventory.GetInventoryList());
                    inventoryTitle.Text = "== Inventory ==";
                }

                updateDisplayInfo();
                InterfaceManager.DrawStep();
            };
            unequipButton.Click += (sender, e) =>
            {
                if (!shipLayout.HasNodeSelected)
                {
                    return;
                }
                GameManager.PlayerShip.UnequipModule(shipLayout.SelectedNode, true);

                updateDisplayInfo();
                InterfaceManager.DrawStep();
            };
            filterReset.Click += (sender, e) =>
            {
                setItemList(GameManager.PlayerShip.Inventory.GetInventoryList());
                inventoryTitle.Text = "== Inventory ==";
                scrollingList.ClearSelection();
                shipLayout.SetShip(GameManager.PlayerShip);
                updateDisplayInfo();
            };
            materialFilter.Click += (sender, e) =>
            {
                setItemList(GameManager.PlayerShip.Inventory.GetInventoryList(ItemTypes.RawMaterial));
                inventoryTitle.Text = string.Format("== Inventory - Filter: {0} ==", ItemTypes.RawMaterial);
                scrollingList.ClearSelection();
                shipLayout.SetShip(GameManager.PlayerShip);
                updateDisplayInfo();
            };
            modFilter.Click += (sender, e) =>
            {
                setItemList(GameManager.PlayerShip.Inventory.GetInventoryList(ItemTypes.ShipMod));
                inventoryTitle.Text = string.Format("== Inventory - Filter: {0} ==", ItemTypes.ShipMod);
                scrollingList.ClearSelection();
                shipLayout.SetShip(GameManager.PlayerShip);
                updateDisplayInfo();
            };
            shipFilter.Click += (sender, e) =>
            {
                scrollingList.SetList(GameManager.PlayerFaction.OwnedShips);
                inventoryTitle.Text = string.Format("== Owned Ships ==");
                scrollingList.ClearSelection();
                shipLayout.SetShip(GameManager.PlayerShip);
                updateDisplayInfo();
            };
            #endregion

            #region Control Registration
            //Titles
            RegisterControl(shipDesignationTitle);
            RegisterControl(shipModelTitle);
            RegisterControl(shipAttackTitle);
            RegisterControl(shipDefenseTitle);
            RegisterControl(shipCargoTitle);
            RegisterControl(shipJumpTitle);

            //Buttons
            RegisterControl(backButton);
            RegisterControl(equipButton);
            RegisterControl(unequipButton);
            //RegisterControl(previousShip);
            //RegisterControl(nextShip);
            RegisterControl(filterReset);
            RegisterControl(materialFilter);
            RegisterControl(modFilter);
            RegisterControl(shipFilter);

            //Other
            RegisterControl(scrollingList);
            RegisterControl(descriptionBox);
            RegisterControl(shipLayout);
            #endregion
        }
示例#8
0
        public TradingScreen(InterfaceManager manager)
            : base(manager)
        {
            screenTitle = new Title(null, "Trading Hub", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center);

            playerValueTitle     = new Title(null, "Player Value", 50, 11, Title.TextAlignModes.Center);
            computerValueTitle   = new Title(null, "Computer Value", 51, GraphicConsole.BufferHeight - 11, Title.TextAlignModes.Center);
            differenceValueTitle = new Title(null, "Difference Value", GraphicConsole.BufferWidth / 2, GraphicConsole.BufferHeight / 2, Title.TextAlignModes.Center);

            playerCreditsTitle   = new Title(null, "Player Credits", 1, 1, Title.TextAlignModes.Left);
            computerCreditsTitle = new Title(null, "Computer Credits", GraphicConsole.BufferWidth - 26, 1, Title.TextAlignModes.Left);

            backButton        = new Button(null, "Back", 0, 0, 6, 1);
            backButton.Click += (sender, e) =>
            {
                InterfaceManager.ChangeInterface("System");
            };

            Color4 controlFillColor = new Color4(0.15f, 0.15f, 0.15f, 1f);
            Color4 darkerColor      = new Color4(0.1f, 0.1f, 0.1f, 1f);
            Color4 lighterColor     = new Color4(0.2f, 0.2f, 0.2f, 1f);

            TradingListItem.BufferWidth = 25; //Set to the width of the inventory screens

            inventoryList                = new ScrollingList(null, 1, 2, 25, GraphicConsole.BufferHeight - 3);
            inventoryList.FillColor      = controlFillColor;
            availableItemsList           = new ScrollingList(null, GraphicConsole.BufferWidth - 26, 2, 25, GraphicConsole.BufferHeight - 3);
            availableItemsList.FillColor = controlFillColor;

            offeredList              = new ScrollingList(null, 38, 2, 25, 9);
            offeredList.FillColor    = controlFillColor;
            interestedList           = new ScrollingList(null, 37, GraphicConsole.BufferHeight - 10, 25, 9);
            interestedList.FillColor = controlFillColor;

            playerRemoveOne               = new Button(null, "<1", 26, 2, 6, 3);
            playerRemoveOne.FillColor     = darkerColor;
            playerRemoveTen               = new Button(null, "<10", 26, 5, 6, 3);
            playerRemoveTen.FillColor     = darkerColor;
            playerRemoveHundred           = new Button(null, "<100", 26, 8, 6, 3);
            playerRemoveHundred.FillColor = darkerColor;

            playerAddOne               = new Button(null, "1>", 32, 2, 6, 3);
            playerAddOne.FillColor     = lighterColor;
            playerAddTen               = new Button(null, "10>", 32, 5, 6, 3);
            playerAddTen.FillColor     = lighterColor;
            playerAddHundred           = new Button(null, "100>", 32, 8, 6, 3);
            playerAddHundred.FillColor = lighterColor;

            playerRemoveOne.Click     += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 1);
            playerRemoveTen.Click     += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 10);
            playerRemoveHundred.Click += (sender, e) => RemovePlayerItem(offeredList.GetSelection(), 100);

            playerAddOne.Click     += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 1);
            playerAddTen.Click     += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 10);
            playerAddHundred.Click += (sender, e) => AddPlayerItem(inventoryList.GetSelection(), 100);

            computerAddOne               = new Button(null, "<1", 62, GraphicConsole.BufferHeight - 4, 6, 3);
            computerAddOne.FillColor     = lighterColor;
            computerAddTen               = new Button(null, "<10", 62, GraphicConsole.BufferHeight - 7, 6, 3);
            computerAddTen.FillColor     = lighterColor;
            computerAddHundred           = new Button(null, "<100", 62, GraphicConsole.BufferHeight - 10, 6, 3);
            computerAddHundred.FillColor = lighterColor;

            computerRemoveOne               = new Button(null, "1>", 68, GraphicConsole.BufferHeight - 4, 6, 3);
            computerRemoveOne.FillColor     = darkerColor;
            computerRemoveTen               = new Button(null, "10>", 68, GraphicConsole.BufferHeight - 7, 6, 3);
            computerRemoveTen.FillColor     = darkerColor;
            computerRemoveHundred           = new Button(null, "100>", 68, GraphicConsole.BufferHeight - 10, 6, 3);
            computerRemoveHundred.FillColor = darkerColor;

            computerRemoveOne.Click     += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 1);
            computerRemoveTen.Click     += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 10);
            computerRemoveHundred.Click += (sender, e) => RemoveComputerItem(interestedList.GetSelection(), 100);

            computerAddOne.Click     += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 1);
            computerAddTen.Click     += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 10);
            computerAddHundred.Click += (sender, e) => AddComputerItem(availableItemsList.GetSelection(), 100);

            makeOfferButton        = new Button(null, "Make Offer", GraphicConsole.BufferWidth / 2 - 6, GraphicConsole.BufferHeight / 2 - 3);
            makeOfferButton.Click += (sender, e) => makeOffer();

            computerInventory = new Inventory();

            #region Control Registration
            RegisterControl(screenTitle);
            RegisterControl(playerValueTitle);
            RegisterControl(computerValueTitle);
            RegisterControl(playerCreditsTitle);
            RegisterControl(computerCreditsTitle);
            RegisterControl(differenceValueTitle);
            RegisterControl(inventoryList);
            RegisterControl(availableItemsList);
            RegisterControl(offeredList);
            RegisterControl(interestedList);
            RegisterControl(playerAddOne);
            RegisterControl(playerAddTen);
            RegisterControl(playerAddHundred);
            RegisterControl(playerRemoveOne);
            RegisterControl(playerRemoveTen);
            RegisterControl(playerRemoveHundred);
            RegisterControl(computerAddOne);
            RegisterControl(computerAddTen);
            RegisterControl(computerAddHundred);
            RegisterControl(computerRemoveOne);
            RegisterControl(computerRemoveTen);
            RegisterControl(computerRemoveHundred);
            RegisterControl(makeOfferButton);
            RegisterControl(backButton);
            #endregion
        }
        public NewGameScreen(InterfaceManager manager)
            : base(manager)
        {
            Title characterCreation = new Title(null, "Ship Registration", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center);
            Title playerName        = new Title(null, "Name: ", 7, 2, Title.TextAlignModes.Left);
            Title shipName          = new Title(null, "Ship Name: ", 2, 4, Title.TextAlignModes.Left);
            Title companyName       = new Title(null, "Comp Name: ", 2, 6, Title.TextAlignModes.Left);
            Title shipType          = new Title(null, "Ship Type: ", 2, 8, Title.TextAlignModes.Left);
            Title shipDescription   = new Title(null, "Description: ", 25, 8, Title.TextAlignModes.Left);
            Title shipLayoutTitle   = new Title(null, "Layout: ", 64, 8, Title.TextAlignModes.Left);

            playerNameInput           = new InputBox(null, 13, 2, 20);
            playerNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            playerNameInput.Text      = "James Comey";

            shipNameInput           = new InputBox(null, 13, 4, 20);
            shipNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            shipNameInput.Text      = "Heart of the Horizon";

            companyNameInput           = new InputBox(null, 13, 6, 20);
            companyNameInput.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            companyNameInput.Text      = "Comey Shipping Inc";

            shipSelectionList           = new ScrollingList(null, 2, 9, 22, 19);
            shipSelectionList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            shipSelectionList.SetList(Game.Factories.ShipFactory.BasicShips);
            shipSelectionList.Selected += (sender, e) =>
            {
                Ship selectedShip = (Ship)shipSelectionList.GetSelection();

                shipDescriptionBox.Text = string.Format("== {0} ==\n{1}\n-\nFire: {2}\nDfns: {3}\nCargo: {4}\nJump: {5}",
                                                        selectedShip.Model, selectedShip.Description, selectedShip.FirePower, selectedShip.DefenseRating,
                                                        selectedShip.CargoCapacity, selectedShip.JumpRadius);
                shipLayout.SetShip((Ship)shipSelectionList.GetSelection());

                InterfaceManager.DrawStep();
            };

            shipDescriptionBox           = new TextBox(null, 25, 9, 38, 19);
            shipDescriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            startGameButton        = new Button(null, "Start", GraphicConsole.BufferWidth - 8, GraphicConsole.BufferHeight - 4);
            startGameButton.Click += (sender, e) =>
            {
                if (!isValidInputs())
                {
                    return;
                }
                GameManager.SetupGame(playerNameInput.Text.Trim(), companyNameInput.Text.Trim(), shipNameInput.Text.Trim(), (Ship)shipSelectionList.GetSelection());

                InterfaceManager.ChangeInterface("Travel");
            };

            backButton        = new Button(null, "Back", 1, GraphicConsole.BufferHeight - 4);
            backButton.Click += (sender, e) =>
            {
                InterfaceManager.ChangeInterface("Start");
            };

            shipLayout          = new ShipLayout(null, 34, 19);
            shipLayout.Position = new System.Drawing.Point(64, 9);

            RegisterControl(characterCreation);
            RegisterControl(playerName);
            RegisterControl(shipName);
            RegisterControl(companyName);
            RegisterControl(shipType);
            RegisterControl(shipDescriptionBox);
            RegisterControl(playerNameInput);
            RegisterControl(shipNameInput);
            RegisterControl(companyNameInput);
            RegisterControl(shipSelectionList);
            RegisterControl(shipDescription);
            RegisterControl(shipLayoutTitle);
            RegisterControl(startGameButton);
            RegisterControl(backButton);
            RegisterControl(shipLayout);
        }
示例#10
0
        public BuildScreen(InterfaceManager manager)
            : base(manager)
        {
            //Titles
            Title screenTitle     = new Title(null, "Building Interface", GraphicConsole.BufferWidth / 2, 1, Title.TextAlignModes.Center);
            Title planetListTitle = new Title(null, "Planets", 10, 2, Title.TextAlignModes.Center);

            //Lists
            planetList           = new ScrollingList(null, 1, 3, 21, 23);
            planetList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            //Textboxes
            descriptionBox           = new TextBox(null, 23, 3, 35, 23);
            descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            //Buttons
            Button backButton         = new Button(null, "Back", 0, 0, 6, 1);
            Button buildMarketButton  = new Button(null, "Build Market", 1, 27);
            Button buildStationButton = new Button(null, "Build Station", 1, 30);
            Button buildFactoryButton = new Button(null, "Build Factory", 1, 33);

            /* UI EVENTS */
            planetList.Selected += (sender, e) =>
            {
                descriptionBox.Text = getPlanetDescription((Planetoid)planetList.GetSelection());
                InterfaceManager.DrawStep();
            };

            backButton.Click += (sender, e) =>
            {
                InterfaceManager.ChangeInterface("System");
            };
            buildMarketButton.Click += (sender, e) =>
            {
                GameManager.CurrentSystem.BuildMarket(GameManager.PlayerFaction);
            };
            buildStationButton.Click += (sender, e) =>
            {
                foreach (Planetoid planet in GameManager.CurrentSystem.Planetoids)
                {
                    planet.BuildStation(GameManager.PlayerFaction);
                }
            };
            buildFactoryButton.Click += (sender, e) =>
            {
                foreach (Planetoid planet in GameManager.CurrentSystem.Planetoids)
                {
                    planet.BuildFactory(GameManager.PlayerFaction, Game.Factories.ProductFactory.CarbonDioxide);
                }
            };
            /* END UI EVENTS */

            //Control Register
            RegisterControl(screenTitle);
            RegisterControl(planetListTitle);
            RegisterControl(planetList);
            RegisterControl(descriptionBox);
            RegisterControl(backButton);
            RegisterControl(buildMarketButton);
            RegisterControl(buildStationButton);
            RegisterControl(buildFactoryButton);
        }
示例#11
0
        public CombatScreen(InterfaceManager manager)
            : base(manager)
        {
            backButton        = new Button(null, "Back", 1, 1);
            backButton.Click += (sender, e) => InterfaceManager.ChangeInterface("Travel");

            attackButton        = new Button(null, "Attack", 1, 4);
            attackButton.Click += (sender, e) =>
            {
                if (!shipList.HasSelection)
                {
                    return;
                }

                GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection());
                CombatGroup victor = GameManager.CombatSimulator.SimulateCombat();
                updateDisplayInformation();

                descriptionBox.Text = string.Format("{0} won!", victor.Ships[0].Name);
            };

            scanButton        = new Button(null, "Scan", 1, 7);
            scanButton.Click += (sender, e) =>
            {
                if (!shipList.HasSelection)
                {
                    return;
                }

                GameManager.CombatSimulator.SetCombatants(GameManager.PlayerShip, (Ship)shipList.GetSelection());
                double oddsToWin = GameManager.CombatSimulator.GetCombatOdds();

                string text = string.Format("{0}% chance to win.\n-\n", oddsToWin * 100.0);

                if (GameManager.CombatSimulator.GroupTwo.Ships[0].CanBeScanned(GameManager.PlayerShip))
                {
                    //List the equipped modules
                    foreach (ShipNode node in GameManager.CombatSimulator.GroupTwo.Ships[0].Nodes)
                    {
                        if (node.Empty)
                        {
                            continue;
                        }
                        text += string.Format("{0} - {1}\n", node.ModType, node.Module.Name);
                    }

                    text += "-\n";

                    //List the carried items
                    List <InventorySlot> inventory = GameManager.CombatSimulator.GroupTwo.Ships[0].Inventory.GetInventoryList();
                    foreach (InventorySlot slot in inventory)
                    {
                        text += string.Format("{0} - #{1}\n", slot.Item.Name, slot.Quantity);
                    }
                }
                else
                {
                    text += "Cannot be scanned.";
                }

                descriptionBox.Text = text;
            };

            shipList           = new ScrollingList(null, GraphicConsole.BufferWidth - 41, 1, 40, 20);
            shipList.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            descriptionBox           = new TextBox(null, GraphicConsole.BufferWidth - 41, 22, 40, 14);
            descriptionBox.FillColor = new Color4(0.2f, 0.2f, 0.2f, 1f);

            shipList.Selected += (sender, e) =>
            {
                descriptionBox.Text = getShipDescription((Ship)shipList.GetSelection());
                InterfaceManager.DrawStep();
            };

            RegisterControl(backButton);
            RegisterControl(attackButton);
            RegisterControl(scanButton);
            RegisterControl(shipList);
            RegisterControl(descriptionBox);
        }