Пример #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 ApplicantSelector_OnItemSelected(int index, ListItem item)
 {
     CurrentApplicant = Applicants[index];
     ApplicantPanel.SetApplicant(CurrentApplicant);
 }