Exemple #1
0
        /// <summary>
        /// Generates a nice informative string to be used in display for this part.
        /// It will contain the tag, the index in parent's part-list, a root marker, the part name,
        /// the docking port name and the docking port state.
        /// </summary>
        /// <returns>A string to display this node</returns>
        public override string ToString()
        {
            string s = base.ToString();

            if (DockName.Length > 0)
            {
                if (s[s.Length - 1] == ')')
                {
                    s = s.Substring(0, s.Length - 1);
                }
                else
                {
                    s += " (";
                }
                s += " '" + DockName + "')";
            }
            if (DockState.Length > 0)
            {
                s += ": " + DockState;
                if (DockState.ToLower() == "docked (docker)")
                {
                    if (DockedVesselName.Length > 0)
                    {
                        s += ": " + DockedVesselName; // +", " + DockedVesselType;
                    }
                }
                else if (DockState.ToLower() == "grappled" && DockedPart == ParentPart)
                {
                    if (DockedVesselName.Length > 0)
                    {
                        s += ": " + DockedVesselName + " (this side)"; // +", " + DockedVesselType;
                    }
                }
                else if (DockState.ToLower() == "grappled")
                {
                    if (DockedVesselOtherName.Length > 0)
                    {
                        s += ": " + DockedVesselOtherName + " (other side)"; // +", " + DockedVesselType;
                    }
                }
            }
            return(s);
        }