Beispiel #1
0
        public override bool Success()
        {
            float num = 0f;

            ReportManager.DailyReport todaysReport = ReportManager.Instance.TodaysReport;
            ReportManager.ReportEntry entry        = todaysReport.GetEntry(ReportManager.ReportType.ChoreStatus);
            for (int i = 0; i < entry.contextEntries.Count; i++)
            {
                ReportManager.ReportEntry reportEntry = entry.contextEntries[i];
                if (reportEntry.context == Db.Get().ChoreTypes.PowerTinker.Name)
                {
                    num += reportEntry.Negative;
                }
            }
            for (int j = 0; j < ReportManager.Instance.reports.Count; j++)
            {
                for (int k = 0; k < ReportManager.Instance.reports[j].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries.Count; k++)
                {
                    ReportManager.ReportEntry reportEntry2 = ReportManager.Instance.reports[j].GetEntry(ReportManager.ReportType.ChoreStatus).contextEntries[k];
                    if (reportEntry2.context == Db.Get().ChoreTypes.PowerTinker.Name)
                    {
                        num += reportEntry2.Negative;
                    }
                }
            }
            choresCompleted = Math.Abs(num);
            return(Math.Abs(num) >= numChoreseToComplete);
        }
Beispiel #2
0
 /// <summary>
 /// Calculates how many calories were produced and consumed in the specified cycle.
 /// </summary>
 /// <param name="report">The report to analyze.</param>
 /// <param name="produced">The location where the produced kcal will be stored.</param>
 /// <param name="consumed">The location where the consumed kcal will be stored.</param>
 private static void GetCalorieDeltas(ReportManager.DailyReport report,
                                      out float produced, out float consumed)
 {
     ReportManager.ReportEntry entry;
     if ((entry = report?.GetEntry(ReportManager.ReportType.CaloriesCreated)) != null)
     {
         // Consumption is negative
         produced = entry.accPositive;
         consumed = -entry.accNegative;
     }
     else
     {
         produced = 0.0f;
         consumed = 0.0f;
     }
 }
    private void Refresh()
    {
        Debug.Assert(currentReport != null);
        if (currentReport.day == ReportManager.Instance.TodaysReport.day)
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE_TODAY, currentReport.day));
        }
        else if (currentReport.day == ReportManager.Instance.TodaysReport.day - 1)
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE_YESTERDAY, currentReport.day));
        }
        else
        {
            SetTitle(string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day));
        }
        bool flag = currentReport.day < ReportManager.Instance.TodaysReport.day;

        nextButton.isInteractable = flag;
        if (flag)
        {
            nextButton.GetComponent <ToolTip>().toolTip = string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day + 1);
            nextButton.GetComponent <ToolTip>().enabled = true;
        }
        else
        {
            nextButton.GetComponent <ToolTip>().enabled = false;
        }
        flag = (currentReport.day > 1);
        prevButton.isInteractable = flag;
        if (flag)
        {
            prevButton.GetComponent <ToolTip>().toolTip = string.Format(UI.ENDOFDAYREPORT.DAY_TITLE, currentReport.day - 1);
            prevButton.GetComponent <ToolTip>().enabled = true;
        }
        else
        {
            prevButton.GetComponent <ToolTip>().enabled = false;
        }
        AddSpacer(0);
        int num = 1;

        foreach (KeyValuePair <ReportManager.ReportType, ReportManager.ReportGroup> reportGroup in ReportManager.Instance.ReportGroups)
        {
            ReportManager.ReportEntry entry = currentReport.GetEntry(reportGroup.Key);
            int num2 = num;
            ReportManager.ReportGroup value = reportGroup.Value;
            if (num2 != value.group)
            {
                ReportManager.ReportGroup value2 = reportGroup.Value;
                num = value2.group;
                AddSpacer(num);
            }
            int num3;
            if (entry.accumulate == 0f)
            {
                ReportManager.ReportGroup value3 = reportGroup.Value;
                num3 = (value3.reportIfZero ? 1 : 0);
            }
            else
            {
                num3 = 1;
            }
            bool flag2 = (byte)num3 != 0;
            ReportManager.ReportGroup value4 = reportGroup.Value;
            if (value4.isHeader)
            {
                CreateHeader(reportGroup.Value);
            }
            else if (flag2)
            {
                CreateOrUpdateLine(entry, reportGroup.Value, flag2);
            }
        }
    }