Exemplo n.º 1
0
        protected virtual void DrawMenuOptions(SpriteBatch spriteBatch)
        {
            Color color;

            for (int i = 0; i < menuOptions.Count; i++)
            {
                color = FontManager.FontColorStatic;

                if (cursorIndex == i)
                {
                    color = FontManager.FontSelectColor1;
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(14),
                                       menuOptions[i],
                                       new Vector2(menuOptionOrigin.X + (i * MenuOptionXDistance),
                                                   menuOptionOrigin.Y) + FontManager.FontOffsetStatic,
                                       color,
                                       0f,
                                       Vector2.Zero,
                                       1f,
                                       SpriteEffects.None,
                                       1f);
            }
        }
Exemplo n.º 2
0
        private void DrawOkayButton(SpriteBatch spriteBatch)
        {
            // Draws "okay"-button
            spriteBatch.Draw(okayButton.Texture,
                             okayButtonPosition,
                             okayButton.SourceRectangle,
                             Color.White,
                             0f,
                             new Vector2(okayButton.SourceRectangle.Value.Width / 2,
                                         okayButton.SourceRectangle.Value.Height / 2),
                             1f,
                             SpriteEffects.None,
                             0.975f);

            // Draws "okay"-text
            spriteBatch.DrawString(FontManager.GetFontStatic(14),
                                   "Okay",
                                   okayButtonPosition + FontManager.FontOffsetStatic,
                                   FontManager.FontSelectColor2,
                                   0f,
                                   FontManager.GetFontStatic(14).MeasureString("Okay") / 2,
                                   1f,
                                   SpriteEffects.None,
                                   1f);
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            textBuffer = new List <String>();

            font       = FontManager.GetFontStatic(14);
            fontOffset = FontManager.FontOffsetStatic;
            fontColor  = FontManager.FontColorStatic;

            containerWidth = (int)CanvasTextAreaSize.X;
        }
Exemplo n.º 4
0
 public void DisplayGeneralInfo(SpriteBatch spriteBatch)
 {
     //Money
     spriteBatch.DrawString(FontManager.GetFontStatic(16),
                            "Money: " + (int)StatsManager.Crebits + " Crebits",
                            new Vector2(Game1.ScreenSize.X / 2 + Game1.ScreenSize.X / 4, Game1.ScreenSize.Y * 3 / 4 + 30) + FontManager.FontOffsetStatic,
                            FontManager.FontColorStatic,
                            0f,
                            FontManager.GetFontStatic(16).MeasureString("Money: " + (int)StatsManager.Crebits + " Crebits") / 2,
                            1f,
                            SpriteEffects.None,
                            1f);
 }
Exemplo n.º 5
0
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < displayList.Count; i++)
            {
                displayList[i].Draw(spriteBatch);

                spriteBatch.DrawString(FontManager.GetFontStatic(14), displayList[i].name, displayList[i].Position,
                                       var1 == i ? FontManager.FontSelectColor1 : FontManager.FontColorStatic, 0f,
                                       FontManager.GetFontStatic(14).MeasureString(displayList[i].name) / 2, 1f, SpriteEffects.None, 1f);
            }

            CursorLevel2.Draw(spriteBatch);
        }
Exemplo n.º 6
0
 private void MouseControls()
 {
     for (int i = 0; i < menuOptions.Count; i++)
     {
         if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), menuOptions[i],
                                            new Vector2(menuOptionOrigin.X + i * menuOptionXDistance,
                                                        menuOptionOrigin.Y + i * menuOptionYDistance) + FontManager.FontOffsetStatic,
                                            screenPosition, this is SelectionMenu))
         {
             if (ControlManager.IsMouseMoving())
             {
                 cursorIndex = i;
             }
         }
     }
 }
