public override void DisplayContents() { // XXX: This bypasses the observer rule foreach (AttachmentPoint point in physicalTarget.GetAttachmentPoints()) { StackPanel entry = GameManager.instance.GetResource <StackPanel>("DescriptiveAttachmentEntry"); attachmentsPanel.Children.Add(entry); TextBlock text = Utilities.FindNode <TextBlock>(entry, "AttachmentName"); if (text != null) { text.Text = char.ToUpper(point.name[0]) + point.name.Substring(1); } if (point.maxQuantity != -1) { text = Utilities.FindNode <TextBlock>(entry, "Quantity"); if (text != null) { if (observer.CanObserve(physicalTarget)) { text.Text = $"{point.GetAttached().Length.ToString()}/{point.maxQuantity.ToString()}"; } else { text.Text = "???"; } } } PhysicalAttachmentPoint physicalPoint = point as PhysicalAttachmentPoint; if (physicalPoint != null) { text = Utilities.FindNode <TextBlock>(entry, "VolumeRatio"); if (text != null) { if (observer.CanObserve(physicalTarget)) { if (physicalPoint.capacity >= 0) { text.Text = $"{physicalPoint.filledCapacity.ToString()} L/{physicalPoint.capacity.ToString()} L"; } else { text.Text = $"{physicalPoint.filledCapacity.ToString()} L"; } } else { text.Text = "???"; } } } DisplayAttachmentContents(entry, point); } if (attachmentsPanel.Children.Count == 0) { element.Visibility = System.Windows.Visibility.Collapsed; } }
protected virtual void FetchContents(FrameworkElement entry, GameObject obj) { Physical physicalObj = obj as Physical; if (physicalObj == null) { return; } StackPanel subData = Utilities.FindNode <StackPanel>(entry, "SubData"); if (subData == null) { return; } foreach (AttachmentPoint point in physicalObj.GetAttachmentPoints()) { if (point.GetAttached().Length == 0) { continue; } FrameworkElement pointEntry = GameManager.instance.GetResource <FrameworkElement>("OverviewEntry"); subData.Children.Add(pointEntry); TextBlock text = Utilities.FindNode <TextBlock>(pointEntry, "Data1"); if (text != null) { text.Inlines.Add(char.ToUpper(point.name[0]) + point.name.Substring(1)); } StackPanel pointContents = Utilities.FindNode <StackPanel>(pointEntry, "SubData"); foreach (GameObject child in point.GetAttached()) { DisplayObject(pointContents, child); } } FetchConnections(subData, physicalObj); if (subData.Children.Count == 0) { subData.Visibility = Visibility.Hidden; } }