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 void RefreshStress() { MinionIdentity identity = (!((UnityEngine.Object)selectedTarget != (UnityEngine.Object)null)) ? null : selectedTarget.GetComponent <MinionIdentity>(); if ((UnityEngine.Object)identity == (UnityEngine.Object)null) { stressPanel.SetActive(false); } else { List <ReportManager.ReportEntry.Note> stressNotes = new List <ReportManager.ReportEntry.Note>(); stressPanel.SetActive(true); stressPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.STATS.GROUPNAME_STRESS; ReportManager.ReportEntry reportEntry = ReportManager.Instance.TodaysReport.reportEntries.Find((ReportManager.ReportEntry entry) => entry.reportType == ReportManager.ReportType.StressDelta); stressDrawer.BeginDrawing(); float num = 0f; stressNotes.Clear(); int num2 = reportEntry.contextEntries.FindIndex((ReportManager.ReportEntry entry) => entry.context == identity.GetProperName()); ReportManager.ReportEntry reportEntry2 = (num2 == -1) ? null : reportEntry.contextEntries[num2]; if (reportEntry2 != null) { reportEntry2.IterateNotes(delegate(ReportManager.ReportEntry.Note note) { stressNotes.Add(note); }); stressNotes.Sort((ReportManager.ReportEntry.Note a, ReportManager.ReportEntry.Note b) => a.value.CompareTo(b.value)); for (int i = 0; i < stressNotes.Count; i++) { DetailsPanelDrawer detailsPanelDrawer = stressDrawer; string[] obj = new string[6]; ReportManager.ReportEntry.Note note2 = stressNotes[i]; obj[0] = ((!(note2.value > 0f)) ? string.Empty : UIConstants.ColorPrefixRed); ReportManager.ReportEntry.Note note3 = stressNotes[i]; obj[1] = note3.note; obj[2] = ": "; ReportManager.ReportEntry.Note note4 = stressNotes[i]; obj[3] = Util.FormatTwoDecimalPlace(note4.value); obj[4] = "%"; ReportManager.ReportEntry.Note note5 = stressNotes[i]; obj[5] = ((!(note5.value > 0f)) ? string.Empty : UIConstants.ColorSuffix); detailsPanelDrawer.NewLabel(string.Concat(obj)); float num3 = num; ReportManager.ReportEntry.Note note6 = stressNotes[i]; num = num3 + note6.value; } } stressDrawer.NewLabel(((!(num > 0f)) ? string.Empty : UIConstants.ColorPrefixRed) + string.Format(UI.DETAILTABS.DETAILS.NET_STRESS, Util.FormatTwoDecimalPlace(num)) + ((!(num > 0f)) ? string.Empty : UIConstants.ColorSuffix)); stressDrawer.EndDrawing(); } }
public void SetLine(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup) { this.entry = entry; this.reportGroup = reportGroup; ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .PooledList pos_notes = ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .Allocate(); entry.IterateNotes(delegate(ReportManager.ReportEntry.Note note) { if (IsPositiveNote(note)) { pos_notes.Add(note); } }); ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .PooledList neg_notes = ListPool <ReportManager.ReportEntry.Note, ReportScreenEntryRow> .Allocate(); entry.IterateNotes(delegate(ReportManager.ReportEntry.Note note) { if (IsNegativeNote(note)) { neg_notes.Add(note); } }); LayoutElement component = name.GetComponent <LayoutElement>(); float num3; if (entry.context == null) { num3 = (component.minWidth = (component.preferredWidth = nameWidth)); if (entry.HasContextEntries()) { toggle.gameObject.SetActive(true); spacer.minWidth = groupSpacerWidth; } else { toggle.gameObject.SetActive(false); spacer.minWidth = groupSpacerWidth + toggle.GetComponent <LayoutElement>().minWidth; } name.text = reportGroup.stringKey; } else { toggle.gameObject.SetActive(false); spacer.minWidth = contextSpacerWidth; name.text = entry.context; num3 = (component.minWidth = (component.preferredWidth = nameWidth - indentWidth)); if (base.transform.GetSiblingIndex() % 2 != 0) { bgImage.color = oddRowColor; } } if (addedValue != entry.Positive) { string text = reportGroup.formatfn(entry.Positive); if (reportGroup.groupFormatfn != null && entry.context == null) { float num6 = 0f; num6 = ((entry.contextEntries.Count <= 0) ? ((float)pos_notes.Count) : ((float)entry.contextEntries.Count)); num6 = Mathf.Max(num6, 1f); text = reportGroup.groupFormatfn(entry.Positive, num6); } added.text = text; addedValue = entry.Positive; } if (removedValue != entry.Negative) { string text2 = reportGroup.formatfn(entry.Negative); if (reportGroup.groupFormatfn != null && entry.context == null) { float num7 = 0f; num7 = ((entry.contextEntries.Count <= 0) ? ((float)neg_notes.Count) : ((float)entry.contextEntries.Count)); num7 = Mathf.Max(num7, 1f); text2 = reportGroup.groupFormatfn(entry.Negative, num7); } removed.text = text2; removedValue = entry.Negative; } if (netValue != entry.Net) { object text3; if (reportGroup.formatfn == null) { num3 = entry.Net; text3 = num3.ToString(); } else { text3 = reportGroup.formatfn(entry.Net); } string text4 = (string)text3; if (reportGroup.groupFormatfn != null && entry.context == null) { float num8 = 0f; num8 = ((entry.contextEntries.Count <= 0) ? ((float)(pos_notes.Count + neg_notes.Count)) : ((float)entry.contextEntries.Count)); num8 = Mathf.Max(num8, 1f); text4 = reportGroup.groupFormatfn(entry.Net, num8); } net.text = text4; netValue = entry.Net; } pos_notes.Recycle(); neg_notes.Recycle(); }