コード例 #1
0
ファイル: CASParts.cs プロジェクト: yakoder/NRaas
 public static ArrayList GetOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate)
 {
     if (alternate)
     {
         return(sim.Outfits[category] as ArrayList);
     }
     else
     {
         return(sim.GetCurrentOutfits()[category] as ArrayList);
     }
 }
コード例 #2
0
ファイル: CASParts.cs プロジェクト: yakoder/NRaas
        public static int ReplaceOutfit(SimDescriptionCore sim, Key key, SimOutfit newOutfit, bool alternate)
        {
            bool maternity = ((sim.IsUsingMaternityOutfits) && (!alternate));

            ArrayList outfits = GetOutfits(sim, key.mCategory, alternate);

            if (outfits == null)
            {
                outfits = new ArrayList();
                if (maternity)
                {
                    sim.mMaternityOutfits[key.mCategory] = outfits;
                }
                else
                {
                    sim.Outfits[key.mCategory] = outfits;
                }
            }

            int index = key.GetIndex(sim, alternate);

            if ((index == -1) || (index >= outfits.Count))
            {
                outfits.Add(newOutfit);

                index = outfits.Count - 1;
            }
            else if (index < outfits.Count)
            {
                SimOutfit oldOutfit = outfits[index] as SimOutfit;
                if (oldOutfit != null)
                {
                    bool inUse = false;
                    foreach (OutfitCategories categories in sim.GetCurrentOutfits().Keys)
                    {
                        ArrayList list2 = sim.GetOutfits(categories);
                        if (list2 != null)
                        {
                            foreach (SimOutfit outfit in list2)
                            {
                                if (outfit.Key == oldOutfit.Key)
                                {
                                    inUse = true;
                                    break;
                                }
                            }
                        }

                        if (inUse)
                        {
                            break;
                        }
                    }

                    if (!inUse)
                    {
                        oldOutfit.Uncache();
                    }
                }

                outfits[index] = newOutfit;
            }
            else
            {
                outfits.Insert(index, newOutfit);
            }

            switch (key.mCategory)
            {
            case OutfitCategories.Special:
                if (!string.IsNullOrEmpty(key.mSpecialKey))
                {
                    if (sim.mSpecialOutfitIndices == null)
                    {
                        sim.mSpecialOutfitIndices = new Dictionary <uint, int>();
                    }

                    sim.mSpecialOutfitIndices[ResourceUtils.HashString32(key.mSpecialKey)] = index;
                }
                break;

            case OutfitCategories.Everyday:
                SimDescription simDesc = sim as SimDescription;
                if (simDesc != null)
                {
                    simDesc.mDefaultOutfitKey = sim.GetOutfit(OutfitCategories.Everyday, 0).Key;
                }
                break;
            }

            return(index);
        }
コード例 #3
0
ファイル: CASParts.cs プロジェクト: Robobeurre/NRaas
        public static int ReplaceOutfit(SimDescriptionCore sim, Key key, SimOutfit newOutfit, bool alternate)
        {
            bool maternity = ((sim.IsUsingMaternityOutfits) && (!alternate));

            ArrayList outfits = GetOutfits(sim, key.mCategory, alternate);
            if (outfits == null)
            {
                outfits = new ArrayList();
                if (maternity)
                {
                    sim.mMaternityOutfits[key.mCategory] = outfits;
                }
                else
                {
                    sim.Outfits[key.mCategory] = outfits;
                }
            }

            int index = key.GetIndex(sim, alternate);

            if ((index == -1) || (index >= outfits.Count))
            {
                outfits.Add(newOutfit);

                index = outfits.Count - 1;
            }
            else if (index < outfits.Count)
            {
                SimOutfit oldOutfit = outfits[index] as SimOutfit;
                if (oldOutfit != null)
                {
                    bool inUse = false;
                    foreach (OutfitCategories categories in sim.GetCurrentOutfits().Keys)
                    {
                        ArrayList list2 = sim.GetOutfits(categories);
                        if (list2 != null)
                        {
                            foreach (SimOutfit outfit in list2)
                            {
                                if (outfit.Key == oldOutfit.Key)
                                {
                                    inUse = true;
                                    break;
                                }
                            }
                        }

                        if (inUse) break;
                    }

                    if (!inUse)
                    {
                        oldOutfit.Uncache();
                    }
                }

                outfits[index] = newOutfit;
            }
            else
            {
                outfits.Insert(index, newOutfit);
            }

            switch (key.mCategory)
            {
                case OutfitCategories.Special:
                    if (!string.IsNullOrEmpty(key.mSpecialKey))
                    {
                        if (sim.mSpecialOutfitIndices == null)
                        {
                            sim.mSpecialOutfitIndices = new Dictionary<uint, int>();
                        }

                        sim.mSpecialOutfitIndices[ResourceUtils.HashString32(key.mSpecialKey)] = index;
                    }
                    break;
                case OutfitCategories.Everyday:
                    SimDescription simDesc = sim as SimDescription;
                    if (simDesc != null)
                    {
                        simDesc.mDefaultOutfitKey = sim.GetOutfit(OutfitCategories.Everyday, 0).Key;
                    }
                    break;
            }

            return index;
        }
コード例 #4
0
ファイル: CASParts.cs プロジェクト: Robobeurre/NRaas
 public static ArrayList GetOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate)
 {
     if (alternate)
     {
         return sim.Outfits[category] as ArrayList;
     }
     else
     {
         return sim.GetCurrentOutfits()[category] as ArrayList;
     }
 }