public IEnumerable <AvatarModel.ApplyResult> ApplyOutfit(DCustomOutfit outfit) { List <AvatarModel.ApplyResult> list = new List <AvatarModel.ApplyResult>(); DCustomEquipment[] equipment = outfit.Equipment; for (int i = 0; i < equipment.Length; i++) { DCustomEquipment customEqToApply = equipment[i]; list.Add(this.ApplyEquipment(customEqToApply)); } if (this.OutfitSet != null) { this.OutfitSet(list); } return(list); }
public void Dump() { StringBuilder stringBuilder = new StringBuilder("Outfit: "); stringBuilder.AppendLine(this.ToString()); for (int i = 0; i < this.Equipment.Length; i++) { DCustomEquipment dCustomEquipment = this.Equipment[i]; stringBuilder.Append("- "); stringBuilder.Append(dCustomEquipment.Name); stringBuilder.Append(", DefId:"); stringBuilder.Append(dCustomEquipment.DefinitionId); stringBuilder.Append(", Id:"); stringBuilder.Append(dCustomEquipment.Id); stringBuilder.AppendLine(); for (int j = 0; j < dCustomEquipment.Parts.Length; j++) { DCustomEquipmentPart dCustomEquipmentPart = dCustomEquipment.Parts[j]; stringBuilder.Append("\t- SlotIndex: "); stringBuilder.AppendLine(dCustomEquipmentPart.SlotIndex.ToString()); for (int k = 0; k < dCustomEquipmentPart.Decals.Length; k++) { DCustomEquipmentDecal dCustomEquipmentDecal = dCustomEquipmentPart.Decals[k]; stringBuilder.Append("\t\t- Type: "); stringBuilder.Append(dCustomEquipmentDecal.Type); stringBuilder.Append(", TexName: "); stringBuilder.Append(dCustomEquipmentDecal.TextureName); stringBuilder.Append(", DefId: "); stringBuilder.Append(dCustomEquipmentDecal.DefinitionId); stringBuilder.Append(", Index: "); stringBuilder.Append(dCustomEquipmentDecal.Index); stringBuilder.Append(", Scale: "); stringBuilder.Append(dCustomEquipmentDecal.Scale); stringBuilder.Append(", uOffset: "); stringBuilder.Append(dCustomEquipmentDecal.Uoffset); stringBuilder.Append(", vOffset: "); stringBuilder.Append(dCustomEquipmentDecal.Voffset); stringBuilder.Append(", Rotation: "); stringBuilder.Append(dCustomEquipmentDecal.Rotation); stringBuilder.Append(", Repeat: "); stringBuilder.Append(dCustomEquipmentDecal.Repeat); stringBuilder.AppendLine(); } } } UnityEngine.Debug.Log(stringBuilder.ToString()); }
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); }
private void applyParts(EquipmentModelDefinition eqDefToApply, DCustomEquipment customEqToApply, HashSet <AvatarModel.Part> partsAdded) { for (int i = 0; i < eqDefToApply.Parts.Length; i++) { DCustomEquipmentDecal[] decals = null; EquipmentModelDefinition.Part newPartDef = eqDefToApply.Parts[i]; if (customEqToApply.Parts != null) { for (int j = 0; j < customEqToApply.Parts.Length; j++) { if (customEqToApply.Parts[j].SlotIndex == newPartDef.SlotIndex) { decals = customEqToApply.Parts[j].Decals; break; } } } AvatarModel.Part part = new AvatarModel.Part(eqDefToApply, i, decals); this.changePart(newPartDef, part); partsAdded.Add(part); } }
public EquipmentModelDefinition GetEquipmentDefinition(DCustomEquipment customEq) { return(GetEquipmentDefinition(customEq.Name)); }