Esempio n. 1
0
        //Draw Commands
        public void Draw(GameDrawClassComponents curGameDrawClassComponents)
        {
            if (!_isNull)
            {
                menuBackground.Draw(curGameDrawClassComponents);


                //Display build time and cost.

                /////Implement later. This is temp gap solution?!?
                if (!curGameDrawClassComponents._staticDataCards._isNull)
                {
                    Vector2 vectManuTime = new Vector2(110, 250);
                    Vector2 vectManuCost = new Vector2(110, 300);

                    string strFacilityTypeName = facilityTypeDropDown.textOptions[facilityTypeDropDown.selectedIndex];

                    DataCards.Facility facilCheck = curGameDrawClassComponents._staticDataCards.getFacilityByName(strFacilityTypeName);

                    string strManuTimeDisplay = "Construction Day(s): " + facilCheck.baseManufactureCost.BaseConstructionTime.ToString();

                    string strManuCostDisplay = "Construction Cost: " + facilCheck.baseManufactureCost.ResourceCost.ToString();

                    curGameDrawClassComponents._spriteBatch.DrawString(curGameDrawClassComponents._staticFonts._courierNew, strManuTimeDisplay, vectManuTime, Color.Black);

                    curGameDrawClassComponents._spriteBatch.DrawString(curGameDrawClassComponents._staticFonts._courierNew, strManuCostDisplay, vectManuCost, Color.Black);
                }


                displayButtonsInMenu(curGameDrawClassComponents);



                destinationDropDown.Draw(curGameDrawClassComponents);

                facilityTypeDropDown.Draw(curGameDrawClassComponents);
            }
        }
        public void Draw(GameDrawClassComponents curGameDrawClassComponents)
        {
            if (dropDownCollapsed)
            {
                DrawObj.DrawHelper.DrawRectangle(curGameDrawClassComponents, backColor, dropDownBoxRect, borderColor, borderSize);

                Vector2 arrowVector = new Vector2(dropDownBoxRect.X + dropDownBoxRect.Width, dropDownBoxRect.Y);
                dropDownBoxArrow.VectorPosition = arrowVector;

                dropDownBoxArrow.Draw(curGameDrawClassComponents);

                Color textColor = Color.Black;

                Vector2 textVector = new Vector2(dropDownBoxRect.X, dropDownBoxRect.Y);

                curGameDrawClassComponents._spriteBatch.DrawString(curGameDrawClassComponents._staticFonts._courierNew, textOptions[selectedIndex], textVector, textColor);

                //curGameDrawClassComponents._spriteBatch.Draw(dropDownBoxArrow.spriteTexture, Model.Utilities.getRectFromTexture2D(dropDownBoxArrow), Color.White);
            }
            else
            {
                string strTextOpts = "";
                int    itemsToShow = maxItemsToShow;
                if (textOptions.Count < maxItemsToShow)
                {
                    itemsToShow = textOptions.Count;
                }



                for (int i = 0; i < itemsToShow; i++)
                {
                    if (i != itemsToShow - 1)
                    {
                        strTextOpts += textOptions[i] + "\n";
                    }
                    else
                    {
                        strTextOpts += textOptions[i];
                    }
                }


                //strTextOpts = textOptions[selectedIndex] + "\n" + strTextOpts;

                float textHeight = Model.Utilities.getTextHeight(strTextOpts, curGameDrawClassComponents._staticFonts);


                Rectangle expandedDropDownBoxRect = dropDownBoxRect;
                expandedDropDownBoxRect.Height = (int)textHeight;

                DrawObj.DrawHelper.DrawRectangle(curGameDrawClassComponents, backColor, expandedDropDownBoxRect, borderColor, borderSize);

                Vector2 arrowVector = new Vector2(dropDownBoxRect.X + dropDownBoxRect.Width, dropDownBoxRect.Y);
                dropDownBoxArrow.VectorPosition = arrowVector;

                dropDownBoxArrow.Draw(curGameDrawClassComponents);

                Color textColor = Color.Black;

                Vector2 textVector = new Vector2(dropDownBoxRect.X, dropDownBoxRect.Y);

                curGameDrawClassComponents._spriteBatch.DrawString(curGameDrawClassComponents._staticFonts._courierNew, strTextOpts, textVector, textColor);
            }
        }