public static float DailyReport_Negative(ReportManager.ReportType entryType)
        {
            float yesterday = ReportManager.Instance.YesterdaysReport == null ? 0 : Math.Abs(ReportManager.Instance.YesterdaysReport.GetEntry(entryType).Negative);
            float today     = ReportManager.Instance.TodaysReport == null ? 0 : Math.Abs(ReportManager.Instance.TodaysReport.GetEntry(entryType).Negative);

            return(Math.Max(yesterday, today));
        }
 public override void InitializeStates(out BaseState default_state)
 {
     default_state = nochore;
     saveHistory   = true;
     nochore.Update(delegate(StatesInstance smi, float dt)
     {
         if (smi.master.HasTag(GameTags.Minion) && !smi.master.HasTag(GameTags.Dead))
         {
             ReportManager.Instance.ReportValue(ReportManager.ReportType.WorkTime, dt, string.Format(UI.ENDOFDAYREPORT.NOTES.TIME_SPENT, DUPLICANTS.CHORES.THINKING.NAME), smi.master.GetProperName());
         }
     }, UpdateRate.SIM_200ms, false).ParamTransition(nextChore, haschore, (StatesInstance smi, Chore next_chore) => next_chore != null);
     haschore.Enter("BeginChore", delegate(StatesInstance smi)
     {
         smi.BeginChore();
     }).Update(delegate(StatesInstance smi, float dt)
     {
         if (smi.master.HasTag(GameTags.Minion) && !smi.master.HasTag(GameTags.Dead))
         {
             Chore chore = currentChore.Get(smi);
             if (chore != null)
             {
                 if (smi.master.GetComponent <Navigator>().IsMoving())
                 {
                     ReportManager.Instance.ReportValue(ReportManager.ReportType.TravelTime, dt, GameUtil.GetChoreName(chore, null), smi.master.GetProperName());
                 }
                 else
                 {
                     ReportManager.ReportType reportType = chore.GetReportType();
                     Workable workable = smi.master.GetComponent <Worker>().workable;
                     if ((UnityEngine.Object)workable != (UnityEngine.Object)null)
                     {
                         ReportManager.ReportType reportType2 = workable.GetReportType();
                         if (reportType != reportType2)
                         {
                             reportType = reportType2;
                         }
                     }
                     ReportManager.Instance.ReportValue(reportType, dt, string.Format(UI.ENDOFDAYREPORT.NOTES.WORK_TIME, GameUtil.GetChoreName(chore, null)), smi.master.GetProperName());
                 }
             }
         }
     }, UpdateRate.SIM_200ms, false).Exit("EndChore", delegate(StatesInstance smi)
     {
         smi.EndChore("ChoreDriver.SignalStop");
     })
     .OnSignal(stop, nochore);
 }
        public static float DailyReport_Average(ReportManager.ReportType entryType)
        {
            float total = DailyReport_Positive(entryType);

            return(total * 100 / 600 / Components.MinionResumes.Count);
        }
Example #4
0
 public Chore(ChoreType chore_type, ChoreProvider chore_provider, bool run_until_complete, Action <Chore> on_complete, Action <Chore> on_begin, Action <Chore> on_end, PriorityScreen.PriorityClass priority_class, int priority_value, bool is_preemptable, bool allow_in_context_menu, int priority_mod, bool add_to_daily_report, ReportManager.ReportType report_type)
 {
     if (priority_value == 2147483647)
     {
         priority_class = PriorityScreen.PriorityClass.topPriority;
         priority_value = 2;
     }
     if (priority_value < 1 || priority_value > 9)
     {
         Debug.LogErrorFormat("Priority Value Out Of Range: {0}", priority_value);
     }
     masterPriority = new PrioritySetting(priority_class, priority_value);
     priorityMod    = priority_mod;
     id             = ++nextId;
     if ((UnityEngine.Object)chore_provider == (UnityEngine.Object)null)
     {
         chore_provider = GlobalChoreProvider.Instance;
         DebugUtil.Assert((UnityEngine.Object)chore_provider != (UnityEngine.Object)null);
     }
     choreType        = chore_type;
     runUntilComplete = run_until_complete;
     onComplete       = on_complete;
     onEnd            = on_end;
     onBegin          = on_begin;
     IsPreemptable    = is_preemptable;
     AddPrecondition(ChorePreconditions.instance.IsValid, null);
     AddPrecondition(ChorePreconditions.instance.IsPermitted, null);
     AddPrecondition(ChorePreconditions.instance.IsPreemptable, null);
     AddPrecondition(ChorePreconditions.instance.HasUrge, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingEarly, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingLate, null);
     AddPrecondition(ChorePreconditions.instance.IsOverrideTargetNullOrMe, null);
     chore_provider.AddChore(this);
 }