コード例 #1
0
        public RadialMenu(int number, float radius, string pathAndName, float deployScale, float buttonScale, Vector2 position, ContentManager content)
        {
            m_isDeployed     = false;
            m_centrePosition = position;
            m_number         = number;
            m_radius         = radius;

            m_buttons         = new List <NormalButton>();
            m_rotations       = new List <float>();
            m_buttonPositions = new List <Vector2>();
            m_messageList     = new List <string>();

            m_messageList.Add("Move tower.");
            m_messageList.Add("Sell tower.");

            m_deployButton = new NormalButton(content.Load <Texture2D>("Art\\PlaceholderArt\\Tiles\\TowerPlacementTiles"), m_centrePosition, Color.White, deployScale, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, "Open Tower\nMenu."), "");

            // Create the butons
            for (int i = 0; i < number; i++)
            {
                // This gets the fraction of Pi to be used for button separation
                float piChunk = MathHelper.Pi / number;
                // The rotation depends on the current iteration
                m_rotations.Add(0 + (i * piChunk));

                // Make a button position according to the new rotation
                m_buttonPositions.Add(new Vector2(-(float)Math.Cos(m_rotations[i]), -(float)Math.Sin(m_rotations[i])) * radius);

                // Add the button at the new position
                m_buttons.Add(new NormalButton(content.Load <Texture2D>(pathAndName + i), m_centrePosition + m_buttonPositions[i], Color.White, buttonScale, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, m_messageList[i]), ""));
            }
        }
コード例 #2
0
        public AchievementsMenu(ContentManager Content)
        {
            m_achievemenyRows = new List <NormalMenu>();
            m_rowYPositions   = new List <Vector2>();
            m_names           = new List <string>();

            AddAchievementShorthands();

            AddAchievements(Content);

            m_backButton = new NormalButton(Content.Load <Texture2D>("Art\\GameArt\\MenuGUI\\SettingsMenu\\MenuButton1"), new Vector2(100, 960), Color.White, 1, 1, 1, 1, Content, null, "");
        }
コード例 #3
0
        public DropMenu(ContentManager content, int scrollRectX, int scrollRectY, int scrollRectWidth, int scrollRectHeight, int mainX, int mainY, int gap, int dropX, int dropY, string pathAndName)
        {
            m_selectionButtons = new List <NormalButton>();
            m_dropButton       = new NormalButton(content.Load <Texture2D>(pathAndName), new Vector2(mainX, mainY), Color.White, 1, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, "Open Menu."), "");

            m_scroll     = 1;
            m_scrollRect = new Rectangle(scrollRectX, scrollRectY, scrollRectWidth, scrollRectHeight);
            m_gap        = gap;

            m_dropX = dropX;
            m_dropY = dropY;

            m_hasDropped = false;
        }
コード例 #4
0
        public ConstructionMenu(ContentManager content)
        {
            // Create general menu buttons and open menu
            m_backGround = new StaticGraphic(content.Load <Texture2D>("Art\\GameArt\\ConstructionMenu\\Background"), Vector2.Zero, Color.White);

            m_newTowerButton = new NormalButton(content.Load <Texture2D>("Art\\GameArt\\ConstructionMenu\\Buttons\\NewTower"), new Vector2(150, 50), Color.White, 1, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, "New Tower."), "");

            m_dropMenu = new DropMenu(content, 292, 114, 216, 252, 400, 50, 50, 400, 150, "Art\\GameArt\\ConstructionMenu\\Buttons\\OpenTower");

            m_saveButton = new NormalButton(content.Load <Texture2D>("Art\\GameArt\\ConstructionMenu\\Buttons\\SaveTower"), new Vector2(650, 50), Color.White, 1, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, "Save Tower."), "");

            m_foundationCount = 0;
            m_rotorCount      = 0;

            // Create the part menus and if necessary adjust the source rectangles
            m_partMenus = new List <DropMenu>();

            // Create foundations menu
            CreateFoundationsMenu(content);

            // Create rotors menu
            CreateRotorMenu(content);

            // Create components/struts menu
            CreateComponentMenu(content);

            // Create weapons menu
            CreateWeaponsMenu(content);

            // Create utilities menu
            CreateUtilityMenu(content);

            // Finally create the back button
            m_backButton = new NormalButton(content.Load <Texture2D>("Art\\GameArt\\MenuGUI\\MapGenMenu\\GenButton0"), new Vector2(150, 1000), Color.White, 1, 1, 1, 1, content, new ToolTip(content.Load <Texture2D>("Art\\GameArt\\ToolTipBacking"), Game1.debugFont, new Vector2(0, 0), Color.White, Color.Black, Vector2.Zero, "Return to the level."), "");

            // Create tower info and controls class
            m_construct   = new TowerConstruct(content);
            m_tower       = new Tower(content, new Vector2(126, 126));
            m_openedIndex = 0;

            m_controls = new ConstructionControls(this);
        }