Exemplo n.º 7
0
        private static void DisplayList(SpriteBatch spriteBatch, String tag, List <ShipPart> partList, Vector2 startPosition, float deltaY, int slot = 0)
        {
            spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), tag, startPosition, FontManager.FontColorStatic);

            int pos = 1;

            foreach (ShipPart part in partList)
            {
                string name  = part.Name;
                Color  color = Color.White;

                if (!part.Kind.ToLower().Equals("primary") &&
                    ShipInventoryManager.IsEquipped(part))
                {
                    name += " [equipped]";
                }

                else if (part.Kind.ToLower().Equals("primary") &&
                         ShipInventoryManager.IsEquippedAt(part, slot))
                {
                    name += " [equipped]";
                }

                if (layer == 2 &&
                    layer2pos == partList.IndexOf(part))
                {
                    color = FontManager.FontSelectColor1;
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), name, new Vector2(startPosition.X + 20, startPosition.Y + pos * deltaY), color);
                pos++;
            }

            if (layer == 2)
            {
                Color color = Color.White;
                if (layer2pos == partList.Count)
                {
                    color = FontManager.FontSelectColor1;
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Back", new Vector2(startPosition.X + 20, startPosition.Y + pos * deltaY), color);
            }
        }
        private void MouseControls()
        {
            for (int i = 0; i < options.Count; i++)
            {
                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14),
                                                   options[i], new Vector2(10, 10 + (i * 20)), false))
                {
                    if (ControlManager.IsMouseMoving())
                    {
                        cursorIndex = i;
                    }

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        ButtonActions();
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void CheckMouseCursorLevel2()
        {
            List <Mission> missions;

            switch (cursorLevel1Position)
            {
            case 0:
                missions = MissionManager.ReturnActiveMissions();
                break;

            case 1:
                missions = MissionManager.ReturnCompletedDeadMissions();
                break;

            case 2:
                missions = MissionManager.ReturnFailedDeadMissions();
                break;

            default:
                missions = new List <Mission>();
                break;
            }

            for (int i = 0; i < missions.Count + 1; i++)
            {
                string text = i < missions.Count ? missions[i].MissionName : "Back";

                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), text,
                                                   new Vector2(MissionScreenState.GetRightRectangle.X + Game1.ScreenSize.X / 16,
                                                               93 + i * 23) + Game.fontManager.FontOffset, Vector2.Zero, false))
                {
                    cursorLevel2Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked() &&
                        i == missions.Count)
                    {
                        cursorLevel     = 1;
                        elapsedSinceKey = 0;
                    }
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Draws names of all objects in gameObjects relative to their position
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="gameObjects">objects which names to be displayed</param>
        public static void DrawOverlay(SpriteBatch spriteBatch, List <GameObjectOverworld> gameObjects)
        {
            if (mapState == MapState.On)
            {
                foreach (GameObjectOverworld obj in gameObjects)
                {
                    spriteBatch.DrawString(FontManager.GetFontStatic(14), obj.name,
                                           new Vector2(obj.position.X, obj.position.Y - ((obj.Bounds.Height * obj.scale) / 2) - 300),
                                           Color.White, 0f,
                                           FontManager.GetFontStatic(14).MeasureString(obj.name) / 2,
                                           55, SpriteEffects.None, 1f);
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(14), "Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..",
                                       new Vector2(camera.cameraPos.X, camera.cameraPos.Y + HelpTextOffset),
                                       Color.White, 0f,
                                       FontManager.GetFontStatic(14).MeasureString("Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..") / 2,
                                       80, SpriteEffects.None, 1f);
            }
        }
Exemplo n.º 11
0
        public virtual void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < allButtons.Count; i++)
            {
                Color fontColor = FontManager.FontColorStatic;

                allButtons[i].Draw(spriteBatch);

                if (i == activeButtonIndexY)
                {
                    fontColor = FontManager.FontSelectColor1;
                }

                if (allButtons[i].isVisible)
                {
                    spriteBatch.DrawString(FontManager.GetFontStatic(16), allButtons[i].name, allButtons[i].Position, fontColor, 0f,
                                           FontManager.GetFontStatic(16).MeasureString(allButtons[i].name) / 2, 1f, SpriteEffects.None, 0.9f);
                }
            }

            activeMenuState.Draw(spriteBatch);

            foreach (TextBox txtBox in textBoxes)
            {
                Color color = Game.fontManager.FontColor;

                if (txtBox.GetText().Contains("Main - "))
                {
                    color = MissionManager.MainMissionColor;
                }

                else if (txtBox.GetText().Contains("Secondary - "))
                {
                    color = MissionManager.SideMissionColor;
                }

                txtBox.Draw(spriteBatch, color, Game.fontManager.FontOffset);
            }
        }
