Example #1
0
    private string OnNoteTooltip(float total_accumulation, string tooltip_text, ReportManager.ReportEntry.Order order, ReportManager.FormattingFn format_fn, Func <ReportManager.ReportEntry.Note, bool> is_note_applicable_cb, ReportManager.GroupFormattingFn group_format_fn = null)
    {
        notes.Clear();
        entry.IterateNotes(delegate(ReportManager.ReportEntry.Note note)
        {
            if (is_note_applicable_cb(note))
            {
                notes.Add(note);
            }
        });
        string text = string.Empty;
        float  num  = 0f;

        num = ((entry.contextEntries.Count <= 0) ? ((float)notes.Count) : ((float)entry.contextEntries.Count));
        num = Mathf.Max(num, 1f);
        foreach (ReportManager.ReportEntry.Note item in Sort(notes, reportGroup.posNoteOrder))
        {
            ReportManager.ReportEntry.Note current = item;
            string arg = format_fn(current.value);
            if (toggle.gameObject.activeInHierarchy && group_format_fn != null)
            {
                arg = group_format_fn(current.value, num);
            }
            text = string.Format(UI.ENDOFDAYREPORT.NOTES.NOTE_ENTRY_LINE_ITEM, text, current.note, arg);
        }
        string arg2 = format_fn(total_accumulation);

        if (group_format_fn != null && entry.context == null)
        {
            arg2 = group_format_fn(total_accumulation, num);
        }
        return(string.Format(tooltip_text + "\n" + text, arg2));
    }
        private static List <ReportManager.ReportEntry.Note> Sort(List <ReportManager.ReportEntry.Note> notes, ReportManager.ReportEntry.Order order)
        {
            switch (order)
            {
            case ReportManager.ReportEntry.Order.Ascending:
                notes.Sort((ReportManager.ReportEntry.Note x, ReportManager.ReportEntry.Note y) => x.value.CompareTo(y.value));
                break;

            case ReportManager.ReportEntry.Order.Descending:
                notes.Sort((ReportManager.ReportEntry.Note x, ReportManager.ReportEntry.Note y) => y.value.CompareTo(x.value));
                break;
            }
            return(notes);
        }