コード例 #1
0
        public WorldComp(World world) : base(world)
        {
            if (DressersToUse != null)
            {
                DressersToUse.Clear();
            }
            else
            {
                DressersToUse = new LinkedList <Building_Dresser>();
            }

            if (PawnOutfits != null)
            {
                PawnOutfits.Clear();
            }
            else
            {
                PawnOutfits = new Dictionary <Pawn, PawnOutfitTracker>();
            }

            if (OutfitsForBattle != null)
            {
                OutfitsForBattle.Clear();
            }
            else
            {
                OutfitsForBattle = new List <Outfit>();
            }
        }
コード例 #2
0
 public static void AddDresser(Building_Dresser dresser)
 {
     if (!DressersToUse.Contains(dresser))
     {
         DressersToUse.AddLast(dresser);
     }
 }
コード例 #3
0
 public static bool RemoveDesser(Building_Dresser dresser)
 {
     if (DressersToUse.Remove(dresser))
     {
         return(true);
     }
     return(false);
 }
コード例 #4
0
        public static void AddDresser(Building_Dresser dresser)
        {
            if (dresser == null || dresser.Map == null)
            {
                Log.Error("Cannot add ChangeDresser that is either null or has a null map.");
                return;
            }

            if (!DressersToUse.Contains(dresser))
            {
                DressersToUse.AddLast(dresser);
            }
        }
コード例 #5
0
        public static void RemoveDressers(Map map)
        {
            LinkedListNode <Building_Dresser> n = DressersToUse.First;

            while (n != null)
            {
                var next           = n.Next;
                Building_Dresser d = n.Value;
                if (d.Map == null)
                {
                    DressersToUse.Remove(n);
                }
                n = next;
            }
        }
コード例 #6
0
        public static void SortDressersToUse()
        {
            LinkedList <Building_Dresser> l = new LinkedList <Building_Dresser>();

            foreach (Building_Dresser d in DressersToUse)
            {
                bool added = false;
                for (LinkedListNode <Building_Dresser> n = l.First; n != null; n = n.Next)
                {
                    if (d.settings.Priority > n.Value.settings.Priority)
                    {
                        added = true;
                        l.AddBefore(n, d);
                        break;
                    }
                }
                if (!added)
                {
                    l.AddLast(d);
                }
            }
            DressersToUse.Clear();
            DressersToUse = l;
        }