Exemplo n.º 1
0
        // Custom save/load logic
        public static void Look(ref IncidentTarget value, string label)
        {
            int id = value == null ? -1 : value.id;

            Scribe_Values.Look(ref id, label, default(int), true);
            IncidentTarget found = Values.FirstOrDefault((target) => target.id == id);

            value = found;
        }
Exemplo n.º 2
0
 public override void ExposeData()
 {
     Scribe_Values.Look(ref logDebug, "logDebug", true); // TODO: Set this to false on release, make a setting for it?
     Utils.ScribeCustomList(ref events, "events", e =>
     {
         string incidentName           = e.incidentName;
         IncidentTarget incidentTarget = e.incidentTarget;
         Scribe_Values.Look(ref incidentName, "incident");
         IncidentTarget.Look(ref incidentTarget, "incidentTarget");
         e.Scribe();
     }, () =>
     {
         string incidentName           = null;
         IncidentTarget incidentTarget = null;
         Scribe_Values.Look(ref incidentName, "incident");
         IncidentTarget.Look(ref incidentTarget, "incidentTarget");
         if (incidentName == null || incidentTarget == null)
         {
             Utils.LogDebug("Found invalid incident in saved events");
             return(null);
         }
         ScheduledEvent e = new ScheduledEvent(incidentTarget, incidentName);
         e.Scribe();
         return(e);
     }, this);
     events.RemoveAll(e => e == null); // Remove all nulls
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         // We should try and find out game component and run an update on it
         if (Current.Game != null)
         {
             SEGameComponent comp = Current.Game.GetComponent <SEGameComponent>();
             if (comp != null)
             {
                 comp.ReloadEvents();
             }
         }
     }
     base.ExposeData();
 }
Exemplo n.º 3
0
        public IntervalScale offsetScale = IntervalScale.HOURS;   // The offset scale

        public ScheduledEvent(IncidentTarget target, string incidentName)
        {
            this.incidentTarget = target;
            this.incidentName   = incidentName;
        }