Пример #1
0
        void HireButton_OnClicked()
        {
            List <Room> rooms = Faction.GetRooms();

            bool hasBalloonPort = rooms.Any(room => room.RoomData.Name == "BalloonPort");

            if (CurrentApplicant.Level.Pay * 4 > Faction.Economy.CurrentMoney)
            {
                Dialog.Popup(GUI, "Can't hire!",
                             "We can't afford the signing bonus. Our treasury: " + Faction.Economy.CurrentMoney.ToString("C"), ButtonType.OK, 500, 300, this, LocalBounds.Width / 2 - 250, LocalBounds.Height / 2 - 150);
            }
            else if (!hasBalloonPort)
            {
                Dialog.Popup(GUI, "Can't hire!",
                             "We can't hire anyone when there are no balloon ports.", ButtonType.OK, 500, 300, this, LocalBounds.Width / 2 - 250, LocalBounds.Height / 2 - 150);
            }
            else
            {
                Applicants.Remove(CurrentApplicant);
                Faction.Hire(CurrentApplicant);
                SoundManager.PlaySound(ContentPaths.Audio.cash);
                OnOnHired(CurrentApplicant);
                CurrentApplicant = Applicants.FirstOrDefault();
                ApplicantSelector.ClearChildren();
                ApplicantSelector.Items.Clear();
                foreach (Applicant applicant in Applicants)
                {
                    ApplicantSelector.AddItem(applicant.Level.Name + " - " + applicant.Name);
                }

                ApplicantPanel.SetApplicant(Applicants.FirstOrDefault());
                WasSomeoneHired = true;
            }
        }
Пример #2
0
        void buyButton_OnClicked()
        {
            float total = ShoppingCart.ComputeTotal();


            if (!(total > 0))
            {
                Dialog.Popup(GUI, "Nothing to buy!", "Nothing to buy. Select something from the left panel.", Dialog.ButtonType.OK);
                return;
            }
            if (total > Faction.Economy.CurrentMoney)
            {
                Dialog.Popup(GUI, "Not enough money!", "Can't buy that! We don't have enough money (we have only " + Faction.Economy.CurrentMoney.ToString("C") + " in our treasury).", Dialog.ButtonType.OK);
                return;
            }
            else if (Faction.ComputeStockpileSpace() < ShoppingCart.ComputeSpace())
            {
                Dialog.Popup(GUI, "Too many items!", "Can't buy that! We don't have enough inventory space. Build more stockpiles.", Dialog.ButtonType.OK);
                return;
            }

            SoundManager.PlaySound(ContentPaths.Audio.cash);
            Buy();

            ShoppingCart.Items.Clear();
            ShoppingCart.ReCreateItems();
            ShoppingCart.UpdateItems();

            BuyTotal.Text = "Order Total: " + 0.0f.ToString("C");
        }
Пример #3
0
        private void DeleteVoxels(IEnumerable <Voxel> refs)
        {
            foreach (Voxel v in refs.Select(r => r).Where(v => !v.IsEmpty))
            {
                if (IsBuildDesignation(v))
                {
                    BuildVoxelOrder vox = GetBuildDesignation(v);
                    vox.ToBuild.Destroy();
                    BuildDesignations.Remove(vox.Order);
                }
                else if (IsInRoom(v))
                {
                    Room existingRoom = GetMostLikelyRoom(v);

                    if (existingRoom == null)
                    {
                        continue;
                    }

                    Dialog destroyDialog = Dialog.Popup(PlayState.GUI, "Destroy room?",
                                                        "Do you want to destroy this " + existingRoom.RoomData.Name + "?", Dialog.ButtonType.OkAndCancel);
                    destroyDialog.OnClosed += (status) => destroyDialog_OnClosed(status, existingRoom);
                    break;
                }
            }
        }
Пример #4
0
 private void editor_OnKeyModified(string name, Keys prevKey, Keys arg, KeyEdit editor)
 {
     if (!KeyManager.IsMapped(arg))
     {
         KeyManager[name] = arg;
         KeyManager.SaveConfigSettings();
     }
     else
     {
         editor.Key  = prevKey;
         editor.Text = prevKey.ToString();
         Dialog.Popup(GUI, "Key assigned!", "Key " + arg.ToString() + " already assigned.", Dialog.ButtonType.OK);
     }
 }
Пример #5
0
        void sellButton_OnClicked()
        {
            float total = SellCart.ComputeTotal();


            if (!(total > 0))
            {
                Dialog.Popup(GUI, "Nothing to sell!", "Nothing to sell. Select something from the left panel.", Dialog.ButtonType.OK);
                return;
            }

            SoundManager.PlaySound(ContentPaths.Audio.cash);
            Sell();

            SellCart.Items.Clear();
            SellCart.ReCreateItems();
            SellCart.UpdateItems();

            SellTotal.Text = "Order Total: " + 0.0f.ToString("C");
        }