private GameObject CreateOrUpdateLine(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup, bool is_line_active) { GameObject value = null; lineItems.TryGetValue(reportGroup.stringKey, out value); if (!is_line_active) { if ((Object)value != (Object)null && value.activeSelf) { value.SetActive(false); } } else { if ((Object)value == (Object)null) { value = Util.KInstantiateUI(lineItem, contentFolder, true); value.name = "LineItem" + lineItems.Count; lineItems[reportGroup.stringKey] = value; } value.SetActive(true); ReportScreenEntry component = value.GetComponent <ReportScreenEntry>(); component.SetMainEntry(entry, reportGroup); } return(value); }
public void SetMainEntry(ReportManager.ReportEntry entry, ReportManager.ReportGroup reportGroup) { if ((UnityEngine.Object)mainRow == (UnityEngine.Object)null) { mainRow = Util.KInstantiateUI(rowTemplate.gameObject, base.gameObject, true).GetComponent <ReportScreenEntryRow>(); MultiToggle toggle = mainRow.toggle; toggle.onClick = (System.Action)Delegate.Combine(toggle.onClick, new System.Action(ToggleContext)); MultiToggle componentInChildren = mainRow.name.GetComponentInChildren <MultiToggle>(); componentInChildren.onClick = (System.Action)Delegate.Combine(componentInChildren.onClick, new System.Action(ToggleContext)); MultiToggle componentInChildren2 = mainRow.added.GetComponentInChildren <MultiToggle>(); componentInChildren2.onClick = (System.Action)Delegate.Combine(componentInChildren2.onClick, new System.Action(ToggleContext)); MultiToggle componentInChildren3 = mainRow.removed.GetComponentInChildren <MultiToggle>(); componentInChildren3.onClick = (System.Action)Delegate.Combine(componentInChildren3.onClick, new System.Action(ToggleContext)); MultiToggle componentInChildren4 = mainRow.net.GetComponentInChildren <MultiToggle>(); componentInChildren4.onClick = (System.Action)Delegate.Combine(componentInChildren4.onClick, new System.Action(ToggleContext)); } mainRow.SetLine(entry, reportGroup); currentContextCount = entry.contextEntries.Count; for (int i = 0; i < entry.contextEntries.Count; i++) { if (i >= contextRows.Count) { ReportScreenEntryRow component = Util.KInstantiateUI(rowTemplate.gameObject, base.gameObject, false).GetComponent <ReportScreenEntryRow>(); contextRows.Add(component); } contextRows[i].SetLine(entry.contextEntries[i], reportGroup); } UpdateVisibility(); }
public void SetMainEntry(ReportManager.ReportGroup reportGroup) { if ((Object)mainRow == (Object)null) { mainRow = Util.KInstantiateUI(rowTemplate.gameObject, base.gameObject, true).GetComponent <ReportScreenHeaderRow>(); } mainRow.SetLine(reportGroup); }
public void SetLine(ReportManager.ReportGroup reportGroup) { LayoutElement component = name.GetComponent <LayoutElement>(); float num3 = component.minWidth = (component.preferredWidth = nameWidth); spacer.minWidth = groupSpacerWidth; name.text = reportGroup.stringKey; }
private GameObject CreateHeader(ReportManager.ReportGroup reportGroup) { GameObject value = null; lineItems.TryGetValue(reportGroup.stringKey, out value); if ((Object)value == (Object)null) { value = Util.KInstantiateUI(lineItemHeader, contentFolder, true); value.name = "LineItemHeader" + lineItems.Count; lineItems[reportGroup.stringKey] = value; } value.SetActive(true); ReportScreenHeader component = value.GetComponent <ReportScreenHeader>(); component.SetMainEntry(reportGroup); return(value); }
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); } } }
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(); }