Ejemplo n.º 1
0
        public override Boolean Activate()
        {
            Boolean successfullyActivated = false;

            var eventTextList = new List <String>();

            if (!IsCleared())
            {
                eventTextList.Add(eventText);

                if (ShipInventoryManager.HasAvailableSlot())
                {
                    ShipInventoryManager.AddItem(item);
                    ClearEvent();
                    successfullyActivated = true;
                }
                else
                {
                    eventTextList.Add(inventoryFullText);
                }
            }
            else
            {
                eventTextList.Add(clearText);
            }

            PopupHandler.DisplayMessage(eventTextList.ToArray());
            return(successfullyActivated);
        }
        public void DisplayMissionCompletedText()
        {
            if (MissionManager.MissionEventBuffer.Count <= 0)
            {
                List <String> temp = new List <String>();

                Game.SaveOnEnterOverworld = true;

                BaseStateManager.TextBoxes.Clear();

                List <Mission> completedMissions = MissionManager.ReturnCompletedMissions(BaseState.GetBase().name);

                foreach (String str in completedMissions[0].CompletedText.Split('#'))
                {
                    temp.Add(str);
                }

                SetPortraitFromText(temp[0]);
                SetTextRectangle();

                if (HasReward(completedMissions[0]))
                {
                    if (HasRewardItem(completedMissions[0]))
                    {
                        if (ShipInventoryManager.HasAvailableSlot())
                        {
                            temp.Add(GetRewardText(completedMissions[0]));
                        }

                        else
                        {
                            temp.Add(GetNoEmptySlotText(completedMissions[0]));
                        }
                    }
                    else
                    {
                        temp.Add(GetRewardText(completedMissions[0]));
                    }
                }

                BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14),
                                                                       tempRect,
                                                                       false, true,
                                                                       temp[0]));

                MissionManager.MarkCompletedMissionAsDead(completedMissions[0].MissionID);

                BaseStateManager.ButtonControl = ButtonControl.Confirm;

                for (int i = 1; i < temp.Count; i++)
                {
                    MissionManager.MissionEventBuffer.Add(temp[i]);
                }
            }
        }
Ejemplo n.º 3
0
        public override Boolean Activate()
        {
            itemBought = false;

            var responseChoices = new List <String>()
            {
                "Yes", "No"
            };

            PopupHandler.DisplaySelectionMenu(welcomeText, responseChoices, new List <System.Action>()
            {
                delegate
                {
                    if (!ShipInventoryManager.HasAvailableSlot())
                    {
                        PopupHandler.DisplayMessage(inventoryFullText);
                    }

                    else if (StatsManager.Crebits >= price)
                    {
                        PopupHandler.DisplayMessage(itemBoughtText);

                        StatsManager.Crebits -= price;
                        ShipInventoryManager.AddItem(item);
                        if (oneTimeOnly)
                        {
                            IsCleared();
                        }
                        itemBought = true;
                    }

                    else
                    {
                        PopupHandler.DisplayMessage(notEnoughMoneyText);
                    }
                },

                delegate
                {
                    PopupHandler.DisplayMessage(declinePurchaseText);
                }
            });

            return(true);
        }
        public void DisplayMissionAcceptText()
        {
            if (SelectedMission.AcceptText[0].ToLower().Equals("empty"))
            {
                MissionManager.MarkMissionAsActive(selectedMission.MissionID);
                BaseStateManager.ChangeMenuSubState("Overview");
                BaseStateManager.ActiveButton     = BaseStateManager.AllButtons[BaseStateManager.ActiveButtonIndexY];
                selectedMission.IntroductionText += "/ok";

                return;
            }
            if (selectedMission.RequiresAvailableSlot)
            {
                if (ShipInventoryManager.HasAvailableSlot())
                {
                    String[] temp = SelectedMission.AcceptText[selectedMission.AcceptIndex].Split('#');

                    SetPortraitFromText(temp[0]);

                    BaseStateManager.TextBoxes.Clear();

                    MissionManager.MarkMissionAsActive(selectedMission.MissionID);

                    SetTextRectangle();

                    BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14),
                                                                           tempRect, false, true, temp[0]));

                    if (temp.Length > 1)
                    {
                        for (int i = temp.Length - 1; i > 0; i--)
                        {
                            MissionManager.MissionEventBuffer.Insert(0, temp[i]);
                        }
                    }

                    missionCursorIndex = 0;

                    BaseStateManager.ButtonControl = ButtonControl.Confirm;

                    selectedMission.IntroductionText += "/ok";
                }

                else
                {
                    DisplayMissionAcceptFailedText();
                }
            }

            else
            {
                String[] temp = SelectedMission.AcceptText[selectedMission.AcceptIndex].Split('#');

                SetPortraitFromText(temp[0]);

                BaseStateManager.TextBoxes.Clear();

                MissionManager.MarkMissionAsActive(selectedMission.MissionID);

                SetTextRectangle();

                BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14),
                                                                       tempRect, false, true, temp[0]));

                if (temp.Length > 1)
                {
                    for (int i = temp.Length - 1; i > 0; i--)
                    {
                        MissionManager.MissionEventBuffer.Insert(0, temp[i]);
                    }
                }

                missionCursorIndex = 0;

                BaseStateManager.ButtonControl = ButtonControl.Confirm;

                selectedMission.IntroductionText += "/ok";
            }
        }