예제 #1
0
 public static List <T> QuickFind <T>(Inventory ths, bool checkInUse, ItemTestFunction testFunction, object customData)
     where T : GameObject
 {
     if ((!checkInUse) && (testFunction == null))
     {
         return(QuickFind <T>(ths));
     }
     else
     {
         List <T> retList = new List <T>();
         QuickApplyFuncToAllItems <T>(
             ths,
             delegate(InventoryItem item)
         {
             if (!checkInUse || (!item.InUse && !ths.GetStackInUse(item.StackNumber)))
             {
                 T local = item.Object as T;
                 if ((local != null) && ((testFunction == null) || testFunction(item.Object, customData)))
                 {
                     retList.Add(local);
                 }
             }
         },
             false
             );
         return(retList);
     }
 }
        public override List<GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
        {
            List<GameObject> results = new List<GameObject>();

            foreach (HotairBalloon obj in actor.LotCurrent.GetObjects<HotairBalloon>(new Predicate<HotairBalloon>(TestUse)))
            {
                if ((testFunc != null) && (!testFunc(obj, null))) continue;

                results.Add(obj);
            }

            return results;
        }
예제 #3
0
        public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
        {
            List <GameObject> results = new List <GameObject>();

            foreach (HotairBalloon obj in actor.LotCurrent.GetObjects <HotairBalloon>(new Predicate <HotairBalloon>(TestUse)))
            {
                if ((testFunc != null) && (!testFunc(obj, null)))
                {
                    continue;
                }

                results.Add(obj);
            }

            return(results);
        }
        public override List<GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
        {
            List<GameObject> results = new List<GameObject>();

            if (GameUtils.IsInstalled(ProductVersion.EP4))
            {
                foreach (ShowerOutdoor obj in actor.LotCurrent.GetObjects<ShowerOutdoor>(new Predicate<ShowerOutdoor>(TestUse)))
                {
                    if ((testFunc != null) && (!testFunc(obj, null))) continue;

                    results.Add(obj);
                }
            }

            return results;
        }
예제 #5
0
        public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
        {
            List <GameObject> results = new List <GameObject>();

            if (GameUtils.IsInstalled(ProductVersion.EP4))
            {
                foreach (ShowerOutdoor obj in actor.LotCurrent.GetObjects <ShowerOutdoor>(new Predicate <ShowerOutdoor>(TestUse)))
                {
                    if ((testFunc != null) && (!testFunc(obj, null)))
                    {
                        continue;
                    }

                    results.Add(obj);
                }
            }

            return(results);
        }
예제 #6
0
 public static List <T> QuickFind <T>(Inventory ths, bool checkInUse, ItemTestFunction testFunction)
     where T : GameObject
 {
     return(QuickFind <T>(ths, checkInUse, testFunction, null));
 }
예제 #7
0
        public static List <T> InventoryFindAll <T>(SimDescription sim, bool checkInUse, ItemTestFunction func)
            where T : GameObject
        {
            if (!VerifyInventory(sim))
            {
                return(new List <T>());
            }

            return(QuickFind <T>(sim.CreatedSim.Inventory, checkInUse, func));
        }
예제 #8
0
 public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
 {
     return(null);
 }
        protected static void AddToList <T>(SimDescription sim, List <GameObject> objs, ItemTestFunction testFunc)
            where T : GameObject
        {
            bool first = true;

            List <T> results = Inventories.InventoryFindAll <T>(sim);

            results.Sort(new Comparison <T>(SortByValue));

            foreach (T obj in results)
            {
                if (testFunc != null)
                {
                    if (!testFunc(obj, null))
                    {
                        continue;
                    }
                }

                if (!first)
                {
                    objs.Add(obj as GameObject);
                }
                else
                {
                    first = false;
                }
            }
        }
예제 #10
0
            public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
            {
                List <GameObject> list = new List <GameObject>();

                foreach (ToiletStall current in actor.LotCurrent.GetObjects <ToiletStall>(new Predicate <ToiletStall>(TestUse)))
                {
                    if ((testFunc == null || testFunc(current, null)) && TestAccessible(current, actor) && TestAccessible(current, target))
                    {
                        list.Add(current);
                    }
                }
                return(list);
            }
예제 #11
0
            public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
            {
                List <GameObject> results = new List <GameObject>();

                foreach (ElevatorDoors obj in actor.LotCurrent.GetObjects <ElevatorDoors>(new Predicate <ElevatorDoors>(new Tester(actor).TestUse)))
                {
                    if ((testFunc != null) && (!testFunc(obj, null)))
                    {
                        continue;
                    }

                    results.Add(obj);
                }

                return(results);
            }
예제 #12
0
 public override List<GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
 {
     return null;
 }
예제 #13
0
            public override List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc)
            {
                List <BedDouble> objects = new List <BedDouble>();
                BedDouble        bed     = actor.Bed as BedDouble;

                if (bed != null)
                {
                    if (bed.LotCurrent == actor.LotCurrent && TestUse(bed))
                    {
                        objects.Add(bed);
                    }
                }

                bed = target.Bed as BedDouble;

                if (bed != null)
                {
                    if (bed.LotCurrent == target.LotCurrent && TestUse(bed))
                    {
                        objects.Add(bed);
                    }
                }

                if (objects.Count == 0)
                {
                    objects = actor.LotCurrent.GetObjects(new Predicate <BedDouble>(TestUse));
                }

                List <GameObject> results = new List <GameObject>();

                foreach (GameObject obj in objects)
                {
                    if (testFunc != null && !testFunc(obj, null))
                    {
                        continue;
                    }

                    results.Add(obj);
                }

                return(results);
            }
예제 #14
0
 public abstract List<GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc);
예제 #15
0
 public abstract List <GameObject> GetAvailableObjects(Sim actor, Sim target, ItemTestFunction testFunc);