Exemple #1
0
        public static WearableItem Create(string wearableTypeName)
        {
            WearableItem       wearableItem = new WearableItem(wearableTypeName);
            List <VisualParam> typeParams   = FindParamsForWearable(wearableTypeName);

            foreach (VisualParam param in typeParams)
            {
                wearableItem.AddVisualSetting(new VisualSetting(param));
            }
            return(wearableItem);
        }
Exemple #2
0
 public static WearableItem Create(string wearableTypeName)
 {
     WearableItem wearableItem = new WearableItem(wearableTypeName);
     List<VisualParam> typeParams = FindParamsForWearable(wearableTypeName);
     foreach (VisualParam param in typeParams)
     {
         wearableItem.AddVisualSetting(new VisualSetting(param));
     }
     return wearableItem;
 }
Exemple #3
0
 public void Wear(WearableItem item)
 {
     Wear(item.ItemID, item.AssetID);
 }
 public void Wear(WearableItem item)
 {
     Wear(item.ItemID, item.AssetID);
 }
Exemple #5
0
        public static WearableItem CreateFromAsset(string assetData)
        {
            UUID creatorID   = UUID.Zero;
            UUID ownerID     = UUID.Zero;
            UUID lastOwnerID = UUID.Zero;
            UUID groupID     = UUID.Zero;

            char[]   newlineDelimiter = { '\n' };
            string[] lines            = assetData.Split(newlineDelimiter);

            WearableItem wearableObject = null;
            Regex        r               = new Regex("[\t ]+");
            bool         reachedParams   = false;
            bool         reachedTextures = false;

            foreach (string line in lines)
            {
                string trimLine = line.Trim();
                // m_log.Debug("line : " + trimLine);

                string[] splitLine = r.Split(trimLine);
                if (splitLine.Length > 1)
                {
                    switch (splitLine[0])
                    {
                    case "textures":
                        reachedParams   = false;
                        reachedTextures = true;
                        break;

                    case "type":
                        string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1]));
                        wearableObject = Create(wearableTypeName.ToLower());
                        break;

                    case "parameters":
                        reachedParams = true;
                        break;

                    case "creator_id":
                        creatorID = new UUID(splitLine[1]);
                        break;

                    case "owner_id":
                        ownerID = new UUID(splitLine[1]);
                        break;

                    case "last_owner_id":
                        lastOwnerID = new UUID(splitLine[1]);
                        break;

                    case "group_id":
                        groupID = new UUID(splitLine[1]);
                        break;

                    default:
                        if ((wearableObject != null) && (reachedParams))
                        {
                            int id = Convert.ToInt32(splitLine[0]);
                            if (wearableObject.VisualSettings.ContainsKey(id))
                            {
                                wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture);
                            }
                        }
                        else if ((wearableObject != null) && (reachedTextures))
                        {
                            wearableObject.TextureStrings.Add(line);
                        }
                        break;
                    }
                }
            }

            if (wearableObject != null)
            {
                wearableObject.CreatorID   = creatorID;
                wearableObject.OwnerID     = ownerID;
                wearableObject.LastOwnerID = lastOwnerID;
                wearableObject.GroupID     = groupID;
            }

            return(wearableObject);
        }