Ejemplo n.º 1
0
        private string getAge(CivPopKerbal crew)
        {
            var res = formatter.format(currentDate - crew.GetBirthdate(), TimeFormat.AGE);

            if (crew.IsDead())
            {
                res = res + " - Dead";
            }
            return(res);
        }
Ejemplo n.º 2
0
        public void draw()
        {
            GUILayout.BeginVertical();
            foreach (CivPopVessel vessel in repo.GetVessels().OrderBy(v => v.GetId()))
            {
                if (vessel.GetCapacity() > 0)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(getVesselStatus(vessel));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("M : " + repo.GetLivingRosterForVessel(vessel.GetId()).Count(k => k.GetGender() == CivPopKerbalGender.MALE)
                                    + " - F : " + repo.GetLivingRosterForVessel(vessel.GetId()).Count(k => k.GetGender() == CivPopKerbalGender.FEMALE)
                                    + " (" + repo.GetLivingRosterForVessel(vessel.GetId()).Count(k => k.GetExpectingBirthAt() > 0) + ")");
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("  Housing capacity : " + vessel.GetCapacity());
                    GUILayout.EndHorizontal();

                    if (vessel.GetMissionArrival() > 0)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("  Mission arrival : " + formatter.format(vessel.GetMissionArrival() - currentDate));
                        GUILayout.EndHorizontal();
                    }

                    foreach (CivPopKerbal female in repo.GetLivingRosterForVessel(vessel.GetId()).Where(k => k.GetExpectingBirthAt() > 0))
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("  " + female.GetName() + " will give birth in " + formatter.format(female.GetExpectingBirthAt() - currentDate));
                        GUILayout.EndHorizontal();
                    }
                }
            }
            GUILayout.EndVertical();
        }
        public void Format_age_for_35_years_and_few_seconds()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("Adult (35 years)", formatter.format(21600 * 426 * 35 + 1, TimeFormat.AGE));
        }
        public void Format_age_for_20_years()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("Young adult (20 years)", formatter.format(21600 * 426 * 20, TimeFormat.AGE));
        }
        public void Format_0_to_0_sec()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("00:00:00", formatter.format(0));
        }
        public void Format_500_days()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("1 year 74 day(s) 00:00:00", formatter.format(10800000));
        }
        public void Format_age_for_100_days()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("Young (100 days)", formatter.format(2160000, TimeFormat.AGE));
        }
        public void Format_time_counting_days()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("37 day(s) 04:03:43", formatter.format(813823));
        }
        public void Format_100_days()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("100 day(s) 00:00:00", formatter.format(2160000));
        }
        public void Format_time_counting_hours()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("04:03:43", formatter.format(14623));
        }
        public void Format_60_into_1_m_0_s()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("00:01:00", formatter.format(60));
        }
        public void Format_double_to_int_sec()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("00:00:02", formatter.format(2.43));
        }
        public void Format_age_for_65_years()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("Ancient (65 years)", formatter.format(21600 * 426 * 65, TimeFormat.AGE));
        }
        public void Format_age_for_50_years()
        {
            TimeFormatter formatter = new TimeFormatter();

            Assert.AreEqual("Senior (50 years)", formatter.format(21600 * 426 * 50, TimeFormat.AGE));
        }