Esempio n. 1
0
        private FormattedMessage GetExamineText(IEntity entity)
        {
            var message = new FormattedMessage();

            var doNewline = false;

            //Add an entity description if one is declared
            if (!string.IsNullOrEmpty(entity.Description))
            {
                message.AddText(entity.Description);
                doNewline = true;
            }

            message.PushColor(Color.DarkGray);

            var subMessage = new FormattedMessage();

            //Add component statuses from components that report one
            foreach (var examineComponents in entity.GetAllComponents <IExamine>())
            {
                examineComponents.Examine(subMessage);
                if (subMessage.Tags.Count == 0)
                {
                    continue;
                }

                if (doNewline)
                {
                    message.AddText("\n");
                    doNewline = false;
                }
                message.AddMessage(subMessage);
            }

            message.Pop();

            return(message);
        }