Пример #1
0
        private void ejectReplacedEquipment(EquipmentModelDefinition eqDefToApply, AvatarModel.ApplyResult result)
        {
            HashSet <AvatarModel.Part>         partsEjected = null;
            HashSet <EquipmentModelDefinition> hashSet      = null;

            if (this.GetEquipmentToEject(eqDefToApply, out partsEjected, out hashSet))
            {
                foreach (EquipmentModelDefinition current in hashSet)
                {
                    this.equipmentList.Remove(current);
                    if (this.EquipmentEjected != null)
                    {
                        try
                        {
                            this.EquipmentEjected(current);
                        }
                        catch (Exception ex)
                        {
                            Log.LogException(this, ex);
                        }
                    }
                }
            }
            result.PartsEjected     = partsEjected;
            result.EquipmentEjected = hashSet;
        }
Пример #2
0
        public AvatarModel.ApplyResult ApplyEquipment(DCustomEquipment customEqToApply)
        {
            EquipmentModelDefinition equipmentDefinition = this.Definition.GetEquipmentDefinition(customEqToApply);

            AvatarModel.ApplyResult applyResult = new AvatarModel.ApplyResult();
            applyResult.CustomEquipmentApplied     = customEqToApply;
            applyResult.EquipmentDefinitionApplied = equipmentDefinition;
            applyResult.PartsAdded = new HashSet <AvatarModel.Part>();
            if (equipmentDefinition != null)
            {
                this.ejectReplacedEquipment(equipmentDefinition, applyResult);
                this.applyParts(equipmentDefinition, customEqToApply, applyResult.PartsAdded);
                this.ejectRemainingParts(applyResult.PartsEjected);
                this.equipmentList.Add(equipmentDefinition);
            }
            return(applyResult);
        }