Exemplo n.º 12
0
        protected override void DrawMenuOptions(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < menuOptions.Count; i++)
            {
                Color color = FontManager.FontColorStatic;

                if (cursorIndex == i)
                {
                    color = FontManager.FontSelectColor1;
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(14),
                    menuOptions[i],
                    new Vector2(canvasPosition.X,
                                canvasPosition.Y + (i * MenuOptionYDistance)) + FontManager.FontOffsetStatic,
                    color,
                    0f,
                    FontManager.GetFontStatic(14).MeasureString(menuOptions[i]) / 2,
                    1f,
                    SpriteEffects.None,
                    1f);
            }
        }
Exemplo n.º 13
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(FontManager.GetFontStatic(12), "X: " + x + " Y: " + y, new Vector2(10, 10), Color.White);
 }
        public override void Update(GameTime gameTime)
        {
            if (BaseState.GetBase() != null)
            {
                availableMissions = MissionManager.ReturnAvailableMissions(BaseState.GetBase().name);
            }

            if (BaseStateManager.ButtonControl.Equals(ButtonControl.Mission) ||
                BaseStateManager.ButtonControl.Equals(ButtonControl.Response))
            {
                missionCursor.isActive  = true;
                missionCursor.isVisible = true;
            }

            else
            {
                missionCursor.isActive  = false;
                missionCursor.isVisible = false;
            }


            if (BaseStateManager.ButtonControl == ButtonControl.Mission)
            {
                //Moves button cursor right when pressing up.
                if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    missionCursorIndex--;
                }

                //Moves button cursor left when pressing down
                else if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    missionCursorIndex++;
                }

                if (MissionCursorIndex > availableMissions.Count)
                {
                    missionCursorIndex = 0;
                }

                else if (MissionCursorIndex < 0)
                {
                    missionCursorIndex = availableMissions.Count;
                }

                for (int i = 0; i < availableMissions.Count + 1; i++)
                {
                    String text = i != availableMissions.Count ? availableMissions[i].MissionName : "Back";

                    if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), text,
                                                       new Vector2(Game1.ScreenSize.X / 2,
                                                                   Game1.ScreenSize.Y / 2 - 40 + (20 * (i + (i == availableMissions.Count ? 1 : 0)))
                                                                   + FindTextBoxWithText(text).TextBoxRect.Height)))
                    {
                        if (ControlManager.IsMouseMoving())
                        {
                            missionCursorIndex = i;
                        }
                    }
                }

                if (availableMissions.Count > 0 && missionCursorIndex != availableMissions.Count)
                {
                    selectedMission = availableMissions[MissionCursorIndex];
                }
            }

            else if (BaseStateManager.ButtonControl == ButtonControl.Response)
            {
                //Moves button cursor right when pressing up.
                if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    responseCursorIndex--;
                }

                //Moves button cursor left when pressing down
                else if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    responseCursorIndex++;
                }

                if (MissionManager.MissionResponseBuffer.Count <= 0)
                {
                    if (ControlManager.IsMouseOverArea(new Rectangle(
                                                           BaseStateManager.ResponseRectangles[0].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X / 2,
                                                           BaseStateManager.ResponseRectangles[0].Y + BaseStateManager.ResponseRectangles[0].Height / 2,
                                                           (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X,
                                                           (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).Y)))
                    {
                        responseCursorIndex = 0;
                    }

                    else if (ControlManager.IsMouseOverArea(new Rectangle(
                                                                BaseStateManager.ResponseRectangles[1].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X / 2,
                                                                BaseStateManager.ResponseRectangles[1].Y + BaseStateManager.ResponseRectangles[1].Height / 2,
                                                                (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X,
                                                                (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).Y)))
                    {
                        responseCursorIndex = 1;
                    }

                    if (responseCursorIndex > 1)
                    {
                        responseCursorIndex = 0;
                    }

                    else if (responseCursorIndex < 0)
                    {
                        responseCursorIndex = 1;
                    }
                }

                else
                {
                    for (int i = 0; i < MissionManager.MissionResponseBuffer.Count; i++)
                    {
                        if (ControlManager.IsMouseOverArea(new Rectangle(
                                                               BaseStateManager.ResponseRectangles[i].X - (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X / 2,
                                                               BaseStateManager.ResponseRectangles[i].Y + BaseStateManager.ResponseRectangles[i].Height / 2,
                                                               (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X,
                                                               (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).Y)))
                        {
                            responseCursorIndex = i;
                        }
                    }

                    if (responseCursorIndex > MissionManager.MissionResponseBuffer.Count - 1)
                    {
                        responseCursorIndex = 0;
                    }

                    else if (responseCursorIndex < 0)
                    {
                        responseCursorIndex = MissionManager.MissionResponseBuffer.Count - 1;
                    }
                }
            }

            if (BaseStateManager.ButtonControl != ButtonControl.Response &&
                ControlManager.CheckPress(RebindableKeys.Pause))
            {
                SkipMissionText();
            }
            else
            {
                base.Update(gameTime);
            }
        }
        private void CheckMouseLevel2()
        {
            int    listLength;
            string text = "";

            if (cursorCoordLv1.Position != 5)
            {
                listLength = ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1];
            }

            else
            {
                if (cursorCoordLv1.Y == 0)
                {
                    listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count;
                }
                else
                {
                    listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count;
                }
            }

            for (int i = 0; i < listLength + 1; i++)
            {
                if (i < listLength)
                {
                    if (cursorCoordLv1.Position != 5)
                    {
                        if (cursorCoordLv1.Position == 1)
                        {
                            text = ShipInventoryManager.ownedEnergyCells[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 2)
                        {
                            text = ShipInventoryManager.ownedPlatings[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 3)
                        {
                            text = ShipInventoryManager.ownedShields[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 4)
                        {
                            text = ShipInventoryManager.OwnedSecondary[i].Name;
                        }
                    }

                    else
                    {
                        if (cursorCoordLv1.Y == 0)
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(1)[i].Name;
                        }
                        else
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(2)[i].Name;
                        }
                    }
                }
                else
                {
                    text = "Back";
                }

                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(16), text,
                                                   new Vector2(Game1.ScreenSize.X / 2 + 50, 93 + i * 23), Vector2.Zero, false))
                {
                    cursorLevel2Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        if (cursorLevel2Position < listLength)
                        {
                            OnPressLevel2();
                        }
                        else
                        {
                            cursorLevel     = 1;
                            elapsedSinceKey = 0;
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
 public static void DisplayPlatingInfo(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Platings", topDisplayPos + FontManager.FontOffsetStatic, FontManager.FontColorStatic, 0, FontManager.GetFontStatic(16).MeasureString("Plating") / 2, 1.0f, SpriteEffects.None, 0.5f);
     DisplayList(spriteBatch, "Owned platings", ShipInventoryManager.OwnedPlatings, equippedDisplayPos + FontManager.FontOffsetStatic, ySpacing);
 }
Exemplo n.º 17
0
 public static void DisplayPrimaryWeaponInfo2(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Primary weapon slot 2", topDisplayPos + FontManager.FontOffsetStatic, FontManager.FontColorStatic, 0, FontManager.GetFontStatic(16).MeasureString("Primary weapon slot 2") / 2, 1.0f, SpriteEffects.None, 0.5f);
     DisplayList(spriteBatch, "Owned weapons", ShipInventoryManager.GetAvailablePrimaryWeapons(2), equippedDisplayPos + FontManager.FontOffsetStatic, ySpacing, 2);
 }
Exemplo n.º 18
0
 public static void DisplayBackInfo(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Back", topDisplayPos + FontManager.FontOffsetStatic, FontManager.FontColorStatic, 0, FontManager.GetFontStatic(16).MeasureString("Back") / 2, 1.0f, SpriteEffects.None, 0.5f);
     spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Leave inventory", equippedDisplayPos + FontManager.FontOffsetStatic, FontManager.FontColorStatic);
 }
Exemplo n.º 19
0
 public void Initialize()
 {
     font       = FontManager.GetFontStatic(14);
     textSize   = font.MeasureString(AutoSaveMessage);
     windowSize = new Vector2(Game1.ScreenSize.X, Game1.ScreenSize.Y);
 }