Example #1
0
 public void SetUp(Mission parent)
 {
     this.parentMission = parent;
     timer = def.timer.GetTotalTime;
     if (thingTracker == null && def.targetSettings != null)
     {
         thingTracker = new ThingTracker(def.targetSettings, def.type);
     }
     if (travelTracker == null)
     {
         travelTracker = new TravelTracker(def.travelSettings);
     }
     if (failTracker == null && def.failConditions != null)
     {
         failTracker = new FailTracker(def.failConditions);
     }
 }
 private void SetUp()
 {
     if (def.timer.GetTotalTime > 0)
     {
         timer = def.timer.GetTotalTime;
     }
     if (!def.objectives.NullOrEmpty())
     {
         foreach (ObjectiveDef objective in def.objectives)
         {
             MakeObjective(objective);
         }
     }
     if (failTracker == null && def.failConditions != null)
     {
         failTracker = new FailTracker(def.failConditions);
     }
     Notify_Change();
 }
        private void FailconReadout <T>(T t, FailConditions conditions, ref Listing_Standard listing)
        {
            FailTracker failTracker  = t is Mission ? (t as Mission).failTracker : (t as Objective).failTracker;
            bool        whenFinished = conditions.whenFinished;

            if (!conditions.missions.NullOrEmpty())
            {
                string missions = whenFinished ? "FailCon_MissionDone".Translate() : "FailCon_MissionFail".Translate();
                listing.IconLabel(StoryMats.warning, (missions + ":"), new Vector2(9f, 18f));
                foreach (MissionDef mdef in conditions.missions)
                {
                    listing.Label("    - " + mdef.LabelCap);
                }
            }
            if (!conditions.objectives.NullOrEmpty())
            {
                string objectives = whenFinished ? "FailCon_ObjectiveDone".Translate() : "FailCon_ObjectiveFail".Translate();
                listing.IconLabel(StoryMats.warning, (objectives + ":"), new Vector2(9f, 18f));
                foreach (ObjectiveDef oDef in conditions.objectives)
                {
                    listing.Label("    - " + oDef.LabelCap);
                }
            }
            if (!conditions.targetSettings.targets.NullOrEmpty())
            {
                string targets = conditions.targetSettings.any ? "FailCon_TargetsAny".Translate() : "FailCon_Targets".Translate();
                listing.IconLabel(StoryMats.warning, (targets + ":"), new Vector2(9f, 18f));
                foreach (ThingValue tv in conditions.targetSettings.targets)
                {
                    listing.Label("    - " + tv.ThingDef.LabelCap + " - " + failTracker.TargetsLost[tv] + "/" + tv.value);
                }
            }
            if (conditions.targetSettings.minColonistsToLose > 0)
            {
                listing.IconLabel(StoryMats.warning, "FailCon_DeadColonists".Translate() + ": " + failTracker.lostColonists + "/" + conditions.targetSettings.minColonistsToLose, new Vector2(9f, 18f));
            }
        }