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;
            }
        }
Пример #2
0
 public virtual void RemoveAttachmentPoint(PhysicalAttachmentPoint point)
 {
     attachmentPoints.Remove(point);
 }
Пример #3
0
 public virtual void AddAttachmentPoint(PhysicalAttachmentPoint point)
 {
     attachmentPoints.Add(point);
 }
Пример #4
0
 /// <summary>
 /// Amalgams cannot have their own attachment points. Add points to the amalgam's parts instead.
 /// </summary>
 /// <param name="material"></param>
 /// <param name="parts"></param>
 public override void RemoveAttachmentPoint(PhysicalAttachmentPoint point)
 {
     return;
 }