示例#1
0
        internal CharacterAttachmentSlot(CustomizationManager manager, XElement element)
        {
            m_manager = manager;
            Element = element;

            Name = element.Attribute("name").Value;

            var allowNoneAttribute = element.Attribute("allowNone");
            if(allowNoneAttribute != null)
                CanBeEmpty = allowNoneAttribute.Value == "1";

            var hiddenAttribute = element.Attribute("hidden");
            if(hiddenAttribute != null)
                Hidden = hiddenAttribute.Value == "1";

            var subSlotElements = element.Elements("AttachmentSlot");
            if (subSlotElements.Count() > 0)
            {
                SubAttachmentSlots = new CharacterAttachmentSlot[subSlotElements.Count()];
                for(int i = 0; i < subSlotElements.Count(); i++)
                {
                    var subSlotElement = subSlotElements.ElementAt(i);

                    SubAttachmentSlots[i] = new CharacterAttachmentSlot(manager, subSlotElement);
                }
            }

            var mirroredSlotElements = element.Elements("MirroredSlot");
            if (mirroredSlotElements.Count() > 0)
            {
                MirroredSlots = new CharacterAttachmentSlot[mirroredSlotElements.Count()];
                for (int i = 0; i < mirroredSlotElements.Count(); i++)
                {
                    var mirroredSlotElement = mirroredSlotElements.ElementAt(i);

                    MirroredSlots[i] = new CharacterAttachmentSlot(manager, mirroredSlotElement);
                }
            }

            // Set up brands
            var slotBrandElements = element.Elements("Brand");

            int numBrands = slotBrandElements.Count();
            Brands = new CharacterAttachmentBrand[numBrands];

            for(int i = 0; i < numBrands; i++)
            {
                var brandElement = slotBrandElements.ElementAt(i);

                Brands[i] = new CharacterAttachmentBrand(this, brandElement);
            }
        }
示例#2
0
        internal CharacterAttachmentSlot(CustomizationManager manager, XElement element)
        {
            Manager = manager;
            Element = element;

            Name = element.Attribute("name").Value;

            var uiNameAttribute = element.Attribute("uiName");

            if (uiNameAttribute != null)
            {
                UIName = uiNameAttribute.Value;
            }

            var categoryAttribute = element.Attribute("category");

            if (categoryAttribute != null)
            {
                Category = categoryAttribute.Value;
            }

            var allowNoneAttribute = element.Attribute("allowNone");

            if (allowNoneAttribute != null)
            {
                CanBeEmpty = allowNoneAttribute.Value == "1";
            }

            if (CanBeEmpty)
            {
                EmptyAttachment = new CharacterAttachment(this, null);
            }

            var hiddenAttribute = element.Attribute("hidden");

            if (hiddenAttribute != null)
            {
                Hidden = hiddenAttribute.Value == "1";
            }

            var subSlotElements = element.Elements("AttachmentSlot");

            if (subSlotElements.Count() > 0)
            {
                SubAttachmentSlots = new CharacterAttachmentSlot[subSlotElements.Count()];
                for (int i = 0; i < subSlotElements.Count(); i++)
                {
                    var subSlotElement = subSlotElements.ElementAt(i);

                    SubAttachmentSlots[i] = new CharacterAttachmentSlot(manager, subSlotElement);
                }
            }

            var mirroredSlotElements = element.Elements("MirroredSlot");

            if (mirroredSlotElements.Count() > 0)
            {
                MirroredSlots = new CharacterAttachmentSlot[mirroredSlotElements.Count()];
                for (int i = 0; i < mirroredSlotElements.Count(); i++)
                {
                    var mirroredSlotElement = mirroredSlotElements.ElementAt(i);

                    MirroredSlots[i] = new CharacterAttachmentSlot(manager, mirroredSlotElement);
                }
            }

            // Set up brands
            var slotBrandElements = element.Elements("Brand");

            int numBrands = slotBrandElements.Count();

            Brands = new CharacterAttachmentBrand[numBrands];

            for (int i = 0; i < numBrands; i++)
            {
                var brandElement = slotBrandElements.ElementAt(i);

                Brands[i] = new CharacterAttachmentBrand(this, brandElement);
            }
        }